A method and system for protecting high-value agent skills based on local model-generated guidance vectors

By dividing Skill content units in a trusted training environment and training local small models to generate short, request-conditional guidance vectors, combined with server-side verification and runtime protection, the problems of plaintext leakage of Agent Skills, reuse of control representations, and direct leakage of model output are solved, achieving comprehensive protection for high-value Agent Skills.

CN123116228APending Publication Date: 2026-11-17UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611332520.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-31
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing technologies struggle to simultaneously prevent the plaintext leakage of high-value Agent Skills, the reuse of fixed control representations, and the direct leakage of Skill content from model outputs.

Method used

By dividing Skill content units in a trusted training environment, generating teacher supervision information using a teacher model, training the LoRA parameters and linear mapping layer of the user-side local small model, generating request-conditional short guiding vectors, and validating and injecting them into the large language model on the server side, combined with a runtime protection module to perform semantic similarity determination, restricting the direct use and repeated calls of Skill plaintext, and preventing direct leakage of model output.

Benefits of technology

While maintaining the agent's task execution capabilities, it reduces the direct use and exposure of Skill plaintext, lowers the risk of reusing control representations, and prevents the model output from directly leaking Skill content, thus achieving comprehensive protection for high-value agent skills.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123116228A_ABST
    Figure CN123116228A_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for protecting high-value Agent Skills based on a local model-generated guidance vector, addressing the problem that existing Agent Skills distributed using plaintext directly leak Skill hints. This invention trains the LoRA parameters and linear mapping layer parameters of a user-side local small model, enabling the model to generate fixed-length short guidance vectors based on user input. During runtime, the server-side Agent system performs single-call verification and injection, generating candidate outputs. Before the candidate outputs are published, a preset risk rule is used to determine whether Skill content should be leaked. This invention is used for the controlled distribution, invocation, and leakage prevention protection of high-value Agent Skills.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence, large language model agents, efficient parameter fine-tuning, runtime vector injection, and software intellectual property protection, and particularly to a high-value agent skills protection method and system based on local model-generated guiding vectors. Background Technology

[0002] As large language model agents are increasingly applied to scenarios such as enterprise automation, professional services, data analysis, R&D support, and industry-specific intelligent agents, agent skills have evolved from simple prompts to reusable procedural knowledge encompassing task steps, branching conditions, tool orchestration, parameter input, result validation, exception handling, and failure recovery. Some agent skills, developed and iterated over a long period by skill providers, directly influence how agents execute professional tasks and their effectiveness, possessing significant technical and commercial value.

[0003] Existing Agent Skills technologies primarily focus on Skill content organization and loading, continuous control of large language models, and Skill information security protection. Regarding Skill content organization and loading, existing Agent systems typically encapsulate specialized task knowledge using Skill files, system prompts, workflow configurations, plugin descriptions, and tool invocation templates. Skill files can further include task execution steps, domain rules, tool invocation methods, result verification rules, and exception handling procedures. During operation, the Agent selects the appropriate Skill based on the current user task and loads the required Skill content into the large language model context to guide the model in completing the task. Some technologies further employ on-demand loading, loading the corresponding content only when the Skill is triggered to reduce context usage. In terms of large language model control, besides directly using natural language prompts, existing research has proposed methods such as soft prompts, prefix tuning, and continuous prompts. These methods encode task-related information into continuous vectors and apply these vectors to the input or intermediate representations of the large language model, controlling the model to execute specific tasks without updating all parameters of the large language model. Control methods based on continuous representations reduce direct reliance on natural language prompts and provide a new approach for the efficient deployment of task capability parameters. Regarding security protection, existing research primarily employs access control, prompt protection, attack request detection, output filtering, and control representation hiding to address the risks of leakage of system prompts, private instructions, and continuous control representations. Simultaneously, research has begun to focus on the problem of attackers extracting internal model instructions through constructed prompts or recovering continuous control representations through repeated queries and output behavior analysis.

[0004] However, the aforementioned existing technologies still have the following limitations:

