A Vectorized Compression-Based Agent Skills Protection Method and System

CN123013054APending Publication Date: 2026-10-30UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611085808.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-21
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0007]鉴于此,本发明提出了一种基于向量化压缩的Agent Skills保护方法及系统,解决现有技术在降低技能上下文开销时难以保持程序化技能流程逻辑、工具协议和条件依赖,以及训练反向传播路径长、显存占用高和固定注入配置无法适配不同技能复杂度的问题

Benefits of technology

[0019]与现有技术相比,本发明的有益效果在于,

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123013054A_ABST
    Figure CN123013054A_ABST
Patent Text Reader

Abstract

The application provides an Agent Skills protection method and system based on vectorization compression, and the method steps comprise: obtaining programmed skill content to be compressed, calling a general skill vector generator to convert the programmed skill content into a skill vector matched with an intermediate layer calling process of a target large language model, and configuring an injection strategy to make the model not read the skill vector before a specified injection layer, and injecting the skill vector into a model hidden state when the injection layer is reached; through offline injection configuration selection, based on a fidelity score of a diagnosis question and a reference answer, a target injection configuration meeting a threshold and having a lower calculation cost is selected for each skill; during online reasoning, a corresponding skill vector is matched according to a user query, and a response meeting a skill constraint is generated after fusion through the injection layer; and when the skill content is updated, the vector is regenerated or the configuration is reselected. The method of the application reduces online context overhead, shortens a training back propagation path, reduces memory occupation and enhances skill asset protection while ensuring skill execution logic.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and large language model agent technology, and more specifically, to an agent skills protection method and system based on vectorization compression. Background Technology

[0002] With the development of large language model agent technology, more and more reusable task capabilities are being encapsulated as Agent Skills. Agent Skills typically include task triggering conditions, execution steps, tool calling protocols, parameter constraints, output formats, verification logic, and exception recovery strategies, and are important knowledge assets for Agent systems to complete specific tasks.

[0003] Currently, Agent Skills are often deployed and distributed in the form of plaintext prompts, configuration files, process scripts, or skill documents to the runtime or user end. While this method facilitates direct reading and execution by LLMs, the complete skill text is exposed in the context, logs, cache, or recipient's file system, making it vulnerable to copying, leakage, rewriting, redistribution, or reverse engineering. This makes it difficult to meet the needs of skill providers for preventing Agent Skill leakage and protecting intellectual property rights.

[0004] To address the aforementioned issues, existing methods of encrypted storage, access control, or permission verification can only mitigate risks during the storage and transmission phases. At runtime, the plaintext skill text still needs to be handed over to the Agent framework or LLM for reading. If there are leaks in the runtime environment, call chain, or logging system, the core skill processes and tool orchestration rules can still be recovered. Furthermore, the repeated inclusion of long skill text in the context during each inference iteration increases input resource consumption and impacts operational efficiency in multi-skill collaborative scenarios.

[0005] Existing general text compression, prompt word summarization, or vector retrieval methods are mainly aimed at semantic information compression, which makes it difficult to stably preserve the conditional branches, tool parameters, step dependencies, format constraints, and error recovery logic in Agent Skills. If they directly replace the complete skill text, it is easy to cause the LLM output to deviate from the skill requirements, and it is impossible to balance leakage prevention, executability, and inference efficiency.

[0006] Therefore, there is a need for an Agent Skills protection method and system based on vectorized compression, which compresses the executable rules in Agent Skills into skill vectors that can be injected into LLMs, and through offline injection configuration selection and online intermediate layer injection, enables LLMs to obtain corresponding skill constraints without repeatedly exposing the complete skill plaintext, thereby achieving skill leakage-proof deployment and low context overhead operation. Summary of the Invention

[0007] In view of this, the present invention proposes an Agent Skills protection method and system based on vectorized compression, which solves the problems of existing technologies in reducing skill context overhead, such as difficulty in maintaining procedural skill flow logic, tool protocols and conditional dependencies, as well as long training backpropagation paths, high memory consumption and fixed injection configurations that cannot be adapted to different skill complexities.

