Method for detecting hallucination of large model based on atomic fact and entity relation graph

By constructing a hallucination dataset and the large-scale hallucination detection model Cuckoo, the hallucination problem of large language models is solved, achieving efficient and low-cost hallucination recognition and correction, applicable to large Chinese and English language models.

CN121525665BActive Publication Date: 2026-04-14JIANGXI NORMAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JIANGXI NORMAL UNIV
Filing Date
2026-01-15
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing large-scale language models are easily misled by unrealistic contexts, leading to illusions. Existing methods such as retrieval enhancement generation and model fine-tuning suffer from limitations in retrieval quality and high costs.

Method used

By constructing an illusion dataset and utilizing the atomic fact decomposition module, entity relationship graph construction module, and illusion detection and correction module, the Cuckoo large-scale illusion detection model is constructed to identify and mask the contextual illusion information of nodes in the entity relationship graph.

Benefits of technology

It effectively identifies and corrects illusions, improves the accuracy and efficiency of large language models, reduces resource requirements, and is applicable to large Chinese and English language models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121525665B_ABST
    Figure CN121525665B_ABST
Patent Text Reader

Abstract

The application discloses a hallucination detection method based on atomic facts and entity relation graphs, and belongs to the technical field of natural language processing. The method steps are as follows: a hallucination dataset is constructed and a real question and answer dataset is obtained; a large model hallucination detection model is constructed, the large model hallucination detection model comprising an atomic fact decomposition module, an entity relation graph construction module and a hallucination detection and correction module; the atomic fact decomposition module decomposes context information into an atomic fact list through a large language model; the entity relation graph construction module obtains an entity relation graph from the atomic fact list through the large language model; the hallucination detection and correction module identifies and masks hallucination information of the context of nodes in the entity relation graph through the large language model, and obtains a correct reply that has been corrected for hallucination. In order to alleviate the hallucination problem of the large language model, the hallucination detection and correction module is used to identify and mask the unreal context in the input to reduce the hallucination problem.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing technology, and in particular to a method for detecting large-scale illusions based on atomic facts and entity relationship graphs. Background Technology

[0002] Since their advent, Large Language Models (LLMs) have brought significant improvements to fields such as text generation and human-computer dialogue. However, with the deep application of LLMs, they are susceptible to being misled by unrealistic contexts, leading to the emergence of the "illusion" problem. In LLMs, illusion is defined as the phenomenon where the LLM generates seemingly reasonable content that is actually incorrect, irrelevant to the input prompts, or even contradictory. Furthermore, illusion is particularly prominent in specialized fields, where timely, accurate, and logically consistent content is crucial.

[0003] To mitigate the illusion problem of large language models, existing research mainly employs retrieval-enhanced generation methods and model fine-tuning and alignment. However, both retrieval-enhanced generation and model fine-tuning / alignment methods have certain limitations.

[0004] (1) The retrieval-enhanced generation method has the problem that the retrieval quality determines the upper limit, that is, the ceiling of the retrieval-enhanced generation system is entirely determined by the quality of its retrieval link. If the retrieval system cannot find the correct and relevant information, or if the information found is incorrect or outdated, then no matter how powerful the subsequent large language model is, it will not be able to generate the correct answer.

[0005] (2) The methods based on model fine-tuning and alignment are significantly costly and time-consuming. Fine-tuning is a resource-intensive process. It requires: high-quality datasets, a large amount of computing resources, expensive GPU clusters, training time of several weeks or even longer, and professional personnel. Moreover, this method also suffers from the problems of static and outdated knowledge. Summary of the Invention

[0006] To address the shortcomings of existing technologies, this invention reduces the hallucination problem by identifying and masking unrealistic contexts in the input through atomic fact decomposition.

[0007] To achieve the above objectives, this invention provides a large-model illusion detection method based on atomic facts and entity relationship graphs, comprising the following steps:

[0008] Step S1: Construct the illusion dataset and obtain the real question-and-answer dataset;

[0009] Step S2: Construct a large-scale hallucination detection model, which includes an atomic fact decomposition module, an entity relationship graph construction module, and a hallucination detection and correction module.

[0010] Step S3: The atomic fact decomposition module decomposes the contextual information into a list of atomic facts using a large language model;

[0011] Step S4: The entity relationship graph construction module obtains the entity relationship graph from the list of atomic facts through a large language model;

[0012] Step S5, the hallucination detection and correction module, uses a large language model to identify and mask the hallucination information of the context of nodes in the entity relationship graph, and obtains the correct answer for the corrected hallucination;

