Large model illusion detection and suppression method and system based on logic type guidance
By constructing a text reasoning logic graph and guiding knowledge graph search, the problem of identifying and correcting complex reasoning-based hallucinations in large model-generated content is solved, achieving efficient and interpretable hallucination detection and suppression.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHENGZHOU UNIV
- Filing Date
- 2026-02-03
- Publication Date
- 2026-05-15
AI Technical Summary
Existing technologies struggle to effectively identify and suppress complex reasoning-based hallucinations in large model-generated content in real-time scenarios, especially hallucinations caused by logical breaks during multi-step reasoning, which involve high computational complexity and a huge search space.
By constructing a text reasoning logic graph and guiding it based on logical types, candidate entity subgraphs in the knowledge graph are matched. Path elimination rules and global logical consistency checks are used to accurately detect and correct logical conflicts, and semantic reconstruction is performed in conjunction with a pre-trained language model.
It significantly reduces computational complexity, accurately captures long-distance semantic relationships, improves the interpretability of hallucination detection and the logical consistency of generated content, and achieves efficient identification and correction of complex reasoning hallucinations.
Smart Images

Figure CN122047490A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of large model illusion detection technology, and in particular to a method and system for large model illusion detection and suppression based on logic type guidance. Background Technology
[0002] With the groundbreaking advancements in generative capabilities and general intelligence of large language models, their application potential across various vertical fields is increasingly evident. However, the inherent probabilistic generation mechanism of these models inevitably leads to illusion phenomena—the generation of seemingly fluent content that actually contradicts reality. Knowledge graphs, as a structured, interpretable, and reasonable form of knowledge representation, can explicitly characterize entities, relationships, and their semantic constraints, providing models with high-confidence factual references and logical support. Introducing knowledge graphs into the illusion detection and suppression process of large models helps to compensate for the shortcomings of large models in terms of factual consistency, verifiability, and interpretability.
[0003] In existing technologies, large-model hallucination detection is typically used as a means of quality assessment and credibility analysis of the results generated by large language models. Its detection process generally includes the following steps: First, the target text content generated by the large language model after receiving user input is obtained, specifically containing several factual descriptions, inference conclusions, or knowledge statements. Second, the target text content undergoes semantic parsing and structuring processing, dividing the natural language text into multiple detection units, and identifying corresponding entity information, attribute information, and relationship information between entities to form a set of knowledge assertions to be verified. Then, reference information is obtained using knowledge graph retrieval or external searches, and each detection unit in the target text content is analyzed for support from the reference information through rule matching, semantic similarity calculation, or discriminant model judgment to determine its degree of matching in terms of factual accuracy and semantic consistency. Subsequently, based on the consistency verification results, the target text content is judged for hallucination. When a detection unit cannot obtain effective support from the reference information or has obvious conflicts with the reference information, the detection unit is judged to have a hallucination risk; when multiple detection units are judged to have a hallucination risk, the target text content is deemed to have a hallucination problem. Finally, the hallucination detection results are output as a basis for subsequent content correction, regeneration, or manual review.
[0004] For example, Chinese patent application CN120104765A discloses a method and system for detecting hallucinations based on a large language model with a knowledge graph structure. The method includes: acquiring text data generated by a large language model, extracting triples from the text data to obtain a knowledge graph triple representation set; determining whether the triples in the knowledge graph triple representation set are hallucinations based on the large language model and a natural language reasoning model, and outputting the results of the two models as the final hallucination probability; and outputting the probability of each triple being hallucination and displaying it visually.
[0005] However, in the process of implementing the inventive technical solution in the embodiments of this application, it was found that the above-mentioned technology has at least the following technical problems:
[0006] The illusions of large models often stem not only from biases in a single fact, but also from breaks in reasoning logic. Validating such errors on a knowledge graph typically requires multi-hop reasoning across multiple entities. However, as the depth of reasoning increases, the number of candidate paths grows exponentially, resulting in a huge search space and extremely high computational complexity, making effective validation through exhaustive search in real-time scenarios difficult.
[0007] Against this backdrop, existing technologies (such as neural networks) have significant limitations in processing deep reasoning. They are susceptible to problems such as oversmoothing and loss of long-range dependencies, which leads to homogenization of node representations. They are unable to accurately capture the complex semantic relationships and implicit logic between distant nodes, and thus find it difficult to effectively identify complex reasoning illusions. Summary of the Invention
[0008] To address the technical problem of existing technologies' inability to effectively identify complex reasoning-based illusions in large model-generated content, this invention provides a method and system for detecting and suppressing large model illusions based on logic type guidance. The technical solution is as follows:
[0009] On the one hand, a method for detecting and suppressing illusions in large models based on logical types is provided. This method includes: parsing the text to be verified generated by the large model to construct a text reasoning logic graph, and matching candidate entity subgraphs in the knowledge graph based on the text reasoning logic graph; using directed edges and their logical types in the text reasoning logic graph as structural constraints, performing multi-hop path search in the candidate entity subgraphs, and retaining a set of valid candidate paths according to configured path elimination rules. The path elimination rules are configured as follows: quantifying the matching degree between the graph relationship in the current path and the corresponding logical type in the text reasoning logic graph, and eliminating path branches with a matching degree lower than a preset threshold; based on... The effective candidate path set performs consistency verification on the text reasoning logic graph, calculates the global logical consistency score between the text reasoning logic graph and the effective candidate path set. When the global logical consistency score is less than a preset safety threshold, it is determined that the text to be verified has a logical conflict, and the conflicting logical segment that caused the logical conflict is located. Based on the conflicting logical segment, the matching correct graph triplet is extracted from the candidate entity subgraph, and the semantic reconstruction correction of the conflicting logical segment is performed using the structural information of the correct graph triplet to generate the corrected text content. If it is determined that the text to be verified has a logical conflict, the corrected text content is output; otherwise, the text to be verified is output directly.
[0010] On the other hand, a large-scale model illusion detection and suppression system based on logical type guidance is provided, including: a logical graph matching module, a multi-hop path filtering module, a consistency verification module, a semantic reconstruction correction module, and a text verification output module. The logical graph matching module is used to parse the text to be verified generated by the large model to construct a text reasoning logical graph, and to match candidate entity subgraphs in the knowledge graph based on the text reasoning logical graph. The multi-hop path filtering module is used to use the directed edges and their logical types in the text reasoning logical graph as structural constraints to perform multi-hop path search in the candidate entity subgraph, and retain the set of valid candidate paths according to the configured path elimination rules. The path elimination rules are configured as follows: quantitatively judge the matching degree between the graph relationship in the current path and the corresponding logical type in the text reasoning logical graph, and eliminate the matching. The consistency verification module is used to verify the consistency of the text reasoning logic graph based on the set of valid candidate paths. It calculates the global logical consistency score between the text reasoning logic graph and the set of valid candidate paths. When the global logical consistency score is less than the preset safety threshold, it determines that the text to be verified has a logical conflict and locates the conflicting logical segment. The semantic reconstruction and correction module is used to extract the matching correct graph triples from the candidate entity subgraph based on the conflicting logical segments. It uses the structural information of the correct graph triples to perform semantic reconstruction and correction on the conflicting logical segments and generate the corrected text content. The text verification output module is used to output the corrected text content if the text to be verified has a logical conflict, otherwise it directly outputs the text to be verified.
[0011] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following:
[0012] This invention fundamentally solves the technical problem of existing technologies' inability to effectively identify and suppress complex reasoning illusions in large-model-generated content by introducing a reasoning consistency verification mechanism enhanced by knowledge graphs. This invention is no longer limited to verifying the correctness of a single fact, but instead constructs a textual reasoning logic graph by parsing the text to be verified. It explicitly models the multi-step reasoning relationships and implicit logic within the text, using this as structural constraints to guide multi-hop path searches in the knowledge graph. This effectively avoids the exponential expansion of the number of candidate paths as reasoning depth increases, significantly reducing the search space and computational complexity, and meeting real-time verification requirements.
[0013] Meanwhile, this invention abandons the strong dependence on deep graph neural networks, avoiding problems such as oversmoothing, loss of long-range dependencies, and homogenization of node representations that are common in existing technologies in deep reasoning scenarios. It can more accurately capture complex semantic relationships and reasoning logic between distant entities. By performing a global logical consistency check on the text reasoning logic graph and the selected set of valid candidate paths, this invention can not only accurately determine whether there are logical conflicts in the text to be verified, but also locate the specific logical segments that cause the conflicts, significantly improving the interpretability of the hallucination detection results. Based on this, this invention further utilizes the correct triples matched in the knowledge graph to perform structured semantic reconstruction of the conflicting logical segments, achieving automatic correction of hallucination content rather than simple interception or labeling. This effectively improves the logical consistency, knowledge reliability, and practical application value of the content generated by the large model in complex reasoning scenarios. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0015] Figure 1 A flowchart of a large-model hallucination detection and suppression method based on logic type guidance provided in this application embodiment;
[0016] Figure 2 A flowchart for constructing a text reasoning logic graph for a large-model hallucination detection and suppression method based on logic type guidance provided in this application embodiment;
[0017] Figure 3 The conflict logic segment localization logic diagram of the large model illusion detection and suppression method based on logic type guidance provided in the embodiments of this application. Detailed Implementation
[0018] Embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of the present disclosure are shown in the drawings, it should be understood that embodiments of the present disclosure may be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure.
[0019] It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure. In the description of the embodiments of this disclosure, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "this embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc., may refer to different or the same objects.
[0020] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.
[0021] With the widespread application of large-scale pre-trained language models in scenarios such as intelligent question answering, text generation, and decision support, the logical reliability and knowledge credibility of the generated content have become one of the important factors restricting practical implementation. Existing research shows that when large models generate complex reasoning content, deviations are often not solely due to missing facts or memory errors. More commonly, problems such as implicit premise errors, mismatched logical relationships, or broken reasoning chains occur during multi-step reasoning processes, thus creating a highly deceptive "reasoning illusion." Such illusions often appear semantically coherent and phrased reasonably on the surface, but they conflict with objective facts or common sense in terms of deep logic and knowledge dependencies, posing potential risks to user judgment and system decision-making.
[0022] To enhance the credibility of generated content, utilizing structured knowledge resources to validate the output of large models has become an important approach. Knowledge graphs, due to their explicit representation of entities, relationships, and their constraints, are widely used for fact consistency verification and reasoning support. However, in practical applications, complex reasoning illusions often involve multi-hop reasoning verification across multiple entities and relationships. As the reasoning depth increases, the number of candidate paths grows exponentially, leading to a sharp expansion of the search space and a significant increase in computational complexity. Traditional verification methods based on exhaustive search or relaxed heuristics are difficult to apply effectively in real-time scenarios.
[0023] Therefore, there is an urgent need for a technical solution that can explicitly model the text reasoning structure, effectively constrain the multi-hop search process of knowledge graphs, and achieve accurate detection and interpretable correction of complex reasoning illusions while ensuring computational efficiency, so as to make up for the shortcomings of existing methods in deep reasoning consistency verification and illusion suppression.
[0024] Firstly, such as Figure 1 The diagram shown is a flowchart of a large-model hallucination detection and suppression method based on logical type guidance provided in an embodiment of this application. (Refer to...) Figure 1 The method includes the following steps: logical graph matching, multi-hop path filtering, consistency verification, semantic reconstruction correction, and text verification output.
[0025] The first step in the large-model illusion detection and suppression method guided by logic type, namely logic graph matching, specifically involves: parsing the text to be verified generated by the large model to construct a text reasoning logic graph, and then matching candidate entity subgraphs in the knowledge graph based on the text reasoning logic graph. This step constructs an explicit text reasoning logic graph by performing structured parsing on the text generated by the large model, expressing the entities, relationships, and reasoning directions originally implicit in natural language in a graph structure, transforming the reasoning process from an invisible language pattern into a computable logical structure. Matching candidate entity subgraphs in the knowledge graph on this basis can narrow the verification scope from a large-scale unconstrained search across the entire graph to a local subspace highly related to the semantics of the current text, thereby significantly reducing the search scale of subsequent reasoning verification, improving computational efficiency, and providing a structured alignment foundation for subsequent logical consistency checks.
[0026] It should be noted that, for example Figure 2 The diagram shown is a flowchart of the text reasoning logic graph construction process for the large-model hallucination detection and suppression method based on logic type guidance provided in this application embodiment. (Refer to...) Figure 2 The specific steps for constructing a text reasoning logic graph include:
[0027] First, dependency parsing is performed on the text to be verified to extract entities as entity nodes, and text fragments with dependency relationships between entity nodes are identified as candidate relation words. Specifically, natural language processing tools (such as dependency parsers) are used to parse sentence structure, identify subjects, objects, modifiers, and their dependency relationship structures in the text, and extract entities with clear semantic orientations as entity nodes. Simultaneously, the dominance and subordination relationships between words in the sentence are analyzed, and text fragments with direct or indirect dependency relationships between entity nodes are extracted. These fragments are considered potential semantic connection bridges, i.e., candidate relation words. Candidate relation words can include verbs, prepositional phrases, conjunction structures, or modifiers with inferential meaning, used to characterize the possible logical connections between entities.
[0028] Next, candidate relation words are matched with a pre-defined set of logical types. This set contains keywords representing causal, temporal, or conditional reasoning logic, along with corresponding logical types for classification rules. Specifically, before designing a large-scale illusion detection and suppression method guided by logical types, a set of logical types is pre-constructed. This set includes not only keywords representing various types of reasoning logic (such as because, therefore, leading to, if, after, etc.) but also corresponding classification rules. The extracted candidate relation words are compared with this set of logical types to determine whether they belong to words representing causal (e.g., leading to), temporal (e.g., subsequently), or conditional (e.g., if, then) reasoning logic. Only candidate relation words that match the keyword features or classification rules in the set are confirmed as words with reasoning significance.
[0029] Secondly, successfully matched candidate relation words are labeled as inference predicates. Directed edges connecting entity nodes are determined based on the logical type of the inference predicates to construct a text inference logic graph. Specifically, for causal logic, directed edges point from the cause entity to the result entity; for temporal logic, directed edges point from earlier events to later events. In this way, the text to be verified is transformed into a text inference logic graph composed of entity nodes and directed edges with clear logical directions and types, thus providing a structured data foundation for subsequent knowledge graph matching and logical verification.
[0030] By constructing the text reasoning logic graph as described above, this invention effectively achieves structured modeling of complex reasoning relationships in text generated by large models, laying a reliable foundation for subsequent knowledge graph constraint search, consistency verification, and semantic correction.
[0031] As a further approach, candidate entity subgraphs in the knowledge graph are matched based on text reasoning logic graphs, specifically including:
[0032] First, entity nodes in the text reasoning logic graph are mapped to corresponding entities in the knowledge graph, serving as seed nodes. Specifically, entity nodes extracted from the text reasoning logic graph are mapped to their unique entity identifiers in the knowledge graph using entity linking technology. Second, the directed edges in the text reasoning logic graph are traversed, and the logic type corresponding to each directed edge is obtained.
[0033] Next, the target graph relation set corresponding to each directed edge logic type is queried from the pre-defined logic-relation mapping table. The logic-relation mapping table defines multiple relation predicates corresponding to the same logic type in the knowledge graph; this mapping table predefines the correspondence between logic types in natural language and specific relation predicates in the knowledge graph. Since relational expressions in the knowledge graph are often more specific and diverse than text logic, the same logic type may correspond to multiple graph relation predicates. For example, when text logic is causal, the mapping table may correspond to multiple specific relation predicates in the graph, such as cause, trigger, result, and reason. The query retrieves all possible target graph relation sets covered by the current directed edge logic type.
[0034] Here is a specific example of a logical-relational mapping representation:
[0035] Logical types Logical description Target Graph Relationship Set Causal logic This indicates that there is a causal relationship between two entities that leads to, causes, or produces something. Cause, Result, Induce Sequential Logic It indicates the chronological order or evolutionary relationship of two entities on the timeline. OccursBefore (occurs before), Precede (previous to), Follows (follows) Conditional Logic This indicates that one entity is a prerequisite or necessary condition for the occurrence of another entity. Prerequisite, Require, DependOn Subordinate logic It represents the composition or attribution relationship between entities (as auxiliary logic). PartOf (component), LocatedIn (located in), SubClassOf (subclass)
[0036] For example, suppose that when constructing a text reasoning logic graph, a directed edge is identified between two entity nodes, "smoking" and "lung cancer," and the logic type of this edge is determined to be "causal logic." During knowledge graph matching, the aforementioned mapping table is consulted. According to the mapping table, the target graph relation set corresponding to "causal logic" is {Cause, ResultIn, Induce}. Subsequently, a search is performed in the knowledge graph starting from the seed nodes corresponding to "smoking" and "lung cancer." As long as the connection relationship (i.e., predicate) between these two entities in the graph belongs to any of the aforementioned sets (e.g., the graph contains triples <smoking, Cause, lung cancer> or <smoking, Induce, lung cancer>), this connection path will be preserved and included in the candidate entity subgraph. This method overcomes the problem of incomplete consistency between textual terms (such as "cause") and graph predicates (such as ResultIn), ensuring the comprehensiveness of the retrieval.
[0037] Then, starting from the seed node, a connection path containing any relation predicate in the target graph relation set is retrieved in the knowledge graph, and the retrieved connection path and its associated nodes are constructed as a candidate entity subgraph.
[0038] This implementation method effectively solves problems such as difficulty in aligning text reasoning with knowledge graphs, excessive search space, and inaccurate relationship matching by constructing knowledge graph subgraphs guided by logical types, thus providing a solid foundation for the efficient detection and correction of complex reasoning illusions.
[0039] The second step of the large-model illusion detection and suppression method based on logical type guidance, namely multi-hop path filtering, specifically involves: using directed edges and their logical types in the text reasoning logic graph as structural constraints, performing multi-hop path search in the candidate entity subgraph, and retaining the set of valid candidate paths according to the configured path elimination rules. The path elimination rules are configured to: quantify the matching degree between the graph relationships in the current path and the corresponding logical types in the text reasoning logic graph, and eliminate path branches with a matching degree lower than a preset threshold. This step utilizes directed edges and their logical types in the text reasoning logic graph as structural constraints to perform multi-hop path search in the candidate entity subgraph, and pre-prunes path branches that do not conform to the semantic logic of the text through matching quantification and threshold elimination mechanisms. This transforms the search process from indiscriminate expansion to semantically controlled directional expansion, effectively suppressing the exponential expansion of paths that occurs with increasing reasoning depth. While ensuring multi-hop reasoning capabilities, it significantly compresses the search space and computational complexity, thereby improving real-time performance and scalability in complex reasoning scenarios.
[0040] It should be added that, in order to achieve fine-grained constraints on the consistency between knowledge graph relationships and text reasoning logic during path search, a semantic matching quantification judgment is performed on the logical types of the corresponding positions in the text reasoning logic graph involved in the current path during each path expansion. As an example of the first aspect, quantifying the matching degree between the graph relationships in the current path and the corresponding logical types in the text reasoning logic graph specifically includes:
[0041] First, obtain the logical type of the directed edge corresponding to the current jump in the text reasoning logic graph, and the relational predicate of the knowledge graph corresponding to the current path in the candidate entity subgraph; that is, one side is the logical type (e.g., causality) of the directed edge corresponding to the current jump step in the text reasoning logic graph, which represents the abstract logical relationship expressed by the text intent; the other side is the relational predicate (e.g., causing) defined in the knowledge graph corresponding to the current search path in the candidate entity subgraph, which represents the specific connection relationship between entities in the graph.
[0042] Next, pre-trained language models (such as BERT and RoBERTa) are used to encode the acquired logical types and relational predicates, transforming them into input sequences that the model can process (e.g., by adding special markers). High-dimensional semantic features are extracted through the deep Transformer structure of the model to generate corresponding logical type semantic vectors and graph relational semantic vectors.
[0043] Secondly, calculate the semantic similarity (cosine similarity) between the logical type semantic vector and the graph relation semantic vector, and use it as the matching degree.
[0044] Traditional keyword-based literal matching methods often fail to handle synonyms or polysemous words. For example, in textual logic, "cause" might be "lead," while in graph relations, it might be "induce," despite their different literal meanings. This embodiment introduces a pre-trained language model to generate semantic vectors, capturing the deep semantic equivalence between logical types and graph predicates. Even if the words are dissimilar, a high matching degree can be achieved as long as the semantics are highly related. This semantic vector-based quantitative judgment method significantly improves the accuracy of path selection, effectively avoiding the erroneous rejection of correct reasoning paths due to differences in lexical expression, while maintaining the efficiency of the computational process.
[0045] To further enhance the overall perception of reasoning context in path matching, the second aspect of the implementation involves expanding the matching granularity from single logical types and relational predicates to triple-level semantic alignment that includes entity context. This quantifies the matching degree between the graph relations in the current path and the corresponding logical types in the text reasoning logic graph, specifically including:
[0046] First, construct text triples corresponding to the text reasoning logic graph and graph triples corresponding to the candidate entity subgraphs. A text triple contains the predecessor entity node, logical type, and successor entity node in the text reasoning logic graph, while a graph triple contains the predecessor graph node, graph relation predicate, and successor graph node. Specifically, for example, a text triple consists of the predecessor entity node (subject), the logical type (predicate), and the successor entity node (object) in the text reasoning logic graph, such as (smoking, causation, lung cancer). A graph triple consists of the predecessor graph node, graph relation predicate, and successor graph node in the candidate entity subgraph, such as (smoking entity, causing, lung cancer entity).
[0047] Next, the pre-trained language model is used to encode the text triples and graph triples respectively to generate text global context vectors and graph global context vectors. Then, the similarity (cosine similarity) between the text global context vector and the graph global context vector is calculated and used as the matching degree.
[0048] Compared to comparing only isolated relational predicates, this embodiment incorporates entity nodes into the consideration, effectively resolving ambiguities arising from relational predicates in different entity contexts. For example, under certain entity combinations, the same logical type may correspond to drastically different graph relations, or a relation in the graph may have a special meaning when involving a specific entity. Through triple-level global context vector encoding, this embodiment can accurately capture the inherent semantic logic of the complete structure of entity, relation, and entity, thereby more accurately determining whether the text reasoning path truly matches the graph fact path. This global perspective matching strategy significantly improves the robustness and accuracy of hallucination detection in complex scenarios.
[0049] By combining relational semantic-level matching in the first aspect with triplet context-level matching in the second aspect, this invention forms a two-layer semantic filtering mechanism in the multi-hop path search process, which consists of abstract logical constraints and specific contextual consistency verification. While ensuring search efficiency, it significantly improves the semantic credibility of reasoning paths, providing a high-quality reasoning support foundation for the accurate detection and structured correction of complex reasoning illusions.
[0050] The third step in the logic-type-guided large-model hallucination detection and suppression method, namely consistency verification, specifically involves: performing consistency verification on the text reasoning logic graph based on the effective candidate path set, calculating the global logical consistency score between the text reasoning logic graph and the effective candidate path set; and determining that the text to be verified has a logical conflict when the global logical consistency score is less than a preset safety threshold, and locating the conflicting logical segment. This step, by aligning and measuring the consistency between the selected effective candidate path set and the text reasoning logic graph, and calculating the global logical consistency score, not only judges whether the text reasoning is consistent with the logical structure supported by the knowledge graph at the overall level, but also further locates the specific logical segment causing the conflict when the score is lower than the safety threshold. This upgrades hallucination detection from traditional local fact verification to global logical verification oriented towards the complete reasoning chain, significantly improving the ability to identify complex reasoning hallucinations and enhancing the interpretability and traceability of the detection results.
[0051] It should be noted that the calculation of the global logical consistency score between the text reasoning logic graph and the set of valid candidate paths specifically includes:
[0052] First, the text reasoning logic graph is traversed to extract connected paths as text reasoning path sequences. Then, for each text reasoning path sequence, its path score in the valid candidate path set is calculated, and the graph path corresponding to the maximum path score is selected as the target graph path. The path score is the arithmetic mean of the node entity overlap and the path topology similarity. The node entity overlap is obtained using an entity alignment algorithm or a string similarity calculation tool (such as the Jaccard similarity coefficient based on edit distance). The path topology similarity is obtained using a graph sequence alignment algorithm or the longest common subsequence (LCS) algorithm tool.
[0053] Secondly, the semantic similarity between the logical types in the text reasoning path sequence and the relational predicates in the target graph path is calculated (by calculating the distance between semantic vectors) to obtain the path consistency score; then, the path consistency scores of all text reasoning path sequences are averaged to obtain the global logical consistency score.
[0054] This implementation method achieves refined, interpretable, and quantifiable evaluation of the complex reasoning logic of large model-generated text through path-level alignment and global consistency modeling, effectively improving the accuracy and practicality of illusion detection and suppression methods in deep reasoning scenarios.
[0055] As a further option, such as Figure 3 The diagram shown is a logic diagram for locating conflict logic fragments in the large-model hallucination detection and suppression method based on logic type guidance provided in this application embodiment. (Refer to...) Figure 3 Locate the conflicting logical segments that cause the logical conflict, specifically including:
[0056] First, the text reasoning path sequence with the lowest path consistency score is selected as the abnormal path sequence. The abnormal path sequence is decomposed to obtain a preset number of consecutive text triplet segments. The optimal matching similarity (i.e., the maximum value of the path consistency score) of each text triplet segment in the effective candidate path set is calculated. Then, the text triplet segments with the optimal matching similarity less than the preset segment threshold are identified as conflict logic segments, and character indexing is performed based on the first and last entity nodes corresponding to the conflict logic segments.
[0057] This mechanism combines path-level filtering with triplet-level fine-grained matching to achieve high-precision localization of complex reasoning-based illusions, providing crucial support for subsequent knowledge graph-based targeted correction.
[0058] The fourth step in the large-model illusion detection and suppression method guided by logic type, namely semantic reconstruction correction, specifically involves: extracting matching correct graph triples from candidate entity subgraphs based on conflicting logic fragments; and using the structural information of the correct graph triples to perform semantic reconstruction correction on the conflicting logic fragments, generating corrected text content. This step, for the located conflicting logic fragments, extracts semantically matching and logically correct graph triples from candidate entity subgraphs and uses their structural relationships to semantically reconstruct the original erroneous reasoning, achieving targeted correction of erroneous logic in the text. It not only identifies problems but also provides corrected content with factual basis and logical support based on structured knowledge, avoiding the information loss problems caused by simply indicating errors or deleting content, thus significantly improving the knowledge reliability and expressive completeness of the generated results.
[0059] It should be noted that extracting the correct matching graph triples from the candidate entity subgraph specifically includes:
[0060] First, the conflict logic fragments are parsed to identify the corresponding subject and object entities as the head and tail entities of the path to be corrected. Second, the candidate entity subgraph is traversed to retrieve all candidate graph paths connecting the head and tail entities.
[0061] Next, when there is at least one candidate graph path, the pre-trained language model is used to perform semantic encoding on the original logic type corresponding to the relational predicates and conflict logic fragments in each candidate graph path to calculate semantic similarity, and this is used as a screening index. The candidate graph path with the highest screening index is selected as the target correction path.
[0062] Then, the graph relation predicates corresponding to the head entity and tail entity are extracted from the target correction path, and the head entity, graph relation predicates and tail entity are combined into the correct graph triples for semantic reconstruction correction.
[0063] As a further approach, the structural information of the correct graph triples is used to semantically reconstruct and correct conflicting logical fragments, specifically including:
[0064] First, based on the correct graph triples, a target fact description containing a head entity, a graph relation predicate, and a tail entity is generated. For example, the triple (smoking, causes, lung cancer) is transformed into smoking causes lung cancer. Next, a correction prompt is constructed. The correction prompt contains the context window of the conflicting logic fragment in the text to be verified, the conflicting logic fragment, and the target fact description, and carries constraint instructions to indicate that the entities remain unchanged and the logical relations are corrected.
[0065] Then, the correction prompts are input into a pre-set large language model for inference, generating corrected text fragments to replace conflicting logic fragments; finally, the corrected text fragments are used to replace the conflicting logic fragments in the text to be verified, and the corrected text content is output.
[0066] Through the synergistic cooperation of the above two steps, this invention can not only accurately locate and identify reasoning illusions in text, but also perform targeted, interpretable and high-quality semantic correction of conflicting logic based on the correct structured facts provided by the knowledge graph, thereby significantly improving the credibility, stability and practical value of large model-generated text in complex reasoning scenarios.
[0067] The fifth step in the logic-type-guided large-model illusion detection and suppression method, namely text verification output, specifically: if the text to be verified is determined to have a logical conflict, the corrected text content is output; otherwise, the text to be verified is output directly. This step achieves adaptive processing of the generated content by selecting to output the original text or the corrected text based on the existence of logical conflicts in the final stage. When the text logic is consistent, the original expression is kept undisturbed, avoiding excessive intervention; when there is a reasoning conflict, the corrected result is automatically output, forming a closed-loop mechanism of detection, judgment, correction, and output. While ensuring the security and credibility of the content, it also takes into account the naturalness and stability of the generated results, further improving the usability and user experience in real-world application scenarios.
[0068] Secondly, embodiments of this application also provide a large-scale illusion detection and suppression system based on logical type guidance. The system includes: a logical graph matching module, a multi-hop path filtering module, a consistency verification module, a semantic reconstruction correction module, and a text verification output module.
[0069] Specifically, the logic graph matching module is used to parse the text to be verified generated by the large model to construct a text reasoning logic graph, and to match candidate entity subgraphs in the knowledge graph based on the text reasoning logic graph.
[0070] The multi-hop path filtering module uses directed edges and their logical types in the text reasoning logic graph as structural constraints to perform multi-hop path search in the candidate entity subgraph and retain the set of valid candidate paths according to the configured path elimination rules. The path elimination rules are configured as follows: quantitatively judge the matching degree between the graph relationship in the current path and the corresponding logical type in the text reasoning logic graph, and eliminate path branches with a matching degree lower than a preset threshold.
[0071] The consistency verification module is used to perform consistency verification on the text reasoning logic graph based on the set of valid candidate paths. It calculates the global logical consistency score between the text reasoning logic graph and the set of valid candidate paths. When the global logical consistency score is less than the preset security threshold, it determines that there is a logical conflict in the text to be verified and locates the conflicting logical segment that caused the logical conflict.
[0072] The semantic reconstruction and correction module is used to extract the correct graph triples from the candidate entity subgraph based on the conflict logic fragments, and use the structural information of the correct graph triples to perform semantic reconstruction and correction on the conflict logic fragments, generating the corrected text content.
[0073] The text verification output module is used to output the corrected text content if the text to be verified is determined to have a logical conflict; otherwise, it directly outputs the text to be verified.
[0074] In summary, this invention addresses the problem of the exponential growth in the number of candidate paths during cross-entity multi-hop reasoning in knowledge graphs, leading to a huge search space and extremely high computational complexity. It utilizes directed edges and their logical types in the text reasoning logic graph as structural constraints, coupled with preset path elimination rules for guided search. Furthermore, by combining a mechanism that quantifies matching degree and promptly eliminates invalid path branches below a threshold, the search space is significantly compressed, and computational consumption is substantially reduced. This makes it possible to efficiently verify content generated by large models in real-time scenarios.
[0075] Secondly, addressing the limitations of existing graph neural network technologies in handling deep reasoning, such as susceptibility to oversmoothing, homogenization of node representations, and loss of long-range dependencies, this invention does not rely solely on low-dimensional embedding representations of nodes. Instead, it directly performs multi-hop path search and matching based on graph structure logic. This mechanism can accurately capture the complex semantic relationships and implicit logic between distant nodes, effectively overcoming the technical bottleneck of information dilution in deep reasoning paths in existing technologies and improving the accuracy of deep logic judgments.
[0076] Furthermore, this invention verifies the content generated by a large model from the perspective of the overall logical chain by calculating the global logical consistency score between the text reasoning logic graph and the set of valid candidate paths. Compared to the limitations of traditional techniques that can only perform shallow fact-checking, this method can keenly identify complex reasoning illusions arising from logical breaks and accurately generate specific fragments of logical conflict, significantly improving the depth and specificity of detection.
[0077] Finally, this invention constructs a closed-loop processing mechanism from detection to correction. This mechanism not only effectively identifies hallucinations but also, upon discovering logical conflicts, utilizes the correct graph triples and their structural information extracted from the knowledge graph to semantically reconstruct and correct conflicting segments. This process directly uses prior knowledge to correct logical deviations in the generated content, thereby suppressing the propagation of hallucinations at the source and significantly improving the logicality, reliability, and overall quality of the large model's output.
[0078] Through the above description of the implementation methods, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the above functions can be divided into different functional modules to complete all or part of the functions described above.
[0079] In the embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between devices or units, and may be electrical, mechanical, or other forms.
[0080] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units, located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0081] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0082] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to the solution, or all or part of the technical solution, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0083] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A large-scale hallucination detection and suppression method based on logical type guidance, characterized in that, Includes the following steps: The text to be verified generated by the large model is parsed to construct a text reasoning logic graph, and candidate entity subgraphs in the knowledge graph are matched based on the text reasoning logic graph. Using directed edges and their logical types in the text reasoning logic graph as structural constraints, multi-hop path search is performed in the candidate entity subgraph, and a set of valid candidate paths is retained according to the configured path elimination rules. The path elimination rules are configured as follows: quantitatively judge the matching degree between the graph relationship in the current path and the corresponding logical type in the text reasoning logic graph, and eliminate path branches with a matching degree lower than a preset threshold. The consistency of the text reasoning logic graph is verified based on the effective candidate path set. The global logical consistency score between the text reasoning logic graph and the effective candidate path set is calculated. When the global logical consistency score is less than the preset security threshold, it is determined that there is a logical conflict in the text to be verified, and the conflicting logical segment that caused the logical conflict is located. Based on the conflict logic fragment, the correct graph triplet is extracted from the candidate entity subgraph. The structural information of the correct graph triplet is used to semantically reconstruct and correct the conflict logic fragment, and the corrected text content is generated. If the text to be verified is determined to have a logical conflict, the corrected text content will be output; otherwise, the text to be verified will be output directly.
2. The method for detecting and suppressing large-scale hallucinations based on logical type guidance as described in claim 1, characterized in that, The specific construction steps of the text reasoning logic graph include: Dependency parsing is performed on the text to be verified to extract entities as entity nodes and identify text fragments with dependency relationships between entity nodes as candidate relation words. The candidate relation words are matched with a preset set of logical types, which includes keywords used to characterize causal, temporal, or conditional reasoning logic and the logical types corresponding to the classification rules. Candidate relation words that are successfully matched are marked as inference predicates. Directed edges connecting entity nodes are determined based on the logical type of the inference predicates in order to construct a text inference logic graph.
3. The method for detecting and suppressing large-scale hallucinations based on logical type guidance as described in claim 2, characterized in that, The matching of candidate entity subgraphs in the knowledge graph based on text reasoning logic graphs specifically includes: Map the entity nodes in the text reasoning logic graph to the corresponding entities in the knowledge graph, and use them as seed nodes; Traverse the directed edges in the text reasoning logic graph and obtain the logic type corresponding to each directed edge; The set of target graph relations corresponding to each directed edge logic type is queried from the preset logic-relation mapping table. The logic-relation mapping table is used to define multiple relation predicates corresponding to the same logic type in the knowledge graph. Starting from the seed node, retrieve the connection path in the knowledge graph that contains any relation predicate in the relation set of the target graph, and construct the retrieved connection path and its associated nodes as a candidate entity subgraph.
4. The method for detecting and suppressing large-scale hallucinations based on logical type guidance as described in claim 1, characterized in that, The quantitative determination of the matching degree between the graph relationships in the current path and the corresponding logical types in the text reasoning logic graph specifically includes: Obtain the logical type of the directed edge corresponding to the current jump in the text reasoning logic graph, and the relational predicate of the knowledge graph corresponding to the current path in the candidate entity subgraph; The acquired logical types and relational predicates are encoded using a pre-trained language model to generate corresponding logical type semantic vectors and graph relational semantic vectors. Calculate the semantic similarity between the logical type semantic vector and the graph relation semantic vector, and use it as the matching degree.
5. The method for detecting and suppressing large-scale hallucinations based on logical type guidance as described in claim 1, characterized in that, The quantitative determination of the matching degree between the graph relationships in the current path and the corresponding logical types in the text reasoning logic graph specifically includes: Construct text triples corresponding to the text reasoning logic graph and graph triples corresponding to the candidate entity subgraphs; The text triplet contains the predecessor entity node, logic type and successor entity node in the text reasoning logic graph, and the graph triplet contains the predecessor graph node, graph relation predicate and successor graph node. The text triples and graph triples are encoded using a pre-trained language model to generate text global context vectors and graph global context vectors respectively. Calculate the similarity between the text global context vector and the graph global context vector, and use it as the matching score.
6. The method for detecting and suppressing large-scale hallucinations based on logical type guidance as described in claim 1, characterized in that, The calculation of the global logical consistency score between the text reasoning logic graph and the set of valid candidate paths specifically includes: Traverse the text reasoning logic graph and extract connected paths as a text reasoning path sequence; For each text reasoning path sequence, calculate the path score of each graph path in the effective candidate path set, and select the graph path corresponding to the maximum path score as the target graph path. The path score is the arithmetic mean of the node entity overlap degree and the path topology similarity. Calculate the semantic similarity between the logical types in the text reasoning path sequence and the relational predicates in the target graph path to obtain the path consistency score; The global logical consistency score is obtained by averaging the path consistency scores of all text reasoning path sequences.
7. The method for detecting and suppressing large-scale hallucinations based on logical type guidance as described in claim 6, characterized in that, The conflicting logical segments that cause logical conflicts in the positioning specifically include: The text reasoning path sequence with the lowest path consistency score is selected as the abnormal path sequence. The abnormal path sequence is decomposed to obtain a preset number of consecutive text triple fragments. The optimal matching similarity of each text triple fragment in the effective candidate path set is calculated. Text triplet segments with the best matching similarity less than a preset segment threshold are identified as conflict logic segments, and character indexing is performed based on the first and last entity nodes corresponding to the conflict logic segments.
8. The method for detecting and suppressing large-scale hallucinations based on logical type guidance as described in claim 1, characterized in that, The extraction of the correct matching graph triples from the candidate entity subgraph specifically includes: Analyze conflicting logic fragments to identify the corresponding subject and object entities as the head and tail entities of the path to be corrected; Traverse the candidate entity subgraph and retrieve all candidate graph paths that connect the head entity and the tail entity; When there is at least one candidate graph path, the pre-trained language model is used to semantically encode the original logic type corresponding to the relational predicate and conflict logic fragment in each candidate graph path to calculate the semantic similarity, and this is used as a screening index. The candidate graph path with the highest screening index is selected as the target correction path. Extract the graph relation predicates corresponding to the head entity and tail entity from the target correction path, and combine the head entity, graph relation predicates and tail entity into the correct graph triples for semantic reconstruction correction.
9. The method for detecting and suppressing large-scale hallucinations based on logical type guidance as described in claim 8, characterized in that, The semantic reconstruction and correction of conflicting logical fragments using the structural information of correct graph triples specifically includes: Based on the correct graph triples, generate a target fact description that includes head entity, graph relation predicate, and tail entity; Construct a correction prompt word, which includes a context window of the conflicting logic fragment in the text to be verified, the conflicting logic fragment, and a description of the target fact, and carries a constraint instruction to indicate that the entities remain unchanged and the logical relationship is corrected. The correction prompts are input into a pre-built large language model for inference, generating corrected text fragments to replace conflicting logic fragments; The corrected text fragment replaces conflicting logical fragments in the text to be verified in situ, and then integrates and outputs the corrected text content.
10. A large-model hallucination detection and suppression system based on logical type guidance, employing the large-model hallucination detection and suppression method based on logical type guidance as described in any one of claims 1-9, characterized in that, include: The system includes a logic graph matching module, a multi-hop path filtering module, a consistency verification module, a semantic reconstruction and correction module, and a text verification output module. The logic graph matching module is used to parse the text to be verified generated by the large model to construct a text reasoning logic graph, and to match candidate entity subgraphs in the knowledge graph based on the text reasoning logic graph. The multi-hop path filtering module is used to use the directed edges and their logical types in the text reasoning logic graph as structural constraints to perform multi-hop path search in the candidate entity subgraph, and retain the effective candidate path set according to the configured path elimination rules. The path elimination rules are configured as follows: quantitatively judge the matching degree between the graph relationship in the current path and the corresponding logical type in the text reasoning logic graph, and eliminate path branches with a matching degree lower than a preset threshold. The consistency verification module is used to perform consistency verification on the text reasoning logic graph based on the effective candidate path set, calculate the global logical consistency score between the text reasoning logic graph and the effective candidate path set, and determine that the text to be verified has a logical conflict when the global logical consistency score is less than the preset security threshold, and locate the conflicting logical segment that caused the logical conflict. The semantic reconstruction and correction module is used to extract the matching correct graph triples from the candidate entity subgraph based on the conflict logic fragments, and use the structural information of the correct graph triples to perform semantic reconstruction and correction on the conflict logic fragments to generate the corrected text content. The text verification output module is used to output the corrected text content if it determines that the text to be verified has a logical conflict, otherwise it directly outputs the text to be verified.