[0005] 1. When providing skill content via skill files, system prompts, or workflow configurations, the plaintext skill text still needs to be read or loaded into the model context during runtime. Users with file access or runtime permissions may directly read, copy, or redistribute the workflows, domain rules, tool invocation rules, and exception handling rules contained within. Even if direct access to skill files is restricted, the relevant content may still be paraphrased or interpreted by the large language model during model interaction, making it difficult to effectively protect the internal knowledge of high-value skills.

[0006] 2. When using soft hints, continuous vectors, or other control representations to replace plaintext Skills, the existing control representations are typically fixed for specific tasks or Skills, or have a low degree of correlation with the current user request. The repeated use of the same or highly related control representations for the same Skill in different requests may allow the current request to obtain more Skill control information than actually needed to complete the request. Furthermore, attackers can collect and analyze these control representations through repeated calls, increasing the risk of the control representations being recovered, copied, or illegally reused.

[0007] 3. Existing continuous control methods typically focus on using continuous representations to control model capabilities, but lack usage constraints for the Skill invocation process. After obtaining a valid control representation, it may be resubmitted or reused for model invocation. Therefore, simply converting the Skill plaintext into a continuous representation is insufficient to prevent the control representation from being reused and replayed.

[0008] 4. Existing protection methods mainly focus on the Skill input content or control representation itself. However, after a large language model executes a task under the guidance of the Skill or control representation, it has already acquired some of the Skill knowledge required to complete the task. When the user requests the model to explain the execution basis, internal steps, or tool usage rules, the output generated by the model may still directly restate, summarize, or disclose the protected content in the Skill in a semantically equivalent form. Therefore, relying solely on Skill hiding or control representation transformation on the input side is insufficient to control Skill content leakage during the model output stage.

[0009] In summary, existing Agent Skills protection technologies still struggle to simultaneously address issues such as plaintext skill exposure, repeated exposure of fixed control representations, reuse of control representations, and direct leakage of skill content in model output. Therefore, a protection method suitable for high-value Agent Skills is needed. This method should maintain the Agent's normal task execution capabilities while reducing its reliance on plaintext skills during runtime. It should enable the control representation to be dynamically generated based on current user requests and restrict its reuse, while also controlling the risk of skill content leakage in the model's generated results. Summary of the Invention

[0010] The purpose of this invention is to overcome the problems of existing client-side vector guidance methods that cannot simultaneously prevent the plaintext leakage of high-value Agent Skills, the reuse of control representations, and the direct leakage of Skill content by model output. This invention provides a method and system for protecting high-value Agent Skills based on locally generated guidance vectors. While maintaining the local generation and Agent framework injection architecture, the plaintext Skill, the request conditional short guidance vector, and the model candidate output are each constrained by corresponding protection mechanisms.

[0011] The present invention adopts the following technical solution:

[0012] This invention provides a high-value agent skills protection method based on generating guidance vectors from a local model, comprising the following steps:

[0013] Step 1: Prepare the Skill files for the high-value Agent Skills to be protected and the corresponding task samples in the trusted training environment of the Skill provider.

[0014] Step 2: Invoke the teacher model to generate teacher output and tool call trajectory based on the Skill file and task sample, forming teacher supervision information;

[0015] Step 3: Based on the teacher supervision information, while freezing the basic parameters of the teacher model and the user-side local mini-model, train the corresponding user-side local mini-model LoRA parameters and linear mapping layer parameters for each Skill.

[0016] Step 4: When the Agent determines that the target Skill needs to be invoked, it generates a single Skill invocation request; the user-side local small model generates a request conditional short bootstrap vector based on the invocation request; the server verifies the content returned by the user-side local small model, and after the verification is passed, maps and injects the short bootstrap vector into the hidden representation space of the large language model;

[0017] Step 5: When the LLM in the Agent generates candidate outputs that have not yet been published, the runtime protection module determines whether the candidate outputs directly leak the content of the protected Skill according to preset risk rules, and processes the candidate outputs based on the determination result.

