Large language model illusion suppression method, product and equipment based on multi-order detection

By extracting core entities and using the Wikipedia API to obtain background summaries, combined with a multi-layer detection mechanism, the problem of generating illusions in large language models was solved, achieving efficient and accurate illusion correction and improving the credibility and applicability of the generated text.

CN120975246APending Publication Date: 2025-11-18XIHUA UNIV

Patent Information

Application Number
CN202511492449.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-20
Publication Date
2025-11-18

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively identify and correct hallucinations generated by large language models, especially in logical reasoning and common-sense responses, leading to reduced application reliability, particularly in high-risk areas such as medical diagnosis, legal analysis, and financial decision-making.

Method used

By extracting core entities from the input text, obtaining background summaries using the Wikipedia API, and combining multi-layered detection mechanisms, including sentence-level and entity-level detection, the generated answers are iteratively optimized to reduce illusory content.

Benefits of technology

It achieves accurate identification and correction of hallucination content, improves the credibility and rationality of generated text, adapts to user needs in different scenarios, and enhances the reliability and responsiveness of the model in practical applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120975246A_ABST
    Figure CN120975246A_ABST
Patent Text Reader

Abstract

The invention provides a large language model illusion suppression method, product and equipment based on multi-order detection. The method comprises the following steps: step 1, extracting and enhancing a core entity; 2, generating an initial answer; step 3, sentence detection and entity detection; 4, illusion is corrected; and step 5, performing iterative optimization. According to the method, the credibility and rationality of the generated text are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of large language models, and in particular to a large language model hallucination suppression method based on multi-order detection, a product and equipment. BACKGROUND

[0002] Hallucination is a key challenge faced by large language models, referring to the phenomenon of generating seemingly reasonable but actually incorrect or meaningless content. Hallucination seriously affects the reliability of large language model applications. The causes of hallucination are diverse, which may be low-quality training data, defects of self-recurrence generation model or pre-training bias encoding. Therefore, alleviating hallucination is the key to improving the reliability of large language models.

[0003] Hallucination is a core bottleneck that plagues large language models, referring to the phenomenon of generating seemingly reasonable but actually incorrect or logically flawed content. This key problem seriously undermines the reliability of large language models in practical applications, especially in high-risk fields such as medical diagnosis, legal analysis, and financial decision-making, which require high accuracy.

[0004] The causes of hallucination are multifaceted, stemming from the inherent limitations of model design and training paradigms. These include noise, bias or knowledge gaps in training data; structural defects of self-recurrence generation mechanism; and pre-training bias encoding.

[0005] Given the profound impact of hallucination on the credibility of large language models, alleviating hallucination has become a key research frontier, and is also a fundamental prerequisite for improving model reliability and promoting its safe and scalable deployment in critical task scenarios.

[0006] The existing technology alleviates the hallucination of large language models by retrieving external knowledge to generate candidate answers, and using iterative evaluation detection methods based on candidate answers. The core evaluation indicator is the similarity F between the candidate answer and the standard answer, and a similarity threshold is set. When the similarity F of the candidate answer is lower than the similarity threshold, it is judged as hallucination and enters the correction process; if it is higher than the similarity threshold, the answer is directly output.

[0007] The existing technology mainly relies on comparing the entity sets of the reference content and the generated content when judging hallucination. This method has significant limitations, i.e. it can only be applied to answers containing explicit entity types such as names, place names, and organization names. For answers based on common sense or logical reasoning, it is difficult to effectively extract entities from them, so this method cannot be used to alleviate hallucination. This limitation greatly reduces the applicability and effectiveness of the existing technology in handling diverse answer types.

[0008] The core input of the prior art similarity F is the "fact unit matching amount", but the document does not define "what is a fact unit", and there is no objective standard for setting the threshold value relying on artificial experience, and the adaptability is poor. SUMMARY

[0009] The present application aims to solve the defects of the prior art, and provides a large language model hallucination suppression method, product and equipment based on multi-order detection, which improves the credibility and rationality of the generated text.

[0010] The present application adopts the following technical solutions: The large language model hallucination suppression method based on multi-order detection comprises the following steps: Step 1. Core entity extraction and enhancement: The core entity is extracted from the input source text, and the Wikipedia API interface is called to obtain the background summary of the core entity, providing supplementary knowledge for the model to generate answers.