[0013] Step S6: Validate the performance of the large-scale hallucination detection model using the hallucination dataset and the obtained real question-and-answer dataset.

[0014] Further, in step S1, an illusion dataset is constructed and a real question-and-answer dataset is obtained; wherein, the constructed illusion dataset includes illusion type text, question text, best answer text, correct answer text, incorrect answer text, multiple-choice task text, and probability multiple-choice task text; the specific steps are as follows:

[0015] Step S11: Download the publicly available files and divide the obtained files into current files and obsolete files;

[0016] Step S12: Compare the current provisions of the existing documents with the repealed provisions of the repealed documents, filter out the consistent provisions, and retain the inconsistent provisions;

[0017] Step S13: Construct a question based on inconsistent regulations to obtain question text; respond to the constructed question based on current regulations to obtain best answer text; the large language model responds to the constructed question based on current regulations to obtain correct answer text; and the large language model responds to the constructed question based on obsolete regulations to obtain incorrect answer text.

[0018] Step S14: By comparing the text of the wrong answer with the text of the correct answer, four types of illusions are statistically identified: time illusion, content illusion, location illusion, and name illusion.

[0019] Step S15: The multiple-choice task text includes question text, context information, a correct option, and an incorrect option. The context information is the dialogue history in the human-computer dialogue, the correct option is the correct answer text, and the incorrect option is the incorrect answer text. The probabilistic multiple-choice task text includes: question text and context information.

[0020] Step S16: Obtain the real question-and-answer dataset.

[0021] Furthermore, in step S3, the atomic fact decomposition module decomposes the contextual information into a list of atomic facts using a large language model;

[0022] Input the multiple-choice task text from the illusion dataset and the contextual information of the probability multiple-choice task text;

[0023] The contextual information of multiple choice task text and probability multiple choice task text in the illusion dataset is embedded into the thought chain used for atomic fact decomposition, serving as a prompt word template for atomic fact decomposition.

[0024] Input the cue word template used for atomic fact decomposition into the large language model to obtain a list of atomic facts; as shown in the formula:

[0025] ;

[0026] Where AF={AF1,AF i ,...,AF n ,}, AF represents a list of atomic facts, AF i AF represents the atomic fact of the i-th statement. n Let n represent the atomic facts of the nth sentence, LLMs represent the large language model, and Info represent contextual information. This refers to the thought chain used for the decomposition of atomic facts.

[0027] Furthermore, the prompt template for atomic fact decomposition includes: a paragraph description and target definition section, which clearly defines the given context information as the processing target of atomic fact decomposition and specifies the generation target as an atomic fact list; a thought chain section, which defines the format and thinking steps of the atomic fact decomposition thought chain; and a generated content section, which defines the generation location of the atomic fact list.

[0028] Furthermore, in step S4, the entity relationship graph construction module obtains the entity relationship graph from the list of atomic facts using a large language model; the specific steps are as follows:

[0029] The list of atomic facts is embedded into the thought chain used for the entity relationship graph and input into the large language model as a prompt word template for the entity relationship graph, resulting in the entity relationship graph; as shown in the formula:

[0030] ;

[0031] Where G represents the entity relationship diagram, This represents the thought chain used in entity relationship diagrams, where V represents the entity set and E represents a relationship that exists between any two entities.

[0032] Furthermore, the prompt word template for the entity relationship diagram includes: a paragraph description and target definition section, which explicitly provides a list of atomic facts as the processing target of the entity relationship diagram and specifies the generation target as the entity relationship diagram; a thought chain section, which defines the format and thinking steps for constructing the thought chain of the entity relationship diagram; and a content generation section, which outputs the entity relationship diagram.

[0033] Furthermore, in step S5, the hallucination detection and correction module identifies and masks the hallucination information of the context of nodes in the entity relationship graph using a large language model, thereby obtaining the correct response to the corrected hallucination; the specific steps are as follows:

[0034] Step S51, Illusion detection: The large language model infers predicted sub-entities based on the entity relationship graph, and judges the authenticity of the original sub-entities by calculating the similarity between the predicted sub-entities and the original sub-entities.

[0035] Step S52, correcting illusions: The large language model generates the correct response for different tasks based on the question and the context information that has been masked.

[0036] Further, hallucination detection; the specific steps are as follows:

[0037] Step S511: Design an illusion detection algorithm and construct two node sets, namely the first node set set1 and the second node set2. The first node set is labeled "child entity" and the second node set is labeled "root entity".

