Block chain-based large language model agent abnormal behavior tracing method

By defining behavioral constraint strategies and generating behavioral proof chains in large language model agents using blockchain technology, and combining differential privacy and zero-knowledge proofs, the problem of dynamic behavior recording and attack tracing of agents is solved. This achieves transparent recording of agent behavior and cross-chain collaborative defense, thereby improving the security and trustworthiness of the system.

CN121786818APending Publication Date: 2026-04-03ZHEJIANG UNIV BINJIANG RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-11
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing technologies struggle to record and analyze the dynamic behavioral characteristics of large language model agents globally, cannot effectively identify implicit attack paths across toolchains, lack a mechanism for attributing behavioral responsibility, and traditional jailbreak testing is resource-intensive and unsuitable for large-scale deployment.

Method used

By defining behavioral constraint strategies through blockchain smart contracts, combining differential privacy and zero-knowledge proofs to generate behavioral commitments and consistency proofs, a behavioral proof chain is constructed. Multi-dimensional anomaly detection is integrated to build an attack propagation graph and achieve cross-chain collaborative defense.

Benefits of technology

It enables transparent recording and trusted auditing of intelligent agent behavior, improves the ability to identify complex attacks, quickly traces the source of attacks and performs cross-chain collaborative defense, and is suitable for financial, medical and government scenarios with high security requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121786818A_ABST
    Figure CN121786818A_ABST
Patent Text Reader

Abstract

The invention discloses a block chain-based large language model agent abnormal behavior tracing method. The method comprises the steps of defining a constraint strategy for an agent based on a block chain smart contract; generating a behavior commitment according to the execution data of the agent; using zero knowledge proof to generate behavior consistency proof for each walking state of the intelligent agent, and writing the behavior commitment and the behavior consistency proof of each step into a block chain to generate a behavior proof chain; comprehensively calculating a semantic evolution anomaly index, a behavior state deviation index and a tool calling time sequence anomaly index to obtain a comprehensive anomaly score, and performing agent behavior anomaly detection; according to the behavior proof chain, constructing an attack propagation atlas which takes the intelligent agent as a node and takes an abnormal influence propagation relationship as an edge; and based on an anomaly detection result and an attack propagation atlas, tracing and controlling an abnormal agent, and realizing cooperative defense through a cross-chain protocol. According to the method, the behavior credibility, the operation safety and the overall supervision of the large language model agent collaborative system can be remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the interdisciplinary field of artificial intelligence security and blockchain trusted computing, specifically involving a method for tracing the abnormal behavior of a large language model intelligent agent based on blockchain. Background Technology

[0002] As Large Language Models (LLMs) demonstrate their powerful capabilities in tasks such as dialogue generation, agent collaboration, and multimodal interaction, LLM-based automated agent systems are increasingly being widely applied in complex scenarios such as search and question answering, task execution, process control, and data analysis. These LLM agents significantly improve task automation by building long-term memory through multi-turn interactions, autonomously invoking tools, and making dynamic decisions. However, the complex behavioral chains of LLM agents also introduce new security vulnerabilities: attackers can induce agents to output content that violates alignment rules through methods such as hint injection, contextual interference, or instruction hijacking, forming a "jailbreak" attack, or even triggering uncontrollable chain reactions.

[0003] To mitigate these risks, researchers have conducted extensive studies on the security of LLMs in recent years, proposing alignment mechanisms such as RLHF (Reinforcement Learning Based on Human Feedback), adversarial training, rejection filtering, and behavior auditing to constrain model behavior and filter potentially harmful outputs. However, due to the agent's autonomous planning and multi-step tool invocation capabilities, traditional static alignment methods struggle to capture abnormal patterns in its dynamic behavior. This allows attackers to bypass these mechanisms through carefully crafted system prompts, plugin abuse, or hidden instruction chains, rendering the alignment mechanisms ineffective and leading to serious consequences such as unauthorized system operations, information leaks, and even the propagation of attack chains.

[0004] In this context, defense strategies that only focus on model output are insufficient, and there is an urgent need for a systematic, verifiable, and traceable defense mechanism to track and analyze the intent and path behind each decision made by the agent at the behavioral level. In this process, blockchain technology, with its characteristics of "immutability, end-to-end recording, and consensus verification," offers new technological possibilities for tracing the origins of agent behavior, verifying security alignment, and detecting attacks.

[0005] Current technologies face the following challenges: 1. Lack of global recording and analysis capabilities for agent behavior chains. Existing methods mostly focus on static single-round response detection, making it difficult to identify dynamic behavioral characteristics of agents gradually deviating from the safety boundary in continuous multi-step tasks.