[0011] Step 2. Generate initial answer: Take the core entity-summary as the context, combine the user question, and call the large language model to generate a preliminary answer.

[0012] Step 3. Sentence detection and entity detection: Sentence-level detection is performed to split the generated answer into sentences, and the large language model is used to infer and judge the relationship between each sentence and the source text, and mark the contradictory or unmentioned sentences as candidate hallucination sentences; and perform entity-level detection on the non-hallucination sentences to check whether the content passed the sentence-level detection contains core entities not mentioned in the source text, and mark the unmentioned core entities as entity-level hallucinations.

[0013] Step 4. Correct hallucination: The detected hallucination content is used as a correction prompt to guide the large language model to correct the answer, and if it is correct, it is directly output, and if it is incorrect, step 5 is performed.

[0014] Step 5. Iterative optimization: Repeat steps 1-4 until there is no hallucination content or the maximum number of iterations is reached, and finally return the optimized answer.

[0015] Further, the core entity in step 1 includes a person, a place and an event.

[0016] Further, the method for extracting the core entity from the input source text in step 1 is to use the en_core_web_trf pre-trained model in the spaCy natural language processing library for core entity extraction.

[0017] Further, in step 1, the Wikipedia API interface is called to link to the Wikipedia knowledge base, so as to obtain the background summary of the core entity.

[0018] Further, in step 2, structured prompts are designed in combination with user questions, and a large language model is called by setting a low temperature parameter temperature=0.1.

[0019] Further, in step 3, the relationship between the sentence and the source text includes coincidence, contradiction and non-mention.

[0020] The application also provides a computer program product, comprising computer programs / instructions, which, when executed by a processor, realize the above-mentioned large language model hallucination suppression method based on multi-order detection.

[0021] The application also provides a computer device, comprising a memory, a processor and a computer program stored on the memory, wherein the processor executes the computer program to realize the above-mentioned large language model hallucination suppression method based on multi-order detection.

[0022] The application has the following beneficial effects: (1) The application can accurately obtain background knowledge related to the question by performing entity linking on the question. This background knowledge can be used as a context prompt for open-domain question answering, providing a more indicative knowledge reference for the generation of initial answers by the large language model.

[0023] (2) The application introduces a multi-layer detection method, which realizes fine inspection of the content generated by the large language model by constructing a multi-dimensional and progressive hallucination detection system. Accurate hallucination detection results not only provide clear guidance for subsequent targeted disassembly of hallucination sentences and targeted evidence retrieval, but also avoid invalid corrections caused by hallucination misjudgment or missed judgment, laying a solid foundation for efficient promotion of the entire hallucination correction process.

[0024] (3). The iterative correction prompting method adopted by the present application is core in constructing a closed-loop mechanism of historical result feedback-fine-grained correction-iterative optimization. It can guide the model to make accurate corrections based on the deficiencies of the previous results. Each round of correction is based on historical results, without the need for manual threshold setting, avoiding repeated correction of correct parts, realizing the upgrade from overall correction to fine-grained unit correction, and significantly improving the correction efficiency and accuracy. On the other hand, the directional response capability for factual type tasks makes the system adaptable to the deep needs of users in different scenarios: such as the need for factual integrity and logical coherence in the document summary scenario, or the need for term accuracy and traceability in professional Q&A, which can be met through multiple rounds of iterative correction. The final output result not only outperforms general systems in factual correctness, but also improves content adaptability and user expectation compatibility, significantly enhancing the practical value in actual application scenarios. BRIEF DESCRIPTION OF DRAWINGS

[0025] Figure 1 The overall flowchart of the present application. DETAILED DESCRIPTION

[0026] To make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the present application is described clearly and completely below. Obviously, the described embodiments are part of the embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor belong to the scope of protection of the present application.