[0018] Existing Agent Skills typically store workflow steps, domain rules, and tool invocation rules in plaintext files. When the Agent executes a target task, the corresponding Skill content needs to be directly provided to the large language model. Simply converting plaintext Skills to fixed vectors or using ordinary model distillation can reduce the direct transmission of plaintext Skills, but it fails to simultaneously address two issues: firstly, the converted model parameters or vectors must retain the Skill capabilities required to complete the actual task; secondly, when user input itself constitutes a Skill extraction attack, the model must be prevented from using learned Skill capabilities to output the protected rules within the Skill. Based on these considerations, this invention trains the model through steps 1, 2, and 3 of the above scheme, balancing Skill task execution capability with the prevention of protected content leakage.

[0019] In the above scheme, step 1 specifically involves the following steps:

[0020] The high-value Agent Skills are structurally segmented, dividing the workflow steps, domain rules, and tool invocation rules with independent semantics into multiple content units, and identifying the content units that need to be protected as protected content units.

[0021] The task samples include normal task samples and Skill extraction attack samples; the Skill extraction attack samples include requests to repeat the contents of a Skill file, enumerate internal steps, disclose tool rules, or continuously query the internal boundaries of a Skill; the normal task samples are marked with normal task results, and the Skill extraction attack samples are marked with secure outputs that do not disclose the protected content units of the Skill.

[0022] In the above scheme, step 2 specifically involves the following steps:

[0023] The teacher model is a large language model configured for the Agent; it enables the teacher model to generate teacher output and tool call trajectories based on the Skill file and normal task samples, forming teacher supervision information.

[0024] In the above scheme, step 3 specifically involves the following steps:

[0025] The user-side local mini-model outputs a short, fixed-length guidance vector based on user input; the linear mapping layer maps the short guidance vector to the hidden representation space corresponding to the teacher model target injection layer;

[0026] The gradient of the training loss is backpropagated through the teacher model, the linear mapping layer, and the user-side local small model, updating only the LoRA parameters of the user-side local small model and the parameters of the linear mapping layer corresponding to the current Agent Skill.

[0027] In the above scheme, the training loss adopts a joint loss that simultaneously includes an output distribution consistency term and an attack defense term;

[0028] The output distribution consistency term is used to constrain the probability distribution of the model at each output position after the guidance vector injection to be consistent with the probability distribution of the corresponding output position of the teacher model.

[0029] The attack defense term is calculated based on attack samples extracted by the Agent Skill and their corresponding security outputs. The joint loss is expressed as:

[0030]

[0031] in, This indicates the number of tokens output by the teacher. Indicates the distillation temperature. and The teacher model and the post-injection model respectively represent the first two models in the first two months. Temperature output distribution at each location This indicates the number of attack samples extracted by Skill. Indicates the first Each skill extracts attack input. This indicates the corresponding safe output that does not disclose the internal contents of the Skill. The weights of the attack defense terms are represented, and the joint loss is minimized during training. In the above scheme, it is further considered that even if plaintext Agent Skills are no longer transmitted during the runtime phase, and only short guidance vectors are transmitted, if the same legally generated short guidance vector can be repeatedly submitted and injected back into the Agent large language model, an attacker may still intercept, save, and reuse the runtime control signals to perform unexpected repeated calls to Agent Skill capabilities. Therefore, this invention further introduces a single Agent Skill call mechanism, coordinating the generation process of the short guidance vector with the one-time call state of the server, restricting the runtime control signals to use within the corresponding single Agent Skill call process. The specific steps of step 4 are as follows:

[0032] Step 4.1: When the Agent determines that the current user request requires invoking the target Agent Skill, it generates a single Agent Skill invocation request for this Agent Skill invocation and sends it to the user side. The single Agent Skill invocation request includes user input, a single invocation identifier, and an Agent Skill identifier, wherein the single invocation identifier is obtained by generating a random number. The server establishes a verification record corresponding to the single invocation identifier. The verification record is associated with the Skill identifier and the invocation status, and the invocation status is initialized to be ready for use.

[0033] Step 4.2: After receiving the single Agent Skill call request, the user-side small model loads the corresponding LoRA parameters according to the AgentSkill identifier, generates a short conditional guide vector based on the user input, and sends the short conditional guide vector and the single call identifier to the server.