[0038] Step S512: Iteratively detect and mask nodes in the first node set set1. Use the Jaccard similarity coefficient to calculate the first similarity between the initial content of the masked node and the predicted content of the masked node. The predicted content of the masked node is obtained by embedding the entity relationship graph into the thought chain used for masking the content as a prompt word template for masking the content and inputting it into the large language model for inference.

[0039] Step S513: Iteratively detect and mask nodes in the second node set set2, and use the Jaccard similarity coefficient to calculate the second similarity between the initial content of the masked node and the predicted content of the masked node; wherein, the predicted content of the masked node is obtained by embedding the entity relationship graph into the thought chain used for masking content as a prompt word template for masking content and inputting it into the large language model for inference.

[0040] Step S514: Take the maximum value of the first similarity and the second similarity, and compare the maximum value of the two with the similarity threshold. If it exceeds the similarity threshold, the content of the masked node is considered to be real content. If it is below the similarity threshold, the masked node is assigned a phantom label.

[0041] Furthermore, to correct hallucinations, the specific steps are as follows:

[0042] Step S521: After obtaining the masked nodes with assigned illusion labels, map them to the corresponding positions in the atomic fact list, and mask the corresponding content in the atomic fact list with illusion labels to obtain an atomic fact list with illusion labels.

[0043] Step S522: The list of atomic facts labeled with illusion is embedded as contextual information into the multiple-choice task text and the probabilistic multiple-choice task text, and the correct answer for the corrected illusion is obtained through the large language model.

[0044] Furthermore, the prompt word template for masking content includes: a paragraph description and target definition section, which explicitly gives the entity relationship graph as the processing target for illusion detection and specifies the generated target as entity content; a thought chain section, which defines the format and thinking steps of the illusion detection thought chain; and a content generation section, which outputs entity content.

[0045] The beneficial effects of this invention are:

[0046] (1) The present invention constructs a novel hallucination dataset, which is manually annotated to support the present invention’s research on legal hallucination detection.

[0047] (2) This invention constructs a large-scale illusion detection model—Cuckoo. This large-scale illusion detection model consists of three modules: an atomic fact decomposition module, an entity relation graph construction module, and an illusion detection and correction module. The atomic fact decomposition module obtains entity-level atomic facts, rather than the coarse-grained entire context or fine-grained tags in the input, which helps in understanding and interpreting factual inconsistencies in the text in detail. The entity relation graph module enriches the semantic relationships between concepts and events in a given context. The illusion detection and correction module can effectively identify and mask unrealistic contexts at the entity level and on entity-level nodes in the entity relation graph. More importantly, the modules in the large-scale illusion detection model (Cuckoo) can be successfully integrated into current mainstream Chinese and English large-scale language models.

[0048] (3) The present invention has been extensively verified on two different datasets. The results show that the present invention has strong effectiveness and adaptability in the hallucination detection task. Attached Figure Description

[0049] Figure 1 This is a flowchart illustrating the present invention. Detailed Implementation

[0050] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the embodiments and accompanying drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and are not intended to limit the present invention.

[0051] Example 1

[0052] like Figure 1 As shown, this embodiment provides a large-model illusion detection method based on atomic facts and entity relationship graphs, including the following steps:

[0053] Step S1: Construct the illusion dataset and obtain the real question-and-answer dataset;

[0054] Step S2: Construct a large-scale hallucination detection model, which includes an atomic fact decomposition module, an entity relationship graph construction module, and a hallucination detection and correction module.

[0055] Step S3: The atomic fact decomposition module decomposes the contextual information into a list of atomic facts using a large language model;

[0056] Step S4: The entity relationship graph construction module obtains the entity relationship graph from the list of atomic facts through a large language model;

[0057] Step S5, the hallucination detection and correction module, uses a large language model to identify and mask the hallucination information of the context of nodes in the entity relationship graph, and obtains the correct answer for the corrected hallucination;

[0058] Step S6: Validate the performance of the large-scale hallucination detection model using the hallucination dataset and the obtained real question-and-answer dataset.

[0059] Further, in step S1, an illusion dataset is constructed and a real question-and-answer dataset is obtained; wherein, the constructed illusion dataset includes illusion type text, question text, best answer text, correct answer text, incorrect answer text, multiple-choice task text, and probability multiple-choice task text; the specific steps are as follows:

[0060] Step S11: Download the publicly available files and divide the obtained files into current files and obsolete files;

[0061] Step S12: Compare the current provisions of the existing documents with the repealed provisions of the repealed documents, filter out the consistent provisions, and retain the inconsistent provisions;

[0062] Step S13: Construct a question based on inconsistent regulations to obtain question text; (human) respond to the constructed question according to current regulations to obtain the best answer text; large language model responds to the constructed question according to current regulations to obtain the correct answer text; large language model responds to the constructed question according to obsolete regulations to obtain the incorrect answer text.