[0027] In view of the limitations of the prior art, the present application proposes a large language model hallucination suppression method based on multi-order detection, product and equipment. The core entity of the user's question is extracted and linked to the background knowledge in the Wiki knowledge base to obtain the context prompt information of the question. Then, through the establishment of a multi-layer hallucination detection mechanism, iterative verification prompts and response generation are realized, thereby effectively reducing the hallucination generation phenomenon of the large language model. This method not only realizes accurate identification and positioning of hallucination content through entity knowledge enhancement and multi-level detection, but also avoids the shortcomings of excessive dependence on artificial rules and weak generalization ability of traditional hallucination correction methods. Moreover, the entire process does not require additional training of model parameters, but can be implemented through prompt engineering and external knowledge linking, greatly reducing the consumption of computing resources and the cost of technical application, making the method have good practicality and convenience, and effectively reducing the hallucination generation of the model.

[0028] As shown in Figure 1 The large language model hallucination suppression method based on multi-order detection of the present application comprises: Step 1. Core entity extraction and construction of entity list: core entity extraction is performed using the en_core_web_trf pre-trained model in the spaCy natural language processing library, and an entity list is returned.

[0029] Step 2. Entity linking and obtaining context knowledge: for the input entity list, link it to the Wikipedia knowledge base through the Wikipedia API interface, batch obtain the background summary of the corresponding core entity in Wikipedia, and form a structured core entity-summary mapping list.

[0030] Step 3. Generate initial answer: format and integrate core entity-summary information into context, design structured prompt words, and control the certainty of large language model output by setting low temperature parameter temperature=0.1 to reduce randomness.

[0031] Step 4. Sentence detection and entity detection: hierarchical detection is performed on the generated text, including: S401. First, sentence-level detection is performed, the generated text is segmented into independent sentences using the NLTK tool, and prompt words are constructed, the large language model is called to judge the relationship [Entailment] / [Contradiction] / [Neutral] between each sentence and the source text, sentences marked as [Contradiction] and [Neutral] are candidate hallucination sentences, and sentences marked as [Entailment] are non-hallucination sentences.

[0032] S402. Entity-level detection is performed on non-hallucination sentences, first traverse non-hallucination sentences, extract core entities from each sentence using the spaCy library, check if each core entity in the sentence exists in the entity set of the reference answer, and return the core entity that exists in the generated text but does not exist in the reference text as an entity-level hallucination. If no hallucinations are detected at the sentence and entity levels, the generated text is directly output. Otherwise, step 5 is entered.

[0033] Step 5. Correct hallucinations. Set the prompt instruction to correct the hallucination content detected as a correction prompt to guide the large language model to correct the answer. This process will be repeated until no hallucination content is detected or the maximum number of iterations is reached.

[0034] The present application realizes effective mitigation of large language model hallucinations by combining entity linking, multi-layer detection and verification and correction mechanisms. The present application not only improves the accuracy in the field of question answering, but also significantly enhances the response ability and level of the model through iterative prompts from coarse granularity to fine granularity.

[0035] The application further provides a computer program product comprising computer programs / instructions which, when executed by a processor, implement the above large language model hallucination suppression method based on multi-order detection.

[0036] The application further provides a computer device comprising a memory, a processor and a computer program stored on the memory, wherein the processor executes the computer program to implement the above large language model hallucination suppression method based on multi-order detection.

[0037] Embodiments Problem description: Query content: Which Lloyd Webber musical premiered in the US on 10 th December 1993? Translated into 1993-12-10, which Lloyd Webber musical premiered in the US? Entity extraction and construction of entity list: using the spacy library and its en_core_web_trf model, the named core entity in the input question is recognized. The recognition result is as follows: entity list: [{'text': 'Lauren Bacall', 'label': 'PERSON'}].

[0038] Entity linking and obtaining context knowledge: for the above extracted entity list, through entity linking technology, relevant background information is retrieved from the knowledge base as the context prompt for question query, as follows: [{'entity': 'Lauren Bacall','summary': "Betty Joan Perske (September 16, 1924 – August 12,2014), professionally known as Lauren Bacall ( bə-KAWL), was an American actress....", 'label': 'PERSON'}] 。

[0039] Generate initial answer: the model generates the initial answer according to the question and the obtained background knowledge as follows: The actress who was voted Miss Greenwich Village in 1942 is **Audrey Hepburn**. The initial answer is wrong, and will enter the multi-layer detection step.

