A citation correction-based hallucination mitigation scheme for large language models

By constructing complete training data and citation correction solutions, we solve the problems of low recall rate of hallucination correction and difficulty in detecting multiple hallucinations in practical applications of large language models, improve detection accuracy and correction accuracy, and reduce inference costs and delays. .

CN117910449BActive Publication Date: 2024-09-17MEMORY TENSOR (SHANGHAI) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410082135.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-19
Publication Date
2024-09-17
Estimated Expiration
2044-01-19

AI Technical Summary

Technical Problem

In practical application scenarios, existing large language models have problems such as low hallucination correction recall rate and inability to detect and correct multiple hallucinations at the same time. Existing solutions have high reasoning costs and delays, and lack generalization and robustness.

Method used

A large language model hallucination mitigation scheme based on citation correction is designed. By constructing more complete training data, the hallucination distribution of the text to be corrected is more consistent with the actual application scenario. It adopts two steps of hallucination detection and correction, and uses reference Materials are detected and corrected, combined with plug-in knowledge base and search engine retrieval, and training data is constructed to achieve end-to-end citation correction.

Benefits of technology

It improves the hallucination detection accuracy and correction accuracy of the model in practical applications, reduces the cost and delay of reasoning resources, and achieves the correct detection and correction of multiple hallucinations existing at the same time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117910449B
    Figure CN117910449B
Patent Text Reader

Abstract

The present invention discloses a large language model hallucination mitigation scheme based on citation correction, which relates to the field of large language model text generation, and includes two steps: hallucination detection and hallucination correction, wherein the hallucination detection uses reference materials as a benchmark to judge whether the original statement is consistent with the reference materials; the hallucination correction effectively corrects the hallucinations in the original statement according to the reference materials for the original statement that is inconsistent with the reference materials, and finally outputs a corrected statement without hallucinations. The present invention designs a complete hallucination correction training data construction scheme, so that the hallucination distribution of the text to be corrected is more consistent with the hallucination distribution of the actual application scenario, improves the recall rate of the model in correcting factual errors in the actual application scenario; improves the model's ability to detect hallucinations; the scheme realizes that the model completes hallucination detection and hallucination correction in one step, reduces resource costs and delays in the actual application process; and simultaneously realizes the correct detection and correction of the original output of the model with multiple hallucinations at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of large language model text generation, in particular to the field of generated text hallucination mitigation, and more particularly to a large language model hallucination mitigation solution based on citation correction. Background Art

[0002] With the rapid development of large language models (LLMs), related generative AI applications continue to emerge, and the attempts to implement large language models in various industries are becoming more and more popular. However, due to biased or insufficient training data, overfitting of training data, limited contextual understanding, lack of domain knowledge, etc., all current large models inevitably have hallucination problems, that is, the model may produce outputs that are inconsistent with the facts or misleading, which seriously hinders the implementation of large language models in various industries, especially for industries with low fault tolerance such as financial services, legal decision-making and medical diagnosis.

[0003] In order to promote the practical application of large language models, many works have been proposed to solve the problem of detecting and mitigating model hallucinations. The main solution is to optimize hallucination mitigation in the model training stage and the application stage. The optimization plan in the training stage includes building a high-quality data set, designing a model structure that can better encode and utilize source information, and using controllable text generation technology and reinforcement learning technology. The optimization in the application stage mainly uses an external knowledge base to recall relevant knowledge to detect hallucinations in the model output. Furthermore, the original output of the model with hallucinations is post-edited and corrected to reduce the hallucinations of the generated text.

[0004] In order to alleviate hallucinations in the application stage, existing research works have proposed different solutions for post-editing and correcting the original output of the model with hallucinations:

[0005] (1) To address the hallucination mitigation problem of large language model summary generation tasks, a post-editing correction module is proposed. By extracting and exchanging entities between document d and the correct summary s, a hallucinated summary s' is constructed. (s', s, d) triples are constructed as training data. The summary text correction model is trained with BART as the base model. Experiments show that the model can correct factual errors in summaries generated by other neural summarization models and outperforms previous models in factual consistency evaluation on the CNN / DailyMail dataset.