[0034] Step 4.3: After receiving the request conditional short bootstrap vector and the single call identifier, the server queries the corresponding verification record according to the single call identifier. If the verification record exists and the call status is pending, the server updates the call status to used.

[0035] After the verification is passed, the linear mapping layer corresponding to the target Agent Skill is determined according to the Agent Skill identifier associated with the verification record. The linear mapping layer is used to map the request conditional short bootstrap vector to the hidden representation space corresponding to the target injection layer, and then merge it with the intermediate hidden state of the target injection layer.

[0036] The above scheme further considers that even if the local small model is constrained by extracting attack samples using Skills during the training phase, the Agent large language model may still be affected by user context, historical dialogue, or complex prompts during the actual generation process, thus restating the Agent Skill's internal rules in the candidate output. Therefore, relying solely on the defense constraints during the training phase is insufficient to cover all possible forms of Skill content leakage during the runtime phase. Therefore, this invention continues to use the protected content units obtained in step 1 as the detection objects for runtime protection in step 5, so that the Skill protection boundary determined during the training phase is directly extended to the runtime phase. The specific steps of step 5 are as follows:

[0037] The LLM in the Agent generates candidate outputs based on the current user request and the injected short bootstrapping vector, and sends the candidate outputs to the runtime protection module before publishing them to the user;

[0038] The runtime protection module obtains the current user request and candidate output, and calculates the semantic similarity between the candidate output and the protected content unit.

[0039] When the semantic similarity is lower than the set threshold, the candidate output is published;

[0040] When the semantic similarity is higher than the set threshold, the LLM modifies the candidate output and recalculates the semantic similarity of the modified candidate output until the release conditions are met.

[0041] In the above scheme, the runtime protection module obtains the set of protected content units corresponding to the target Agent Skills, uses a preset semantic representation model to obtain the semantic representation of the candidate output and each protected content unit, calculates the semantic similarity between the candidate output and each protected content unit, takes the maximum semantic similarity between the candidate output and all protected content units as the leakage judgment value, and compares the leakage judgment value with a preset threshold.

[0042] This invention provides a high-value Agent Skills protection system based on a local model to generate guiding vectors, comprising:

[0043] The training data preparation module is used to obtain Skill files and corresponding task samples;

[0044] The teacher supervision generation module is used to call the teacher model that is the same as the LLM in the Agent framework runtime phase and has the same parameter version, generate teacher output and tool call trajectory, and use them as teacher supervision information;

[0045] The request conditional vector training module is used to train the LoRA parameters and linear mapping layer of the user-side local small model;

[0046] The verification and injection module is invoked to generate and verify a single call identifier, and to map and inject the short guiding vector after the verification passes.

[0047] The runtime protection module is used to determine whether candidate output directly leaks the content of the protected Skill before it is published, and to process it according to the determination result.

[0048] In the above scheme, the verification and injection module is further used for:

[0049] Generate a single-invocation request that includes user input, a single-invocation identifier, and an Agent Skills identifier;

[0050] Establish a verification record corresponding to a single call identifier, and associate the verification record with the Agent Skills identifier and the call status;

[0051] Receive the request conditional short bootstrap vector and single call identifier returned by the user's local small model;

[0052] Query and verify records based on the single call identifier and update the call status;

[0053] After the verification is passed, the short bootstrap vector of the request conditionalization is mapped to the hidden representation space corresponding to the target injection layer using the linear mapping layer corresponding to the target Agent Skills, and then fused with the intermediate hidden state of the target injection layer.

[0054] Compared with the prior art, the present invention has the following advantages:

[0055] I. Based on the consideration that high-value Agent Skills need to maintain their task execution capabilities while avoiding plaintext exposure, this invention divides Skills into normal task samples and Skill extraction attack samples. It then uses teacher-supervised collaborative training to train the LoRA parameters and linear mapping layer of the local mini-model corresponding to the Skill. This enables the local mini-model to generate short request conditional guidance vectors based on the current user request, thereby maintaining the Skill's task execution capabilities while reducing the direct use and exposure of the Skill's plaintext during the runtime phase.