[0063] Step S14: By comparing the text of the wrong answer with the text of the correct answer, four types of illusions are statistically identified: time illusion, content illusion, location illusion, and name illusion.

[0064] Step S15: The multiple-choice task text includes question text, context information, a correct option, and an incorrect option. The context information is the dialogue history in the human-computer dialogue, the correct option is the correct answer text, and the incorrect option is the incorrect answer text. The probabilistic multiple-choice task text includes: question text and context information.

[0065] Step S16: Obtain the real question-and-answer dataset.

[0066] Furthermore, in step S3, the atomic fact decomposition module decomposes the contextual information into a list of atomic facts using a large language model;

[0067] Input the multiple-choice task text from the illusion dataset and the contextual information of the probability multiple-choice task text;

[0068] The contextual information of multiple choice task text and probability multiple choice task text in the illusion dataset is embedded into the thought chain used for atomic fact decomposition, serving as a prompt word template for atomic fact decomposition.

[0069] Input the cue word template used for atomic fact decomposition into the large language model to obtain a list of atomic facts; as shown in the formula:

[0070] ;

[0071] Where AF={AF1,AF i ,...,AF n ,}, AF represents a list of atomic facts, AF i AF represents the atomic fact of the i-th statement. n Let n represent the atomic facts of the nth sentence, LLMs represent the large language model, and Info represent contextual information. This refers to the thought chain used for the decomposition of atomic facts.

[0072] Furthermore, the prompt template for atomic fact decomposition includes: a paragraph description and target definition section, which clearly defines the given context information as the processing target of atomic fact decomposition and specifies the generation target as an atomic fact list; a thought chain section, which defines the format and thinking steps of the atomic fact decomposition thought chain; and a generated content section, which defines the generation location of the atomic fact list.

[0073] Furthermore, in step S4, the entity relationship graph construction module obtains the entity relationship graph from the list of atomic facts using a large language model; the specific steps are as follows:

[0074] The list of atomic facts is embedded into the thought chain used for the entity relationship graph and input into the large language model as a prompt word template for the entity relationship graph, resulting in the entity relationship graph; as shown in the formula:

[0075] ;

[0076] Where G represents the entity relationship diagram, This represents the thought chain used in entity relationship diagrams, where V represents the entity set and E represents a relationship that exists between any two entities.

[0077] Furthermore, the prompt word template for the entity relationship diagram includes: a paragraph description and target definition section, which explicitly provides a list of atomic facts as the processing target of the entity relationship diagram and specifies the generation target as the entity relationship diagram; a thought chain section, which defines the format and thinking steps for constructing the thought chain of the entity relationship diagram; and a content generation section, which outputs the entity relationship diagram.

[0078] Furthermore, in step S5, the hallucination detection and correction module identifies and masks the hallucination information of the context of nodes in the entity relationship graph using a large language model, thereby obtaining the correct response to the corrected hallucination; the specific steps are as follows:

[0079] Step S51, Illusion detection: The large language model infers predicted sub-entities based on the entity relationship graph, and judges the authenticity of the original sub-entities by calculating the similarity between the predicted sub-entities and the original sub-entities.

[0080] Step S52, correcting illusions: The large language model generates the correct response for different tasks based on the question and the context information that has been masked.

[0081] Further, hallucination detection; the specific steps are as follows:

[0082] Step S511: Design an illusion detection algorithm and construct two node sets, namely the first node set set1 and the second node set2. The first node set is labeled "child entity" and the second node set is labeled "root entity".

[0083] Step S512: Iteratively detect and mask nodes in the first node set set1. Use the Jaccard similarity coefficient to calculate the first similarity between the initial content of the masked node and the predicted content of the masked node. The predicted content of the masked node is obtained by embedding the entity relationship graph into the thought chain used for masking the content as a prompt word template for masking the content and inputting it into the large language model for inference.

[0084] Step S513: Iteratively detect and mask nodes in the second node set set2, and use the Jaccard similarity coefficient to calculate the second similarity between the initial content of the masked node and the predicted content of the masked node; wherein, the predicted content of the masked node is obtained by embedding the entity relationship graph into the thought chain used for masking content as a prompt word template for masking content and inputting it into the large language model for inference.

[0085] Step S514: Take the maximum value of the first similarity and the second similarity, and compare the maximum value of the two with the similarity threshold. If it exceeds the similarity threshold, the content of the masked node is considered to be real content. If it is below the similarity threshold, the masked node is assigned a phantom label.