[0006] (2) Generate questions q and retrieve evidence e to obtain reference materials for detecting hallucinations. Use a few-shot prompt and thought chain approach to take the model’s original output y, question q, and corresponding evidence e as input, and guide the model to perform hallucination correction on y based on q and e.

[0007] (3) By generating a question q and retrieving evidence e, an answer a is generated for q. On this basis, the model is trained to generate a statement expression based on the question q and the answer a. By calculating the consistency score between the generated statement expression and the retrieved evidence and the semantic distance between the generated statement expression and the original output of the model, the optimal statement is selected to replace the original output of the model, thereby alleviating the illusion existing in the original output of the model.

[0008] Although the trained model in solution (1) can accurately correct the errors in the summary of the test task, the overall recall rate of correcting factual errors in the real environment is still very low, which shows that the errors introduced by exchanging entities, numbers, dates and pronouns in the document and the correct summary have different distributions from the errors generated by the actual summary system. Obviously, the model trained based on the data constructed by this solution can only correct the above four types of errors. The model cannot detect and correct illusions at the opinion level. At the same time, the low recall rate of the model error correction shows that the model is not capable of detecting illusions.

[0009] Solution (2) uses a step-by-step approach to hallucination detection and mitigation, which increases the model's reasoning cost and latency in actual applications. At the same time, this work uses a few-sample prompt and thought chain approach, which places extremely high demands on the model's understanding ability. When the actual input and the provided sample distribution are inconsistent, the model is very likely to be unable to generate correct output. The few-sample prompt solution is not as generalizable and robust as a supervised training model for a specific task.

[0010] Solution (3) selects the best statement expression from multiple QA-generated statements to replace the original output of the model. Since each statement expression only verifies one information point in the original output of the model, this solution is not applicable when there are multiple hallucinations in the original output of the model. Summary of the invention

[0011] In view of the above-mentioned defects of the prior art, the technical problem to be solved by the present invention is how to design a more complete hallucination correction training data construction scheme so that the hallucination distribution of the text to be corrected is more consistent with the hallucination distribution of the actual application scenario, thereby improving the recall rate of the model in correcting factual errors in the actual application scenario; at the same time, the correct detection and correction of the original output of the model with multiple hallucinations at the same time can be achieved.

[0012] To achieve the above-mentioned purpose, the present invention provides, on the one hand, a large language model hallucination mitigation scheme based on citation correction, including two steps: hallucination detection and hallucination correction, wherein the hallucination detection uses reference materials as a benchmark to judge whether the original statement is consistent with the reference materials; the hallucination correction effectively corrects the hallucinations existing in the original statement that is inconsistent with the reference materials according to the reference materials, and finally outputs a corrected statement without hallucinations.

[0013] Preferably, the original statement is the original output of a large language model.

[0014] Preferably, the reference material is knowledge related to the original statement retrieved through an external knowledge base and / or a search engine.

[0015] On the other hand, the present invention also provides a large language model hallucination mitigation solution based on citation correction, which uses articles as data sources and the full text of articles as input for training data construction process; the training data includes original statements, reference materials and corrected statements; wherein the solution inputs the original statements and reference materials and outputs the corrected statements.

[0016] Preferably, the original statement includes a positive sample of the original statement, and the positive sample of the original statement is constructed in the following manner:

[0017] Randomly extract paragraphs from the full text of the article, including extracting single paragraphs and consecutive paragraphs, and filtering short paragraphs in the paragraph selection process;

[0018] Rewrite the extracted single paragraph, keep the rewritten text significantly different from the single paragraph, and keep the information expressed consistent;

[0019] Performing a text summary on the extracted multiple consecutive paragraphs, keeping the summary text information consistent with the extracted multiple consecutive paragraphs;