[0056] Second, based on the consideration that short bootstrap vectors may be cached, repeatedly submitted, and replayed, this invention generates a single call request for each Skill call, and the server verifies and updates the corresponding call status, restricting the reuse of the same call request, thereby reducing the risk of repeatedly obtaining the target Skill execution capability after the short bootstrap vector is replayed.

[0057] Third, based on the consideration that the internal content of the Skill may still be directly output after the large language model is executed, the present invention divides the Skill into multiple protected content units. Before the candidate output is published, leakage is determined based on the protected content units, and the candidate output that meets the leakage conditions is processed, thereby reducing the risk that the internal steps, workflow and tool calling rules of the Skill will be directly output. Attached Figure Description

[0058] Figure 1 This is a schematic diagram of the overall process of the three-layer protection of high-value Agent Skills in this invention, including plaintext protection of skills, control representation protection, and interaction protection.

[0059] Figure 2 This is a schematic diagram illustrating the division of the request-conditional training and controlled operation modules of the present invention, including a training data preparation module, a teacher supervision generation module, and a request-conditional vector training module in the trusted training phase, as well as a call verification and injection module and a runtime protection module in the controlled operation phase. Detailed Implementation

[0060] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. It should be understood that the following embodiments are for illustrative purposes only and are not intended to limit the scope of protection of the present invention. Where there is no conflict, the technical features of the various embodiments can be combined with each other.

[0061] The system in this implementation includes a trusted training environment, a user side, and an Agent system server. The trusted training environment is controlled by the Skill provider and is used to process the Skill plaintext, prepare task samples, divide protected content units, and perform model training. The user side runs a local small model with frozen basic parameters and loaded LoRA parameters of the corresponding Skill. The Agent system server runs an LLM corresponding to the teacher model in the training phase and saves the linear mapping layer parameters, injection strategies, and runtime protection strategies for each Skill.

[0062] Step 1: Obtain the Skill file and the corresponding task sample.

[0063] The skill provider prepares the skill file to be protected and the corresponding task sample in a trusted training environment. The skill file is then structurally segmented, dividing workflow steps, domain rules, tool invocation rules, etc., with independent semantics into multiple content units. Based on a preset protection scope, the protected content units are determined from these content units.

[0064] The task samples include normal task samples and Skill extraction attack samples. Normal task samples cover typical task requests, boundary requests, tool anomalies, and recovery processes of the target Skill; Skill extraction attack samples include requests to restate Skill file contents, enumerate internal steps, disclose tool invocation rules, explain internal execution criteria, or continuously query the internal boundaries of the Skill. Normal task samples are labeled with normal task results, while Skill extraction attack samples are labeled with secure outputs that do not disclose protected content units.

[0065] Step 2: Generate teacher supervision information from the teacher model.

[0066] The teacher model is a large language model configured for the agent system. The teacher model receives normal task samples and complete skill files, and generates teacher outputs and corresponding tool call trajectories for the normal task samples, forming teacher supervision information. For agent systems using structured tool call formats, tool call instructions and their execution processes can be converted into supervision sequences corresponding to the teacher outputs, enabling tool selection, parameter generation, and task results to participate in subsequent training. Skill files, protected content units, and teacher supervision information are all stored in a trusted training environment controlled by the skill provider.

[0067] Step 3: Train the LoRA parameters and corresponding linear mapping layers of the user-side local small model.

[0068] During training, the basic parameters of the user-side local small model and the teacher model parameters are frozen, and the corresponding LoRA parameters and linear mapping layer are trained separately for each Skill.

[0069] The training loss employs output distribution consistency loss and attack / defense loss:

[0070] For normal task samples, the output distribution consistency loss is used to ensure that the probability distribution of the model at each output position after injecting short guide vectors remains consistent with the probability distribution of the corresponding output positions when the teacher model uses the complete Skill file. The output distribution consistency loss is expressed as:

[0071]