[0006] 2. Inability to effectively identify cross-toolchain instruction hijacking and covert attack paths. Attackers can use chained calls or plugin instructions to hide harmful behaviors, allowing them to bypass shallow alignment rules. Existing methods struggle to accurately pinpoint risk nodes.

[0007] 3. Lack of behavior replay and accountability mechanisms. When errors occur in large-scale model systems during complex interactions, it is difficult to trace the source back to the specific agent or interaction location, lacking an on-chain verifiable mechanism for tracing behavioral responsibility.

[0008] 4. Lack of low-overhead behavioral risk measurement methods at the agent level. Traditional jailbreak testing often requires constructing a large number of adversarial examples or conducting costly fine-tuning training, which is resource-intensive and inefficient, and is not suitable for continuous security assessment of large-scale deployed models.

[0009] Therefore, how to construct a defense and assessment framework that can support the full-process recording of agent behavior, quantify the judgment of behavioral risks, and execute local security countermeasures has become an important direction for current LLM security research. Summary of the Invention

[0010] In view of the above, the purpose of this invention is to provide a method for tracing the abnormal behavior of intelligent agents based on a large language model in blockchain. Through behavior commitment, zero-knowledge proof of behavior consistency, behavior state evolution modeling and cross-chain collaborative defense, it realizes transparent execution of intelligent agent behavior, verifiable auditing and visual attack tracing.

[0011] To achieve the above-mentioned objectives, the present invention provides the following technical solution: In a first aspect, the present invention provides a method for tracing the abnormal behavior of a large language model intelligent agent based on blockchain, comprising the following steps: Based on blockchain smart contracts, on-chain constraint policies are defined for multiple collaborative smart agents to constrain their execution process. The agent calculates the next action state based on the current walking state, privacy input, and tool invocation, and then generates a action commitment based on the next action state, privacy input, and tool invocation. Zero-knowledge proofs are used to generate behavioral consistency proofs for the calculation of the action state of the intelligent agent at each step, and the action commitment and behavioral consistency proof at each step are written into the blockchain to generate a behavioral proof chain; A comprehensive anomaly score is obtained by comprehensively calculating semantic evolution anomaly index, behavioral state deviation index and tool call timing anomaly index, which is used to detect anomalies in the behavior of the intelligent agent. Based on the behavior proof chain recorded on the blockchain, an attack propagation graph is constructed with intelligent agents as nodes and abnormal influence propagation relationships as edges. Based on anomaly detection results and attack propagation graphs, the abnormal intelligent agents are traced and their execution permissions are controlled. Evidence is synchronized to other chains or nodes through cross-chain protocols to achieve collaborative defense.

[0012] Preferably, the blockchain-based smart contract defines on-chain constraint policies for multiple collaborative agents to constrain their execution processes, including: Based on the constructed multi-agent collaborative execution framework, the behavioral boundaries of each agent are constrained by blockchain smart contracts using formal strategies. This includes constraining their reasoning behavior, calling tools, and interacting objects, resulting in corresponding behavior sets, tool sets, and interaction sets. Furthermore, the maximum depth constraint of the reasoning chain is defined to ensure that all actions of the agents are constrained on-chain before execution.

[0013] Preferably, the step of calculating the next action state based on the agent's current walking state, privacy input, and tool invocation, and then generating a action commitment based on the next action state, privacy input, and tool invocation, includes: Differential privacy mechanism is used to control the input of the intelligent agent. Perturbation protection ensures privacy of input. Based on the agent's current walking state, privacy-preserving input, and the tools invoked, the next action state is calculated. : , in, This indicates that the agent is at time step The internal behavioral state, This indicates that the agent is at time step Privacy-preserving input prompts received from users or upstream intelligent agents This indicates that the agent is at time step The identifier of the external tool being invoked. Represents a verifiable mechanism function; Based on the obtained next action status Privacy-protected input and tool call identifier Perform concatenation operations to generate corresponding behavioral commitments. : , in, This represents the commitment function.

[0014] Preferably, the step of using zero-knowledge proofs to generate behavioral consistency proofs for each step of the agent's behavioral state calculation, and writing the behavioral commitment and behavioral consistency proof for each step into the blockchain to generate a behavioral proof chain, includes: Constructing a behavior consistency proof based on zero-knowledge proof ,satisfy: , in, A zero-knowledge proof verification algorithm is defined if and only if there exists an internal witness that can prove the behavior mechanism function. Output the value when the given input is valid and the behavior policy constraints are not violated. The value is verified without disclosing the internal behavioral state or the complete reasoning chain. This will then lead to a commitment to each step of the action. and proof of behavioral consistency Write the data into the blockchain in chronological order to generate an immutable chain of proofs of behavior. : , in, This indicates the total number of time steps in the current session.

