Search

CN-120994822-B - Self-attention compressible memory management method driven by graph

CN120994822BCN 120994822 BCN120994822 BCN 120994822BCN-120994822-B

Abstract

The application discloses a graph-driven self-attention compressible memory management method, belonging to the technical field of penetration test, which accurately describes semantic dependence and attention flow direction among multi-Agent nodes by utilizing edge weights by constructing attention graphs, improves the relevance and acquirability of information, screens key memory fragments based on the attention graph edge weights and task related characteristics in terms of screening and loading, only loads useful information, effectively eliminates redundancy, the application reduces the data volume processed by the system and improves the running efficiency of the system, when the memory content exceeds the input context window limit of the large model, the semantic compression module can carry out abstract processing on the historical information based on various elements, and the abstract length is controlled in the window limit on the premise of ensuring that the key semantic information is not lost, thereby ensuring that the model can normally process the information, and improving the adaptability and stability of the system to different data volumes.

Inventors

  • LI JIANWANG

Assignees

  • 沥泉科技(成都)有限公司

Dates

Publication Date
20260505
Application Date
20250818

Claims (9)

  1. 1. A graph-driven self-care compressible memory management method, comprising the steps of: The method comprises the steps of S1, constructing a focus map, namely constructing a focus map of a dynamic directed graph structure by taking each round of information interacted by multiple agents in a penetration test task as a node, wherein the information comprises dialogue records and tool call data, the side weight of the focus map represents the attention dependency relationship among different nodes, the side weight is determined by analyzing the semantic relevance among the nodes and the interaction logic flow direction, and the side weight is used for describing the semantic dependency and the attention flow direction among the multiple Agent nodes, and the information corresponding to the nodes forms a history memory segment; The method comprises the steps of S2, directionally searching and selectively loading, wherein based on the edge weight of a concerned graph, a history memory segment which is strongly related to a current penetration test task, namely a key memory segment, is screened out from the concerned graph, the strong correlation is matched according to the vulnerability type, the attack stage and the used tool characteristics of the current task, the key memory segment is loaded, irrelevant redundant information is removed, if the total length of the loaded memory segment exceeds a message length threshold preset by a large model, S3 is executed, and if the total length of the loaded memory segment does not exceed the message length threshold, S4 is directly executed; the tool features include tool type, tool function and tool call history parameters; S3, performing self-adaptive processing on overflow of a context window, starting a semantic compression module, performing abstract processing on the key memory fragments loaded in the S2 based on core elements and historical response contents including task intention and tool call, extracting key semantic information and generating a compression abstract; And S4, multi-scene adaptation optimization, namely selecting and executing multi-parameter tool call optimization and multi-Agent collaborative optimization based on the memory content loaded in S2 or the compression abstract generated in S3, wherein the multi-Agent collaborative optimization specifically transmits related information of agents responsible for different tasks through a focus map, ensures that the agents share necessary contexts and performs work based on the shared information.
  2. 2. The graph-driven self-attention compressible memory management method of claim 1, wherein in S1, when a new interaction message is added as a node to a focused graph, an edge weight is updated by calculating the semantic similarity between the new node and an existing node, the semantic similarity calculation adopts a vector cosine similarity algorithm based on a pre-training language model, the edge weight is dynamically adjusted according to the new semantic association condition, and the adjustment amplitude and the semantic similarity are positively correlated.
  3. 3. The graph-driven self-care compressible memory management method of claim 1, wherein in S2, the tool types include a vulnerability scanning tool, a vulnerability exploitation tool, and a right lifting tool, the tool functions are classified into information collection, vulnerability detection, and attack implementation categories according to their roles in the penetration test flow, and the tool call history parameters include parameter names, parameter value ranges, and parameter combination modes.
  4. 4. The graph-driven self-care compressible memory management method of claim 1, wherein in S3, the semantic compression module performs semantic parsing and content refining on the history information through a natural language processing model.
  5. 5. The graph-driven self-care compressible memory management method of claim 1 wherein in the multi-parameter tool call optimization of S4, tool parameter specification is added by adding tool parameter specification to the memory content loaded by S2 or the compression digest generated by S3, thereby enhancing the understanding of tool usage by the model.
  6. 6. The graph-driven self-care compressible memory management method of claim 1, wherein in the multi-Agent collaborative optimization of S4, the related information includes task progress, tool call results and authority states, the task progress presents the current task completion condition and the advancing state of each subtask in a percentage form, the tool call results include whether the call is successful, return data and error codes, and the authority states record the currently acquired system authority level and authority range.
  7. 7. The graph-driven self-care compressible memory management method of claim 1 wherein in S1, the node is uniquely identified, the identification information includes a time stamp of message generation and a number of a sending Agent and a type of the message, the number of the sending Agent is a unique identifier allocated to the system, and the attribute information of the node further includes a message type, a message length, and an associated tool identifier.
  8. 8. The graph-driven self-attention compressible memory management method of claim 7, wherein the generated compressed digest is accompanied by index information including unique identification of the original node, storage path, and generation time in S3.
  9. 9. The graph-driven self-care compressible memory management method according to claim 1, wherein in S4, when the multiple agents are co-optimized, an information synchronization mechanism between the agents is established, and unified processing of message distribution and acceptance is realized through a subscription-release mode.