[0072] in, This indicates the number of tokens output by the teacher. Indicates the distillation temperature. and The teacher model and the post-injection model respectively represent the first two models in the first two months. Temperature output distribution at each location.

[0073] For Skill extraction attack samples, the attack defense loss is calculated based on the security output of the corresponding non-disclosure protected content unit, used to enable the model to generate output that meets protection requirements when faced with a Skill extraction request. The attack defense loss is expressed as:

[0074]

[0075] This indicates the number of attack samples extracted by Skill. Indicates the first Each skill extracts attack input. This indicates the corresponding safe output that does not disclose the internal contents of the Skill.

[0076] The overall training loss is expressed as:

[0077]

[0078] in, The weights representing the attack / defense terms represent the weights of the attack / defense loss. During training, the output distribution consistency loss and attack / defense loss are jointly reduced, and only the LoRA parameters and linear mapping layer parameters corresponding to the current Skill are updated.

[0079] After training, the LoRA parameters and linear mapping layer corresponding to the current Skill are validated to make its task execution results and tool invocation behavior on normal task samples close to the output of the teacher model when using the complete Skill file, and to avoid directly disclosing protected content units under Skill extraction attack samples.

[0080] After verification, the LoRA parameters corresponding to the Skill are deployed to the user's local small model, and the corresponding linear mapping layer parameters are deployed to the Agent system server. The user does not need to save or receive the complete Skill file, and the server-side LLM does not need to add the Skill plaintext to the model context during normal task execution.

[0081] Step 4: Complete a single Skill call and vector injection by calling the verification and injection module.

[0082] Step 4.1: Generate a single Skill call request.

[0083] When the Agent system determines that the current user request requires invoking the target Skill, it generates a single Skill invocation request for this Skill invocation and sends it to the user side. The single Skill invocation request includes user input, a single invocation identifier, and a Skill identifier, wherein the single invocation identifier is obtained by generating a random number. The server establishes a verification record corresponding to the single invocation identifier. The verification record is associated with the Skill identifier and the invocation status, and the invocation status is initialized to be ready for use.

[0084] Step 4.2: Generate a short guiding vector for request conditionalization.

[0085] After receiving the single Skill call request, the user-side local mini-model loads the LoRA parameters corresponding to the target Skill based on the Skill identifier, and performs forward computation based on the user input to generate a short conditional bootstrapping vector. Once the vector is generated, the user-side sends the short conditional bootstrapping vector and the corresponding single call identifier to the server.

[0086] Step 4.3: Verify the single call and complete vector mapping and injection.

[0087] After receiving the request conditional short bootstrap vector and single-call identifier, the server queries the corresponding verification record based on the single-call identifier. When the verification record exists and the call status is pending, the server updates the call status to used and continues to perform subsequent processing after the status update is successful.

[0088] After the verification is passed, the server determines the linear mapping layer corresponding to the target skill based on the Skill identifier associated with the verification record, and determines the target injection layer according to the preset injection strategy. The linear mapping layer is used to map the request conditional short bootstrap vector to the hidden representation space corresponding to the target injection layer to obtain the vector to be injected, and the vector to be injected is fused with the intermediate hidden state of the target injection layer.

[0089] Step 5: Perform runtime protection before candidate output is published.

[0090] In the Agent system, the LLM performs inference under the influence of the current user request and the injected request-conditionalized short bootstrap vector, first generating candidate outputs. The runtime protection module acquires the candidate outputs and performs semantic similarity calculations between them and multiple protected content units corresponding to the target Skill.

[0091] Let the set of protected content units corresponding to the target Skill be:

[0092]

[0093] in, Let represent the i-th protected content unit, and N represent the number of protected content units. Using a predefined semantic representation model E, obtain the candidate outputs and the semantic representation of each protected content unit, and calculate:

[0094]

[0095] in, This represents the semantic similarity function. In one implementation, cosine similarity is used as the semantic similarity function. The maximum semantic similarity between the candidate output and all protected content units is used as the leakage determination value of the current candidate output.

[0096]