[0008] To achieve the above objectives, the present invention proposes the following technical solution: A method for protecting Agent Skills based on vectorized compression includes the following steps: Step 1: Train a general skill vector generator based on multiple procedural skill samples, wherein the procedural skill samples include natural language skill texts that indicate when the large language model invokes capabilities, how to execute workflows, how to invoke tools, and how to satisfy usage constraints; Step 2: During normal use, obtain the Agent skill content to be compressed, and call the general skill vector generator to generate a vectorized representation of the procedural skill content to obtain a skill vector that matches the intermediate layer calling process of the target large language model, and determine the candidate injection configuration including the injection layer, skill vector length and fusion method. Step 3: Configure the skill vector injection strategy so that the target large language model does not receive or read the skill vector in the first few layers before the injection layer, and injects the skill vector into the model's hidden state when it reaches the injection layer; Step 4: Before deployment, perform offline injection configuration selection for each procedural skill and target large language model, generate diagnostic questions, generate reference answers based on complete skill text, generate candidate answers based on skill vectors under different candidate injection configurations, and select the target injection configuration that meets the threshold and has low computational cost based on the fidelity score of the candidate answers relative to the reference answers. Step 5: During online inference, the corresponding skill vector is matched according to the user query or skill routing result, so that the user query passes through the previous several layers before the injection layer, and then the skill vector is fused in the injection layer to generate a response that conforms to the procedural skill. Step 6: When the procedural skill content is updated, the general skill vector generator is invoked to regenerate the corresponding skill vector, and if the update magnitude or fidelity score does not meet the preset conditions, the offline injection configuration selection or incremental update of the general skill vector generator is re-executed.

[0009] Furthermore, the procedural skill content includes at least one or more of the following: skill name, skill description, skill text, and metadata. In step 1, priority is given to protecting the skill text, which includes one or more of the following: workflow steps, tool description, tool parameters, triggering conditions, prohibition conditions, output format, and error handling rules.

[0010] Furthermore, the skill vector in step 2 is generated by the general skill vector generator and is used to replace the complete skill text in the online context of the target large language model, while retaining at least the step sequence, triggering conditions, tool parameters, output constraints and error handling rules in the procedural skill.

[0011] Furthermore, for user requests containing multiple procedural skills, skill vectors for each procedural skill are obtained or generated, and these skill vectors are fused at the injection layer through splicing, weighted summation, gating selection, or grouping condition modulation.

[0012] Furthermore, the general skill vector generator in step 1 is trained through a skill structure reconstruction task, a process question-and-answer task, and a real skill task alignment task. The skill structure reconstruction task uses skill vectors as intermediate layer conditional signals to reconstruct workflow steps, triggering conditions, tool parameters, output formats, and error handling rules in the skill text, so that the skill vectors retain the core execution information of the skill. The process question-and-answer task constructs weakly supervised data with procedural documents, questions, and answers, so that the skill vectors are usable for the target large language model. The real skill task alignment task generates skill-related questions and supervised answers based on real skills, and introduces tool call simulation and multi-skill combination training.

[0013] Furthermore, the tool invocation simulation includes generating alternating trajectories containing intermediate states, actions, and observations, and simulating tool observations based on tool patterns, user questions, and partial trajectories; the multi-skill combination training includes breaking down complex skills into multiple self-contained sub-skills, generating skill vectors for each sub-skill using the general skill vector generator, and fusing them at a specified injection layer, thereby training the target large language model to maintain skill logic under the combined action of multiple sub-skills.

[0014] Furthermore, the offline injection configuration selection in step 4 satisfies:

[0015] Where s represents the procedural skill, and C represents the candidate injection configuration. This is a set of candidate injection configurations for skill s, where each candidate injection configuration includes one or more of the following: injection layer, skill vector length, skill vector dimension, and fusion method. Configure the fidelity score corresponding to C for candidate injection. For the fidelity threshold, Configure the corresponding computational cost for candidate injections.

[0016] Furthermore, when the procedural skill content is updated, the general skill vector generator is invoked to regenerate the corresponding skill vector, and the offline injection configuration selection or incremental update of the general skill vector generator is re-executed when the update magnitude exceeds the preset condition or the fidelity score is lower than the threshold.

[0017] This invention further proposes an Agent Skills protection system based on vectorized compression, comprising: Skill Acquisition Module: Used to acquire the Agent skill content to be compressed; General Skill Vector Generator Module: Used to convert procedural skill content into skill vectors that match the intermediate layer of the target large language model; Training alignment module: used to train the general skill vector generator module and the injected fusion parameters based on skill structure reconstruction tasks, process question answering tasks and real skill task alignment tasks; Injection Configuration Selection Module: Based on diagnostic questions, reference answers, candidate answers, and fidelity scores, this module selects the injection layer, skill vector length, skill vector dimension, and fusion method that meet the thresholds for each procedural skill and target large language model. Injection control module: used to determine the procedural skill to be invoked based on user request during online inference, load the skill vector and target injection configuration corresponding to the procedural skill and the target large language model, so that the target large language model only processes user input or task input before the specified injection layer, does not receive or read the skill vector, and injects the skill vector into the hidden state of the model when the specified injection layer is reached, so as to generate a response that conforms to the constraints of the procedural skill.