[0086] Furthermore, to correct hallucinations, the specific steps are as follows:

[0087] Step S521: After obtaining the masked nodes with assigned illusion labels, map them to the corresponding positions in the atomic fact list, and mask the corresponding content in the atomic fact list with illusion labels to obtain an atomic fact list with illusion labels.

[0088] Step S522: The list of atomic facts labeled with illusion is embedded as contextual information into the multiple-choice task text and the probabilistic multiple-choice task text, and the correct answer for the corrected illusion is obtained through the large language model.

[0089] Furthermore, the prompt word template for masking content includes: a paragraph description and target definition section, which explicitly gives the entity relationship graph as the processing target for illusion detection and specifies the generated target as entity content; a thought chain section, which defines the format and thinking steps of the illusion detection thought chain; and a content generation section, which outputs entity content.

[0090] Example 2

[0091] The prompt template for atomic fact decomposition is: Please learn the atomic fact decomposition method based on the given context and provide a list of atomic facts for the following text; Information: <contextual information>; Mindset for atomic fact decomposition: 1. Analyze and identify the core themes and structure of the input text; 2. The goal is to transform each enumeration item into an independent and indivisible atomic fact statement; 3. Process the enumeration items one by one; 4. Organize the transformed atomic facts into a bulleted list; Output: A list of atomic facts.

[0092] The prompt template for entity relationship diagrams is as follows: Your task is to extract the relationship between two entities in the input sentence and output an entity relationship diagram in a specific format; Please follow these steps to think and give the final result; Atomic fact list; Mind chain for entity relationship diagrams: Identify entities; Analyze the association and roles between two entities; Determine the relationship type and construct triples; Optimize and confirm the relationship triples; Entity relationship diagram.

[0093] The prompt template for masking content is as follows: Your task is to perform logical reasoning on the masked portion of the entity relationship diagram and regenerate the masked content; please learn the following thought process, but do not use them directly! Please reason based on the provided entity relationship diagram and generate the final result; Input: Entity relationship diagram listing entity relationships in JSON format; This mask is marked as [the masked content]; Processing: This step requires explicitly labeling the identified entity relationship triples; The final result only needs to contain the content at the masked location, directly outputting the content itself without adding prompts or punctuation; Output: Entity relationship diagram;

[0094] The thought process for masking content is as follows: Receive a message containing a list of entity relationships and a mask marker; analyze the entity relationships and infer the content that should be displayed at the location marked "[Content to be masked]"; read the entity relationship list, find the triple containing the mask marker "[Content to be masked]" and extract its content; search the list for triples related to the root node; based on legal and regulatory knowledge, internal database data, and root node-related triples, infer that the content to be displayed at the masked location should be <Content to be masked>; according to the above logical reasoning, the most likely masked content is <Content to be masked>; as per the instructions, extract plain text from the inferred content; output: the content at the masked location.

[0095] Example 3

[0096] To enhance resistance to various hallucinations, this invention, building upon existing work, evaluates the performance of the large-scale hallucination detection model (Cuckoo) on a primary task: generative multiple choice. Specifically, for the generative multiple choice task, a large language model is instructed to select one response from candidate answers. Furthermore, this invention employs multiple methods to comprehensively evaluate the performance of the proposed large-scale hallucination detection model (Cuckoo) on single or double information, across six sub-tasks. Details are as follows:

[0097] (1) Single_true_false: Provides a single piece of information for multiple-choice tasks, with answers arranged in the order of true and false.

[0098] (2) Single_false_true: Provides a single piece of information for multiple-choice questions, with answers arranged in the order of false and true.

[0099] (3) Double_true_false: Provides double information for multiple-choice questions, with answers arranged in the order of true and false.

[0100] (4) Double_false_true: Provides double information for multiple-choice questions, with answers arranged in the order of false and true.

[0101] (5) Open_single_ended: Provides a single piece of information for probabilistic multiple choice, attaches each candidate option to the question and the given information, and calculates the probability of the candidate options. The answer is determined by selecting the option with the highest probability.

[0102] (6) Open_double_ended: Provides double information for probabilistic multiple choice by attaching each candidate option to both the question and the given information and calculating the probability of each candidate option. The answer is determined by selecting the option with the highest probability.

[0103] Example 4

[0104] The hallucination dataset constructed in this invention contains four types of hallucinations, specifically defined as follows:

[0105] Location illusion: The location of a regulation used in a response generated by a large language model is inconsistent with the corresponding location of the current regulation. For example, the large language model might generate an incorrect regulatory location as "Article 20," while the actual regulatory location is "Article 25."