Description

Self-attention compressible memory management method driven by graph Technical Field The invention belongs to the technical field of penetration test, and particularly relates to a graph-driven self-attention compressible memory management method. Background In the penetration test task, the multi-Agent collaborative work needs to process a large amount of history interaction information, including dialogue records, tool call tracks and the like. The historical memory segment formed by the information has important reference value for the execution of the current task. However, the conventional memory management method has the following problems: 1. When a memory structure is constructed, complex semantic dependence and attention flow direction among multi-Agent nodes cannot be effectively described, so that information relevance is poor, and key information is difficult to accurately retrieve. 2. When the method faces to mass memory fragments, a high-efficiency screening and loading mechanism is lacking, a large amount of irrelevant redundant information is introduced into a processing flow, so that the burden of a system is increased, the execution of a current task is possibly interfered, and the efficiency is reduced. 3. When the loaded memory content exceeds the limit of the large-model input context window, the existing processing mode often adopts a mode of directly cutting off the content, which causes information loss or greatly reduces the performance of the model, and effective compression processing can not be performed on the premise of ensuring the information integrity. Disclosure of Invention In order to solve the problems in the background art, the application provides a graph-driven self-attention compressible memory management method to solve the problems that in the traditional penetration test task, information relevance is poor, key information is difficult to accurately retrieve, efficient screening and loading mechanisms are lacked, and information loss or model performance is greatly reduced due to simple compression. In order to achieve the above purpose, the present invention provides the following technical solutions: A graph-driven self-care compressible memory management method comprising the steps of: The method comprises the steps of S1, constructing a focus map, namely constructing a focus map of a dynamic directed graph structure by taking each round of information interacted by multiple agents in a penetration test task as a node, wherein the information comprises dialogue records and tool call data, the side weight of the focus map represents the attention dependency relationship among different nodes, the side weight is determined by analyzing the semantic relevance among the nodes and the interaction logic flow direction, and the side weight is used for describing the semantic dependency and the attention flow direction among the multiple Agent nodes, and the information corresponding to the nodes forms a history memory segment; The method comprises the steps of S2, directionally searching and selectively loading, wherein based on the edge weight of a concerned graph, a history memory segment which is strongly related to a current penetration test task, namely a key memory segment, is screened out from the concerned graph, the strong correlation is matched according to the vulnerability type, the attack stage and the used tool characteristics of the current task, the key memory segment is loaded, irrelevant redundant information is removed, if the total length of the loaded memory segment exceeds a message length threshold preset by a large model, S3 is executed, and if the total length of the loaded memory segment does not exceed the message length threshold, S4 is directly executed; S3, performing self-adaptive processing on overflow of a context window, starting a semantic compression module, performing abstract processing on the key memory fragments loaded in the S2 based on core elements and historical response contents including task intention and tool call, extracting key semantic information and generating a compression abstract; And S4, multi-scene adaptation optimization, namely selecting and executing multi-parameter tool call optimization and multi-Agent collaborative optimization based on the memory content loaded in S2 or the compression abstract generated in S3, wherein the multi-Agent collaborative optimization specifically transmits related information of agents responsible for different tasks through a focus map, ensures that the agents share necessary contexts and performs work based on the shared information. Preferably, in S1, when a new interaction message is added as a node to the attention graph, the edge weight is updated by calculating the semantic similarity between the new node and the existing node, the semantic similarity is calculated by using a vector cosine similarity algorithm based on a pre-training language model, the edge weight is d