Large language model illusion path accurate blocking method and system
By constructing time-varying graphs and using topological isolation techniques to precisely block the illusionary paths of large language models, the security issues of AI systems caused by illusions are resolved, improving the security and reliability of the model while maintaining its functional integrity and performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU ANQUAN DIGITAL INTELLIGENCE TECH CO LTD
- Filing Date
- 2026-06-02
- Publication Date
- 2026-07-03
AI Technical Summary
Existing large language models are prone to generating factual illusions when generating content, which affects the security of AI systems in critical applications. Existing mitigation technologies are costly and difficult to accurately block illusions while maintaining the integrity of model functionality.
By acquiring a hallucination-induced probe set, the output of the large language model is judged as a factual hallucination. A time-varying graph is constructed and the neuron activation sequence is determined. The hallucination path is extracted based on the contribution of Shannon entropy and structural entropy. Topological isolation technology is used to implement hierarchical and precise intervention to block the flow of erroneous information.
It achieves precise blocking of hallucination pathways, improves the security and reliability of AI systems, maintains the creativity and generalization ability of models, provides a computable explanation of the hallucination generation mechanism, and enhances the transparency and debuggability of the system.
Smart Images

Figure CN122333487A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence security technology, specifically to a method and system for accurately blocking illusion paths in large language models. Background Technology
[0002] With the widespread adoption of large language models based on architectures such as Transformer in various critical tasks, the factual illusion in their generated content has become a core technical obstacle restricting the reliable deployment of these models. This means that while the content is fluent, it contradicts objective facts or the input context, severely impacting the security of AI systems in critical fields such as finance, healthcare, and law. Mainstream mitigation techniques have inherent limitations that are difficult to overcome. Typical techniques include reinforcement learning based on human feedback and factual data augmentation training. These methods have extremely high computational and annotation costs, requiring massive amounts of labeled data and large-scale computing resources. Moreover, parameter adjustments are irreversible, and globally modifying model parameters can easily lead to overfitting correction. Furthermore, they face a performance trade-off: while suppressing illusions, they significantly reduce the model's creativity, generalization ability, or instruction-following ability. Therefore, there is an urgent need for a method to accurately block the illusion path in large language models while maintaining the integrity of the model's original functions. Summary of the Invention
[0003] This specification provides an embodiment of a method and system for accurately blocking illusion paths in a large language model, the technical solution of which is as follows:
[0004] Firstly, embodiments of this specification provide a method for accurately blocking hallucination paths in a large language model, comprising: acquiring a hallucination-inducing probe set and inputting it into a large language model; determining factual hallucinations in the model output of the large language model to identify the model's factual hallucination output and the corresponding neuron activation sequence; determining a time-varying graph based on the neuron activation sequence, wherein the time-varying graph includes at least a set of neuron nodes corresponding to any word generation time, connection edges dynamically formed based on the activation correlation between neurons, and connection edge weights; the activation correlation between neurons is determined by mutual information and cosine similarity; and determining the model's factual hallucination output based on the activation correlation between neurons. The system defines a time window for hallucination occurrence and determines the node weighting of the time-varying graph within that window. The node weighting is used to determine the structural entropy contribution and Shannon entropy. Based on the gradient direction of Shannon entropy on neuron activation, the system locates hallucination output lexical nodes according to the model's factual hallucination output. It then traces back based on these hallucination output lexical nodes and extracts coherent neuron activation chains across multiple layers as candidate hallucination paths based on the structural entropy contribution. Based on these candidate hallucination paths, the system identifies the target hallucination path during model inference and implements hierarchical precise intervention through topological isolation techniques to block the flow of erroneous information on the target hallucination path.
[0005] Secondly, embodiments of this specification provide a system for accurately blocking hallucination paths in a large language model, comprising: a hallucination determination module, used to acquire a hallucination-inducing detection set and input it into a large language model, and to perform factual hallucination determination on the model output of the large language model to determine the model's factual hallucination output and the corresponding neuron activation sequence; a time-varying graph determination module, used to determine a time-varying graph based on the neuron activation sequence, wherein the time-varying graph includes at least a set of neuron nodes corresponding to any word generation time, connection edges dynamically formed based on the activation correlation between neurons, and connection edge weights; the activation correlation between neurons is determined by mutual information and cosine similarity; and a Shannon entropy determination module, used to determine the model's factual hallucination output and the corresponding neuron activation sequence. The system determines the time window for hallucination occurrence based on the output of the hallucination and the node weighting of the time-varying graph within the time window. The node weighting is used to determine the structural entropy contribution and Shannon entropy. The path extraction module is used to locate the hallucination output word nodes based on the gradient direction of neuron activation by Shannon entropy, and to trace back based on the hallucination output word nodes to extract coherent neuron activation chains across multiple layers as candidate hallucination paths based on the structural entropy contribution. The intervention module is used to identify the target hallucination path during the model inference process based on the candidate hallucination paths, and to implement hierarchical precise intervention through topological isolation technology to block the flow of erroneous information on the target hallucination path.
[0006] The beneficial effects of the technical solutions provided in some embodiments of this specification include at least the following:
[0007] This specification's embodiments can determine factual hallucinations in the output of a large language model to identify the model's factual hallucination output and the corresponding neuron activation sequence. Based on the neuron activation sequence, a time-varying graph is determined, and the node weighting within the hallucination generation time window is further determined, along with the structural entropy contribution and Shannon entropy. Based on the gradient direction of Shannon entropy on neuron activation, the hallucination output lexical nodes are located according to the model's factual hallucination output, and a reverse tracing is performed based on these nodes. Based on the structural entropy contribution, coherent neuron activation chains across multiple layers are extracted as candidate hallucination paths. This specification's embodiments leap from coarse intervention at the neuron level to precise intervention at the neural path level. By identifying and blocking the propagation path of erroneous information flow in the topological network, rather than simply suppressing individual neurons, it fundamentally solves the problem of indiscriminate functional impairment caused by neuronal polysemy. Furthermore, this specification's embodiments can also identify typical hallucination path patterns through structural entropy analysis and reverse path tracing, providing calculable and interpretable quantitative evidence for the hallucination generation mechanism of large language models, significantly improving the transparency and debuggability of the AI system.
[0008] Furthermore, the embodiments in this specification can implement hierarchical and precise intervention through topological isolation technology, realizing a flexible response system composed of different levels of intervention and emergency intervention. This hierarchical system can dynamically adjust the intervention intensity according to the severity of hallucination, scene risk level, and real-time context, achieving an optimal balance between safety and effectiveness. Moreover, the embodiments in this specification can also employ topological isolation technology, through hierarchical intervention methods such as targeted noise injection, attention rerouting, and conditional gating, to ensure that the function of polysemous neurons on non-hallucination pathways remains completely unaffected. The embodiments in this specification can precisely block the hallucination pathway of the model, improving the model's safety and reliability.
[0009] Moreover, the embodiments in this specification can be integrated into various large language models based on the Transformer architecture, and are applicable to many application scenarios such as intelligent question answering, text generation, code programming, machine translation, and summary generation. Especially in key fields such as financial analysis, medical diagnosis, and legal consultation, where the accuracy of facts is extremely important, this invention can significantly improve the credibility and security of AI systems, and has broad market application value and industrial promotion prospects. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of this specification, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a schematic diagram illustrating the application scenario of the method for accurately blocking illusion paths in large language models provided in this manual.
[0012] Figure 2 This is a flowchart illustrating the method for precisely blocking the illusion path of the large language model provided in this manual.
[0013] Figure 3 This is a flowchart illustrating the determination of the time-varying diagram provided in this manual.
[0014] Figure 4 This is a flowchart illustrating the process for determining the structural entropy contribution and Shannon entropy, as provided in this specification.
[0015] Figure 5 This is a schematic diagram of the structure of the large language model illusion path precise blocking system provided in this manual.
[0016] Figure 6 This is a schematic diagram of the structure of an electronic device provided in this specification. Detailed Implementation
[0017] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings.
[0018] The terms "first," "second," etc., in the description, claims, and accompanying drawings are used to distinguish different objects and not to describe a particular order. Furthermore, the term "comprising" and any variations thereof are intended to cover a non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such processes, methods, products, or apparatus.
[0019] This specification provides a method for accurately blocking large language model illusion paths through multiple embodiments. The executing entity of this method can be the large language model illusion path accurate blocking system provided in the embodiments of this invention.
[0020] Before this manual elaborates on the precise blocking method for illusion paths in large language models in conjunction with one or more embodiments, it first introduces the application scenarios of this precise blocking method for illusion paths in large language models.
[0021] Please see Figure 1 , Figure 1 This is a schematic diagram illustrating an application scenario of a method for accurately blocking large language model illusion paths provided in an embodiment of the present invention. In this embodiment, the large language model illusion path accurate blocking system 100 can be integrated into an electronic device, such as a terminal or a server. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, or personal computer (PC); the server can be a single server or a server cluster composed of multiple servers.
[0022] In some embodiments, the large language model illusion path precise blocking system 100 can also be integrated into multiple electronic devices. For example, the large language model illusion path precise blocking system 100 can be integrated into multiple servers, and multiple servers can implement the large language model illusion path precise blocking method of this application.
[0023] In some embodiments, the server may also be implemented as a terminal. The terminal may be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, or personal computer (PC), etc. The terminal includes a central processing unit (CPU), a graphics processing unit (GPU), memory, storage devices, a network communication module, sensors, a display screen, a battery and power management module, etc.
[0024] For example, refer to Figure 1 The electronic device may include a server 110, a storage terminal 120, etc. The storage terminal 120 stores hallucination-inducing detection sets, etc. The server 110 and the storage terminal 120 communicate with each other, which will not be described in detail here.
[0025] The server 110 may include a processor and memory, among other things. Server 110 can acquire the hallucination-inducing probe set and input it into a large language model. It then performs factual hallucination determination on the model output to identify the model's factual hallucination output and the corresponding neuron activation sequence. Based on the neuron activation sequence, it determines a time-varying graph, which includes at least the set of neuron nodes corresponding to any word generation time, dynamically formed connection edges based on the activation correlation between neurons, and connection edge weights. The activation correlation between neurons is determined by mutual information and cosine similarity. Based on the model's factual hallucination output, it determines the hallucination generation time window and the node weighting degree of the time-varying graph within the hallucination generation time window. The node weighting degree is used to determine the structural entropy contribution and Shannon entropy. Based on the gradient direction of the neuron activation by Shannon entropy, it locates the hallucination output word nodes based on the model's factual hallucination output and traces back based on the hallucination output word nodes. Based on the structural entropy contribution, it extracts coherent neuron activation chains across multiple layers as candidate hallucination paths. Based on the candidate hallucination paths, it identifies the target hallucination path during model inference and implements hierarchical precise intervention through topological isolation technology to block the flow of erroneous information on the target hallucination path.
[0026] It should be noted that, Figure 1 The schematic diagram of the large language model illusion path precise blocking system shown is merely an example. The large language model illusion path precise blocking system and scenario described in the embodiments of the present invention are for the purpose of more clearly illustrating the technical solutions of the embodiments of the present invention, and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. As those skilled in the art will know, with the evolution of the large language model illusion path precise blocking system and the emergence of new scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.
[0027] Please see Figure 2 , Figure 2 This is a flowchart illustrating a method for precisely blocking hallucination paths in a large language model, provided by an embodiment of the present invention. This method for precisely blocking hallucination paths in a large language model can be... Figure 1 The large language model hallucination path precise blocking system 100 is executed. This large language model hallucination path precise blocking method may include at least the following steps:
[0028] 200. Obtain the hallucination-induced probe set and input it into the large language model. Perform factual hallucination determination on the model output of the large language model to determine the model's factual hallucination output and the corresponding neuron activation sequence.
[0029] In this embodiment, the system can acquire a hallucination-inducing detection set that includes data from multiple fields such as scientific facts, historical events, biographies, and professional terminology, to ensure coverage of core scenarios where large language models are prone to hallucinations.
[0030] In some embodiments, the model output of a large language model is subjected to factual illusion determination to determine the model's factual illusion output and the corresponding neuron activation sequence, including: performing fact matching verification on the model output based on a knowledge database to obtain fact matching verification data; determining the model input based on the illusion-inducing probe set, and determining contextual coherence verification data through the semantic similarity between the model input and the model output; acquiring factual corroborating data corresponding to the model output from several information sources, and performing cross-source conflict detection on the factual corroborating data and the model output based on a logical predicate conflict detection algorithm to obtain cross-source conflict data; when the factual matching verification data, contextual coherence verification data, or cross-source conflict data meet the factual illusion determination conditions, the model output is determined as the model's factual illusion output; based on dynamic activation probe technology, with time step as the sampling granularity, capturing the neuron activation tensors of each network layer of the model at each word generation time, arranging the activation tensors in chronological order to determine the neuron activation time evolution sequence, and obtaining the neuron activation sequence corresponding to the model's factual illusion output from the neuron activation time evolution sequence.
[0031] This embodiment can determine whether the model output is a factual illusion based on a multi-dimensional verification mechanism, thus locking in the target for subsequent path analysis.
[0032] For example, the first dimension corresponds to factual consistency verification. In this embodiment, a dynamically updated multi-domain authoritative knowledge database can be established based on Wikipedia, the UpToDate database in the medical field, the core data of China Judgments Online in the legal field, and the Nature abstract database in the scientific field. Then, the model output is compared with the knowledge database at the entity level (such as names of people, places, times, values, etc.) and the relation level (such as causality, attribution, logical deduction, etc.) to obtain the number of matched entities and relations, and the total number of entities and relations involved in the model output. The factual matching rate is calculated based on the ratio between the number of matched entities and relations and the total number of entities and relations involved in the model output to obtain factual matching verification data.
[0033] For example, the second dimension corresponds to contextual coherence verification. In this embodiment, the Sentence-BERT model can be used to generate semantic vectors, and then the semantic similarity between the model input and the model output can be calculated using the cosine similarity algorithm to obtain contextual coherence verification data, thereby identifying unfounded model generation that is detached from the input facts (such as information not mentioned in the input, information that contradicts the input, etc.).
[0034] For example, the third dimension corresponds to multi-source cross-validation. This embodiment can call a lightweight retrieval tool to obtain the corresponding content from several independent and authoritative information sources, i.e., factual evidence data. Independent and authoritative information sources can be Wikipedia, authoritative physics databases, biographical knowledge bases, etc. This embodiment can use a conflict detection algorithm based on logical predicates to determine whether there are cross-source conflicts in the model output. When cross-source conflicts exist in the model output, the number of information sources that conflict with the model output content is determined, thus obtaining cross-source conflict data. This embodiment can establish a conflict detection algorithm based on a logical predicate library containing a large number of commonly used logical predicates to achieve rapid cross-source conflict detection.
[0035] This embodiment can determine the factual illusion of the model output based on fact matching verification data, contextual coherence verification data, and cross-source conflict data. The model output is determined to be a factual illusion output when any of the following factual illusion determination conditions are met. Any factual illusion determination condition can include a first condition, a second condition, a third condition, etc. The first condition can be when the fact matching rate is less than a matching threshold and the semantic similarity is less than a similarity threshold; the second condition can be when there is an information source exceeding a certain number threshold that conflicts with the model output content; the third condition can be when the key facts (such as core values, core relationships, etc.) corresponding to the model output are completely different from those in an authoritative knowledge database. In this embodiment, each threshold can be adaptively adjusted according to the task scenario. For rigorous tasks such as medical and legal tasks, the threshold can be increased, while for creative tasks, the threshold can be decreased.
[0036] This embodiment can employ dynamic activation probe technology to capture the neuron activation tensors and complete temporal evolution sequences of key network layers of the model, such as feedforward network layers, attention output layers, and normalization layers, at a fine-grained (time-step level) level when the model runs the hallucination-inducing probe set. This ensures that no activation information is missed, obtains the neuron activation temporal evolution sequence, and further obtains the neuron activation sequence corresponding to the model's factual hallucination output from the neuron activation temporal evolution sequence.
[0037] In this embodiment, the dynamic activation probe technology can use the TransformerLens library to inject hooks during the model's forward propagation, capturing the activation values of each neuron node in the network layer in full. The sampling frequency can be once for each generated word, corresponding to one time step, ensuring the temporal continuity of the activation sequence. The hooks can be non-intrusive data acquisition interfaces that are preset at the output of each network layer of the model and automatically triggered after the forward propagation is completed.
[0038] 210. Determine the time-varying graph based on the neuron activation sequence. The time-varying graph includes at least the set of neuron nodes corresponding to any word generation time, the connection edges dynamically formed based on the activation correlation between neurons, and the connection edge weights. The activation correlation between neurons is determined by mutual information and cosine similarity.
[0039] In some embodiments, please refer to Figure 3 , Figure 3 This is a schematic flowchart illustrating the determination of a time-varying graph according to an embodiment of the present invention. Determining the time-varying graph based on neuron activation sequences includes:
[0040] 300. Based on the arbitrary word generation time, determine all the neuron nodes involved in the activation of each network layer of the model, so as to obtain the set of neuron nodes corresponding to all word generation times;
[0041] 310. Determine the time sliding window corresponding to the generation time of any word, and obtain the activation values of any two neuron nodes within the time sliding window based on the neuron activation sequence;
[0042] 320. Determine the cosine similarity between any two neuron nodes based on their activation values within a time sliding window;
[0043] 330. Determine the mutual information between any two neurons based on the K-nearest neighbor method;
[0044] 340. The cosine similarity and mutual information between any two neuron nodes are fused to obtain the activation correlation between neurons corresponding to any two neuron nodes.
[0045] 350. When the activation correlation between neurons meets the correlation threshold, connect any two neuron nodes through connecting edges.
[0046] 360. Determine the weight of the connection edge between any two neuron nodes based on the normalized Pearson correlation coefficient;
[0047] 370. Determine the time-varying graph based on the set of neuron nodes, the connecting edges, and the weights of the connecting edges.
[0048] This embodiment models the neuron activation sequence as a time-varying graph G(t) = (V, E(t), W(t)), where G(t) represents the time sequence graph, t represents the t-th time step, V represents the set of neuron nodes, which includes all neurons involved in activation in each network layer, and is further divided into nodes of the input mapping layer, semantic encoding layer, logical reasoning layer, and output generation layer according to function, clearly defining the node hierarchy attributes to facilitate subsequent path tracing. E(t) represents the connection edges dynamically formed at time t based on the activation correlation between neurons. The correlation calculation adopts a fusion of mutual information and cosine similarity: mutual information can be calculated using the K-nearest neighbor method, and cosine similarity can be calculated using a time sliding window of several time steps (e.g., 5), retaining only strongly correlated edges with a correlation coefficient not less than a preset correlation value (e.g., 0.3), thereby filtering weak correlation noise and ensuring the effectiveness of the edges. W(t) represents the connection edge weight, which can be quantified using a normalized Pearson correlation coefficient, with a value range between 0 and 1. The higher the correlation coefficient, the greater the weight, accurately representing the strength of information transmission between neurons.
[0049] 220. Determine the time window for hallucination occurrence based on the model’s factual hallucination output, and determine the node weighting degree of the time-varying graph within the time window for hallucination occurrence. The node weighting degree is used to determine the structural entropy contribution and Shannon entropy.
[0050] In some embodiments, please refer to Figure 4 , Figure 4 This is a flowchart illustrating the process of determining the structural entropy contribution and Shannon entropy according to an embodiment of the present invention. The time window for hallucination occurrence is determined based on the model's factual hallucination output, and the node weighting of the time-varying graph within the hallucination occurrence time window is determined. The node weighting is used to determine the structural entropy contribution and Shannon entropy, including:
[0051] 400. Determine the hallucination output words and corresponding times based on the factual hallucination output of the model, and determine the hallucination generation time window based on the time corresponding to the hallucination output words;
[0052] 410. Based on time-varying graphs, obtain the average activation value of any neuron node in the time window corresponding to the hallucination generation, and the number of connection edges of any neuron node at the time corresponding to the hallucination output word.
[0053] 420. Determine the node weighting degree of any neuron node based on the average activation value and the number of connected edges. The node weighting degree is the product of the average activation value and the number of connected edges.
[0054] 430. Determine the structural entropy contribution of any neuron node. The structural entropy contribution is the ratio of the node weighting degree of any neuron node to the sum of the node weighting degrees of all neuron nodes.
[0055] 440. Determine the Shannon entropy of any neuron node based on its structural entropy contribution.
[0056] This embodiment can model neuronal activation sequences as time-varying graphs to further calculate the structural entropy within the time window of hallucination occurrence. Abnormal peak values of structural entropy are strongly correlated with hallucination outbreaks. This embodiment can use Shannon entropy H_s(G) based on the degree distribution weighted by node activation intensity to determine the structural entropy of the time-varying graph within the time window of hallucination occurrence, quantifying the disorder and concentration of information propagation patterns.
[0057] This embodiment can determine the hallucination output words and corresponding times based on the model's factual hallucination output. For example, if the model outputs a hallucination when the k-th word is output, then the corresponding time is k. The time window for hallucination generation is then calculated by backtracking several time steps (e.g., 10-15 steps) from time k. The hallucination generation time window in this embodiment can be adaptively adjusted according to the number of model layers. The more model layers there are, the larger the window range can be.
[0058] In this embodiment, when determining the node weighting degree, the node weighting degree D(v_i) corresponding to any neuron node v_i is equal to the multiplication of the node activation intensity S(v_i) and the node degree d(v_i). The node activation intensity S(v_i) is the average activation value of any neuron node v_i within the hallucination generation time window, which can be normalized to the interval between 0 and 1. The node degree d(v_i) is the number of connected edges of any neuron node v_i at time t. The node weighting degree in this embodiment comprehensively reflects the activation intensity and connection breadth of the neuron node.
[0059] In this embodiment, the weighted degree proportion is determined, that is, when determining the structural entropy contribution of any neuron node, the structural entropy contribution P(v_i) = D(v_i) / ΣD(v_j), where ΣD(v_j) represents the sum of the node weights of all neuron nodes determined after traversing all neuron nodes, and D(v_i) represents the node weight corresponding to any neuron node v_i. The structural entropy contribution of any neuron node can represent the proportion of information propagation contribution of any neuron node in the entire topology network.
[0060] In this embodiment, when determining the Shannon entropy, the Shannon entropy H_s(G) = -Σ(P(v_i)・log2P(v_i)). The larger the Shannon entropy H_s(G), the more dispersed the information propagation, and the less likely it is to form a concentrated erroneous path. When the Shannon entropy H_s(G) is smaller and a peak appears, it indicates that the information is concentrated along a few paths, and it is easy to form hallucinations.
[0061] 230. Based on the gradient direction of neuron activation by Shannon entropy, locate the hallucination output word node according to the factual hallucination output of the model, and trace back based on the hallucination output word node. Extract the coherent neuron activation chain across multiple layers as candidate hallucination path according to the structural entropy contribution.
[0062] In some embodiments, based on the gradient direction of Shannon entropy on neuron activation, the hallucination output word nodes are located according to the model's factual hallucination output, and the hallucination output word nodes are traced back in reverse. Based on the structural entropy contribution, a coherent neuron activation chain across multiple layers is extracted as a candidate hallucination path. This includes: determining the hallucination output word based on the model's factual hallucination output; determining the hallucination output word nodes in the output layer of the large language model, where the hallucination output word nodes are the neuron nodes corresponding to the hallucination output word nodes; determining the first gradient between the Shannon entropy of any neuron node and the activation value of any neuron node, where the first gradient is the gradient of Shannon entropy on neuron activation; determining the gradient descent direction based on the gradient of Shannon entropy on neuron activation, and tracing back layer by layer to the input layer of the large language model based on the gradient descent direction to obtain candidate neuron nodes; obtaining the integral gradient corresponding to the candidate neuron nodes, and sorting the candidate neuron nodes according to the integral gradient and the structural entropy contribution of the candidate neuron nodes to determine key nodes from the candidate neuron nodes; and connecting the key nodes in series according to the time series and the connection relationship between each network layer of the model to obtain a coherent neuron activation chain, which is the candidate hallucination path.
[0063] This embodiment obtains the integral gradient of candidate neuron nodes based on the integral gradient algorithm. Then, it multiplies the integral gradient of each candidate neuron node with its corresponding structural entropy contribution to obtain an improved gradient. Based on this improved gradient, the candidate neuron nodes are ranked to identify key nodes. This embodiment highlights the gradient signal of key nodes, further improving tracing accuracy. In this embodiment, candidate neuron nodes during the backtracking process can be ranked according to the improved gradient obtained by multiplying the structural entropy contribution with the integral gradient. For example, the top 20% of key nodes are retained, while secondary nodes are filtered out to reduce path redundancy.
[0064] In this embodiment, the tracing direction can be determined by starting from the illusion output word node and tracing back layer by layer along the gradient descent direction to the input mapping layer. The gradient descent direction is the direction in which the entropy gradient is less than 0, and the gradient descent direction is the direction in which the entropy value decreases and the information is concentrated and propagated.
[0065] In some embodiments, before identifying the target hallucination path during model inference, based on candidate hallucination paths, the process includes: acquiring a candidate hallucination path dataset and performing clustering processing on the candidate hallucination path dataset to obtain several typical hallucination path patterns. The typical hallucination path patterns include, but are not limited to, paths with strong prior knowledge coverage, context-independent extrapolation paths, and paths with conflicting multi-source information. The typical hallucination path patterns are encoded into path feature templates. The path feature templates include, but are not limited to, topological skeletons, key node types, spatiotemporal patterns of activation intensity, and entropy feature signatures.
[0066] This embodiment can perform structured encoding on each typical illusion path pattern to obtain a path feature template, which can be stored as a combination of an adjacency matrix and an eigenvector.
[0067] This embodiment can employ algorithms such as graph neural networks or graph clustering to cluster a large number of candidate hallucination paths, abstracting several typical hallucination path patterns shared across tasks and domains. Among them, the prior knowledge strong coverage path pattern is where the model output relies excessively on prior knowledge and ignores the facts of the input context; the context-independent extrapolation path pattern is where the model output extrapolates based on local semantic fragments without basis and is detached from the overall context; and the multi-source information conflict path pattern is where information from different sources conflicts during propagation, leading to factual confusion.
[0068] In some embodiments, identifying the target hallucination path during model inference based on candidate hallucination paths includes: determining each inference time corresponding to the large language model, and obtaining the instantaneous activation subgraph and Shannon entropy corresponding to each inference time; the instantaneous activation subgraph is a network graph determined by the neuron nodes in an active state at any inference time and the connection relationships between the neuron nodes; matching the instantaneous activation subgraph with the path feature template to obtain a matching confidence score; when the matching confidence score is higher than a preset confidence threshold, determining the target hallucination path based on the instantaneous activation subgraph.
[0069] In this embodiment, each inference time point corresponding to the large language model can generate the time point corresponding to each lexical unit for the large language model. This embodiment can determine the instantaneous activation subgraph and structural entropy data of the current inference time point, and perform subgraph isomorphic or approximate matching with the path feature template. When the matching confidence score exceeds the dynamic threshold, the corresponding intervention strategy is activated.
[0070] 240. Based on candidate illusion paths, identify target illusion paths during model inference and implement hierarchical precise intervention through topological isolation technology to block the flow of erroneous information on the target illusion path.
[0071] In this embodiment, topology isolation technology may include directional noise injection isolation, attention weight adjustment isolation, dynamic gating scaling isolation, path cutting isolation, etc. In this embodiment, an appropriate isolation method can be selected according to the target hallucination path pattern, severity and scene risk level.
[0072] In some embodiments, hierarchical precision intervention is implemented through topological isolation technology, including a first-level intervention. The first-level intervention includes: determining the intervention target node based on the structural entropy contribution of each neuron node in the target hallucination path, wherein the intervention target node is a neuron node whose structural entropy contribution is greater than a preset contribution threshold; generating a directed adversarial noise vector using a pre-trained neural network, wherein the training objective of the neural network is to minimize the activation intensity of the target hallucination path and minimize the degree of influence on the normal path; and adding the directed adversarial noise vector to the intervention target node to increase the structural entropy of the target hallucination path by a preset amount, thereby interfering with the centralized propagation of erroneous information flow.
[0073] This embodiment can perform hallucination path interference, i.e., entropy perturbation, on a large language model by injecting targeted adversarial noise vectors into the target nodes of the target hallucination path. The noise can be generated by training a small neural network, with the training objective being to minimize the activation intensity of the target hallucination path and minimize the impact on the normal path. For example, for the targeted noise generation process, this embodiment can train a 3-layer fully connected neural network as the noise generator. The input dimension is the same as the target neuron activation vector dimension, which can be consistent with the output dimension of the LLaMA-13B FFN layer, and the output dimension is the same as the input dimension. The training dataset can include hallucination path activation samples and normal path activation samples. The loss function can be the sum of the hallucination path activation intensity loss and the cross-path impact difference loss. The number of training iterations is set to 50 rounds, and the noise generation time is ≤1ms / cycle.
[0074] In some embodiments, hierarchical precision intervention is implemented through topological isolation technology, including a second-level intervention. The second-level intervention includes: identifying local attention heads associated with key nodes corresponding to the target hallucination path, and temporarily adjusting the attention weight distribution of the local attention heads, including: increasing the attention weight of factual supporting words in the input context by a first preset value, and decreasing the attention weight of hallucination triggering source words by a second preset value, so as to guide the information flow to the correct branch.
[0075] This embodiment can perform attention rerouting on a large language model to block the target hallucination path, i.e., topology reshaping. This embodiment can dynamically fine-tune the weights of local attention heads associated with key nodes corresponding to the target hallucination path, enhance the attention weights of contextual factual supporting words, and reduce the attention weights of hallucination trigger source words. For attention rerouting parameter settings, the attention head fine-tuning range can be ±0.2 (dynamic range based on meta-learning optimization). The fine-tuning range is only for local attention heads associated with key nodes of the hallucination path (accounting for 20% of the total number of attention heads in this layer), avoiding global adjustments. The fine-tuning time is ≤2ms / time.
[0076] In some embodiments, hierarchical precision intervention is implemented through topological isolation technology, including a third-level intervention. The third-level intervention includes: determining the core polysemous neurons of the target hallucination path, inserting a conditional gating function into the core polysemous neurons, the conditional gating function adopting a two-layer MLP structure, the input of the two-layer MLP structure being the activation history window of the core polysemous neurons in the most recent several time steps and the context embedding of the network layer in which they are located, and the core polysemous neurons output a gating scaling coefficient of a preset interval to dynamically adjust the output intensity of the neurons.
[0077] This embodiment can perform conditional gating on a large language model, that is, temporarily blocking the target hallucination path. For example, this embodiment can insert a two-layer MLP structure of conditional gating function into the core polysemous neuron of the path. Only when the neuron's activation mode highly matches the hallucination feature template is the output scaled by 0.3-0.7 times applied. After the activation mode returns to normal, the gating is fully open. For example, the gating function can be a two-layer MLP (hidden layer dimension 512, activation function is ReLU function), the input is the activation sequence of the neuron in the last 10 time steps and the context embedding of the network layer, the dimension is 4096, and the output is a scaling factor of [0, 1]; the training set can include normal activation samples and hallucination path activation samples, and is trained using a binary classification cross-entropy loss function, with a training accuracy of ≥92% and a gating judgment time of ≤1ms / time.
[0078] In some embodiments, hierarchical precision intervention is implemented through topological isolation technology, including: after performing the first-level intervention, obtaining the activation intensity corresponding to the target hallucination path at several consecutive time steps; when it is determined that the activation intensity corresponding to the target hallucination path at several consecutive time steps increases by a preset activation magnitude, triggering the second-level intervention; after performing the second-level intervention, obtaining the instantaneous activation subgraph corresponding to the large language model under the second-level intervention, and determining the sub-matching confidence score between the instantaneous activation subgraph corresponding to the second-level intervention and the path feature template; when the sub-matching confidence score is higher than a preset confidence threshold, triggering the third-level intervention.
[0079] In some embodiments, when the target hallucination path corresponds to a preset high-risk scenario, emergency intervention is performed, including: obtaining the core connection edge of the target hallucination path and performing a weight reset operation on the core connection edge to forcibly cut off the erroneous information flow; the weight of the connection edge of the core connection edge is greater than a preset weight threshold; and initiating post-verification corresponding to the cutting off of the erroneous information flow, including: obtaining the current model output corresponding to the forced cutting off of the erroneous information flow, performing secondary verification on the current model output based on the knowledge database, and retaining the current model output when the verification passes; and controlling the large language model to re-execute the generation process while maintaining the weight reset to zero state when the verification fails.
[0080] This embodiment also includes an emergency intervention mechanism, namely path interruption and isolation. For high-risk scenarios, a weight reset operation is applied to the core connecting edges of the target hallucination path to forcibly cut off the erroneous information flow, in conjunction with post-event verification using an external authoritative knowledge base. For example, this embodiment sets corresponding path interruption and isolation parameters; when filtering core connecting edges, the top 10% of the connecting edge weights in the hallucination path can be selected as the interruption targets, with the zeroing operation taking ≤0.5ms / time; the post-event verification tool can call a lightweight authoritative knowledge base retrieval interface, with verification taking ≤3ms / time.
[0081] In some embodiments, the large language model is configured with a closed-loop evaluation and adaptive optimization module, which includes: a dual-objective evaluation unit configured to establish a dual-core indicator system of hallucination suppression rate and model capability retention rate, determine the hallucination suppression rate through a standard factual evaluation set, determine the model capability retention rate using a comprehensive capability evaluation set, and periodically output a quantitative evaluation report; and a parameter adaptive learning unit coupled with the dual-objective evaluation unit, configured to adaptively optimize hyperparameters based on meta-learning or Bayesian optimization algorithms according to the quantitative evaluation report, wherein the hyperparameters include at least the intervention trigger threshold, noise intensity, attention adjustment amplitude, and gating scaling coefficient.
[0082] This specification's embodiments can determine factual hallucinations in the output of a large language model to identify the model's factual hallucination output and the corresponding neuron activation sequence. Based on the neuron activation sequence, a time-varying graph is determined, and the node weighting within the hallucination generation time window is further determined, along with the structural entropy contribution and Shannon entropy. Based on the gradient direction of Shannon entropy on neuron activation, the hallucination output lexical nodes are located according to the model's factual hallucination output, and a reverse tracing is performed based on these nodes. Based on the structural entropy contribution, coherent neuron activation chains across multiple layers are extracted as candidate hallucination paths. This specification's embodiments leap from coarse intervention at the neuron level to precise intervention at the neural path level. By identifying and blocking the propagation path of erroneous information flow in the topological network, rather than simply suppressing individual neurons, it fundamentally solves the problem of indiscriminate functional impairment caused by neuronal polysemy. Furthermore, this specification's embodiments can also identify typical hallucination path patterns through structural entropy analysis and reverse path tracing, providing calculable and interpretable quantitative evidence for the hallucination generation mechanism of large language models, significantly improving the transparency and debuggability of the AI system.
[0083] Furthermore, the embodiments in this specification can implement hierarchical and precise intervention through topological isolation technology, realizing a flexible response system composed of different levels of intervention and emergency intervention. This hierarchical system can dynamically adjust the intervention intensity according to the severity of hallucination, scene risk level, and real-time context, achieving an optimal balance between safety and effectiveness. Moreover, the embodiments in this specification can also employ topological isolation technology, through hierarchical intervention methods such as targeted noise injection, attention rerouting, and conditional gating, to ensure that the function of polysemous neurons on non-hallucination pathways remains completely unaffected. The embodiments in this specification can precisely block the hallucination pathway of the model, improving the model's safety and reliability.
[0084] Moreover, the embodiments in this specification can be integrated into various large language models based on the Transformer architecture, and are applicable to many application scenarios such as intelligent question answering, text generation, code programming, machine translation, and summary generation. Especially in key fields such as financial analysis, medical diagnosis, and legal consultation, where the accuracy of facts is extremely important, this invention can significantly improve the credibility and security of AI systems, and has broad market application value and industrial promotion prospects.
[0085] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0086] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of the large language model illusion path precise blocking system provided in the embodiments of this specification.
[0087] like Figure 5 As shown, the large language model hallucination path precise blocking system may include at least a hallucination determination module 500, a time-varying graph determination module 510, a Shannon entropy determination module 520, a path extraction module 530, and an intervention module 540, among which:
[0088] The hallucination determination module 500 is used to acquire the hallucination-induced probe set and input it into the large language model. It performs factual hallucination determination on the model output of the large language model to determine the model's factual hallucination output and the corresponding neuron activation sequence.
[0089] The time-varying graph determination module 510 is used to determine the time-varying graph based on the neuron activation sequence. The time-varying graph includes at least the set of neuron nodes corresponding to any word generation time, the connection edges dynamically formed based on the activation correlation between neurons, and the connection edge weights. The activation correlation between neurons is determined by mutual information and cosine similarity.
[0090] The Shannon entropy determination module 520 is used to determine the time window for the occurrence of hallucinations based on the model's factual hallucination output, and to determine the node weighting degree of the time-varying graph within the time window for the occurrence of hallucinations. The node weighting degree is used to determine the structural entropy contribution and the Shannon entropy.
[0091] The path extraction module 530 is used to locate the hallucination output word node based on the gradient direction of neuron activation based on Shannon entropy, locate the hallucination output word node based on the factual hallucination output of the model, and trace back based on the hallucination output word node to extract the coherent neuron activation chain across multiple layers as candidate hallucination path based on the structural entropy contribution.
[0092] Intervention module 540 is used to identify the target illusion path during the model inference process based on candidate illusion paths, and to implement hierarchical precise intervention through topological isolation technology to block the flow of erroneous information on the target illusion path.
[0093] In some embodiments, the hallucination determination module 500 includes a hallucination determination submodule, which is used to: perform fact matching verification on the model output based on a knowledge database to obtain fact matching verification data; determine the model input based on the hallucination induction probe set, and determine the context coherence verification data through the semantic similarity between the model input and the model output; acquire factual evidence data corresponding to the model output from several information sources, and perform cross-source conflict detection on the factual evidence data and the model output based on a logical predicate conflict detection algorithm to obtain cross-source conflict data; when the fact matching verification data, context coherence verification data, or cross-source conflict data meet the factual hallucination determination conditions, determine the model output as the model's factual hallucination output; and based on dynamic activation probe technology, capture the neuron activation tensors of each network layer of the model at each word generation time with time step as the sampling granularity, arrange the activation tensors in chronological order to determine the neuron activation time evolution sequence, and obtain the neuron activation sequence corresponding to the model's factual hallucination output from the neuron activation time evolution sequence.
[0094] In some embodiments, the time-varying graph determination module 510 includes a time-varying graph determination submodule, which is used to: determine all activated neuron nodes in each network layer of the model based on arbitrary word generation time to obtain a set of neuron nodes corresponding to all word generation times; determine a time sliding window corresponding to arbitrary word generation time, and obtain the activation values of any two neuron nodes within the time sliding window based on the neuron activation sequence; determine the cosine similarity between any two neuron nodes based on the activation values of any two neuron nodes within the time sliding window; determine the mutual information between any two neuron nodes based on the K-nearest neighbor method; fuse the cosine similarity and mutual information between any two neuron nodes to obtain the activation correlation between neurons corresponding to any two neuron nodes; when the activation correlation between neurons meets the correlation threshold, connect any two neuron nodes through connecting edges; determine the weight of the connecting edge between any two neuron nodes based on the normalized Pearson correlation coefficient; and determine the time-varying graph based on the set of neuron nodes, connecting edges, and connecting edge weights.
[0095] In some embodiments, the Shannon entropy determination module 520 includes an entropy determination submodule, which is used to: determine the hallucination output term and corresponding time based on the model's factual hallucination output; determine the hallucination generation time window based on the time corresponding to the hallucination output term; obtain the average activation value of any neuron node in the hallucination generation time window and the number of connection edges of any neuron node at the time corresponding to the hallucination output term based on the time-varying graph; determine the node weighting degree of any neuron node based on the average activation value and the number of connection edges, where the node weighting degree is the product of the average activation value and the number of connection edges; determine the structural entropy contribution of any neuron node, where the structural entropy contribution is the ratio of the node weighting degree of any neuron node to the sum of the node weighting degrees of all neuron nodes; and determine the Shannon entropy of any neuron node based on the structural entropy contribution.
[0096] In some embodiments, the path extraction module 530 includes a path extraction submodule, which is used to: determine the hallucination output lexicon based on the factual hallucination output of the model; determine the hallucination output lexicon node in the output layer of the large language model, wherein the hallucination output lexicon node is the neuron node corresponding to the hallucination output lexicon; determine the first gradient between the Shannon entropy of any neuron node and the activation value of any neuron node, wherein the first gradient is the gradient of Shannon entropy on neuron activation; determine the gradient descent direction based on the gradient of Shannon entropy on neuron activation, and backtrack layer by layer to the input layer of the large language model based on the gradient descent direction to obtain candidate neuron nodes; obtain the integral gradient corresponding to the candidate neuron node, and sort the candidate neuron nodes according to the integral gradient and the structural entropy contribution of the candidate neuron node to determine key nodes from the candidate neuron nodes; and connect the key nodes in series according to the time series and the connection relationship between each network layer of the model to obtain a coherent neuron activation chain, wherein the coherent neuron activation chain is the candidate hallucination path.
[0097] In some embodiments, the large language model illusion path precise blocking system further includes a clustering module, which is used to: obtain a candidate illusion path dataset and perform clustering processing on the candidate illusion path dataset to obtain several typical illusion path patterns. The typical illusion path patterns include, but are not limited to, paths with strong prior knowledge coverage, context-independent extrapolation paths, and multi-source information conflict paths; and encode the typical illusion path patterns into path feature templates. The path feature templates include, but are not limited to, topological skeletons, key node types, spatiotemporal patterns of activation intensity, and entropy feature signatures.
[0098] In some embodiments, the intervention module 540 includes an identification module, which is used to: determine each inference time corresponding to the large language model, and obtain the instantaneous activation subgraph and Shannon entropy corresponding to each inference time; the instantaneous activation subgraph is a network graph determined by the neuron nodes in the active state at any inference time and the connection relationship between the neuron nodes; match the instantaneous activation subgraph with the path feature template to obtain a matching confidence score; when the matching confidence score is higher than a preset confidence threshold, determine the target hallucination path based on the instantaneous activation subgraph.
[0099] In some embodiments, the intervention module 540 includes a hierarchical intervention module, which is used for: a first-level intervention, including: determining intervention target nodes based on the structural entropy contribution of each neuron node in the target hallucination path, wherein the intervention target nodes are neuron nodes whose structural entropy contribution is greater than a preset contribution threshold; generating a directed adversarial noise vector using a pre-trained neural network, wherein the training objective of the neural network is to minimize the activation intensity of the target hallucination path and minimize the impact on the normal path; adding the directed adversarial noise vector to the intervention target node to increase the structural entropy of the target hallucination path by a preset amount and interfere with the centralized propagation of erroneous information flow; and a second-level intervention, including: identifying key nodes corresponding to the target hallucination path. The system involves three levels of intervention: First, it identifies the core polysemous neuron that is associated with the target hallucination path. This involves temporarily adjusting the attention weight distribution of the core polysemous neuron, including increasing the attention weight of factual supporting words in the input context by a first preset magnitude and decreasing the attention weight of hallucination triggering words by a second preset magnitude, to guide information flow to the correct branch. Second, it involves identifying the core polysemous neuron and inserting a conditional gating function into it. The conditional gating function uses a two-layer MLP structure. The input to the two-layer MLP structure is the activation history window of the core polysemous neuron in the most recent time steps and the context embedding of its network layer. The core polysemous neuron outputs a gating scaling coefficient within a preset interval to dynamically adjust the neuron's output intensity.
[0100] In some embodiments, the intervention module 540 includes an intervention triggering module, which is used to: after performing a first-level intervention, obtain the activation intensity corresponding to the target hallucination path at several consecutive time steps; when it is determined that the activation intensity corresponding to the several consecutive time steps increases by a preset activation magnitude, trigger a second-level intervention; after performing a second-level intervention, obtain the instantaneous activation subgraph corresponding to the large language model under the second-level intervention, and determine the sub-matching confidence score between the instantaneous activation subgraph corresponding to the second-level intervention and the path feature template; when the sub-matching confidence score is higher than a preset confidence threshold, trigger a third-level intervention; when the target hallucination path corresponds to a preset high-risk scenario, perform an emergency intervention, including: obtaining the core connection edge of the target hallucination path and performing a weight reset operation on the core connection edge to forcibly cut off the erroneous information flow; the connection edge weight of the core connection edge is greater than a preset weight threshold; initiate a post-verification corresponding to the cutting off of the erroneous information flow, including: obtaining the current model output corresponding to the forced cutting off of the erroneous information flow, performing a secondary verification on the current model output based on the knowledge database, retaining the current model output when the verification passes; and controlling the large language model to re-execute the generation process while maintaining the weight reset state when the verification fails.
[0101] In some embodiments, the large language model is configured with a closed-loop evaluation and adaptive optimization module, which includes:
[0102] The dual-objective evaluation unit is configured to establish a dual-core indicator system of hallucination suppression rate and model capability retention rate. The hallucination suppression rate is determined by a standard factual evaluation set, and the model capability retention rate is determined by a comprehensive capability evaluation set. Quantitative evaluation reports are output regularly.
[0103] The parameter adaptive learning unit, coupled with the dual-objective evaluation unit, is configured to be based on meta-learning or Bayesian optimization algorithms. It adaptively optimizes hyperparameters according to the quantitative evaluation report. The hyperparameters include at least the intervention trigger threshold, noise intensity, attention adjustment amplitude, and gating scaling factor.
[0104] Based on the content of the large language model hallucination path precise blocking system in multiple embodiments of this specification, it can be seen that the embodiments of this specification can determine the factual hallucination of the model output of the large language model to identify the model's factual hallucination output and the corresponding neuron activation sequence; determine the time-varying graph based on the neuron activation sequence, determine the node weighting degree of the time-varying graph within the hallucination generation time window, and further determine the structural entropy contribution and Shannon entropy; based on the gradient direction of Shannon entropy on neuron activation, locate the hallucination output word node according to the model's factual hallucination output, and trace back based on the hallucination output word node, extracting a coherent neuron activation chain across multiple layers as candidate hallucination paths based on the structural entropy contribution. The embodiments of this specification leap from coarse intervention at the neuron level to precise intervention at the neural path level, fundamentally solving the problem of indiscriminate functional impairment caused by neuronal polysemy by identifying and blocking the propagation path of erroneous information flow in the topological network, rather than simply inhibiting individual neurons. Furthermore, the embodiments in this specification can also identify typical hallucination path patterns through structural entropy analysis and reverse path tracing, which provides a calculable and interpretable quantitative basis for the hallucination generation mechanism of large language models, significantly improving the transparency and debuggability of AI systems.
[0105] Furthermore, the embodiments of this specification can implement hierarchical and precise intervention through topological isolation technology, realizing a flexible response system composed of different levels of intervention and emergency intervention. This hierarchical system can dynamically adjust the intensity of intervention according to the severity of hallucination, the risk level of the scene, and the real-time context, achieving an optimal balance between safety and effectiveness. Moreover, the embodiments of this specification can also use topological isolation technology to ensure that the function of polysemous neurons on non-hallucinatory pathways is completely unaffected through hierarchical intervention methods such as targeted noise injection, attention rerouting, and conditional gating.
[0106] Moreover, the embodiments in this specification can be integrated into various large language models based on the Transformer architecture, and are applicable to many application scenarios such as intelligent question answering, text generation, code programming, machine translation, and summary generation. Especially in key fields such as financial analysis, medical diagnosis, and legal consultation, where the accuracy of facts is extremely important, this invention can significantly improve the credibility and security of AI systems, and has broad market application value and industrial promotion prospects.
[0107] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiment of the large language model hallucination path precise blocking system is relatively simple in description because it is fundamentally similar to the embodiment of the large language model hallucination path precise blocking method; relevant parts can be referred to the description of the method embodiment.
[0108] Please see Figure 6 The diagram shown is a structural schematic of an electronic device provided in an embodiment of this specification.
[0109] like Figure 6 As shown, the electronic device 600 may include at least one processor 610, at least one network interface 640, a user interface 630, a memory 650, and at least one communication bus 620.
[0110] The communication bus 620 can be used to realize the connection and communication of the above components.
[0111] The user interface 630 may include buttons, and the optional user interface may also include a standard wired interface or a wireless interface.
[0112] The network interface 640 may include, but is not limited to, Bluetooth modules, NFC modules, Wi-Fi modules, etc.
[0113] The processor 610 may include one or more processing cores. The processor 610 connects to various parts within the electronic device 600 using various interfaces and lines. It executes various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 650, and by calling data stored in the memory 650. Optionally, the processor 610 may be implemented using at least one hardware form selected from DSP, FPGA, and PLA. The processor 610 may integrate one or more of the following: CPU, GPU, and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 610 and may be implemented as a separate chip.
[0114] The memory 650 may include RAM or ROM. Optionally, the memory 650 may include a non-transitory computer-readable medium. The memory 650 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 650 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 650 may also be at least one storage device located remotely from the aforementioned processor 610. As a computer storage medium, the memory 650 may include an operating system, a network communication module, a user interface module, and a large language model illusion path precise blocking application. The processor 610 may be used to call the large language model illusion path precise blocking application stored in the memory 650 and execute the steps of the large language model illusion path precise blocking method mentioned in the foregoing embodiments.
[0115] This specification also provides a computer-readable storage medium storing instructions that, when executed on a computer or processor, cause the computer or processor to perform the above-described instructions. Figures 2-4 One or more steps in the illustrated embodiment. If the constituent modules of the above-described electronic device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium.
[0116] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this specification is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., Digital Versatile Discs (DVDs)), or semiconductor media (e.g., Solid State Disks (SSDs)).
[0117] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks. Unless otherwise specified, the technical features of this embodiment and its implementation can be combined arbitrarily.
[0118] The above embodiments are merely preferred embodiments described in this specification and are not intended to limit the scope of this specification. Any modifications and improvements made by those skilled in the art to the technical solutions of this specification without departing from the spirit of this specification should fall within the protection scope defined by the claims of this specification.
Claims
1. A large language model hallucination path precise blocking method, characterized in that, include: A hallucination-inducing probe set is acquired and input into a large language model. The model output of the large language model is then subjected to a factual hallucination determination to identify the model's factual hallucination output and the corresponding neuron activation sequence. A time-varying graph is determined based on the neuron activation sequence. The time-varying graph includes at least a set of neuron nodes corresponding to any word generation time, connection edges dynamically formed based on the activation correlation between neurons, and connection edge weights. The activation correlation between neurons is determined by mutual information and cosine similarity. The hallucination generation time window is determined based on the factual hallucination output of the model, and the node weighting degree of the time-varying graph within the hallucination generation time window is determined. The node weighting degree is used to determine the structural entropy contribution and Shannon entropy. Based on the gradient direction of the Shannon entropy for neuron activation, the hallucination output word node is located according to the factual hallucination output of the model, and the hallucination output word node is traced back in reverse. Based on the structural entropy contribution, a coherent neuron activation chain across multiple layers is extracted as a candidate hallucination path. Based on the candidate hallucination paths, the target hallucination path is identified during the model inference process, and hierarchical precise intervention is implemented through topological isolation technology to block the flow of erroneous information on the target hallucination path.
2. The method of claim 1, wherein, The step of determining factual hallucinations in the output of the large language model to identify the model's factual hallucination output and the corresponding neuron activation sequence includes: Based on the knowledge database, fact matching verification is performed on the model output to obtain fact matching verification data. The model input is determined based on the hallucination-inducing detection set, and the contextual coherence verification data is determined by the semantic similarity between the model input and the model output. Obtain factual evidence data corresponding to the model output from several information sources, and perform cross-source conflict detection on the factual evidence data and the model output based on a conflict detection algorithm of logical predicates to obtain cross-source conflict data. When the fact matching verification data, the context coherence verification data, or the cross-source conflict data meet the factual illusion determination conditions, the model output is determined as the model factual illusion output; Based on dynamic activation probe technology, the neuron activation tensors of each network layer of the model at each word generation time are captured with time step as the sampling granularity. The activation tensors are arranged in chronological order to determine the neuron activation time evolution sequence, and the neuron activation sequence corresponding to the model's factual hallucination output is obtained from the neuron activation time evolution sequence.
3. The method of claim 1, wherein, The step of determining the time-varying map based on the neuron activation sequence includes: Based on the arbitrary word generation time, determine all the neuron nodes involved in the activation of each network layer of the model, so as to obtain the set of neuron nodes corresponding to all word generation times; Determine the time sliding window corresponding to the arbitrary word generation time, and obtain the activation values of any two neuron nodes within the time sliding window based on the neuron activation sequence; The cosine similarity between any two neurons is determined based on the activation values of any two neurons within the time sliding window. The mutual information between any two neurons is determined based on the K-nearest neighbor method. The cosine similarity between any two neuron nodes and the mutual information are fused to obtain the activation correlation between neurons corresponding to any two neuron nodes. When the activation correlation between the neurons meets the correlation threshold, any two neuron nodes are connected by a connecting edge; The weights of the connection edges between any two neuron nodes are determined based on the normalized Pearson correlation coefficient. The time-varying graph is determined based on the set of neuron nodes, the connecting edges, and the weights of the connecting edges.
4. The method of claim 1, wherein, The process involves determining the hallucination occurrence time window based on the model's factual hallucination output, and determining the node weighting degree of the time-varying graph within the hallucination occurrence time window. The node weighting degree is used to determine the structural entropy contribution and Shannon entropy, including: Based on the factual hallucination output of the model, the hallucination output words and corresponding times are determined, and the hallucination generation time window is determined based on the times corresponding to the hallucination output words. Based on the time-varying graph, the average activation value of any neuron node corresponding to the time window of the hallucination, and the number of connection edges of any neuron node at the time corresponding to the hallucination output word are obtained. The node weighting degree of any neuron node is determined based on the average activation value and the number of connecting edges, wherein the node weighting degree is the product of the average activation value and the number of connecting edges; The structural entropy contribution of any neuron node is determined, wherein the structural entropy contribution is the ratio of the node weighting degree of the arbitrary neuron node to the sum of the node weighting degrees of all neuron nodes; The Shannon entropy of any neuron node is determined based on the structural entropy contribution.
5. The method of claim 1, wherein, The process involves locating hallucination output lexical nodes based on the gradient direction of neuron activation according to the Shannon entropy, tracing back based on the hallucination output lexical nodes, and extracting coherent neuron activation chains across multiple layers as candidate hallucination paths based on the structural entropy contribution. This includes: The hallucination output morphology is determined based on the factual hallucination output of the model; In the output layer of the large language model, hallucination output word nodes are determined, and the hallucination output word nodes are the neuron nodes corresponding to the hallucination output words. Determine a first gradient between the Shannon entropy of any neuron node and the activation value of the arbitrary neuron node, wherein the first gradient is the gradient of the Shannon entropy with respect to neuron activation; The gradient descent direction is determined based on the gradient of the Shannon entropy on the neuron activation, and the gradient descent direction is used to backtrack layer by layer to the input layer of the large language model to obtain candidate neuron nodes. The integral gradient corresponding to the candidate neuron node is obtained, and the candidate neuron nodes are sorted according to the integral gradient and the structural entropy contribution of the candidate neuron node, so as to determine the key nodes from the candidate neuron nodes. The key nodes are connected in series according to the time sequence and the connection relationship between each network layer of the model to obtain a coherent neuron activation chain, which is the candidate hallucination path.
6. The method of claim 5, wherein, The process of identifying the target hallucination path during model inference based on the candidate hallucination paths includes: Determine each inference time point corresponding to the large language model, and obtain the instantaneous activation subgraph and Shannon entropy corresponding to each inference time point respectively; the instantaneous activation subgraph is a network graph determined by the neuron nodes in the active state at any inference time point and the connection relationship between the neuron nodes; The instantaneous activation subgraph is matched with the path feature template to obtain a matching confidence score; When the matching confidence score is higher than the preset confidence threshold, the target hallucination path is determined based on the instantaneous activation subgraph.
7. The method of claim 6, wherein, The implementation of hierarchical and precise intervention through topology isolation technology includes: Level 1 intervention includes: Based on the structural entropy contribution of each neuron node in the target hallucination path, the intervention target node is determined. The intervention target node is a neuron node whose structural entropy contribution is greater than a preset contribution threshold. A pre-trained neural network is used to generate a directed adversarial noise vector. The training objective of the neural network is to minimize the activation intensity of the target hallucination path and minimize the impact on the normal path. The targeted adversarial noise vector is added to the intervention target node to increase the structural entropy of the target hallucination path by a predetermined amount, thereby interfering with the centralized propagation of erroneous information flow; Level 2 intervention includes: Identify local attention heads associated with key nodes corresponding to the target hallucination path, and temporarily adjust the attention weight distribution of the local attention heads, including: increasing the attention weight of factual supporting words in the input context by a first preset value, and decreasing the attention weight of hallucination triggering source words by a second preset value, so as to guide the information flow to the correct branch; Level 3 intervention includes: The core polysemous neuron of the target hallucination path is determined, and a conditional gating function is inserted into the core polysemous neuron. The conditional gating function adopts a two-layer MLP structure. The input of the two-layer MLP structure is the activation history window of the core polysemous neuron in the most recent several time steps and the context embedding of the network layer in which it is located. The core polysemous neuron outputs a gating scaling coefficient of a preset interval to dynamically adjust the output intensity of the neuron.
8. The method according to claim 7, characterized in that, The implementation of hierarchical and precise intervention through topology isolation technology includes: After the first level of intervention is performed, the activation intensity of the target hallucination path is obtained at several consecutive time steps. When it is determined that the activation intensity at several consecutive time steps increases by a preset activation range, the second level of intervention is triggered. After the second-level intervention is performed, the instantaneous activation subgraph corresponding to the large language model under the second-level intervention is obtained, and the sub-match confidence score between the instantaneous activation subgraph corresponding to the second-level intervention and the path feature template is determined; when the sub-match confidence score is higher than the preset confidence threshold, the third-level intervention is triggered. When the target hallucination path corresponds to a preset high-risk scenario, emergency intervention is performed, including: Obtain the core connecting edge of the target hallucination path and perform a weight reset operation on the core connecting edge to zero to forcibly cut off the erroneous information flow; the connecting edge weight of the core connecting edge is greater than a preset weight threshold; Initiating post-verification corresponding to the forced severing of the error information flow includes: obtaining the current model output corresponding to the forced severing of the error information flow; performing secondary verification on the current model output based on the knowledge database; retaining the current model output when the verification passes; and controlling the large language model to re-execute the generation process while maintaining the weight reset to zero when the verification fails.
9. The method of claim 1, wherein, The large language model is configured with a closed-loop evaluation and adaptive optimization module, which includes: The dual-objective evaluation unit is configured to establish a dual-core indicator system of hallucination suppression rate and model capability retention rate. The hallucination suppression rate is determined by a standard factual evaluation set, and the model capability retention rate is determined by a comprehensive capability evaluation set. Quantitative evaluation reports are output regularly. The parameter adaptive learning unit, coupled with the dual-objective evaluation unit, is configured to adaptively optimize hyperparameters based on meta-learning or Bayesian optimization algorithms, according to the quantization evaluation report. The hyperparameters include at least the intervention trigger threshold, noise intensity, attention adjustment amplitude, and gating scaling factor.
10. A large language model hallucination path precise blocking system, characterized in that, include: The hallucination determination module is used to acquire the hallucination-induced detection set and input it into the large language model, and to perform factual hallucination determination on the model output of the large language model in order to determine the model's factual hallucination output and the corresponding neuron activation sequence. The time-varying graph determination module is used to determine a time-varying graph based on the neuron activation sequence. The time-varying graph includes at least a set of neuron nodes corresponding to any word generation time, connection edges dynamically formed based on the activation correlation between neurons, and connection edge weights. The activation correlation between neurons is determined by mutual information and cosine similarity. The Shannon entropy determination module is used to determine the hallucination generation time window based on the factual hallucination output of the model, and to determine the node weighting degree of the time-varying graph within the hallucination generation time window. The node weighting degree is used to determine the structural entropy contribution and the Shannon entropy. The path extraction module is used to locate the hallucination output word node based on the gradient direction of neuron activation by the Shannon entropy, according to the factual hallucination output of the model, and to trace back based on the hallucination output word node, and extract the coherent neuron activation chain across multiple layers as candidate hallucination paths based on the structural entropy contribution. The intervention module is used to identify the target hallucination path during the model inference process based on the candidate hallucination path, and to implement hierarchical precise intervention through topological isolation technology to block the flow of erroneous information on the target hallucination path.