[0097] in, This represents the maximum semantic similarity between the candidate output and the protected content of the target Skill. A semantic similarity threshold is preset. When satisfied If the current candidate output does not directly disclose the protected Skill content, it is determined that the candidate output does not directly disclose the protected Skill content, and the candidate output is published to the user. Otherwise, if the current candidate output is determined to pose a risk of directly disclosing the protected Skill content, the current candidate output is not published to the user, and the LLM in the Agent system is instructed to modify the candidate output so that the modified output retains the normal business results while reducing the direct description of the Skill's internal workflow, domain rules, or tool invocation rules. For the modified candidate output... The runtime protection module recalculates the semantic similarity between itself and all protected content units for judgment.

[0098] In this embodiment, through the collaborative processing of the training and runtime phases, the plaintext of the Skill file is used only in a trusted training environment. On the user side, a short, conditionalized guidance vector is generated based on the current user input using the LoRA parameter corresponding to the target Skill. On the server side, the reuse of the short guidance vector is restricted by a single-call identifier, and the hidden representation mapping and vector injection are completed using the linear mapping layer corresponding to the target Skill. Before the model output is published, semantic similarity is further determined through protected content units, thus protecting the high-value Agent Skill from three stages: training input, runtime control representation, and model output.

Claims

1. A method for protecting high-value agent skills based on generating guidance vectors using a local model, characterized in that, Includes the following steps: Step 1: Prepare the Skill files for the high-value Agent Skills to be protected and the corresponding task samples in the trusted training environment of the Skill provider. Step 2: Invoke the teacher model to generate teacher output and tool call trajectory based on the Skill file and task sample, forming teacher supervision information; Step 3: Based on the teacher supervision information, while freezing the basic parameters of the teacher model and the user-side local mini-model, train the corresponding user-side local mini-model LoRA parameters and linear mapping layer parameters for each Skill. Step 4: When the Agent determines that the target Skill needs to be invoked, it generates a single Skill invocation request; The user-side local small model generates a request conditional short guiding vector based on the call request. The server verifies the content returned by the user-side local small model and, after the verification is passed, maps and injects the short guiding vector into the hidden representation space of the large language model. Step 5: When the LLM in the Agent generates candidate outputs that have not yet been published, the runtime protection module determines whether the candidate outputs directly leak the content of the protected Skill according to preset risk rules, and processes the candidate outputs based on the determination result.

2. The method according to claim 1, characterized in that, In step 1: The high-value Agent Skills are structurally segmented, dividing the workflow steps, domain rules, and tool invocation rules with independent semantics into multiple content units, and identifying the content units that need to be protected as protected content units. The task samples include normal task samples and Skill extraction attack samples; the Skill extraction attack samples include requests to repeat the contents of a Skill file, enumerate internal steps, disclose tool rules, or continuously query the internal boundaries of a Skill. The normal task samples are labeled with normal task results, and the Skill extraction attack samples are labeled with secure outputs that do not disclose the protected content units of the Skill.

3. The method according to claim 2, characterized in that, In step 2: The teacher model is a large language model configured for the Agent; it enables the teacher model to generate teacher output and tool call trajectories based on the Skill file and normal task samples, forming teacher supervision information.

4. The method according to claim 3, characterized in that, In step 3: The user-side local mini-model outputs a short, fixed-length guidance vector based on user input; the linear mapping layer maps the short guidance vector to the hidden representation space corresponding to the teacher model target injection layer; The gradient of the training loss is backpropagated through the teacher model, the linear mapping layer, and the user-side local small model, updating only the LoRA parameters of the user-side local small model and the parameters of the linear mapping layer corresponding to the current Agent Skill.

5. The method according to claim 4, characterized in that, The training loss employs a joint loss that simultaneously includes an output distribution consistency term and an attack / defense term; The output distribution consistency term is used to constrain the probability distribution of the model at each output position after the guidance vector injection to be consistent with the probability distribution of the corresponding output position of the teacher model. The attack defense term is calculated based on attack samples extracted by the Agent Skill and their corresponding security outputs. The joint loss is expressed as: in, This indicates the number of tokens output by the teacher. Indicates the distillation temperature. and The teacher model and the post-injection model respectively represent the first two models in the first two months. Temperature output distribution at each location This indicates the number of attack samples extracted by Skill. Indicates the first Each skill extracts attack input. This indicates the corresponding safe output that does not disclose the internal contents of the Skill. The weights of the attack and defense terms are represented, and the joint loss is minimized during training.