[0020] The single paragraph rewriting result and the continuous multi-paragraph summary result are positive samples of the original statement.

[0021] Preferably, the original statement includes an original statement negative sample, and the original statement negative sample is constructed in the following manner:

[0022] The original statement negative sample is constructed by injecting incorrect entities and rewriting contradictory opinions. The shortest text segment with incorrect entities and contradictory opinions is called a hallucination segment, which is extracted during the construction of the original statement negative sample.

[0023] Preferably, in the process of constructing the negative sample of the original statement by injecting the wrong entity, the NER model is used to extract the named entity and / or date and / or time and / or digital entity from the full text of the article and the paragraph used to construct the original statement respectively; in the process of injecting the wrong entity into the correct original statement by entity exchange, the semantic similarity between the entities is calculated, and the entity that is different from the entity to be replaced but has the closest semantics is selected from the full text entity for replacement, so that the hallucination distribution of the training data is more consistent with the actual situation.

[0024] Preferably, multiple erroneous entities of different types are injected into each original statement at the same time. The injection of the most similar erroneous entities and the simultaneous existence of multiple types of erroneous entities increase the difficulty of hallucination detection in erroneous statements, so that the model trained based on the data has stronger hallucination detection capabilities, and can correctly correct the original statement with multiple hallucination fragments existing at the same time.

[0025] Preferably, in the process of constructing negative samples of the original statement by rewriting contradictory opinions, errors in the expression of opinion levels are contained, and the entire sentence needs to be rewritten to correct the erroneous opinion; sentences containing opinion expressions in the original statement are selected, and a large model is used to output sentences that contradict its opinion, and the rewritten sentences replace the original sentences as negative samples of the original statement.

[0026] Preferably, the reference material is derived from knowledge related to the original statement retrieved through an external knowledge base and / or a search engine.

[0027] Preferably, the construction method of the reference material is one or more of the following methods:

[0028] (1) On the basis of the paragraph used to construct the original statement, the context paragraph in which the paragraph is located is superimposed, and redundant irrelevant information is introduced into the reference material, increasing the length of the reference material text, simulating the situation in which the recalled knowledge contains a lot of redundant information and the text is long in actual application;

[0029] (2) rewrite the original text of the intercepted article, keep the rewritten text and the original text in a way that is significantly different in expression, keep the information consistent, and reduce the textual similarity between the reference material and the original statement;

[0030] (3) Recall similar texts of the original statement positive samples based on external knowledge base and / or search engine retrieval to simulate the acquisition of reference materials in actual application process.

[0031] Preferably, the original statement includes an original statement positive sample and / or an original statement negative sample; the original statement positive sample without hallucination is output as the corrected statement in the original text, and the original statement negative sample with hallucination is modified into a corresponding positive sample and then output as the corrected statement in the original text.

[0032] The third aspect of the present invention also provides a large language model hallucination mitigation solution based on citation correction, which implements end-to-end citation correction by training a model using a SFT solution for the mainstream large language model.

[0033] Preferably, the SFT training data is in the form of a triple of instruction, input, and output, wherein the instruction describes the task that the model needs to complete, the input is task-related information, and the output is the model target output.

[0034] Preferably, the tasks are: hallucination detection;

[0035] The instruction is: Given an original statement and a reference material, please determine whether the original statement and the reference material are consistent, and directly output whether they are consistent or inconsistent;

[0036] The statement is: original statement: {original statement positive sample or original statement negative sample}; reference material: {reference material};

[0037] The output: consistent or inconsistent.

[0038] Preferably, the tasks are: hallucination detection and hallucination segment extraction;

[0039] The instruction is: Given a statement and a reference material, please determine whether the contents of the statement and the reference material are consistent. If they are consistent, please directly output the consistency. If they are inconsistent, please extract the fragments inconsistent with the reference material content from the statement, output the inconsistency in the first line, and directly output the extracted text fragments in the second line;