[0018] Furthermore, the system also includes a skill update module, which is used to regenerate skill vectors after changes in the content of procedural skills and select whether to re-execute the offline injection configuration selection based on the degree of change, so that the updated procedural skills can be called by the target large language model without having to repeatedly expose the complete plaintext online.

[0019] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention converts procedural skills from online plaintext text into skill vectors that can be used by the intermediate layer specified by the target model, reducing the repeated loading of the complete skill text during online invocation, and reducing context overhead and exposure of plaintext skills.

[0020] This invention improves the executability of skills after injection by reconstructing skill structures, aligning process questions and answers with real skill tasks, and ensuring that skill vectors retain not only factual information but also procedural dependencies between conditions, steps, tool parameters and constraints.

[0021] This invention prevents skill vectors from being used as input in the calculation of the first few layers of the model, and instead allows them to be used in the calculation after a specified injection layer. This reduces activation storage and backpropagation paths before the injection layer during training, thereby reducing memory usage.

[0022] This invention supports the selection of different injection layers, vector lengths, and fusion methods, making it suitable for community skills, enterprise internal skill libraries, and multi-model deployment scenarios. Attached Figure Description

[0023] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. In the drawings: Figure 1 This is a schematic diagram of the overall process of the Agent Skills protection method based on vectorized compression of the present invention; Figure 2 This is a schematic diagram illustrating the relationship between the general skill vector generator and the intermediate layer injection in this invention; Figure 3 This is a schematic diagram of the offline injection configuration selection process of the present invention. Detailed Implementation

[0024] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the disclosure to those skilled in the art. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0025] This embodiment provides a vectorized compression-based method for protecting Agent Skills. Procedural skills can be SKILL.md files, tool call guides, workflow descriptions, task solving templates, automated agent capability descriptions, or other reusable skills described in natural language. These skills contain procedural knowledge that can be executed by a large language model; their key content is not a single fact, but rather the dependencies between steps, conditions, tool protocols, and constraints.

[0026] like Figure 1As shown, the method in this embodiment specifically includes the following steps: Step 1: Train a general-purpose skill vector generator. The system collects multiple procedural skill samples, which can come from skill libraries, plugin repositories, enterprise knowledge bases, or local file systems, and parses the skill names, descriptions, text, and metadata. For skill text that needs to enter the context of a large language model, the system extracts workflow steps, tool descriptions, parameter definitions, prohibition conditions, output formats, and exception handling rules to construct skill structure reconstruction, process question answering, and real-world skill task alignment training data. This training yields a general-purpose skill vector generator that can be reused for different skills.

[0027] Step 2: Generate skill vectors during normal use. For example... Figure 2 As shown, the system acquires the Agent skill content to be compressed and calls a pre-trained general skill vector generator to encode the skill text into skill vectors that can be injected into a specified intermediate layer of the target large language model. These skill vectors can be one or more continuous vectors, which, after projection, are matched with the hidden state dimensions of the specified intermediate layer of the target large language model. They are used to carry the step sequence, triggering conditions, tool parameters, output constraints, and error handling rules of the procedural skill, and replace the repeated loading of the complete skill text in the context.

[0028] Step 3: Configure the intermediate layer injection strategy. The system saves the corresponding skill vector and injection configuration for each skill and target model. The injection configuration includes one or more of the following: injection layer, vector dimension, fusion method, and gating parameters. During inference or training, the target large language model only receives user input or task input in the first few layers before the injection layer, and does not receive or read the skill vector. When calculating the specified injection layer, the system injects the skill vector into the hidden state through residual summation, gating fusion, conditional modulation, or attention bias. For user requests that use multiple skills simultaneously, the system obtains the skill vectors of each skill separately and fuses them at the specified injection layer according to the skill selection or invocation order.