[0015] Preferably, the comprehensive calculation of semantic evolution anomaly indicators, behavioral state shift indicators, and tool call timing anomaly indicators to obtain a comprehensive anomaly score is used for anomaly detection of the agent's behavior, including: Based on semantic evolution anomaly indicators Behavioral state deviation index and tool call timing anomaly indicators Calculate time steps Comprehensive abnormality score : , in, , and Indicates non-negative weighting coefficients; Semantic Evolution Anomaly Indicators The formula is: , in, Indicates time step Semantic embedding vector representation; The L2 norm is used to measure the magnitude of semantic space changes between adjacent time steps. Behavioral state offset index The formula is: , in, This indicates that the agent is at time step behavioral state, This represents the historical baseline state of the agent, which is a behavioral baseline state vector obtained from statistics of historical normal conversations. The preset vector norm is used to measure the degree of deviation of the current state from the baseline; Tool call timing anomaly indicators The formula is: , in, The conditional probability estimated based on historical normal behavior data represents the invocation of the tool at the previous time step. Compared with the current state Call tools The normality of.

[0016] Preferably, the step of constructing an attack propagation graph with intelligent agents as nodes and anomaly impact propagation relationships as edges based on the behavior proof chain recorded on the blockchain includes: Based on the temporal order and content characteristics of the interactions between agents recorded in the behavioral proof chain, the propagation direction of the anomaly in the agent network is inferred, and a directed graph with agents as nodes and the anomaly influence propagation relationship as edges is constructed as the attack propagation graph. In the attack propagation graph, the propagation entropy metric obtained from the message sequence and anomaly marker statistics transmitted between agents is used to calculate the propagation uncertainty or strength of the anomaly impact on each edge, and this entropy metric is used as the propagation weight of the corresponding edge.

[0017] Preferably, the step of tracing the source of the abnormal intelligent agent and controlling its execution permissions based on the anomaly detection results and attack propagation graph, and synchronizing evidence to other chains or nodes through cross-chain protocols to achieve collaborative defense, includes: When the overall anomaly score exceeds the preset threshold, the source agent and propagation path of the abnormal behavior are located based on the attack propagation map, and control measures, including permission downgrading, call restriction or forced isolation, are implemented on the relevant agents. By calculating cross-chain state proofs related to the behavior proof chain through cross-chain protocols, and synchronizing these cross-chain state proofs to other blockchain networks or defense nodes, the target chain or node can verify and adopt the abnormal evidence without having to completely copy the original chain data, thus achieving cross-chain collaborative defense.

[0018] Secondly, embodiments of the present invention also provide a blockchain-based large language model intelligent agent abnormal behavior tracing device, which is implemented using the above-mentioned blockchain-based large language model intelligent agent abnormal behavior tracing method, including: a multi-agent collaborative execution management module, a behavior state modeling and behavior commitment generation module, a zero-knowledge proof and behavior proof chain storage module, an intelligent agent behavior anomaly detection module, an attack propagation graph construction module, and a permission management and cross-chain collaborative defense module. The multi-agent collaborative execution management module is used to define on-chain constraint policies for multiple collaborative agents based on blockchain smart contracts, so as to constrain the execution process of the agents. The behavior state modeling and behavior commitment generation module is used to calculate the current walking state based on the agent's previous behavior state, privacy input, and tool invocation, and then generate a behavior commitment based on the current walking state, privacy input, and tool invocation. The zero-knowledge proof and behavior proof chain storage module is used to generate a behavior consistency proof for the calculation of the action state of the agent at each step using zero-knowledge proof, and writes the behavior commitment and behavior consistency proof of each step into the blockchain to generate a behavior proof chain. The agent behavior anomaly detection module is used to comprehensively calculate semantic evolution anomaly index, behavior state deviation index and tool call timing anomaly index to obtain a comprehensive anomaly score, which is used to detect anomalies in the agent's behavior. The attack propagation graph construction module is used to construct an attack propagation graph with intelligent agents as nodes and abnormal influence propagation relationships as edges, based on the behavior proof chain recorded on the blockchain. The permission management and cross-chain collaborative defense module is used to trace abnormal intelligent agents and perform permission control on them based on anomaly detection results and attack propagation graphs, and to synchronize evidence to other links or nodes through cross-chain protocols to achieve collaborative defense.

[0019] Thirdly, embodiments of the present invention also provide an electronic device, including a memory and one or more processors, wherein the memory is used to store a computer program, and the processor is used to implement the above-described method for tracing abnormal behavior of a large language model intelligent agent based on blockchain when executing the computer program.

[0020] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a computer, implements the above-described method for tracing the abnormal behavior of a large language model intelligent agent based on blockchain.