[0040] The statement is: original statement: {original statement positive sample or original statement negative sample}; reference material: {reference material};

[0041] Said output: consistent or inconsistent, {hallucination fragment}.

[0042] Preferably, the tasks are: hallucination detection and statement correction;

[0043] The instruction is: Given a statement and a reference material, there may be inconsistencies between the statement and the reference material. Please determine whether the statement and the reference material are consistent, and output consistency or inconsistency in the first line. If they are consistent, output the original statement in the second line. If they are inconsistent, please correct the statement according to the reference material so that the corrected statement is consistent with the reference material, and output the correction result in the second line.

[0044] The statement is: original statement: {original statement positive sample or original statement negative sample}; reference material: {reference material};

[0045] The output: consistent or inconsistent, {correction statement}.

[0046] Technical effects of the present invention:

[0047] (1) The present invention designs a more complete training data construction scheme, so that the distribution of training data (including hallucination distribution and reference material distribution) is more consistent with the actual application scenario, improving the accuracy of hallucination detection and the precision and recall of hallucination correction in the actual application scenario, and enabling the model to have the correction capability of correcting multiple hallucinations at the same time;

[0048] (2) The scheme of the present invention designs three tasks: hallucination detection, hallucination detection and hallucination fragment extraction, and hallucination detection and statement correction to gradually guide the model to learn citation correction capabilities. Among them, the hallucination detection and statement correction tasks not only enable the model to complete hallucination detection and hallucination correction in one step, reducing the reasoning resource cost and delay in actual application, but also further improve the model's hallucination detection capability.

[0049] The concept, specific structure and technical effects of the present invention will be further described below in conjunction with the accompanying drawings to fully understand the purpose, characteristics and effects of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 It is a flow chart of training data construction of a preferred embodiment of the present invention. DETAILED DESCRIPTION

[0051] The following describes several preferred embodiments of the present invention with reference to the drawings in the specification, so that the technical content is clearer and easier to understand. The present invention can be embodied in many different forms of embodiments, and the protection scope of the present invention is not limited to the embodiments mentioned in the text.

[0052] In the drawings, components with the same structure are indicated by the same numerical reference numerals, and components with similar structures or functions are indicated by similar numerical reference numerals. The size and thickness of each component shown in the drawings are arbitrarily shown, and the present invention does not limit the size and thickness of each component. In order to make the illustration clearer, the thickness of the components is appropriately exaggerated in some places in the drawings.

[0053] This preferred embodiment provides a large language model hallucination mitigation solution based on citation correction. The solution designs a complete hallucination correction training data construction solution, so that the hallucination distribution of the text to be corrected is more consistent with the hallucination distribution in the actual application scenario, thereby improving the recall rate of the model in correcting factual errors in the actual application scenario; improving the model's ability to detect hallucinations; the solution enables the model to complete hallucination detection and hallucination correction in one step, reducing resource costs and delays in the actual application process; and at the same time, achieving correct detection and correction of the original output of the model with multiple hallucinations at the same time.

[0054] This preferred embodiment proposes a large language model hallucination mitigation solution based on citation correction. By designing a complete citation correction training data construction solution, training data that is more consistent with the distribution of actual application scenarios is constructed, and supervised fine-tuning is performed based on the mainstream large model to achieve end-to-end citation correction.

[0055] To address the hallucination problem of text generated by large language models, we propose a hallucination mitigation solution based on citation correction. The original output of the large language model is called the original statement, and the knowledge related to the statement recalled through retrieval and other means is called reference material. The original statement will be tested for hallucination based on the reference material, and the original statement with hallucination will be corrected. The process of outputting the corrected statement without hallucination is called citation correction.

[0056] A large language model hallucination mitigation scheme based on citation correction includes two steps: hallucination detection and hallucination correction. The hallucination detection uses reference materials as a benchmark to determine whether an original statement is consistent with the reference materials. The hallucination correction effectively corrects the hallucinations in the original statement that are inconsistent with the reference materials based on the reference materials, and finally outputs a corrected statement without hallucinations.