[0029] In the training phase of the general skill vector generator, the first stage is the skill structure reconstruction stage. Skill vectors are injected as intermediate-layer conditional signals into the reconstruction task, enabling the target large language model to recover the workflow steps, triggering conditions, tool parameters, output formats, and error handling rules from the skill text based on these skill vectors. This ensures that the skill vectors retain the core execution information of the skill. The second stage is the process question-and-answer stage, which uses procedural documents, questions, and answers to construct weakly supervised data, allowing the intermediate-layer injected representations to be consumed by the target model during question-and-answer behavior. The third stage is the real-world skill task alignment stage, which uses real skills to generate skill-related questions, tool requirements, separability annotations, and supervised answers. An injection layer gating adapter is then used to align the behavior of the target large language model with the skill vectors. Since skill vectors only participate in computation after a specified injection layer, parameter updates before the injection layer can be frozen or truncated during training, and the saving of activations before the injection layer can be reduced, thereby shortening the backpropagation path and reducing memory usage.

[0030] During the real-world skill task alignment phase, to protect the tool protocol, the system synthesizes ReAct-style trajectories that include intermediate states, actions, and observations, and simulates tool observations based on tool patterns, queries, and the current trajectory. To protect the multi-skill combination relationship, the system breaks down complex skills into multiple self-contained sub-skills, which are then fused at a designated injection layer after generating skill vectors by a general skill vector generator, enabling the model to learn the logical relationships when multiple skills are executed collaboratively.

[0031] Step 4: Execute the offline injection configuration selection. For example... Figure 3 As shown, for each skill s, the target large language model first generates N diagnostic questions based on the complete skill text; then, it generates reference answers under the condition of the complete skill text; then, under each candidate injection configuration C, it generates candidate answers by replacing the complete skill text with the skill vectors output by the general skill vector generator and the corresponding intermediate layer injection method; the system compares the candidate answers and the reference answers and obtains a fidelity score. When it exists Greater than or equal to the threshold When selecting candidate injection configurations, the configuration with lower computational cost and that meets deployment constraints is chosen as the optimal one. : Where s represents the procedural skill, and C represents the candidate injection configuration. The set of candidate injection configurations for skill s includes one or more of the following: injection layer, skill vector length, skill vector dimension, and fusion method. Configure the fidelity score corresponding to C for candidate injection. For the fidelity threshold, Configure the corresponding computational cost for candidate injections.

[0032] Step 6: Online Inference Injection Control. When a user request arrives, the skill retrieval system determines the skill to be invoked, and the injection control module obtains the target model corresponding to that skill. The corresponding skill vectors are loaded, and the shared adapter is activated. The target large language model first runs several layers before the injection layer based on the user query. When it reaches the specified injection layer, the skill vectors are fused, and the final response is generated by subsequent network layers. If the request does not require skills, the adapter is closed or the skill vectors are not loaded to maintain the original capabilities of the base model.

[0033] This embodiment also provides an Agent Skills protection system based on vectorized compression, including the following modules: The skill acquisition module is used to read and parse procedural skill content; A general-purpose skill vector generator module is used to convert procedural skill content into skill vectors that can be injected into a specified intermediate layer of the target large language model; The training alignment module is used to perform skill structure reconstruction, process question answering, and real skill task alignment training to train the general skill vector generator module and inject fusion parameters; The injection configuration selection module is used to select the injection layer, vector dimension, and fusion method for skills through offline diagnostics and fidelity scoring. The injection control module is used to determine the procedural skill to be invoked based on the user request during online inference, load the skill vector and target injection configuration corresponding to the procedural skill and the target large language model, so that the target large language model only processes user input or task input before the specified injection layer, does not receive or read the skill vector, and injects the skill vector into the model hidden state when the specified injection layer is reached, so as to generate a response that conforms to the constraints of the procedural skill. Through the above implementation methods, the present invention can first train a general skill vector generator, and then convert procedural skills from online plaintext context into skill vectors that can be consumed by intermediate layers specified by the target large language model during normal use. By injecting the intermediate layers, the first few layers of the model do not receive or read the skill vectors, thereby reducing online context overhead, shortening the training backpropagation path, reducing memory usage, and enhancing skill asset protection while ensuring the skill execution logic.