[0021] Compared with the prior art, the beneficial effects of the present invention include at least the following: (1) This invention encapsulates each step of the agent's state update into a behavior commitment and uses zero-knowledge proof to generate a behavior consistency proof, forming a complete, continuous and tamper-proof behavior proof chain on the blockchain. This provides reliable evidence that can be publicly verified and audited after the fact for the entire execution process of the agent, strengthens the transparency and credibility of behavior, and realizes the tamper-proof recording and distributed auditing of the agent's behavior.

[0022] (2) The present invention uses a differential privacy mechanism to desensitize the original input, so that the data stored and verified on the chain does not contain recoverable sensitive information; at the same time, combined with zero-knowledge proof technology, it can effectively verify the compliance of behavior without disclosing any internal state and detailed reasoning process, thus achieving the unity of privacy protection and trusted verification.

[0023] (3) By integrating semantic evolution anomaly indicators, behavioral state deviation indicators and tool call timing anomaly indicators, this invention constructs a multi-dimensional comprehensive anomaly scoring mechanism, which can detect novel attacks such as prompt injection, unauthorized calls and chain infection, and improve the system's fine-grained identification ability for complex and covert attacks.

[0024] (4) The present invention is based on a blockchain-based behavioral proof chain, which can construct an attack propagation graph with intelligent agents as nodes and abnormal propagation relationships as edges. At the same time, it introduces the intelligent agent propagation entropy index to quantify the influence weight on the propagation path. This enables security analysts to quickly locate the source of the attack, clearly depict the infection path and assess the scope of the impact, and realize path analysis and visual tracing of new AI attacks such as prompt injection, tool misleading and cross-Agent chain infection.

[0025] (5) This invention uses a lightweight cross-chain state proof protocol to securely and efficiently synchronize the abnormal behavior evidence identified by this chain to other associated blockchains or defense nodes, so that abnormal intelligent agents and their behavioral evidence can be identified and isolated in a wider collaborative network. It is particularly suitable for high security requirements scenarios such as finance, medical care, and government affairs that require multi-agency collaborative supervision.

[0026] In summary, this invention, through the organic combination of technologies such as blockchain notarization, zero-knowledge proof, differential privacy, multi-dimensional anomaly detection, and cross-chain collaboration, enables the attack propagation path of LLM intelligent agent networks to be quantified, traceable, and located. It solves the problem that traditional data-driven defense technologies cannot identify chain-like behavioral manipulation, and significantly improves the behavioral credibility, operational security, and overall regulatory oversight of large language model intelligent agent collaborative systems. Attached Figure Description