[0106] Content illusion: The regulations cited in responses generated by large language models are inconsistent with the content of current regulations. For example, the incorrect content generated by the large language model is: "Having worked in animal diagnosis and treatment services in rural areas for more than 5 consecutive years"; the correct content is: "Having worked as a village-level animal disease prevention officer in rural areas for more than 5 consecutive years".

[0107] Time illusion: The reactions generated by large language models are based on repealed regulations and conflicts with current regulations. For example, a large language model might generate an incorrect implementation date of January 1, 2009, while the correct date is October 1, 2022.

[0108] Name illusion: The rules mentioned in the responses generated by a large language model are non-existent or incorrect. For example, the large language model might generate a departmental regulation with the incorrect name "Rural Veterinarian Management Measures," while the correct name is "Management Measures for Practicing Veterinarians and Rural Veterinarians."

[0109] Of the four types of hallucinations, location hallucinations accounted for 30.95% (620 questions), content hallucinations for 30.11% (603 questions), time hallucinations for 26.31% (527 questions), and name hallucinations for 12.63% (253 questions). This invention randomly selected 100 departmental regulations and required two annotators to annotate 400 cases (e.g., 4 sub-tasks). This invention used Fleiss's Kappa coefficient as a statistical method to evaluate the consistency among annotators for all four types of hallucinations. The hallucination dataset constructed in this invention has a Fleiss Kappa coefficient score of 0.9386. A high Fleiss Kappa coefficient indicates a high-quality dataset. Tables 1 and 2 list the statistical data for different hallucination types and departmental regulation types in the hallucination dataset (ChDepRegHal).

[0110] Table 1. Statistics on hallucination types in the hallucination dataset.

[0111]

[0112] Table 2. Statistics on the types of departmental regulations in the hallucination dataset

[0113]

[0114] Example 5

[0115] Obtain the TruthfulQA dataset, a benchmark for evaluating the ability of large language models to generate truthful answers to false beliefs or misunderstandings. The TruthfulQA dataset contains a validation set of 817 questions across 38 categories, including health, law, finance, and politics, providing a best answer, a correct answer, and an incorrect answer for each question.

[0116] Example 6

[0117] This invention validates the performance of a large-scale hallucination detection model on real question-answering datasets (English dataset) and hallucination datasets (Chinese dataset). Specific settings are as follows:

[0118] Experimental Setup: In probabilistic multiple-choice scenarios, this invention uses multiple-choice accuracy (i.e., single-choice accuracy MC1, two-choice accuracy MC2, and three-choice accuracy MC3) as evaluation metrics. To easily replicate the experimental results, this invention uses the default hyperparameter values ​​of a series of benchmark models of large-scale Chinese and English language models. All evaluations in this work are performed in a single-run setting, using single-loop inference on TACS on NVIDIA A100 80G and other models on NVIDIA 6000 24G. The θ value is set to 0.54. (θ value is the similarity threshold; NVIDIA A100 80G and NVIDIA 6000 24G are graphics card models.) Among these mainstream large-scale Chinese language models, we found that DeepSeek (a large-scale language model developed by DeepSeek) and Mistral (a large-scale language model developed by Mistral AI) are more stable and powerful than other large-scale language models when constructing the Atomic Decomposition Module (AFD) and Entity Relationship Graph (ERG) on Chinese and English datasets, respectively. Therefore, we use DeepSeek and Mistral to perform the corresponding Atomic Decomposition Module (AFD) and Entity Relationship Graph Construction Module (ERG) processes.

[0119] Benchmark Models: For Chinese scenarios, this invention selected five benchmark models (e.g., TACS, DeepSeek-LLM-7B (a large language model developed by DeepSeek), Baichuan2-7B (a large language model developed by Baichuan Intelligence), MiniCPM-2B (a large language model developed by Mianbi Intelligence), and Yi-6B (a large language model developed by Lingyiwu.com)). For English scenarios, this invention selected four benchmark models (e.g., TACS (a lightweight model proposed by the Institute of Computing Technology, Chinese Academy of Sciences, whose full name is Real Consciousness Context Selection: Mitigating the Illusion of Large Language Models Being Danced by Unreal Contexts), ITI, MiniCPM-2B, and Mistral-7B).

[0120] Experimental Results: Performance on the Chinese dataset is shown in Table 3. This invention performs best across all three evaluation metrics. Compared to the baseline, the large-scale illusion detection model (Cuckoo) can effectively represent information and semantic relation units at an appropriate granularity (e.g., entity level) by simultaneously using Atomic Decomposition Modules (AFD) and Entity Relationship Graph Building Modules (ERG).

