A method and system for dynamic access control in LLM based on multi-agent cooperation
The LLM dynamic access control method based on multi-agent collaboration solves the problems of insufficient flexibility and scalability in existing technologies, realizes precise and adaptive access control, improves the detection accuracy and user experience of the system, and reduces maintenance costs.
Patent Information
- Application Number
- CN202611359101.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-03
- Publication Date
- 2026-11-17
AI Technical Summary
Existing LLM access control technologies have significant shortcomings in terms of flexibility, scalability, intelligence, and user experience. They are unable to cope with dynamic attacks and multi-scenario requirements, and the system modules are highly coupled, resulting in poor scalability and maintainability.
The LLM dynamic access control method, which adopts multi-agent collaboration, uses multiple types of dedicated agents to collaboratively perceive user requests from multiple dimensions. Combined with a conflict arbitration mechanism and closed-loop strategy self-evolution, it achieves flexible, accurate and adaptive access control.
It improves detection accuracy, reduces false positives and false negatives, supports multiple execution modes, enables policy switching between security-first and experience-first approaches, reduces maintenance costs with its modular architecture, and generates fine-grained decision evidence chains to meet compliance requirements in high-risk scenarios.
Smart Images

Figure CN123122940A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence security and access control technology, and more specifically, to an LLM dynamic access control method and system based on multi-agent collaboration. Background Technology
[0002] With the widespread application of Large Language Models (LLMs) in fields such as intelligent customer service, content generation, code assistance, and knowledge-based question answering, their powerful capabilities in natural language understanding and generation have greatly promoted the development of artificial intelligence technology. However, the openness and versatility of LLMs have also brought new security challenges, especially in access control and malicious request identification. Most resource access based on LLMs grants resource permissions to the LLM, while efforts are made to set control policies at the LLM access point.
[0003] Currently, access control technologies for LLM mainly rely on static rule bases (such as keyword filtering and prompt word template matching) or single-module detection mechanisms. These traditional technologies have the following obvious shortcomings in practical applications: (1) They rely on fixed keywords or prompt word bases, making it difficult to deal with dynamic prompt word injection attacks such as deformation, splitting, and role-playing. (2) They can only reject risky requests in a "one-size-fits-all" manner, and cannot take differentiated treatment (such as correction, guidance, etc.) according to the risk type or level. (3) The system modules are highly coupled, and adding new detection tools requires modifying the core code, resulting in poor scalability and maintainability. (4) They only detect from a single dimension and lack the ability of multi-agent collaborative evaluation and dynamic decision-making, resulting in a high false positive and false negative rate. (5) They cannot customize the activation, priority, fusion rules, and other strategies of intelligent agents according to business scenarios (such as education, finance, and healthcare), resulting in insufficient flexibility.
[0004] In summary, existing LLM access control technologies have significant shortcomings in terms of flexibility, scalability, intelligence, and user experience. Therefore, there is an urgent need for a modular, configurable, multi-agent collaborative dynamic LLM access control mechanism. This mechanism should utilize multiple types of specialized agents to collaboratively evaluate user requests from multiple dimensions, including keywords, user intent, behavioral patterns, and resource sensitivity, to achieve accurate, flexible, and adaptive access control decisions. Summary of the Invention
[0005] To address the aforementioned technical challenges, this invention proposes a multi-agent collaborative dynamic access control method and system for LLM (Local Management Module). By employing multiple types of specialized agents to collaboratively perceive user access intentions from multiple dimensions, along with conflict arbitration mechanisms and self-evolving closed-loop strategies, this method achieves flexible, precise, and adaptive control over LLM access. It effectively defends against dynamic attacks such as prompt word injection, significantly improving the system's scalability and user experience.
[0006] The first aspect of this invention provides an LLM dynamic access control method based on multi-agent cooperation, comprising the following steps: Step S1: Receive the natural language request input by the user, preprocess it, identify the user's access needs, and generate the preprocessed request text; Step S2: Distribute the preprocessed request text to multiple intent recognition agents. Each agent independently analyzes the request text. The multiple intent recognition agents have different sets of detection tools and access control permission perspectives. They assess the user's access request permission risk from at least two dimensions, including keyword matching, user intent parsing, attack behavior pattern matching, and resource sensitivity assessment, and output risk scores, risk types, and reasoning basis. Step S3: When there is a conflict in the output results of different agents, the arbitration agent is activated to analyze the conflict. Based on the request text and the reasoning basis of the conflicting agents, the divergence point is located, and the risk score and risk type after arbitration are output. Step S4: The strategy decision-making agent receives the risk scores and types output by each agent, and calculates the comprehensive risk level of the request text by combining it with historical decision feedback data; Step S5: Based on the comprehensive risk level and the risk type of the request text, match the corresponding response mode, perform LLM access control on the original user request, and generate a chain of evidence. Step S6: Based on the feedback results after execution, automatically adjust the agent's scheduling strategy, fusion rules, or decision threshold. The adjusted strategy takes effect in real time for processing subsequent requests.
[0007] In this solution, step S2 specifically includes: The agent scheduler distributes the preprocessed request text to multiple enabled intent recognition agents according to a preset scheduling strategy. The distribution method includes parallel distribution, serial distribution or condition-triggered distribution. Before distribution, the scheduler performs lightweight semantic pre-classification on the request text to identify whether there are imperative verbs, sensitive entities or typical injection sentences in the request text. Based on the pre-classification results, the scheduler finds the corresponding priority activation agent and calling order from the preset agent priority mapping table and performs distribution according to the calling order. After receiving the request text, each intent recognition agent calls the detection tool to extract attack features from the request text. Each agent internally calls at least two heterogeneous detection tools and cross-validates the outputs of each tool. Each agent outputs a risk score based on the extracted features, and maintains a sliding window of preset short-term historical request scores within each agent. If the difference between the current score and the historical baseline exceeds a preset threshold, the bias term of the score mapping function is subtracted from the difference. Each agent outputs at least one risk type label, as well as reasoning basis including the trigger feature location, the matched attack pattern identifier, and the key confidence score.
[0008] In this scheme, the intent recognition agent includes at least two of the following types: The keyword detection agent, based on a dynamically updated sensitive word library and adversarial sample variant library, performs multi-pattern matching on the request text to identify preset sensitive words and variants; The user access intent recognition intelligent agent, based on a semantic parsing model, parses the user's natural language request into the target resource access intent, transforms it into structured resource access instructions, and identifies the user's true access purpose; The behavior pattern recognition agent matches the request text with a classic attack pattern feature library to detect whether there are role-playing injection, command hijacking, jailbreak prefix, or adversarial prompt word attack patterns. The module intent identifies intelligent agents and performs fine-grained permission assessment on access requests to specific resource modules, data domains, or functional units to determine whether the user has permission to access the specific module.
[0009] In this solution, step S3 specifically includes: The agent scheduler collects risk scores, risk types, and reasoning bases from all intent-recognition agents. When the difference or mutual exclusion between the outputs of different agents exceeds a preset threshold, the arbitration agent is activated, and the type of conflict that needs to be arbitrated is determined. The arbitration agent receives the original request text, the outputs of all agents, and the conflict type identifier, and calls an external consistency verification tool to perform an independent check on the request text. Analyze the reasoning basis of each agent and locate the points of divergence in the reasoning basis; Based on the preset arbitration model, output the risk score and risk type after arbitration; The output includes an arbitration statement that explains the reasons for the disagreement and the basis for the arbitration.
[0010] In this solution, step S4 specifically includes: The strategy decision-making agent receives risk scores, risk types, and reasoning bases from all intent recognition agents and arbitration agents. It then standardizes the received risk scores and converts the risk type labels into fixed-length vector representations. The policy decision-making agent constructs an N×M output matrix, where N is the number of agents and M is the dimension of the output features of each agent. The features include the calibrated risk score, risk type encoding vector, and key confidence score in the reasoning basis, and are associated with the Q value representing the action value for each agent. For any two agents, the policy decision agent calculates the Pearson correlation coefficient based on the output rating sequence in the historical L requests. The Pearson correlation coefficient is dynamically updated based on a sliding window, and the sliding window length L is a preset value. Each agent is a node, and the node features include the agent's current output risk score, risk type encoding vector, Q value, and historical average accuracy. An edge structure is established based on the Pearson correlation coefficient between two agents. The completed agent collaboration graph is input into the graph neural network to perform message passing and node updates, and to obtain the enhanced feature vectors of the agents. The policy decision-making agent extracts the enhanced risk score and the enhanced risk type probability distribution from the enhanced feature vector of each agent.
[0011] In this solution, step S4 further includes: The strategy decision-making agent calls the fusion strategy engine to calculate the enhanced risk scores and enhanced risk types of all agents and obtain a preliminary comprehensive risk score. The policy decision-making agent retrieves feedback data related to the current request from the historical feedback memory based on semantic vector similar request search and agent performance tracking. The feedback corrector is invoked to correct the preliminary comprehensive risk score using the retrieved feedback data, thereby obtaining the corrected comprehensive risk score. According to the preset risk level mapping rules, the corrected comprehensive risk score is mapped to discrete comprehensive risk levels, including safe, low risk, medium risk and high risk. After the current request processing flow is completed, the policy decision agent obtains the actual verification result and updates the Q value of each agent based on the consistency between the score output by each agent and the actual result.
[0012] In this solution, step S5 specifically includes: The control execution scheduler selects a set of applicable candidate response actions from the policy library based on the comprehensive risk level and risk type set. The candidate response actions include normal access, access denial, content modification, guided access, audit logging, delayed response, manual intervention, and adversarial response. Maintain K parallel value decomposition strategies, each of which decomposes the value of a response action into different value dimensions, including at least two of the following: security dimension, efficiency dimension, user experience dimension, information gain dimension, and deterrence dimension. For each candidate response action, each value decomposition strategy independently outputs a value estimate in the current state, generating K parallel value matrices corresponding to the value decomposition strategies; For each candidate response action, calculate the difference between the value estimates of each strategy, and dynamically adjust the weight of each indicator in the difference measurement according to the risk level and risk type of the current request. Construct an uncertain map of the state-action space. When the difference exceeds a preset threshold, mark the corresponding state-action pair as an uncertain region and obtain exploration rewards based on the indicator factors of the uncertain region. A selection score is calculated for each candidate response action based on the weighted average of the value estimates of each strategy and the exploration reward. The candidate response action with the highest selection score is then selected as the action to be executed. The control execution scheduler calls the corresponding control execution agent according to the selected execution action, generates the final LLM response, and returns it to the user; Simultaneously, an evidence chain record for this execution is generated and stored. The evidence chain includes the value estimate of each strategy, the degree of difference, the identification of uncertain areas, the selection score calculation process, the selected action, the actual execution effect, and the strategy weight update log.
[0013] In this solution, step S6 specifically includes: After the current request is processed, a feedback signal is collected, and a credit score for each value decomposition strategy is calculated based on the feedback signal. Based on the credit score of each strategy, the weights of each value decomposition strategy are updated using the soft maximization rule; After each weight update, the value estimation correlation coefficient matrix between each value decomposition strategy is calculated. When the correlation coefficient exceeds a preset threshold, the value function parameters of any strategy are randomly perturbed. Based on the updated policy weight distribution, the scheduling policy and decision threshold of the agent scheduler are adjusted synchronously, and the adjusted policy takes effect in real time for processing subsequent requests.
[0014] A second aspect of the present invention provides an LLM dynamic access control system based on multi-agent cooperation, the system comprising: Request Reception and Preprocessing Module: This module receives natural language requests from users, preprocesses them, identifies user access needs, and generates preprocessed request text. Intelligent agent scheduling and configuration management module: used to store user-configured scheduling policies and coordinate the execution order and triggering conditions of each intelligent agent; Intent recognition agent group: includes multiple dedicated intent recognition agents. These agents have different sets of detection tools and access control permissions. They analyze the request text independently from at least two dimensions, including keyword matching, user intent parsing, attack behavior pattern matching, and resource sensitivity assessment, and output risk scores, risk types, and reasoning basis. Arbitration agent: Activated when the outputs of multiple intent recognition agents conflict, receives the original request text and the outputs of each agent, analyzes the reasoning basis and locates the point of disagreement, and outputs the risk score and risk type after arbitration according to the preset arbitration rules; Strategic decision-making agent: It receives the output of all intent recognition agents and arbitration agents, calculates the comprehensive risk level by combining historical decision feedback data; maintains the value decomposition strategy through the multi-value decomposition preference strategy library, calculates the difference between the value estimates of each strategy, calculates the selection score for candidate response actions and selects the action to be executed. Group of control execution agents: contains multiple dedicated control execution agents, each corresponding to a response mode; Control execution scheduler: Used to invoke the corresponding control execution agent to control access to the LLM based on the selected response mode and the execution strategy configured by the user; Feedback collection and policy evolution module: used to collect feedback signals after execution, calculate the credit score of each value decomposition policy and update the policy weight, and simultaneously adjust the agent scheduling policy and decision threshold. Log module: Used to record the decision-making process and execution results of each agent, and generate a chain of evidence containing the complete decision-making process.
[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: By employing multiple dedicated intent recognition agents to analyze user requests in parallel across multiple dimensions, including vocabulary, semantics, and behavioral patterns, and combining this with the conflict resolution mechanism of the arbitration agent, the system effectively improves detection accuracy and reduces false positives and false negatives. Through a multi-value decomposition preference policy library and dynamic measurement of estimated differences, it can identify uncertain regions and proactively explore high-value response actions. Combined with user-configurable preference rules, it enables flexible switching between various strategies such as security priority and experience priority. Based on multi-source feedback signals after execution, the system dynamically updates policy weights and maintains the orthogonality of the policy library, achieving automatic adjustment and real-time effectiveness of scheduling policies, fusion rules, and decision thresholds. It supports multiple execution modes, including normal access, access denial, content correction, guided access, and adversarial responses, employing a gradual approach to low- and medium-risk requests to avoid a blanket rejection. The modular architecture allows adding new detection tools or response modes without modifying the core code, reducing maintenance costs. The complete decision evidence chain generated by the system supports fine-grained traceability and difference comparison, meeting compliance requirements in high-risk scenarios. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments or examples of the present invention, the drawings used in the embodiments or examples will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained according to these drawings without creative effort.
[0017] Figure 1 A flowchart of a multi-agent collaborative LLM dynamic access control method is shown. Figure 2 A flowchart is shown to calculate the overall risk level of the request text; Figure 3 This diagram illustrates a flowchart of the LLM access control process performed on a request by matching the corresponding response pattern. Figure 4 A block diagram of an LLM dynamic access control system based on multi-agent cooperation is shown. Detailed Implementation
[0018] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.
[0019] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and therefore the scope of protection of the invention is not limited to the specific embodiments disclosed below.
[0020] like Figure 1 As shown, this embodiment provides an LLM dynamic access control method based on multi-agent collaboration. This method uses multiple types of dedicated agents to collaboratively perceive user requests and assess permission risks. The overall process includes: receiving and preprocessing user request text, and distributing it to multiple dedicated intent recognition agents; each agent independently performs permission risk assessment and outputs a risk score, risk type, and reasoning basis; when there is a conflict in the results, an arbitration agent is activated for parsing; the policy decision agent calculates the comprehensive risk level by integrating the outputs of all parties and historical feedback, matches the corresponding response mode, and executes access control; after execution, the policy is dynamically adjusted and takes effect in real time through a feedback loop, including: Step S1: Receive the natural language request input by the user, perform basic cleaning, and generate the preprocessed request text. Step S2: Distribute the preprocessed request text to multiple intent recognition agents. Each agent independently analyzes the request text and outputs a risk score, risk type, and reasoning basis. Step S3: When there is a conflict in the output results of different agents, the arbitration agent is activated to resolve the conflict. Based on the request text and the reasoning basis of the conflicting agents, the risk score and type after arbitration are output. Step S4: The strategy decision-making agent receives the risk scores and types output by each agent, and calculates the comprehensive risk level of the request text by combining it with historical decision feedback data; Step S5: Based on the comprehensive risk level and the risk type of the request text, match the corresponding response mode, perform LLM access control on the original user request, and generate a chain of evidence. Step S6: Based on the feedback results after execution, automatically adjust the agent's scheduling strategy, fusion rules, or decision threshold. The adjusted strategy takes effect in real time for processing subsequent requests.
[0021] It should be noted that after receiving the user's natural language request, consecutive spaces, tabs, and newlines in the request text are replaced with single spaces, and leading and trailing whitespace characters are removed. Depending on the system configuration, invisible control characters and zero-width characters that do not contribute to semantic analysis are selectively removed or escaped, while special characters that may have malicious intent are retained. All characters are converted to a unified encoding to prevent injection bypass at the encoding level. When the request text exceeds the system's preset maximum length threshold, intelligent truncation is performed based on natural boundaries (periods, newlines) or a start / end preservation strategy, and the truncation flag is recorded. The user's access requirements are parsed from the request text, and the user's access targets (such as database tables, API interfaces, document resources, etc.) are extracted. The access requirements expressed in natural language are transformed into structured resource access instructions; the resource access instructions at least include an access object identifier, operation type, and expected data range. The cleaned request text, along with the resource access instructions, original length, cleaned length, truncation flag, receiving timestamp, and user identifier, is encapsulated into a standardized request object as input for subsequent multi-agent collaborative perception.
[0022] After completing the initial cleaning step, a structured preprocessed request text is obtained. In step S2, the preprocessed request text is used as input and passed to the agent scheduler. The agent scheduler distributes the preprocessed request text to multiple enabled intent-recognition agents according to a preset scheduling strategy. The distribution method includes parallel distribution, serial distribution, or conditionally triggered distribution. Before distribution, the scheduler performs lightweight semantic pre-classification on the request text to identify whether there are imperative verbs, sensitive entities, or typical injection patterns. Based on the pre-classification results, the scheduler looks up the corresponding priority activation agents and their calling order from a preset agent priority mapping table and executes the distribution according to the calling order. The agent scheduler performs extremely lightweight and fast semantic pre-classification on the request text, dynamically determining which agents to activate first, rather than calling them sequentially in a fixed order, significantly improving the response speed and detection depth of critical attacks.
[0023] Each agent possesses a different set of specialized tools. For example, the keyword detection agent invokes a dynamically updated sensitive word library and adversarial example variant library to perform multi-pattern matching on the request text. The semantic understanding agent invokes a small semantic encoder (such as Sentence-BERT) to map the request text into semantic vectors and calculates similarity with a known attack vector library. The behavior pattern agent invokes a rule-based intent classifier to identify whether the request contains typical attack patterns such as "role-playing," "command hijacking," and "jailbreak prefixes." The adversarial attack detection agent invokes a model based on perplexity calculation to detect whether the request text contains a large number of rare words or unconventional grammar.
[0024] Upon receiving the request text, each intent recognition agent invokes a detection tool to extract attack features from the request text. Each agent internally invokes at least two heterogeneous detection tools and cross-validates the outputs of each tool: when the outputs of multiple tools all point to the same risk level, the agent outputs the risk level; otherwise, the agent outputs the risk level along with inferences about the inconsistent features.
[0025] The intent recognition agent described in this embodiment includes at least two of the following types: (1) Keyword detection agent, which performs multi-pattern matching on the request text based on a dynamically updated sensitive word library and adversarial sample variant library, and identifies preset sensitive words and variants; (2) User access intent recognition agent, which parses the user's natural language request into the target resource access intent based on a semantic parsing model, transforms it into a structured resource access instruction, and identifies the user's true access purpose; (3) Behavior pattern recognition agent, which matches the request text with a classic attack pattern feature library to detect whether there are role-playing injection, instruction hijacking, jailbreak prefix or adversarial prompt word attack patterns; (4) Module intent recognition agent, which performs fine-grained permission evaluation on the access request of a specific resource module, data domain or functional unit, and determines whether the user has the permission to access the specific module.
[0026] Each agent outputs a risk score based on extracted features. The scoring algorithm includes one or more combinations of threshold weighting, similarity mapping, or classifier probability. Within each agent, a sliding window of preset short-term historical request scores is maintained. If the difference between the current score and the historical baseline exceeds a preset threshold, the bias term of the scoring mapping function is subtracted from the difference; the current request's score is then relativized to the historical baseline. This avoids systemic misjudgments caused by overall changes in the business scenario. Each agent outputs at least one risk type label, such as role-playing injection, command hijacking, jailbreak attempt, sensitive information leakage, or normal request; and inference criteria including the trigger feature location, the matched attack pattern identifier, and key confidence scores.
[0027] It should be noted that in step S3, when there is a conflict in the output results of different agents, the arbitration agent is activated to resolve the conflict. The agent scheduler collects the risk scores, risk types, and reasoning bases of all intent recognition agents; when the difference or mutual exclusion between the output results of different agents exceeds a preset threshold, the arbitration agent is activated and the type of conflict requiring arbitration is determined. Conflict types include score conflicts, type conflicts, and basis conflicts; the arbitration agent receives the original request text, the outputs of all agents, and the conflict type identifier, calls an external consistency verification tool, and performs a third-party detection on the request text that is unrelated to each agent; it analyzes the reasoning bases of each agent, locates the divergence points in the reasoning bases, such as the use of different attack template libraries or the assignment of different weights to the same keyword; based on a preset arbitration model such as random forest, small neural network, or large language model, it outputs the arbitration-resolved risk score and risk type; and outputs an arbitration explanation containing the reasons for the divergence and the arbitration base. The arbitration-resolved risk score and risk type, along with the original scores, types, and reasoning bases of each agent, are passed to the fusion module for calculating the comprehensive risk level.
[0028] It should be noted that in step S4, the policy decision-making agent receives the above-mentioned multi-source outputs, combines them with historical decision feedback data, and calculates a unified comprehensive risk level for the request text, providing a basis for subsequent control execution.
[0029] like Figure 2 As shown, the strategy decision-making agent receives risk scores, risk types, and reasoning bases from all intent recognition and arbitration agents. It standardizes the received risk scores, mapping each agent's score to a unified standard distribution, and converts risk type labels into fixed-length vector representations. The strategy decision-making agent constructs an N×M output matrix, where N is the number of agents and M is the dimension of each agent's output features. These features include calibrated risk scores, risk type encoding vectors, and key confidence scores in the reasoning base. A Q-value representing the action value is associated with each agent, based on the agent's historical decisions. The cumulative reward calculation for the policy involves using the Q-value as the node attribute input to the graph neural network for each agent. For any two agents, the policy decision agent calculates the Pearson correlation coefficient based on the output score sequence from the previous L requests. This Pearson correlation coefficient is dynamically updated based on a sliding window with a preset length L, ensuring that the correlation reflects the latest collaborative state. Each agent is treated as a node, and its features include the agent's current output risk score, risk type encoding vector, Q-value, and historical average accuracy. An edge structure is established based on the Pearson correlation coefficient between the two agents to construct an agent collaboration graph.
[0030] The constructed agent collaboration graph is input into a graph neural network to perform message passing and node updates. For each agent node, the features of its neighboring nodes are weighted and aggregated using edge weights. The aggregated result is added to the linear transformation of the node's own features and then output through an activation function to obtain the agent's enhanced feature vector. During the message passing process of the graph neural network, nodes... For neighboring nodes Attention coefficients are based on nodes With nodes Feature similarity and nodes The Q-values are jointly determined. The policy decision-making agent extracts the enhanced risk score and the enhanced risk type probability distribution from the enhanced feature vector of each agent. The enhanced score is not a simple weighted sum of the original scores, but rather incorporates the perspectives of the collaborating agents. For example, if the keyword detection agent's original score is 0.9 (high risk), but the semantic understanding agent with high collaborative relationships has an original score of 0.2 (low risk), the message passing of the GNN will appropriately reduce the enhanced score of the keyword agent, reducing overly aggressive or overly cautious judgments by a single agent.
[0031] The strategy decision-making agent invokes the fusion strategy engine to calculate the enhanced risk scores and enhanced risk types of all agents according to the user-configured fusion algorithm, thereby obtaining a preliminary comprehensive risk score. The fusion algorithm includes one or more of the following: maximum value method, weighted average method, attention fusion method, or custom rule engine. The strategy decision-making agent retrieves feedback data related to the current request from the historical feedback memory based on semantic vector similar request search and agent performance tracking. It then invokes the feedback corrector to correct the preliminary comprehensive risk score using the retrieved feedback data, thereby obtaining a corrected comprehensive risk score. The corrector maintains both a global drift term and a local sensitivity term. The global drift term is used to address the overall scoring deviation of the system, while the local sensitivity term is used to address the scoring deviation of specific request types or specific agents. The correction amount is combined through weighted summation. According to the preset risk level mapping rules, the corrected comprehensive risk score is mapped to discrete comprehensive risk levels, including safe, low risk, medium risk, and high risk. The threshold boundary of the mapping rules can be configured by the user or automatically suggested and adjusted by the strategy decision-making agent based on the false positive and false negative distributions in historical feedback data. After the processing flow of the current request is completed, the strategy decision-making agent obtains the actual verification result. Based on the consistency between the score output by each agent and the actual result, the Q value of each agent is updated. If the score output by an agent is consistent with the final verification result, the Q value is increased. The updated Q value is stored in the long-term memory of each agent for graph construction and graph neural network message passing in subsequent requests. The strategy decision-making agent outputs the comprehensive risk level, comprehensive risk score, risk type set, and decision basis summary. The decision basis summary includes the contribution information and correction status of each agent.
[0032] It should be noted that step S5 matches and executes the corresponding response mode based on the comprehensive risk level and risk type, performs fine-grained control over the original user request, and generates a complete chain of decision evidence.
[0033] like Figure 3As shown, the control execution scheduler selects a set of applicable candidate response actions from the policy library based on the comprehensive risk level and risk type set. The policy library stores the mapping rules between (risk level, risk type, context conditions) and response modes. The candidate response actions include normal access, access denied, content modification, guided access, audit logging, delayed response, manual intervention, and adversarial response. Among them, adversarial response includes one or more of the following: harmless noise injection, semantic black hole, honeypot information, attribution obfuscation, and time perturbation. K parallel value decomposition strategies are maintained, each decomposing the value of a response action into different value dimensions. These value dimensions include at least two of the following: security, efficiency, user experience, information gain, and deterrence. The security dimension represents the probability of a response action successfully preventing an attack; the efficiency dimension represents the time cost and computational resource consumption of the response action; the user experience dimension represents the degree of interference the response action causes to normal users; the information gain dimension represents the amount of new attack sample information the response action can bring to the system; and the deterrence dimension represents the inhibitory effect of the response action on the attacker's future behavior. The value decomposition strategies are orthogonal, meaning the correlation coefficient between the value evaluation vectors of any two strategies is below a preset threshold, ensuring that the strategy library can cover multiple independent directions of the value space.
[0034] For each candidate response action, each value decomposition strategy independently outputs a value estimate in the current state, generating a K×|candidate action| value matrix. For each candidate response action, the difference between the value estimates of each strategy is calculated. The difference is calculated using one or more combinations of the range method, standard deviation method, inconsistent pairwise proportional method, or entropy method. The magnitude of the difference reflects the uncertainty of the system's perception of the action's value. The weights of each indicator in the difference metric are dynamically adjusted according to the risk level and risk type of the current request. For example, for low-risk requests, the standard deviation method has a high weight, focusing on overall consistency; for medium-risk requests, the entropy method has a high weight, focusing on the degree of uncertainty. An uncertainty map of the state-action space is constructed, and the request state space (discreteized according to risk score, risk type, user attributes, etc.) is associated with the difference metric. When the difference exceeds a preset threshold, the corresponding state-action pair is marked as an uncertain region, and an exploration reward is obtained based on the indicator factor of the uncertain region. A selection score is calculated for each candidate response action based on the weighted average of the value estimates of each strategy and the exploration reward. , Configuring policy weights for users or learning them for the system. To explore coefficients, For the first Individual value decomposition strategy in state Next, candidate response actions The value estimate, , The uncertainty region indicator factor is a scaling factor; it is 1 when the current state s belongs to the uncertainty region, and 0 otherwise. The candidate response action with the highest selection score is selected as the action to be executed.
[0035] The system provides a user configuration interface, allowing users to define preference rules. These preference rules adopt a partial order relation form, including conditional judgments and corresponding policy weight allocations. User-configurable conditions include one or more of the following: risk scoring threshold, risk type, and user attributes. The preference rules are compiled into a decision tree and dynamically take effect when selecting an action. The control execution scheduler calls the corresponding control execution agent according to the selected action, generates the final LLM response, and returns it to the user. Simultaneously, it generates and stores the evidence chain record for this execution, which includes the value estimate of each policy, the degree of difference, the uncertainty region identifier, the selection score calculation process, the selected action, the actual execution effect, and the policy weight update log.
[0036] It should be noted that after the current request is processed, feedback signals are collected. These feedback signals include one or more of the following: immediate security feedback, user behavior feedback, attack mitigation feedback, and resource consumption feedback. Based on the feedback signals, a credit score is calculated for each value decomposition strategy. The credit score is equal to the initial value plus the sum of the products of each feedback signal multiplied by its corresponding contribution and the learning rate, where the contribution is the degree to which the strategy's value estimate for the selected action exceeds the average level of other strategies.
[0037] Based on the credit score of each strategy, the weights of each value decomposition strategy are updated using a soft maximization rule. Strategies with higher credit scores receive higher weights, and strategies with lower credit scores receive lower weights, with the sum of the weights being 1. During weight updates, if the historical estimate confidence of a strategy is lower than a preset threshold, the weight update magnitude is amplified; if the confidence is higher than the preset threshold, the weight update magnitude is attenuated. After each weight update, the value estimate correlation coefficient matrix between each value decomposition strategy is calculated. When the correlation coefficient exceeds a preset threshold, the value function parameters of any strategy are randomly perturbed to reduce the correlation coefficient below the threshold. Based on the updated strategy weight distribution, the scheduling strategy and decision threshold of the agent scheduler are adjusted synchronously, and the adjusted strategy takes effect in real time for processing subsequent requests.
[0038] like Figure 4 As shown, the second embodiment of the present invention provides an LLM dynamic access control system based on multi-agent cooperation, the system comprising: Request Reception and Preprocessing Module: This module receives natural language requests from users, preprocesses them, identifies user access needs, and generates preprocessed request text. Intelligent agent scheduling and configuration management module: used to store user-configured scheduling policies and coordinate the execution order and triggering conditions of each intelligent agent; Intent recognition agent group: includes multiple dedicated intent recognition agents. These agents have different sets of detection tools and access control permissions. They analyze the request text independently from at least two dimensions, including keyword matching, user intent parsing, attack behavior pattern matching, and resource sensitivity assessment, and output risk scores, risk types, and reasoning basis. Arbitration agent: Activated when the outputs of multiple intent recognition agents conflict, receives the original request text and the outputs of each agent, analyzes the reasoning basis and locates the point of disagreement, and outputs the risk score and risk type after arbitration according to the preset arbitration rules; Strategic decision-making agent: It receives the output of all intent recognition agents and arbitration agents, calculates the comprehensive risk level by combining historical decision feedback data; maintains the value decomposition strategy through the multi-value decomposition preference strategy library, calculates the difference between the value estimates of each strategy, calculates the selection score for candidate response actions and selects the action to be executed. Group of control execution agents: contains multiple dedicated control execution agents, each corresponding to a response mode; Control execution scheduler: Used to invoke the corresponding control execution agent to control access to the LLM based on the selected response mode and the execution strategy configured by the user; Feedback collection and policy evolution module: used to collect feedback signals after execution, calculate the credit score of each value decomposition policy and update the policy weight, and simultaneously adjust the agent scheduling policy and decision threshold. Log module: Used to record the decision-making process and execution results of each agent, and generate a chain of evidence containing the complete decision-making process.
[0039] After system startup, the request receiving and preprocessing module cleans the natural language request input by the user, outputs the preprocessed request text, and transforms the access request into a resource access instruction. The agent scheduling and configuration management module distributes the text to the intent recognition agent group according to a preset strategy. Each dedicated agent in the group independently analyzes the request and outputs a risk score, type, and reasoning basis. If there is a conflict between the outputs of multiple agents, the arbitration agent is activated to resolve the disagreement and output the arbitration result. The strategy decision agent receives all outputs, enhances the agent representation through a graph neural network, calculates the comprehensive risk level, and uses the built-in multi-value decomposition preference strategy library to calculate the selection score for candidate response actions, selecting the highest-scoring action. The control execution scheduler calls the corresponding agent in the control execution agent group according to the selected response action, generates the final response, and returns it to the user. After processing, the feedback collection and strategy evolution module collects execution feedback signals, updates the strategy weights, and synchronously adjusts the scheduling strategy and decision threshold to achieve closed-loop optimization. During the above process, the audit and log module synchronously records the decision-making process and generates an evidence chain. The strategy library and knowledge base provide persistent storage support for rules and parameters for each module.
[0040] The third embodiment of the present invention provides a computer-readable storage medium, which includes a program for a multi-agent cooperative LLM dynamic access control method. When the program for the multi-agent cooperative LLM dynamic access control method is executed by a processor, it implements the steps of the multi-agent cooperative LLM dynamic access control method.
[0041] In the several embodiments provided in this application, it should be understood that the disclosed methods and systems can be implemented in other ways. The system embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple modules or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be indirect coupling or communication connection through some interfaces, devices, or modules, and can be electrical, mechanical, or other forms. Furthermore, in the various embodiments of the present invention, all functional modules can be integrated into one processing module, or each module can be a separate module, or two or more modules can be integrated into one module; the integrated modules can be implemented in hardware or in the form of hardware plus software functional modules.
[0042] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0043] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A multi-agent collaboration-based LLM dynamic access control method, characterized in that, Includes the following steps: Step S1: Receive the natural language request input by the user, preprocess it, identify the user's access needs, and generate the preprocessed request text; Step S2: Distribute the preprocessed request text to multiple intent recognition agents. Each agent independently analyzes the request text. The multiple intent recognition agents have different sets of detection tools and access control permission perspectives. They assess the user's access request permission risk from at least two dimensions, including keyword matching, user intent parsing, attack behavior pattern matching, and resource sensitivity assessment, and output risk scores, risk types, and reasoning basis. Step S3: When there is a conflict in the output results of different agents, the arbitration agent is activated to analyze the conflict. Based on the request text and the reasoning basis of the conflicting agents, the divergence point is located, and the risk score and risk type after arbitration are output. Step S4: The strategy decision-making agent receives the risk scores and types output by each agent, and calculates the comprehensive risk level of the request text by combining it with historical decision feedback data; Step S5: Based on the comprehensive risk level and the risk type of the request text, match the corresponding response mode, perform LLM access control on the original user request, and generate a chain of evidence. Step S6: Based on the feedback results after execution, automatically adjust the agent's scheduling strategy, fusion rules, or decision threshold. The adjusted strategy takes effect in real time for processing subsequent requests.
2. The LLM dynamic access control method based on multi-agent collaboration according to claim 1, characterized in that, Step S2 specifically includes: The agent scheduler distributes the preprocessed request text to multiple enabled intent recognition agents according to a preset scheduling strategy. The distribution method includes parallel distribution, serial distribution or condition-triggered distribution. Before distribution, the scheduler performs lightweight semantic pre-classification on the request text to identify whether there are imperative verbs, sensitive entities or typical injection sentences in the request text. Based on the pre-classification results, the scheduler finds the corresponding priority activation agent and calling order from the preset agent priority mapping table and performs distribution according to the calling order. After receiving the request text, each intent recognition agent calls the detection tool to extract attack features from the request text. Each agent internally calls at least two heterogeneous detection tools and cross-validates the outputs of each tool. Each agent outputs a risk score based on the extracted features, and maintains a sliding window of preset short-term historical request scores within each agent. If the difference between the current score and the historical baseline exceeds a preset threshold, the bias term of the score mapping function is subtracted from the difference. Each agent outputs at least one risk type label, as well as reasoning basis including the trigger feature location, the matched attack pattern identifier, and the key confidence score.
3. The LLM dynamic access control method based on multi-agent collaboration according to claim 2, characterized in that, The intent recognition agent includes at least two of the following types: The keyword detection agent, based on a dynamically updated sensitive word library and adversarial sample variant library, performs multi-pattern matching on the request text to identify preset sensitive words and variants; The user access intent recognition intelligent agent, based on a semantic parsing model, parses the user's natural language request into the target resource access intent, transforms it into structured resource access instructions, and identifies the user's true access purpose; The behavior pattern recognition agent matches the request text with a classic attack pattern feature library to detect whether there are role-playing injection, command hijacking, jailbreak prefix or adversarial prompt word attack patterns. The module intent identifies intelligent agents and performs fine-grained permission assessment on access requests to specific resource modules, data domains, or functional units to determine whether the user has permission to access the specific module.
4. The LLM dynamic access control method based on multi-agent collaboration according to claim 1, characterized in that, Step S3 specifically includes: The agent scheduler collects risk scores, risk types, and reasoning bases from all intent-recognition agents. When the difference or mutual exclusion between the outputs of different agents exceeds a preset threshold, the arbitration agent is activated, and the type of conflict that needs to be arbitrated is determined. The arbitration agent receives the original request text, the outputs of all agents, and the conflict type identifier, and calls an external consistency verification tool to perform an independent check on the request text. Analyze the reasoning basis of each agent and locate the points of divergence in the reasoning basis; Based on the preset arbitration model, output the risk score and risk type after arbitration; The output includes an arbitration statement that explains the reasons for the disagreement and the basis for the arbitration.
5. The LLM dynamic access control method based on multi-agent collaboration according to claim 1, characterized in that, Step S4 specifically includes: The strategy decision-making agent receives risk scores, risk types, and reasoning bases from all intent recognition agents and arbitration agents. It then standardizes the received risk scores and converts the risk type labels into fixed-length vector representations. The policy decision-making agent constructs an N×M output matrix, where N is the number of agents and M is the dimension of the output features of each agent. The features include the calibrated risk score, risk type encoding vector, and key confidence score in the reasoning basis, and are associated with the Q value representing the action value for each agent. For any two agents, the policy decision agent calculates the Pearson correlation coefficient based on the output rating sequence in the historical L requests. The Pearson correlation coefficient is dynamically updated based on a sliding window, and the sliding window length L is a preset value. Each agent is a node, and the node features include the agent's current output risk score, risk type encoding vector, Q value, and historical average accuracy. An edge structure is established based on the Pearson correlation coefficient between two agents. The completed agent collaboration graph is input into the graph neural network to perform message passing and node updates, and to obtain the enhanced feature vectors of the agents. The policy decision-making agent extracts the enhanced risk score and the enhanced risk type probability distribution from the enhanced feature vector of each agent.
6. The LLM dynamic access control method based on multi-agent cooperation according to claim 5, characterized in that, Step S4 further includes: The strategy decision-making agent calls the fusion strategy engine to calculate the enhanced risk scores and enhanced risk types of all agents and obtain a preliminary comprehensive risk score. The policy decision-making agent retrieves feedback data related to the current request from the historical feedback memory based on semantic vector similar request search and agent performance tracking. The feedback corrector is invoked to correct the preliminary comprehensive risk score using the retrieved feedback data, thereby obtaining the corrected comprehensive risk score. According to the preset risk level mapping rules, the corrected comprehensive risk score is mapped to discrete comprehensive risk levels, including safe, low risk, medium risk and high risk. After the current request processing flow is completed, the policy decision agent obtains the actual verification result and updates the Q value of each agent based on the consistency between the score output by each agent and the actual result.
7. The LLM dynamic access control method based on multi-agent collaboration according to claim 1, characterized in that, Step S5 specifically includes: The control execution scheduler selects a set of applicable candidate response actions from the policy library based on the comprehensive risk level and risk type set. The candidate response actions include normal access, access denial, content modification, guided access, audit logging, delayed response, manual intervention, and adversarial response. Maintain K parallel value decomposition strategies, each of which decomposes the value of a response action into different value dimensions, including at least two of the following: security dimension, efficiency dimension, user experience dimension, information gain dimension, and deterrence dimension. For each candidate response action, each value decomposition strategy independently outputs a value estimate in the current state, generating K parallel value matrices corresponding to the value decomposition strategies; For each candidate response action, calculate the difference between the value estimates of each strategy, and dynamically adjust the weight of each indicator in the difference measurement according to the risk level and risk type of the current request. Construct an uncertain map of the state-action space. When the difference exceeds a preset threshold, mark the corresponding state-action pair as an uncertain region and obtain exploration rewards based on the indicator factors of the uncertain region. A selection score is calculated for each candidate response action based on the weighted average of the value estimates of each strategy and the exploration reward. The candidate response action with the highest selection score is then selected as the action to be executed. The control execution scheduler calls the corresponding control execution agent according to the selected execution action, generates the final LLM response, and returns it to the user; Simultaneously, an evidence chain record for this execution is generated and stored. The evidence chain includes the value estimate of each strategy, the degree of difference, the identification of uncertain areas, the selection score calculation process, the selected action, the actual execution effect, and the strategy weight update log.
8. The LLM dynamic access control method based on multi-agent collaboration according to claim 1, characterized in that, Step S6 specifically includes: After the current request is processed, a feedback signal is collected, and a credit score for each value decomposition strategy is calculated based on the feedback signal. Based on the credit score of each strategy, the weights of each value decomposition strategy are updated using the soft maximization rule; After each weight update, the value estimation correlation coefficient matrix between each value decomposition strategy is calculated. When the correlation coefficient exceeds a preset threshold, the value function parameters of any strategy are randomly perturbed. Based on the updated policy weight distribution, the scheduling policy and decision threshold of the agent scheduler are adjusted synchronously, and the adjusted policy takes effect in real time for processing subsequent requests.
9. A multi-agent collaborative LLM dynamic access control system, characterized in that, For implementing the LLM dynamic access control method based on multi-agent cooperation as described in any one of claims 1-8, the system comprises: Request Reception and Preprocessing Module: This module receives natural language requests from users, preprocesses them, identifies user access needs, and generates preprocessed request text. Intelligent agent scheduling and configuration management module: used to store user-configured scheduling policies and coordinate the execution order and triggering conditions of each intelligent agent; Intent recognition agent group: includes multiple dedicated intent recognition agents. These agents have different sets of detection tools and access control permissions. They analyze the request text independently from at least two dimensions, including keyword matching, user intent parsing, attack behavior pattern matching, and resource sensitivity assessment, and output risk scores, risk types, and reasoning basis. Arbitration agent: Activated when the outputs of multiple intent recognition agents conflict, receives the original request text and the outputs of each agent, analyzes the reasoning basis and locates the point of disagreement, and outputs the risk score and risk type after arbitration according to the preset arbitration rules; Strategic decision-making agent: It receives the output of all intent recognition agents and arbitration agents, calculates the comprehensive risk level by combining historical decision feedback data; maintains the value decomposition strategy through the multi-value decomposition preference strategy library, calculates the difference between the value estimates of each strategy, calculates the selection score for candidate response actions and selects the action to be executed. Group of control execution agents: contains multiple dedicated control execution agents, each corresponding to a response mode; Control execution scheduler: Used to invoke the corresponding control execution agent to control access to the LLM based on the selected response mode and the execution strategy configured by the user; Feedback collection and policy evolution module: used to collect feedback signals after execution, calculate the credit score of each value decomposition policy and update the policy weight, and simultaneously adjust the agent scheduling policy and decision threshold. Log module: Used to record the decision-making process and execution results of each agent, and generate a chain of evidence containing the complete decision-making process.