[0057] like Figure 1 As shown, a large language model hallucination mitigation scheme based on citation correction is used, with articles as data sources and the full text of articles as input for the training data construction process; the training data includes original statements, reference materials and corrected statements; wherein the scheme inputs the original statements and reference materials and outputs the corrected statements.

[0058] We train the citation correction model by fine-tuning the mainstream large language model on the citation correction dataset. The training data elements are in the form of (original statement, reference material, correction statement) triples. The model receives (original statement, reference material) as input and outputs the correction statement. The proposed citation correction scheme is oriented to the Chinese field, using Chinese articles as data sources and the full text of the articles as input for the training data construction process. The data construction process is as follows: Figure 1 As shown, the following is a detailed introduction to the construction of each element of the training data:

[0059] (1) Original statement positive samples: Randomly extract paragraphs from the full text of the article, including extracting single paragraphs and consecutive multiple paragraphs, and filter short paragraphs in the paragraph extraction process; rewrite the extracted single paragraph to keep the rewritten text and the original paragraph significantly different and the expressed information consistent; summarize the extracted multiple paragraphs to keep the summary text information consistent with the extracted multiple paragraphs; the single paragraph rewriting results and the multiple paragraph summary results are the original statement positive samples. In order to ensure that the constructed positive sample expression information is consistent with the original text, a large language model is used to judge the consistency of the constructed original statement and the corresponding single paragraph and multiple paragraph original text, and filter out samples with inconsistent judgment results.

[0060] (2) Original statement negative samples: In order to make the hallucination distribution of the text to be corrected more consistent with the hallucination distribution in the actual application scenario and improve the recall rate of the model in correcting factual errors in the actual application scenario, we further optimized the scheme of constructing original statement negative samples by injecting erroneous entities and added original statement negative samples constructed by rewriting contradictory opinions. In addition, we called the shortest text fragment with erroneous entities and contradictory opinions a hallucination fragment and extracted the hallucination fragment during the negative sample construction process.

[0061] In the process of constructing negative samples by injecting wrong entities, the NER (Named Entity Recognition) model is used to extract named entities, date, time, and digital entities from the full text of the article and the paragraphs used to construct the original statement. In the process of injecting wrong entities into the correct statement through entity exchange, considering that the wrong entities existing in most texts are generally similar to the correct entities in actual situations, rather than more obvious errors, different from randomly selecting and exchanging entities of the same type, we calculate the semantic similarity between entities and select entities from the full text that are different from the entity to be replaced but have the closest semantics to replace them, so that the hallucination distribution of the training data is more consistent with the actual situation. In addition, multiple wrong entities of different types are injected into each statement at the same time. The injection of the most similar wrong entities and the simultaneous existence of multiple types of wrong entities increase the difficulty of hallucination detection in the wrong statement, so that the model trained based on this data has stronger hallucination detection capabilities and can realize the correct correction of multiple hallucinated original statements at the same time.

[0062] In the process of constructing negative samples by rewriting contradictory opinions, we consider that the existence of hallucinations in texts is not limited to entity-level errors, but also includes errors in the expression of opinions. Such errors cannot be simply eliminated by correcting the wrong entities, but the entire sentence needs to be rewritten to correct the wrong opinion. To this end, we select sentences in the original statement that contain opinion expressions, use a large model to output sentences that contradict their opinions, and replace the original sentences with the rewritten sentences as negative samples of the original statement.

[0063] (3) Reference materials: In the actual application of citation correction, reference materials are generally obtained from external knowledge bases or search engines. The retrieved relevant knowledge does not always maintain a high correlation with the original statement. In order to meet the needs of actual application scenarios and make the distribution of reference materials in the training data more consistent with the actual situation, we do not directly use the paragraphs used to construct the original statement as reference materials. Instead, we construct reference materials through the following three methods:

[0064] A. Extracting the context of the extracted paragraph: On the basis of the paragraph used to construct the original statement, the context paragraph of the paragraph is superimposed, and redundant irrelevant information is introduced into the reference material. At the same time, the length of the reference material text is increased to simulate the situation in which the recalled knowledge contains a lot of redundant information and the text is long in actual application;

[0065] B. Based on A, rewrite the original text of the intercepted article, keep the rewritten text and the original text in a way that there is a clear difference in expression, and keep the information expressed consistent, further reducing the textual similarity between the reference material and the original statement;

[0066] C. Recall similar texts of the original statement positive samples based on the plug-in knowledge base to simulate the acquisition of reference materials in actual application process.

[0067] 4. Correction statement: The original statement positive sample is used as the correction statement, that is, the model is required to output the original text of the original statement positive sample that is judged to have no hallucination, and modify the original statement negative sample that is judged to have hallucination to the corresponding original statement positive sample.

[0068] We use the supervised fine-tuning (SFT) scheme to train the model to achieve end-to-end citation correction. SFT training data is in the form of (instruction, input, output) triples, where the instruction describes the task that the model needs to complete, the input is task-related information, and the output is the model target output. In order to improve the model's ability to detect hallucinations and enable the model to complete hallucination detection and hallucination correction in one step, we designed three tasks to gradually guide the model to learn citation correction, namely hallucination detection, hallucination detection and hallucination fragment extraction, and hallucination detection and statement correction.

[0069] (1) Task: Hallucination detection;

[0070] Instructions: Given an original statement and a reference material, please determine whether the original statement and the reference material are consistent, and directly output whether they are consistent or inconsistent;

[0071] Claim: Original Claim: {original claim positive sample or original claim negative sample}; Reference Material: {reference material};

[0072] Output: consistent or inconsistent.

[0073] (2) Task: hallucination detection and hallucination segment extraction;

[0074] Instructions: Given a statement and a reference material, please determine whether the statement and the reference material are consistent. If they are consistent, please output the consistency directly. If they are inconsistent, please extract the inconsistent fragments from the statement and the reference material, output the inconsistency in the first line, and directly output the extracted text fragments in the second line.

[0075] Claim: Original Claim: {original claim positive sample or original claim negative sample}; Reference Material: {reference material};

[0076] Output: consistent or inconsistent, {hallucination fragment}.

[0077] (3) Task: hallucination detection and statement correction;

[0078] Instructions: Given a statement and a reference material, there may be inconsistencies between the statement and the reference material. Please determine whether the statement and the reference material are consistent, and output consistency or inconsistency in the first line. If they are consistent, output the original statement in the second line. If they are inconsistent, please correct the statement according to the reference material so that the corrected statement is consistent with the reference material, and output the correction result in the second line.

[0079] Claim: Original Claim: {original claim positive sample or original claim negative sample}; Reference Material: {reference material};

[0080] Output: Agreement or inconsistency, {correction statement}.

[0081] Table 1 gives examples of training data for three tasks. The hallucination detection task only requires the model to determine whether the original statement and the reference material are consistent; the hallucination detection and hallucination fragment extraction task requires the model to first perform hallucination detection and extract hallucination fragments for negative samples with hallucinations; the hallucination detection and statement correction task requires the model to first perform hallucination detection, output the original statement without hallucinations, and output the corrected result for statements with hallucinations.

[0082] Table 1 Training data examples

[0083]

[0084] According to the training data construction method mentioned above, we completed the construction of 12,000 training data based on 8,000 Chinese articles, performed supervised fine-tuning with baichuan2-13b-chat as the base model, and finally obtained the citation correction model.