[0121] Since all large-scale language models in China have achieved similar results on the probabilistic multiple-choice task, this invention selects MiniCPM as the baseline model for the large-scale illusion detection model (Cuckoo). Table 4 shows the performance of the large-scale illusion detection model (Cuckoo) based on MiniCPM as the base large-scale language model for each illusion type. Generally, name illusion and location illusion types are easier to correctly identify compared to the other two illusion types (i.e., time illusion and content illusion). The time pattern and content pattern are not fixed for each departmental rule; they vary depending on the specific departmental rule.

[0122] The performance on the English dataset is shown in Table 5. The performance results of the Llama, Llama+ITI, Llama+TACS−T, LAMA+TACS−S, Mistral, Mistral+TACS-T, and Mistral+TACS-S models on the English dataset are directly adopted from experimental results in existing literature. Similarly, on the probabilistic multiple-choice task, the entity-level masking of this invention outperforms the sentence-level and word-level masking in the TACS model on all three evaluation metrics. Meanwhile, the large-scale illusion detection model (Cuckoo) achieves comparable performance to the TACS model on the generative multiple-choice task. The two modules of this invention, namely the Atomic Decomposition Module (AFD) and the Entity Relationship Graph Construction Module (ERG), can be successfully integrated into current major large-scale English language models (such as MiniCPM and Mistral), thereby improving performance.

[0123] Furthermore, the large-model illusion detection model (Cuckoo) also helps improve illusion correction on probabilistic multiple-choice tasks. Compared to its illusion correction performance on Chinese datasets, the large-model illusion detection model (Cuckoo) performs better on English datasets, showing greater performance gains. A potential reason for this might be that atomic facts and entity relationship graphs are better suited to English.

[0124] Table 3 Experimental results of the model on the Chinese dataset

[0125]

[0126] Table 4. Performance of the large-scale hallucination detection model (Cuckoo) on four types of hallucinations.

[0127]

[0128] Table 5. Experimental results of the model on the English dataset.

[0129]

[0130] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A large-scale hallucination detection method based on atomic facts and entity relationship graphs, characterized in that, The methods include: Step S1: Construct the illusion dataset and obtain the real question-and-answer dataset; Step S2: Construct a large-scale hallucination detection model, which includes an atomic fact decomposition module, an entity relationship graph construction module, and a hallucination detection and correction module. Step S3: The atomic fact decomposition module decomposes the contextual information into a list of atomic facts using a large language model; Step S4: The entity relationship graph construction module obtains the entity relationship graph from the list of atomic facts through a large language model; Step S5, the hallucination detection and correction module, uses a large language model to identify and mask the hallucination information in the context of nodes in the entity relationship graph, obtaining the correct answer to the corrected hallucination; the specific steps are as follows: Step S51, Illusion detection: The large language model infers predicted sub-entities based on the entity relationship graph, and judges the authenticity of the original sub-entities by calculating the similarity between the predicted sub-entities and the original sub-entities. Step S511: Design an illusion detection algorithm and construct two node sets, namely the first node set set1 and the second node set2. The first node set is labeled "child entity" and the second node set is labeled "root entity". Step S512: Iteratively detect and mask nodes in the first node set set1. Use the Jaccard similarity coefficient to calculate the first similarity between the initial content of the masked node and the predicted content of the masked node. The predicted content of the masked node is obtained by embedding the entity relationship graph into the thought chain used for masking the content as a prompt word template for masking the content and inputting it into the large language model for inference. Step S513: Iteratively detect and mask nodes in the second node set set2, and use the Jaccard similarity coefficient to calculate the second similarity between the initial content of the masked node and the predicted content of the masked node; wherein, the predicted content of the masked node is obtained by embedding the entity relationship graph into the thought chain used for masking content as a prompt word template for masking content and inputting it into the large language model for inference. Step S514: Take the maximum value of the first similarity and the second similarity, and compare the maximum value of the two with the similarity threshold. If it exceeds the similarity threshold, the content of the masked node is considered to be real content. If it is below the similarity threshold, the masked node is assigned a phantom label. Step S52, correcting illusions: The large language model generates the correct response for different tasks based on the question and the context information that has been masked. Step S6: Validate the performance of the large-scale hallucination detection model using the hallucination dataset and the obtained real question-and-answer dataset.