[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art 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 based on these drawings without creative effort.

[0028] Figure 1 This is a flowchart illustrating the method for tracing the abnormal behavior of a large language model intelligent agent based on blockchain, as provided in an embodiment of the present invention. Figure 2 This is a schematic diagram of the structure of the blockchain-based large language model intelligent agent abnormal behavior tracing device provided in an embodiment of the present invention. Detailed Implementation

[0029] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the scope of protection of this invention.

[0030] The inventive concept of this invention is as follows: Addressing the problems of opaque behavior chains in existing large language model intelligent agents, difficulty in auditing in distributed multi-agent environments, and the inability of traditional defense mechanisms to effectively detect and trace hidden injection prompts, unauthorized tool calls, and cross-agent chain infection attacks, this invention provides a blockchain-based method for tracing abnormal behavior of large language model intelligent agents. This method predefines and constrains the behavioral boundaries of each agent on the blockchain through smart contracts. During local execution, differential privacy and zero-knowledge proof technologies are integrated to generate privacy-protected and verifiable behavioral commitments and proofs for each state update, which are then written into the blockchain to form an immutable behavioral proof chain. Furthermore, based on this on-chain record, anomaly detection is performed using a multi-dimensional model of semantic evolution, behavioral offset, and tool call timing, and an attack propagation graph is constructed to achieve visualized tracing of the anomaly source and path. Finally, based on the tracing results, access control is implemented for the abnormal agents, and evidence is synchronized through a cross-chain protocol to achieve collaborative defense. This systematically improves the transparency, auditability, and proactive security protection capabilities of multi-agent systems while protecting user privacy.

[0031] like Figure 1 As shown in the embodiment, a method for tracing the abnormal behavior of a large language model intelligent agent based on blockchain is provided, including the following steps: S1 defines on-chain constraint policies for multiple collaborative smart agents based on blockchain smart contracts, thereby constraining the execution process of the smart agents.

[0032] In this embodiment, a multi-agent cooperative execution framework is first constructed. The multi-agent system includes... A smart agent The system first assigns each intelligent agent... Define executable reasoning behaviors, calling tools, and interaction objects on the blockchain to obtain the corresponding set of behaviors. Toolset and interactive collection The strategy is solidified by smart contracts in the form of on-chain policies: , , , Additionally, the smart contract includes a constraint defining the maximum depth of the inference chain. In addition, there is a behavior legality verification logic. This constraint strategy ensures that all behaviors can be constrained on the chain before execution, so that all intelligent agent operations are executed within the verifiable permission range, avoiding unauthorized calls and malicious expansion of permissions.

[0033] S2 calculates the next action state based on the agent's current walking state, privacy input, and tool invocation, and then generates a action commitment based on the next action state, privacy input, and tool invocation.

[0034] In this embodiment, to protect user privacy, the initial prompts input by the intelligent agent are first processed. Perturbation protection is achieved using a differential privacy mechanism: , in, Indicates privacy input. This indicates a randomization mechanism that satisfies differential privacy. This indicates the privacy budget parameter.

[0035] Specifically, the differential privacy mechanism preferably adopts the Laplace mechanism: , in, This indicates a mean of 0 and a scale parameter of . Laplace distributed random variable, This indicates the global sensitivity of the corresponding sensitive function. This strategy ensures that on-chain behavior commitments do not disclose sensitive user information.

[0036] During the execution of the agent, a behavior state vector is constructed for each Prompt parsing, inference chain generation, and tool invocation event. This includes: (1) the current semantic embedding (2) Depth of the reasoning chain (3) Current context summary; (4) Tool call features; (5) Serialization internal state summary.

[0037] Define the state update process using a Verifiable Behavior Mechanism Function (VBMF): , in, This indicates that the agent is at time step. The internal behavioral state, This indicates that the agent is at time step The internal behavioral state, This indicates that the agent is at time step Privacy-preserving input prompts received from users or upstream intelligent agents This indicates that the agent is at time step The identifier of the external tool being invoked. This represents a verifiable mechanism function.

[0038] Verifiable behavioral mechanism function Satisfy the constraint consistency condition: , in, Denotes the set of all legal behavior mechanism functions. Indicates at time step The specific types of actions taken, Indicates at time step The tools used Indicates the depth of the current inference chain. This is the preset maximum inference depth threshold.

[0039] Furthermore, a behavioral commitment is constructed based on this behavioral mechanism function. : , in, This represents the commitment function.

[0040] Specifically, the commitment function preferably employs a cryptographically secure hash function. This generates irreversible, verifiable on-chain behavior records. , in, This indicates a serial operation.

[0041] S3 uses zero-knowledge proofs to generate behavioral consistency proofs for the calculation of the action state of the agent at each step, and writes the action commitment and behavioral consistency proof of each step into the blockchain to generate a behavioral proof chain.

[0042] In this embodiment, a Behavior Consistency Proof (BCP) is constructed to prove that the behavior mechanism function is consistent across the behavior set. Toolset and interactive collection The execution was legal under constraints, and no injection prompts, unauthorized calls, or covert manipulations occurred.

[0043] Constructing a behavior consistency proof based on zero-knowledge proof And provide a verification algorithm: , in, A zero-knowledge proof verification algorithm is defined if and only if there exists an internal witness that can prove the behavior mechanism function. Output the value when the given input is valid and the behavior policy constraints are not violated. Furthermore, the verification process does not require disclosure of internal behavioral status. And the complete reasoning chain.

[0044] This will then lead to a commitment to each step of the action. and proof of behavioral consistency Write the data into the blockchain in chronological order to generate an immutable chain of proofs of behavior. : , in, This represents the total number of time steps in the current session. This chain ensures that all agent behaviors are immutable and replayable.

[0045] S4 calculates a comprehensive anomaly score by combining semantic evolution anomaly index, behavioral state deviation index, and tool call timing anomaly index, which is used to detect anomalies in the agent's behavior.

[0046] In the example, a comprehensive anomaly score is constructed based on three types of indicators.

[0047] (1) Semantic evolution anomaly index : , in, Indicates time step Semantic embedding vector representation; The L2 norm is used to measure the magnitude of semantic space changes between adjacent time steps. If a semantic mutation exceeds the threshold, it may indicate injection or out-of-bounds semantic manipulation.

[0048] (2) Behavioral state deviation index : , in, This indicates that the agent is at time step behavioral state, This represents the historical baseline state of the agent, which is a behavioral baseline state vector obtained from statistics of historical normal conversations. The preset vector norm is used to measure the degree of deviation of the current state relative to the baseline.

[0049] (3) Tool call timing anomaly indicators : , in, The conditional probability estimated based on historical normal behavior data represents the invocation of the tool at the previous time step. Compared with the current state Call tools The normality of.

[0050] Finally, the comprehensive anomaly score Represented as: , in, , and This represents the non-negative weighting coefficient. When... If the threshold is exceeded, it is considered abnormal behavior.

[0051] S5 constructs an attack propagation graph with intelligent agents as nodes and abnormal influence propagation relationships as edges, based on the behavior proof chain recorded on the blockchain.

[0052] In this embodiment, based on the temporal order and content characteristics of the interactions between agents recorded in the behavioral proof chain, the propagation direction of the anomaly in the agent network is inferred, and a directed graph with agents as nodes and the anomaly impact propagation relationship as edges is constructed as the attack propagation graph. : , in, Represents a set of agent nodes. This represents a set of abnormal propagation paths. The attack propagation graph supports visualization of the source, path, and affected nodes.

[0053] In the attack propagation graph, based on the propagation entropy metric obtained from the message sequence and anomaly marker statistics passed between agents, the propagation uncertainty or strength of the anomaly's impact on each edge is calculated, and this entropy metric value is used as the propagation weight of the corresponding edge. : , in, Indicates based on intelligent agent Transmitted to the intelligent agent The propagation entropy metric, obtained from the message sequence and anomaly marker statistics, is used to quantify the diffusion intensity of potentially infectious cues in agent networks.

[0054] S6, based on anomaly detection results and attack propagation graphs, traces the source of abnormal intelligent agents and controls their execution permissions, and synchronizes evidence to other chains or nodes through cross-chain protocols to achieve collaborative defense.

[0055] In this embodiment, when the comprehensive anomaly score exceeds a preset threshold, the source agent and propagation path of the abnormal behavior are located based on the attack propagation map, and control measures, including permission downgrading, call restriction or forced isolation, are implemented on the relevant agent.

[0056] Simultaneously, cross-chain state proofs related to the behavior proof chain are calculated through cross-chain protocols: , in, This indicates a cross-chain verification algorithm. Representation and Behavior Proof Chain The relevant cross-chain state proof, when the verification result is This means that other blockchains or nodes can verify the authenticity and completeness of evidence of abnormal behavior without having to completely copy the original chain data.

[0057] By synchronizing cross-chain state proofs to other blockchain networks or defense nodes, the target chain or node can verify and adopt the abnormal evidence without having to completely copy the original chain's data, thus achieving cross-chain collaborative defense.

[0058] In summary, the blockchain-based method for tracing abnormal behavior of large language model intelligent agents provided in this invention can achieve transparent execution, verifiable auditing, and attack tracing of large language model multi-agent systems without exposing sensitive user information. It effectively defends against functionally disabling attacks such as injection of hints, unauthorized tool calls, and chain propagation, and significantly improves the credibility and security of intelligent agents in key areas such as finance, healthcare, and government affairs.

[0059] Based on the same inventive concept, this invention also provides a blockchain-based large language model intelligent agent abnormal behavior tracing device 200, including: a multi-agent collaborative execution management module 210, a behavior state modeling and behavior commitment generation module 220, a zero-knowledge proof and behavior proof chain storage module 230, an intelligent agent behavior abnormal detection module 240, an attack propagation graph construction module 250, and a permission management and cross-chain collaborative defense module 260.

[0060] The multi-agent collaborative execution management module 210 is used to define on-chain constraint policies for multiple collaborative agents based on blockchain smart contracts, so as to constrain the execution process of the agents.

[0061] The behavior state modeling and behavior commitment generation module 220 is used to calculate the current walking state based on the agent's previous behavior state, privacy input, and tool invocation, and then generate a behavior commitment based on the current walking state, privacy input, and tool invocation.

[0062] The zero-knowledge proof and behavior proof chain storage module 230 is used to generate behavior consistency proofs for the calculation of the behavior state of the intelligent agent at each step using zero-knowledge proofs, and writes the behavior commitment and behavior consistency proof of each step into the blockchain to generate a behavior proof chain.

[0063] The agent behavior anomaly detection module 240 is used to comprehensively calculate semantic evolution anomaly indicators, behavior state deviation indicators and tool call timing anomaly indicators to obtain a comprehensive anomaly score, which is used to detect anomalies in the agent's behavior.

[0064] The attack propagation graph construction module 250 is used to construct an attack propagation graph with intelligent agents as nodes and abnormal influence propagation relationships as edges, based on the behavior proof chain recorded on the blockchain.

[0065] The permission management and cross-chain collaborative defense module 260 is used to trace abnormal intelligent agents and perform permission control on them based on anomaly detection results and attack propagation graphs, and to synchronize evidence to other links or nodes through cross-chain protocols to achieve collaborative defense.

[0066] Based on the same inventive concept, embodiments of the present invention also provide an electronic device, including a memory and one or more processors, wherein the memory is used to store a computer program, and the processor is used to implement the above-described method for tracing abnormal behavior of a blockchain-based large language model intelligent agent when executing the computer program.

[0067] Based on the same inventive concept, this embodiment of the invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a computer, the above-mentioned method for tracing abnormal behavior of a large language model intelligent agent based on blockchain is implemented.

[0068] It should be noted that the blockchain-based large language model intelligent agent abnormal behavior tracing device, electronic device, and computer-readable storage medium provided in the above embodiments all belong to the same inventive concept as the blockchain-based large language model intelligent agent abnormal behavior tracing method. For details of its specific implementation process, please refer to the embodiments of the blockchain-based large language model intelligent agent abnormal behavior tracing method, which will not be repeated here.

[0069] The specific embodiments described above illustrate the technical solution and beneficial effects of the present invention in detail. It should be understood that the above description is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, additions, and equivalent substitutions made within the scope of the principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for tracing the abnormal behavior of a large language model intelligent agent based on blockchain, characterized in that, Includes the following steps: Based on blockchain smart contracts, on-chain constraint policies are defined for multiple collaborative smart agents to constrain their execution process. The agent calculates the next action state based on the current walking state, privacy input, and tool invocation, and then generates a action commitment based on the next action state, privacy input, and tool invocation. Zero-knowledge proofs are used to generate behavioral consistency proofs for the calculation of the action state of the intelligent agent at each step, and the action commitment and behavioral consistency proof at each step are written into the blockchain to generate a behavioral proof chain; A comprehensive anomaly score is obtained by comprehensively calculating semantic evolution anomaly index, behavioral state deviation index and tool call timing anomaly index, which is used to detect anomalies in the behavior of the intelligent agent. Based on the behavior proof chain recorded on the blockchain, an attack propagation graph is constructed with intelligent agents as nodes and abnormal influence propagation relationships as edges. Based on anomaly detection results and attack propagation graphs, the abnormal intelligent agents are traced and their execution permissions are controlled. Evidence is synchronized to other chains or nodes through cross-chain protocols to achieve collaborative defense.

2. The method for tracing the abnormal behavior of a large language model intelligent agent based on blockchain according to claim 1, characterized in that, The blockchain-based smart contract defines on-chain constraint policies for multiple collaborative smart agents, allowing them to execute specific actions, to constrain the execution process of the smart agents, including: Based on the constructed multi-agent collaborative execution framework, the behavioral boundaries of each agent are constrained by blockchain smart contracts using formal strategies. This includes constraining their reasoning behavior, calling tools, and interacting objects, resulting in corresponding behavior sets, tool sets, and interaction sets. Furthermore, the maximum depth constraint of the reasoning chain is defined to ensure that all actions of the agents are constrained on-chain before execution.

3. The method for tracing the abnormal behavior of a large language model intelligent agent based on blockchain according to claim 1, characterized in that, The process of calculating the next action state based on the agent's current walking state, privacy input, and tool invocation, and then generating a action commitment based on the next action state, privacy input, and tool invocation, includes: Differential privacy mechanism is used to control the input of the intelligent agent. Perturbation protection ensures privacy of input. Based on the agent's current walking state, privacy-preserving input, and the tools invoked, the next action state is calculated. : , in, This indicates that the agent is at time step The internal behavioral state, This indicates that the agent is at time step Privacy-preserving input prompts received from users or upstream intelligent agents This indicates that the agent is at time step The identifier of the external tool being invoked. Represents a verifiable mechanism function; Based on the obtained next action status Privacy-protected input and tool call identifier Perform concatenation operations to generate corresponding behavioral commitments. : , in, This represents the commitment function.

4. The method for tracing abnormal behavior of a large language model intelligent agent based on blockchain according to claim 3, characterized in that, The method of using zero-knowledge proofs to generate behavioral consistency proofs for each step of the agent's behavioral state calculation, and writing the behavioral commitment and behavioral consistency proof for each step into the blockchain to generate a behavioral proof chain, includes: Constructing a behavior consistency proof based on zero-knowledge proof ,satisfy: , in, A zero-knowledge proof verification algorithm is defined if and only if there exists an internal witness that can prove the behavior mechanism function. Output the value when the given input is valid and the behavior policy constraints are not violated. The value is verified without disclosing the internal behavioral state or the complete reasoning chain. This will then lead to a commitment to each step of the action. and proof of behavioral consistency Write the data into the blockchain in chronological order to generate an immutable chain of proofs of behavior. : , in, This indicates the total number of time steps in the current session.

5. The method for tracing the abnormal behavior of a large language model intelligent agent based on blockchain according to claim 1, characterized in that, The comprehensive calculation of semantic evolution anomaly indicators, behavioral state shift indicators, and tool call timing anomaly indicators yields a comprehensive anomaly score, which is used to detect anomalies in the agent's behavior, including: Based on semantic evolution anomaly indicators Behavioral state deviation index and tool call timing anomaly indicators Calculate time steps Comprehensive abnormality score : , in, , and Indicates non-negative weighting coefficients; Semantic Evolution Anomaly Indicators The formula is: , in, Indicates time step Semantic embedding vector representation; The L2 norm is used to measure the magnitude of semantic space changes between adjacent time steps. Behavioral state offset index The formula is: , in, This indicates that the agent is at time step behavioral state, This represents the historical baseline state of the agent, which is a behavioral baseline state vector obtained from statistics of historical normal conversations. The preset vector norm is used to measure the degree of deviation of the current state from the baseline; Tool call timing anomaly indicators The formula is: , in, The conditional probability estimated based on historical normal behavior data represents the invocation of the tool at the previous time step. Compared with the current state Call tools The normality of.

6. The method for tracing the abnormal behavior of a large language model intelligent agent based on blockchain according to claim 1, characterized in that, The process of constructing an attack propagation graph based on the behavior proof chain recorded on the blockchain, with intelligent agents as nodes and anomaly impact propagation relationships as edges, includes: Based on the temporal order and content characteristics of the interactions between agents recorded in the behavioral proof chain, the propagation direction of the anomaly in the agent network is inferred, and a directed graph with agents as nodes and the anomaly influence propagation relationship as edges is constructed as the attack propagation graph. In the attack propagation graph, the propagation entropy metric obtained from the message sequence and anomaly marker statistics transmitted between agents is used to calculate the propagation uncertainty or strength of the anomaly impact on each edge, and this entropy metric is used as the propagation weight of the corresponding edge.

7. The method for tracing the abnormal behavior of a large language model intelligent agent based on blockchain according to claim 1, characterized in that, The process of tracing the source of abnormal intelligent agents and controlling their execution permissions based on anomaly detection results and attack propagation graphs, and synchronizing evidence to other chains or nodes through cross-chain protocols to achieve collaborative defense, includes: When the overall anomaly score exceeds the preset threshold, the source agent and propagation path of the abnormal behavior are located based on the attack propagation map, and control measures, including permission downgrading, call restriction or forced isolation, are implemented on the relevant agents. By calculating cross-chain state proofs related to the behavior proof chain through cross-chain protocols, and synchronizing these cross-chain state proofs to other blockchain networks or defense nodes, the target chain or node can verify and adopt the abnormal evidence without having to completely copy the original chain data, thus achieving cross-chain collaborative defense.

8. A blockchain-based device for tracing abnormal behavior of a large language model intelligent agent, implemented using the blockchain-based method for tracing abnormal behavior of a large language model intelligent agent as described in any one of claims 1 to 7, characterized in that, include: The module includes a multi-agent collaborative execution management module, a behavior state modeling and behavior commitment generation module, a zero-knowledge proof and behavior proof chain storage module, an agent behavior anomaly detection module, an attack propagation graph construction module, and a permission management and cross-chain collaborative defense module. The multi-agent collaborative execution management module is used to define on-chain constraint policies for multiple collaborative agents based on blockchain smart contracts, so as to constrain the execution process of the agents. The behavior state modeling and behavior commitment generation module is used to calculate the current walking state based on the agent's previous behavior state, privacy input, and tool invocation, and then generate a behavior commitment based on the current walking state, privacy input, and tool invocation. The zero-knowledge proof and behavior proof chain storage module is used to generate a behavior consistency proof for the calculation of the action state of the agent at each step using zero-knowledge proof, and writes the behavior commitment and behavior consistency proof of each step into the blockchain to generate a behavior proof chain. The agent behavior anomaly detection module is used to comprehensively calculate semantic evolution anomaly index, behavior state deviation index and tool call timing anomaly index to obtain a comprehensive anomaly score, which is used to detect anomalies in the agent's behavior. The attack propagation graph construction module is used to construct an attack propagation graph with intelligent agents as nodes and abnormal influence propagation relationships as edges, based on the behavior proof chain recorded on the blockchain. The permission management and cross-chain collaborative defense module is used to trace abnormal intelligent agents and perform permission control on them based on anomaly detection results and attack propagation graphs, and to synchronize evidence to other links or nodes through cross-chain protocols to achieve collaborative defense.

9. An electronic device comprising a memory and one or more processors, the memory for storing a computer program, characterized in that, The processor is used to implement the blockchain-based large language model intelligent agent abnormal behavior tracing method as described in any one of claims 1 to 7 when executing a computer program.

10. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program is executed by a computer, it implements the blockchain-based method for tracing abnormal behavior of intelligent agents based on large language models, as described in any one of claims 1 to 7.