[0085] For the evaluation of the effect of the trained model, we used the training data construction scheme to complete the construction of 3792 evaluation data based on 1757 Chinese articles, and designed different evaluation indicators for the three tasks: for the hallucination detection task, the gcc indicator was used to evaluate the accuracy of the model's hallucination detection; for the hallucination fragment extraction task, the F1 score was used to evaluate the precision and recall of the model's hallucination fragment extraction; for the statement correction task, the rouge-L indicator was used to calculate the degree of match between the corrected statement output by the model and the original statement positive sample, and the correction effect was observed by comparing the rouge-L values ​​between the statement before and after correction and the original statement positive sample. The citation correction model of baichuan2-13b-chat without SFT and after SFT was evaluated on the constructed dataset, and the evaluation results are shown in Table 2.

[0086] Table 2 Model evaluation results

[0087]

[0088] According to the evaluation results shown in Table 2, supervised fine-tuning of the baichuan2-13b-Chat model on the dataset we constructed can significantly improve the model's citation correction ability; in addition, the correction model has gradually improved its hallucination detection acc index in the three tasks of hallucination detection, hallucination detection and hallucination fragment extraction, and hallucination detection and statement correction. This shows that allowing the model to complete additional tasks based on the hallucination detection results can help further improve the model's hallucination detection ability. In the hallucination detection and statement correction tasks, the Rouge-L value between the model output corrected statement and the target statement is significantly improved (97.34->99.58), indicating that the model has achieved correct correction of hallucination statements.

[0089] The preferred specific embodiments of the present invention are described in detail above. It should be understood that ordinary technicians in the field can make many modifications and changes based on the concept of the present invention without creative work. Therefore, all technical solutions that can be obtained by technicians in the technical field based on the concept of the present invention through logical analysis, reasoning or limited experiments on the basis of the prior art should be within the scope of protection determined by the claims.

Claims

1. A method for constructing hallucination correction training data for a large language model, characterized in that: The article is used as a data source and the full text of the article is used as a training data construction process input; the training data includes an original statement, reference materials and a revised statement; wherein the scheme inputs the original statement and reference materials and outputs the revised statement; The original statement includes an original statement negative sample, and the original statement negative sample is constructed in the following manner: The original statement negative sample is constructed by injecting wrong entities and rewriting contradictory opinions. The shortest text segment with wrong entities and contradictory opinions is called a hallucination segment, and the hallucination segment is extracted during the construction of the original statement negative sample. In the process of constructing the negative sample of the original statement by injecting the wrong entity, the NER model is used to extract the named entity and / or date and / or time and / or digital entity from the full text of the article and the paragraph used to construct the original statement; in the process of injecting the wrong entity into the correct original statement by entity exchange, the semantic similarity between the entities is calculated, and the entity that is different from the entity to be replaced but has the closest semantics is selected from the full text entity for replacement, so that the hallucination distribution of the training data is more consistent with the actual situation; In the process of constructing negative samples of original statements by rewriting contradictory opinions, errors in the expression of opinions at the opinion level are included, and the entire sentence needs to be rewritten to correct the wrong opinions; select sentences containing opinions in the original statement, use the large model to output sentences that contradict its opinions, and replace the original sentences with the rewritten sentences as negative samples of the original statement; End-to-end citation correction is achieved by using a SFT solution training model for a large language model; the SFT solution training data is in the form of instruction, input, and output triples, where the instruction describes the task that the model needs to complete, the input is task-related information, and the output is the model target output.

2. The method for constructing large language model hallucination correction training data according to claim 1, characterized in that: The original statement includes an original statement positive sample, and the original statement positive sample is constructed in the following manner: Randomly extract paragraphs from the full text of the article, including extracting single paragraphs and consecutive paragraphs, and filtering short paragraphs in the paragraph selection process; Rewrite the extracted single paragraph, keep the rewritten text significantly different from the single paragraph, and keep the information expressed consistent; Performing a text summary on the extracted multiple consecutive paragraphs, keeping the summary text information consistent with the extracted multiple consecutive paragraphs; The single paragraph rewriting result and the continuous multi-paragraph summary result are positive samples of the original statement.