6. The method for protecting high-value Agent Skills based on local model-generated guidance vectors according to claim 5, characterized in that, The specific steps of step 4 are as follows: Step 4.1: When the Agent determines that the current user request requires invoking the target Agent Skill, it generates a single Agent Skill invocation request for this Agent Skill invocation and sends it to the user side. The single Agent Skill invocation request includes user input, a single invocation identifier, and an Agent Skill identifier, wherein the single invocation identifier is obtained by generating a random number. The server establishes a verification record corresponding to the single invocation identifier. The verification record is associated with the Skill identifier and the invocation status, and the invocation status is initialized to be ready for use. Step 4.2: After receiving the single Agent Skill call request, the user-side small model loads the corresponding LoRA parameters according to the AgentSkill identifier, generates a short conditional guide vector based on the user input, and sends the short conditional guide vector and the single call identifier to the server. Step 4.3: After receiving the request conditional short bootstrap vector and the single call identifier, the server queries the corresponding verification record according to the single call identifier. If the verification record exists and the call status is pending, the server updates the call status to used. After the verification is passed, the linear mapping layer corresponding to the target Agent Skill is determined according to the Agent Skill identifier associated with the verification record. The linear mapping layer is used to map the request conditional short bootstrap vector to the hidden representation space corresponding to the target injection layer, and then merge it with the intermediate hidden state of the target injection layer.

7. A method for protecting high-value Agent Skills based on local model-generated guidance vectors according to claim 6, characterized in that, The specific steps of step 5 are as follows: The LLM in the Agent generates candidate outputs based on the current user request and the injected short bootstrapping vector, and sends the candidate outputs to the runtime protection module before publishing them to the user; The runtime protection module obtains the current user request and candidate output, and calculates the semantic similarity between the candidate output and the protected content unit. When the semantic similarity is lower than the set threshold, the candidate output is published; When the semantic similarity is higher than the set threshold, the LLM modifies the candidate output and recalculates the semantic similarity of the modified candidate output until the release conditions are met.

8. According to the method of claim 7, the runtime protection module obtains the set of protected content units corresponding to the target Agent Skills, obtains the semantic representation of the candidate output and each protected content unit using a preset semantic representation model, calculates the semantic similarity between the candidate output and each protected content unit, takes the maximum semantic similarity between the candidate output and all protected content units as the leakage judgment value, and compares the leakage judgment value with a preset threshold.

9. A high-value agent skills protection system based on local model-generated guidance vectors, characterized in that, include: The training data preparation module is used to obtain Skill files and corresponding task samples; The teacher supervision generation module is used to call the teacher model that is the same as the LLM in the Agent framework runtime phase and has the same parameter version, generate teacher output and tool call trajectory, and use them as teacher supervision information; The request conditional vector training module is used to train the LoRA parameters and linear mapping layer of the user-side local small model; The verification and injection module is invoked to generate and verify a single call identifier, and to map and inject the short guiding vector after the verification passes. The runtime protection module is used to determine whether candidate output directly leaks the content of the protected Skill before it is published, and to process it according to the determination result.

10. In the system according to claim 9, calling the verification and injection module is further used for: Generate a single-invocation request that includes user input, a single-invocation identifier, and an Agent Skills identifier; Establish a verification record corresponding to a single call identifier, and associate the verification record with the Agent Skills identifier and the call status; Receive the request conditional short bootstrap vector and single call identifier returned by the user's local small model; Query and verify records based on the single call identifier and update the call status; After the verification is passed, the short bootstrap vector of the request conditionalization is mapped to the hidden representation space corresponding to the target injection layer using the linear mapping layer corresponding to the target Agent Skills, and then fused with the intermediate hidden state of the target injection layer.