[0040] Sentence detection and entity detection: Sentence detection: By using sentence detection, it is found that the generated initial answer is [Contradiction]. It means that there is an illusion. That is, [('The actress who was voted Miss Greenwich Village in 1942 is **Audrey Hepburn**.', '[Contradiction]')]. Entity-level detection: Because the sentence detection is [Contradiction], the next step of repairing the answer is directly performed without further entity-level detection, so the entity-level detection list is empty.

[0041] Modify the illusion: Develop a set of prompt instructions, use the illusion content as a correction prompt, and re-direct the large language model to generate an answer. Output the corrected answer: The actress who was voted Miss Greenwich Village in 1942 is **Lauren Bacall**. The answer is correct.

[0042] Through the above process, the present application not only ensures the factual accuracy of the generated content, but also constructs an efficient verification mechanism to detect and correct factual or logical errors in the output of the large language model. The process provides an operational practice paradigm for alleviating the illusion problem of the large language model, fully demonstrating the value of the present application in practical applications.

[0043] Finally, it should be noted that: the above examples are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing examples, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing examples, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A hallucination suppression method for large language models based on multi-order detection, characterized in that, The method comprises the following steps: Step 1. Core entity extraction and enhancement: Extract the core entity from the input source text, and call the Wikipedia API interface to obtain the background summary of the core entity, to provide supplementary knowledge for the model to generate answers; Step 2. Generate initial answer: In the context of core entity-summary, combine user questions, call large language model, and generate preliminary answers; Step 3. Sentence detection and entity detection: Carry out sentence-level detection, split the generated answer into sentences, and judge the relationship between each sentence and the source text through large language model inference, mark the contradictory or unmentioned sentences as candidate hallucination sentences; and carry out entity-level detection on non-hallucination sentences, check whether the content passed through sentence-level detection contains core entities not mentioned in the source text, and mark the unmentioned core entities as entity-level hallucinations; Step 4. Correct hallucination: For the detected hallucination content as a correction prompt, guide the large language model to correct the answer, and if correct, directly output, otherwise, go to step 5; Step 5. Iterative optimization: Repeat steps 1-4 until there is no hallucination content or the maximum number of iterations is reached, and finally return the optimized answer.

2. The method of claim 1, wherein, The core entity in step 1 includes person, place and event.

3. The method of claim 1, wherein, The method for extracting core entities from the input source text in step 1 is to use the en_core_web_trf pre-trained model in the spaCy natural language processing library for core entity extraction.

4. The method of claim 1, wherein, In step 1, the Wikipedia API interface is called to link to the Wikipedia knowledge base to obtain the background summary of the core entity.

5. The method of claim 1, wherein, In step 2, the structured prompt words are designed in combination with the user question, and the large language model needs to be set to low temperature parameter temperature=0.

1.

6. The method of claim 1, wherein, The relationship between the sentence and the source text in step 3 includes coincidence, contradiction and unmentioned.

7. A computer program product comprising computer programs / instructions, characterized in that, The computer program / instructions are executed by the processor to implement the large language model hallucination suppression method based on multi-order detection as claimed in any one of claims 1-6.

8. A computer device comprising a memory, a processor, and a computer program stored on the memory, wherein the computer program comprises instructions that, when executed by the processor, cause the processor to perform the method of any one of claims 1-7. The processor executes the computer program to implement the large language model hallucination suppression method based on multi-order detection as claimed in any one of claims 1-6.

Citation Information

Patent Citations

  • Method and device for illusion detection and restoration in text generation task

    CN117973564A

  • Large model illusion correction method and device based on iterative evaluation algorithm

    CN118709777A

  • Big language model illusion detection method and device

    CN118966202A

  • Large language model illusion relieving method based on entity chain and prompt chain technology

    CN119783829A

  • Construction industry safety question and answer retrieval enhancement generation system and method based on graph structure

    CN120067250A

Cited By

  • Training sample generation and model training method and device, storage medium and product

    CN121525752A

  • Intelligent knowledge question-answering method, device and equipment and storage medium

    CN121543724A

  • An intelligent knowledge question answering method, device, equipment and storage medium

    CN121543724B

  • Text generation method based on large language model

    CN122113890A