3. The method for constructing large language model hallucination correction training data according to claim 1, characterized in that: Multiple erroneous entities of different types are injected into each original statement at the same time. The injection of the most similar erroneous entities and the simultaneous existence of multiple types of erroneous entities increase the difficulty of hallucination detection in erroneous statements, making the model trained based on this data have stronger hallucination detection capabilities and achieving correct correction of original statements with multiple hallucination fragments at the same time.

4. The method for constructing large language model hallucination correction training data according to claim 1, characterized in that: The reference material is derived from knowledge related to the original statement retrieved through an external knowledge base and / or a search engine.

5. The method for constructing large language model hallucination correction training data according to claim 4, characterized in that: The construction method of the reference material is one or more of the following methods: (1) On the basis of the paragraph used to construct the original statement, the context paragraph in which the paragraph is located is superimposed, and redundant irrelevant information is introduced into the reference material, increasing the length of the reference material text, simulating the situation in which the recalled knowledge contains a lot of redundant information and the text is long in actual application; (2) rewrite the original text of the intercepted article, keep the rewritten text and the original text in a way that is significantly different in expression, keep the information consistent, and reduce the textual similarity between the reference material and the original statement; (3) Recall similar texts of the original statement positive samples based on external knowledge base and / or search engine retrieval to simulate the acquisition of reference materials in actual application process.

6. The method for constructing large language model hallucination correction training data according to claim 1, characterized in that: The original statement includes an original statement positive sample and / or an original statement negative sample; the original statement positive sample without hallucination is output as the corrected statement in the original text, and the original statement negative sample with hallucination is modified into a corresponding positive sample and then output as the corrected statement in the original text.

7. The method for constructing large language model hallucination correction training data according to claim 1, characterized in that: The tasks described are: hallucination detection; The instruction is: Given an original statement and a reference material, please determine whether the original statement and the reference material are consistent, and directly output whether they are consistent or inconsistent; The statement is: original statement: {original statement positive sample or original statement negative sample}; reference material: {reference material}; The output: consistent or inconsistent.

8. The method for constructing large language model hallucination correction training data according to claim 1, characterized in that: The tasks are: hallucination detection and hallucination fragment extraction; The instruction is: Given a statement and a reference material, please determine whether the contents of the statement and the reference material are consistent. If they are consistent, please directly output the consistency. If they are inconsistent, please extract the fragments inconsistent with the reference material content from the statement, output the inconsistency in the first line, and directly output the extracted text fragments in the second line; The statement is: original statement: {original statement positive sample or original statement negative sample}; reference material: {reference material}; Said output: consistent or inconsistent, {hallucination fragment}.

9. The method for constructing large language model hallucination correction training data according to claim 1, characterized in that: The tasks described are: hallucination detection and statement correction; The instruction is: Given a statement and a reference material, there may be inconsistencies between the statement and the reference material. Please determine whether the statement and the reference material are consistent, and output consistency or inconsistency in the first line. If they are consistent, output the original statement in the second line. If they are inconsistent, please correct the statement according to the reference material so that the corrected statement is consistent with the reference material, and output the correction result in the second line. The statement is: original statement: {original statement positive sample or original statement negative sample}; reference material: {reference material}; The output: consistent or inconsistent, {correction statement}.

10. A large language model hallucination mitigation method based on citation correction, which uses the large language model hallucination correction training data construction method described in any one of claims 1 to 9 to construct large language model hallucination correction training data, characterized in that: The method comprises two steps: hallucination detection and hallucination correction. The hallucination detection judges whether the original statement is consistent with the reference material based on the reference material. The hallucination correction effectively corrects the hallucination in the original statement that is inconsistent with the reference material according to the reference material, and finally outputs a corrected statement without hallucination.

11. The large language model hallucination mitigation method based on citation correction according to claim 10, characterized in that: The original statement is the original output of the large language model.

12. The large language model hallucination mitigation method based on citation correction according to claim 10, characterized in that: The reference material is knowledge related to the original statement that is retrieved through an external knowledge base and / or a search engine.