2. The large-model illusion detection method based on atomic facts and entity relationship graphs according to claim 1, characterized in that, Step S1 involves constructing an illusion dataset and obtaining a real question-and-answer dataset; the constructed illusion dataset includes illusion type text, question text, best answer text, correct answer text, incorrect answer text, multiple-choice task text, and probability multiple-choice task text; the specific steps are as follows: Step S11: Download the publicly available files and divide the obtained files into current files and obsolete files; Step S12: Compare the current provisions of the existing documents with the repealed provisions of the repealed documents, filter out the consistent provisions, and retain the inconsistent provisions; Step S13: Construct a question based on inconsistent regulations to obtain question text; respond to the constructed question based on current regulations to obtain best answer text; the large language model responds to the constructed question based on current regulations to obtain correct answer text; and the large language model responds to the constructed question based on obsolete regulations to obtain incorrect answer text. Step S14: By comparing the text of the wrong answer with the text of the correct answer, four types of illusions are statistically identified: time illusion, content illusion, location illusion, and name illusion. Step S15: The multiple-choice task text includes question text, context information, a correct option, and an incorrect option. The context information is the dialogue history in the human-computer dialogue, the correct option is the correct answer text, and the incorrect option is the incorrect answer text. The probabilistic multiple-choice task text includes: question text and context information. Step S16: Obtain the real question-and-answer dataset.

3. The large-model illusion detection method based on atomic facts and entity relationship graphs according to claim 2, characterized in that, In step S3, the atomic fact decomposition module decomposes the contextual information into a list of atomic facts using a large language model; Input the multiple-choice task text from the illusion dataset and the contextual information of the probability multiple-choice task text; The contextual information of multiple choice task text and probability multiple choice task text in the illusion dataset is embedded into the thought chain used for atomic fact decomposition, serving as a prompt word template for atomic fact decomposition. Input the cue word template used for atomic fact decomposition into the large language model to obtain a list of atomic facts; as shown in the formula: ; Where AF={AF1,AF i ,...,AF n ,}, AF represents a list of atomic facts, AF i AF represents the atomic fact of the i-th statement. n Let n represent the atomic facts of the nth sentence, LLMs represent the large language model, and Info represent contextual information. This refers to the thought chain used for the decomposition of atomic facts.

4. The large-model illusion detection method based on atomic facts and entity relationship graphs according to claim 3, characterized in that, The prompt template for atomic fact decomposition includes: a paragraph description and target definition section, which clearly defines the given context information as the processing target of atomic fact decomposition and specifies the generated target as an atomic fact list; a thought chain section, which defines the format and thinking steps of the atomic fact decomposition thought chain; and a generated content section, which defines the generation location of the atomic fact list.

5. The large-model illusion detection method based on atomic facts and entity relationship graphs according to claim 4, characterized in that, In step S4, the entity relationship graph construction module obtains the entity relationship graph from the list of atomic facts using a large language model; the specific steps are as follows: The list of atomic facts is embedded into the thought chain used for the entity relationship graph and input into the large language model as a prompt word template for the entity relationship graph, resulting in the entity relationship graph; as shown in the formula: ; Where G represents the entity relationship diagram, This represents the thought chain used in entity relationship diagrams, where V represents the entity set and E represents a relationship that exists between any two entities.

6. The large-model illusion detection method based on atomic facts and entity relationship graphs according to claim 5, characterized in that, The prompt template for the entity relationship diagram includes: a paragraph description and target definition section, which explicitly provides a list of atomic facts as the processing target of the entity relationship diagram and specifies the generation target as the entity relationship diagram; a thought chain section, which defines the format and thinking steps for building the thought chain of the entity relationship diagram; and a content generation section, which outputs the entity relationship diagram.

7. The large-model illusion detection method based on atomic facts and entity relationship graphs according to claim 1, characterized in that, The specific steps to correct hallucinations are as follows: Step S521: After obtaining the masked nodes with assigned illusion labels, map them to the corresponding positions in the atomic fact list, and mask the corresponding content in the atomic fact list with illusion labels to obtain an atomic fact list with illusion labels. Step S522: The list of atomic facts labeled with illusion is embedded as contextual information into the multiple-choice task text and the probabilistic multiple-choice task text, and the correct answer for the corrected illusion is obtained through the large language model.

8. The large-model illusion detection method based on atomic facts and entity relationship graphs according to claim 1, characterized in that, The prompt word template for masking content includes: a paragraph description and target definition section, which clearly defines the given entity relationship graph as the processing target for illusion detection and specifies the generated target as entity content; a thought chain section, which defines the format and thinking steps of the illusion detection thought chain; and a content generation section, which outputs entity content.

Citation Information

Patent Citations

  • Comparison decoding illusion mitigation method and device based on multiple modes, and terminal

    CN118966387A

  • Method and system for detecting and repairing output illusion of large language model

    CN119599137A