[0034] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A method for protecting Agent Skills based on vectorized compression, characterized in that, include: Obtain the procedural skills content to be compressed; The general skill vector generator is invoked to generate a vectorized representation of the procedural skill content, thereby obtaining a skill vector that matches the intermediate layer invocation process of the target large language model, and determining the candidate injection configuration; Configure the skill vector injection strategy so that the target large language model does not receive or read the skill vector in the first few layers before the injection layer, and injects the skill vector into the model hidden state when it reaches the injection layer; For each procedural skill and the target large language model, an offline injection configuration selection is performed. Reference answers and candidate answers are generated based on the complete skill text and diagnostic questions. The target injection configuration that meets the threshold and has low computational cost is selected based on the fidelity score of the candidate answers relative to the reference answers. During online inference, the skill vector corresponding to the user query is matched, so that the user query first passes through several layers before the injection layer, and then the skill vector is fused in the injection layer to generate a response that conforms to the procedural skill.

2. The method according to claim 1, characterized in that, The procedural skill content includes at least one or more of the following: skill name, skill description, skill text, and metadata. Priority is given to protecting the skill text, which includes one or more of the following: workflow steps, tool description, tool parameters, trigger conditions, prohibition conditions, output format, and error handling rules.

3. The method according to claim 1, characterized in that, The skill vectors are generated by the general skill vector generator and are used to replace the complete skill text in the online context of the target large language model, while retaining at least the step sequence, triggering conditions, tool parameters, output constraints and error handling rules in the procedural skills.

4. The method according to claim 1, characterized in that, For a user request containing multiple procedural skills, skill vectors for each procedural skill are obtained or generated, and then fused at the injection layer using methods such as splicing, weighted summation, gating selection, or grouping conditional modulation.

5. The method according to claim 1, characterized in that, The general skill vector generator is trained through skill structure reconstruction tasks, process question answering tasks, and real skill task alignment tasks. The skill structure reconstruction task uses the skill vector as an intermediate layer condition signal to reconstruct the workflow steps, triggering conditions, tool parameters, output format and error handling rules in the skill text, so that the skill vector retains the core execution information of the skill. The process question-and-answer task constructs weakly supervised data using procedural documents, questions, and answers, making the skill vectors available to the target large language model; The real skills task alignment task generates skill-related questions and supervised answers based on real skills, and introduces tool call simulation and multi-skill combination training.

6. The method according to claim 5, characterized in that, The tool call simulation includes generating alternating trajectories containing intermediate states, actions, and observations, and simulating tool observations based on tool patterns, user questions, and partial trajectories; the multi-skill combination training includes breaking down complex skills into multiple self-contained sub-skills, generating skill vectors for each sub-skill using the general skill vector generator, and fusing them at a specified injection layer, thereby training the target large language model to maintain skill logic under the combined action of multiple sub-skills.

7. The method according to claim 1, characterized in that, The offline injection configuration selection satisfies: , Where s represents the procedural skill, and C represents the candidate injection configuration. The set of candidate injection configurations for skill s includes one or more of the following: injection layer, skill vector length, skill vector dimension, and fusion method. Configure the fidelity score corresponding to C for candidate injection. For the fidelity threshold, Configure the corresponding computational cost for candidate injections.

8. The method according to claim 1, characterized in that, When the programmatic skill content is updated, the general skill vector generator is invoked to regenerate the corresponding skill vector. If the update magnitude exceeds the preset condition or the fidelity score is lower than the threshold, the offline injection configuration selection or incremental update of the general skill vector generator is re-executed.

9. An Agent Skills protection system based on vectorized compression, characterized in that, include: The skill acquisition module is used to acquire the Agent skill content to be compressed; A general-purpose skill vector generator module is used to convert procedural skill content into skill vectors that match the intermediate layer of the target large language model; The training alignment module is used to train the general skill vector generator module and the injected fusion parameters based on the skill structure reconstruction task, the process question answering task and the real skill task alignment task. The injection configuration selection module is used to select the injection layer, skill vector length, skill vector dimension, and fusion method that meet the threshold for each procedural skill and target large language model based on the diagnostic question, reference answer, candidate answer, and fidelity score. The injection control module is used to determine the procedural skill to be invoked based on the user request during online inference, load the skill vector and target injection configuration corresponding to the procedural skill and the target large language model, so that the target large language model only processes user input or task input before the specified injection layer, does not receive or read the skill vector, and injects the skill vector into the model hidden state when it reaches the specified injection layer, so as to generate a response that conforms to the constraints of the procedural skill.

10. The system according to claim 9, characterized in that, It also includes a skill update module, which is used to regenerate skill vectors after changes in procedural skill content and select whether to re-execute offline injection configuration selection based on the degree of change, so that the updated procedural skills can be called by the target large language model without having to repeatedly expose the complete plaintext online.