Knowledge boundary perception-based search enhancement generation method and system, electronic device, and storage medium

By constructing a knowledge gap labeled training dataset and fine-tuning the student model using instructions, a knowledge gap planning is generated, which solves the problems of over-retrieval and insufficient demand perception in RAG technology, realizes on-demand retrieval, and improves the accuracy and efficiency of question answering in large language models.

CN122153002APending Publication Date: 2026-06-05DALIAN UNIV OF TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DALIAN UNIV OF TECH
Filing Date
2026-03-20
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing Retrieval Augmentation (RAG) techniques suffer from over-retrieval and lack of demand awareness in knowledge-intensive tasks, leading to wasted computing resources and response delays. Furthermore, existing error correction mechanisms are insufficient to suppress the generation of illusions at the source.

Method used

By constructing a knowledge gap labeled training dataset, using a pre-trained student model for instruction fine-tuning and direct preference optimization, a knowledge gap planning is generated. Combined with cognitive confidence labels, the retrieval trigger is precisely determined, the retrieval decision is optimized, and on-demand retrieval is achieved.

Benefits of technology

It significantly reduces computational resource consumption and response latency, while improving the accuracy and credibility of answers, thus enhancing the performance of large language models in single-hop and multi-hop question-answering tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122153002A_ABST
    Figure CN122153002A_ABST
Patent Text Reader

Abstract

The application discloses a retrieval enhancement generation method and system based on knowledge boundary perception, an electronic device and a storage medium, and belongs to the technical field of natural language processing. The method comprises the following steps: generating a high-quality supervised track by using a teacher model, and learning the ability of gap planning and answers by instruction fine-tuning of a weak model; paired samples reflecting overconfidence and over-conservatism are constructed, and a DPO algorithm is used for confidence calibration; gap planning is generated by a student model during actual prediction, and it is accurately determined whether each knowledge point needs retrieval according to cognitive information labels, and accurate retrieval is triggered only for the knowledge points with knowledge gaps. The application can be widely applied to open domain question answering, dialogue systems and knowledge-intensive tasks by explicitly identifying knowledge boundaries, dynamically adjusting thresholds and fine-grained on-demand retrieval, while ensuring the accuracy of answers, significantly reducing the consumption of computing resources and response delay.
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, specifically to an adaptive retrieval enhancement generation method based on dynamic demand awareness, which is used to improve the accuracy of question answering and the necessity of retrieval in knowledge-intensive tasks using large language models. Background Technology

[0002] Large Language Models (LLMs) have demonstrated powerful capabilities in open-domain question answering, dialogue, and content creation. However, their knowledge is entirely embedded in the parameters, resulting in high update costs, poor timeliness, and a tendency to output inaccurate information due to "illusions." Retrieval-Augmented Generation (RAG), through a two-level paradigm of "retrieve first, then generate," injects real-time external documents into the context, enabling LLMs to acquire the latest knowledge without incremental training. This has become the mainstream technical approach for improving credibility. Compared to further expanding the parameter scale, RAG achieves "instant learning" with minimal computational power, offering significant advantages in professional knowledge service fields such as healthcare, finance, and law.

[0003] Retrieval-enhanced generation (RAG) technology effectively mitigates the illusion problem of LLM in knowledge-intensive tasks by combining external knowledge bases with large language models (LLM). Traditional RAG systems typically employ a two-stage pipeline architecture of retrieval and generation: first, relevant documents are retrieved based on the user query, and then the retrieval results are used as context input to the LLM to generate the answer. However, existing RAG technologies have the following limitations:

[0004] 1) Over-retrieval problem: Existing methods perform retrieval operations on all queries, regardless of whether the LLM has the knowledge required to answer the question, resulting in wasted computing resources and response delays.

[0005] 2) Lack of demand awareness: Existing technologies cannot accurately assess the extent to which an LLM (Local Master Analyst) possesses knowledge of a specific query, resulting in a lack of targeted retrieval decisions. Therefore, how to conduct sufficient necessary searches is receiving increasing attention, which is also the problem that this invention aims to solve.

[0006] To alleviate the computational redundancy and noise introduction problems caused by the "one-size-fits-all" approach in the traditional RAG paradigm, existing technologies mainly focus on improving the retrieval decision-making process from two dimensions: dynamic and refined.

[0007] One approach attempts to determine whether to trigger a retrieval based on implicit signals. Typical solutions include setting heuristic thresholds based on model perplexity or generation entropy, such as the Q3RAG framework, where the retrieval module is only activated when the model's confidence in the currently generated content falls below a preset threshold. The advantage of this approach is that it avoids meaningless retrieval operations to some extent, but its limitations are equally significant: implicit signals are difficult to interpret and cannot precisely characterize which specific knowledge the model is missing. Due to the lack of explicit modeling of knowledge boundaries, the model often exists in an ambiguous state between "knowing" and "not knowing," leading to a misalignment between retrieval decisions and actual knowledge needs—either triggering redundant retrievals when the model could answer correctly, or missing necessary retrievals when key knowledge points are truly lacking because the signals have not exceeded the threshold.

[0008] Another type of method introduces error correction mechanisms during or after the generation process. For example, the FLARE method dynamically determines whether a retrieval is needed before generating each sentence; if low-confidence terms are detected, it backtracks and rewrites subsequent content. Self-RAG, on the other hand, uses an introspective mechanism to evaluate the quality of the answer after generation and decide whether to correct it. While these methods can remedy early errors, the cost is a significantly prolonged prediction path. Furthermore, once early generation goes astray, subsequent retrievals are easily led by incorrect premises, creating a vicious cycle of error propagation. In other words, error correction mechanisms are essentially post-hoc remedies, not pre-hoc prevention, and are unlikely to suppress the generation of illusions at their source.

[0009] In summary, existing RAG technologies share a common deficiency in the knowledge requirement perception level: they lack explicit modeling and precise quantification of the model's own knowledge boundaries, failing to answer "what I know," "what I don't know," or "what specific knowledge I lack." This deficiency leads to either blind or delayed retrieval decisions, failing to achieve optimal coupling between retrieval and generation. Summary of the Invention

[0010] To address the technical problems of traditional RAG systems, such as over-retrieval, fixed retrieval timing, and lack of demand awareness, this invention provides an adaptive retrieval enhancement generation method based on dynamic demand awareness. By introducing knowledge gap quantification assessment, adaptive threshold adjustment, and reinforcement learning optimization mechanisms, it achieves more accurate and efficient on-demand retrieval, significantly reducing computational resource consumption and response latency while ensuring answer accuracy.

[0011] To achieve the above objectives, the present invention adopts the following technical solution:

[0012] The first aspect of this invention provides a retrieval enhancement generation method based on knowledge boundary awareness, comprising the following steps:

[0013] S1: Construct a mainstream open-domain question-answering benchmark dataset, which includes question texts and their corresponding real answers;

[0014] S2: Using a pre-trained large model as the teacher model, knowledge gap planning is generated for each question text in the mainstream open-domain question answering benchmark dataset. The knowledge gap planning includes knowledge points decomposed from the question text, cognitive confidence labels for each knowledge point, and query statements. Based on each question text, its corresponding knowledge gap planning, and the actual answers, a knowledge gap annotation training dataset is constructed.

[0015] S3: Use the knowledge gap labeled dataset to perform instructional fine-tuning on the pre-trained student model. The student model learns the ability to generate supervised trajectories and answers, resulting in the instructionally fine-tuned student model.

[0016] S4: Based on the knowledge gap labeled dataset, construct a preference alignment dataset by batch modifying accurate knowledge points; perform DPO training on the student model after fine-tuning the instructions obtained in S3 based on the preference alignment dataset to obtain a large knowledge gap planning model;

[0017] S5: Input the question text to be queried into the knowledge gap planning model to obtain the knowledge gap plan; based on the cognitive confidence label of each knowledge point in the knowledge gap plan, decide whether to trigger the retrieval;

[0018] S6: For each knowledge point that triggers the retrieval, use the retrieval tool to retrieve Top-level knowledge points from the corpus. A collection of documents; and aggregate the document collections obtained from all knowledge points that trigger the search into global evidence;

[0019] S7: The knowledge gap planning model generates the final answer based on the question text to be queried and global evidence.

[0020] Furthermore, in step S2, the process of constructing the knowledge gap annotation training dataset includes:

[0021] Question text from mainstream open-domain question-answering benchmark datasets Input teacher model , Generate knowledge gap planning for the model parameters:

[0022]

[0023] in, , It represents the total number of question texts in a mainstream open-domain question-answering benchmark dataset, with each question text representing the total number of question texts. Decomposed into One knowledge point, ; It is the first The textual description of each knowledge point can be regarded as a token sequence. , For vocabulary medium length is The token sequence, for The length of the token sequence; The teacher model is for the first Cognitive confidence labels for each knowledge point, among which To express certainty, Indicates uncertainty. He indicated that he did not know; For the first The query statement for each knowledge point, the content of the query statement is composed of... Decision, if The query statement Empty; if The query statement For the first A query for a specific knowledge point (it's a question);

[0024] All question text and its corresponding knowledge gap planning and the real answer Composition of knowledge gap annotation training dataset It is used to guide the model to learn the ability to start from a problem, plan a trajectory, and finally generate the correct answer.

[0025] Furthermore, the teacher model includes the GPT model, the Claude model, or the Gemini model.

[0026] Furthermore, in step S3, the pre-trained student model is a pre-trained language model based on the Transformer architecture, including the Llama series models; the pre-trained student model is subjected to supervised training using the Supervised Fine-Tuning (SFT) method, and the training process includes:

[0027] Input / output construction: Label the knowledge gaps in the training dataset. As input to the pre-trained student model, Each problem sample Planning for the corresponding knowledge gap Concatenate them into a complete target sequence;

[0028] Training objective: Maximize the joint probability that the pre-trained student model generates the correct planned trajectory under given problem conditions; achieved by minimizing the negative log-likelihood loss function.

[0029]

[0030] in, The probabilistic expression representing the pre-trained student model generating planned trajectories sequentially in an autoregressive manner is as follows:

[0031]

[0032] in, Planning for the knowledge gap The length of the token;

[0033] Optimization process: Use stochastic gradient descent or its variants (such as AdamW) to optimize the model parameters. Iterative optimization is performed until the loss converges; during training, the model learns to map the problem to the corresponding reasoning trajectory and gradually masters the ability to plan and generate knowledge gaps.

[0034] After fine-tuning with the above instructions, the parameters of the pre-trained student model are updated, resulting in the fine-tuned student model. This model can autonomously generate reasonable knowledge gap planning and output accurate answers to input questions, thereby completing knowledge reasoning and answering for specific tasks.

[0035] Furthermore, in step S4, the preference alignment dataset is constructed based on the following method:

[0036] Training dataset labeled with knowledge gaps Based on this, construct a preference alignment dataset. This dataset is used to guide the model in distinguishing the quality of different plans;

[0037] in, As a positive sample, Label the training dataset for knowledge gaps = , Indicates the text of the question. The optimal knowledge gap planning, i.e., high-quality planning that conforms to human preferences; For negative samples, It is to label the knowledge gaps in the training dataset. middle In Transformation is performed on the original The knowledge points are marked as or , will originally or The knowledge points are marked as ; This indicates the corresponding inferior choice knowledge gap planning, i.e. planning that is of lower quality or does not conform to preferences.

[0038] Furthermore, in step S4, the student model fine-tuned by the instructions is trained using DPO based on the preference alignment dataset, including:

[0039] The student model after fine-tuning the instructions is used as the initial policy model, and its parameters are denoted as follows: The corresponding probability distribution is Simultaneously, the initial strategy model is frozen as a reference strategy model. (Parameters remain fixed) to constrain the direction of model updates during training, preventing it from deviating too far from its original capabilities; the core objective of DPO is to optimize the initial policy model. This makes it possible for each problem The model provides optimal knowledge gap planning. The probability of success is higher than that of a poor choice in knowledge gap programming. Furthermore, this difference is improved compared to the reference policy model; therefore, the loss function is defined as follows:

[0040]

[0041] in: Use the Sigmoid activation function; This is a temperature coefficient used to adjust the smoothness of preference differences; This represents the log probability difference between the preferred knowledge gap planning and the undesired knowledge gap planning under the current initial strategy model; This represents the corresponding log-probability difference under the reference policy model; expectation. The calculation is performed on all samples in the preference alignment dataset, which is approximated in practice through batch sampling.

[0042] The purpose of this loss function is to maximize the model's preference for the optimal knowledge gap planning (i.e., Compared to (The increase) is the log-likelihood after the Sigmoid transformation; intuitively, when Greater than When the loss decreases, the model is encouraged to favor the optimal plan over the reference model.

[0043] Minimize the loss function using stochastic gradient descent (such as the AdamW optimizer). Iteratively update the initial policy model parameters During training, refer to the policy model. Keep it fixed, optimize only After several rounds of training, the model converges, yielding the final large-scale knowledge gap planning model. The model When generating knowledge gap planning, it can automatically favor high-quality planning, effectively improving the rationality and accuracy of the planning trajectory, thereby providing better support for subsequent answer generation.

[0044] Furthermore, step S5 is detailed as follows:

[0045] The text of the question to be queried Input knowledge gap planning large model To obtain knowledge gap planning for all knowledge points According to cognitive confidence labels Determine whether a search has been triggered.

[0046] Furthermore, in step S6, the global evidence is obtained based on the following method:

[0047] The files in the corpus are segmented using the Porter stemmer to obtain the word segmentation results;

[0048] All documents in the corpus are segmented into words, the segmentation results of all documents are scanned, and a large dictionary is built with "keywords" as the key and "a list of document IDs containing the word" as the value.

[0049] Set hyperparameters In knowledge gap planning middle, For the first A query statement that triggers the retrieval of knowledge points ( Using the same Porter stemmer to segment... Perform word segmentation and use a search engine The BM25 model for the corpus Calculate a relevance score for each document, and retrieve the top-scoring documents. A collection of documents ;

[0050] The collection of documents retrieved from all knowledge points that trigger the search in the text of the query question is aggregated into global evidence. .

[0051] A second aspect of the present invention provides a knowledge boundary-aware retrieval enhancement generation system for executing the knowledge boundary-aware retrieval enhancement generation method, comprising:

[0052] The query receiving module is used to receive input query text and perform preprocessing.

[0053] The knowledge gap planning generation module is used to call the large-scale knowledge gap planning model to generate knowledge gap plans;

[0054] The retrieval decision module is used to determine whether to trigger a retrieval based on the cognitive confidence tags in the knowledge gap planning.

[0055] The retrieval execution module is used to retrieve Top-level keywords from the corpus for each knowledge point that triggers the retrieval. A collection of documents and aggregate the document collections into global evidence;

[0056] The answer generation module is used by the knowledge gap planning big model to generate the final answer based on the question text to be queried and global evidence.

[0057] A third aspect of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor; when the processor executes the computer program, the electronic device executes the knowledge boundary-aware retrieval enhancement generation method described above.

[0058] A fourth aspect of the present invention provides a storage medium comprising a computer program that, when run on an electronic device, causes the electronic device to execute the knowledge boundary-aware retrieval enhancement generation method described above.

[0059] The beneficial effects of this invention are as follows: By designing a knowledge boundary-aware on-demand retrieval stage, this invention generates a knowledge gap planning mechanism from the student model during actual prediction and precisely determines whether each knowledge point needs to be retrieved based on its cognitive confidence label. For knowledge points whose cognitive confidence label is not "Known," the corresponding search text is used as the query for precise retrieval. Compared to existing technologies that uniformly retrieve all queries or only obtain a token indicating whether retrieval is needed, this invention achieves fine-grained on-demand retrieval, triggering retrieval only for knowledge points with knowledge gaps, significantly reducing computational resource consumption and response latency while ensuring answer accuracy. This invention achieves industry-leading results in both single-hop and multi-hop question-answering tasks, improving the factual accuracy and generation credibility of LLM. Attached Figure Description

[0060] Figure 1 This is a structural block diagram of the retrieval enhancement generation method based on knowledge boundary awareness in an embodiment of the present invention.

[0061] Figure 2 This is a training flowchart of the retrieval enhancement generation method based on knowledge boundary awareness in an embodiment of the present invention.

[0062] Figure 3 This is a flowchart illustrating the reasoning process of the knowledge boundary awareness-based retrieval enhancement generation method in this embodiment of the invention. Detailed Implementation

[0063] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0064] like Figure 1 As shown in the figure, this embodiment of the invention provides a retrieval enhancement generation method based on knowledge boundary awareness, the steps of which are as follows:

[0065] S1. Select the dataset NaturalQuestion and preprocess the dataset, specifically: obtain the question text and its corresponding real answer in the dataset.

[0066] S2. Using the pre-trained large model GPT-5 as the teacher model, knowledge gap planning is generated for each question text in the dataset obtained in S1; based on each question text, its corresponding knowledge gap planning, and the actual answers, a knowledge gap annotation training dataset is constructed; the specific process is as follows:

[0067] S2.1, Extract the question text from the NaturalQuestion dataset. Input teacher model , Generate knowledge gap planning for the model parameters:

[0068]

[0069] in, , It represents the number of all question texts in the NaturalQuestion dataset, and the number of each question text. Decomposed into One knowledge point; It is the first The textual description of each knowledge point can be regarded as a token sequence. , For vocabulary medium length is The token sequence, for The length of the token sequence; The teacher model GPT-5 is the first Cognitive confidence labels for each knowledge point, among which To express certainty, Indicates uncertainty. He indicated that he did not know; For the first The query statement for each knowledge point, the content of the query statement is composed of... Decision, if The query statement Empty; if The query statement For the first Search for individual knowledge points;

[0070] All question text and its corresponding knowledge gap planning and the real answer Composition of knowledge gap annotation training dataset .

[0071] S3. Annotate datasets using knowledge gaps. The pre-trained student model Llama3.1-8B was fine-tuned using instructions to obtain the fine-tuned student model; the specific process is as follows:

[0072] Input / output construction: Label the knowledge gaps in the training dataset. As input to the pre-trained student model, Each problem sample Planning for the corresponding knowledge gap They are then assembled into a complete target sequence.

[0073] Training objective: Maximize the joint probability that the pre-trained student model generates the correct planned trajectory under given problem conditions; achieved by minimizing the negative log-likelihood loss function.

[0074]

[0075] in, The probabilistic expression representing the pre-trained student model generating planned trajectories sequentially in an autoregressive manner is as follows:

[0076]

[0077] in, Planning for the knowledge gap The length of the token.

[0078] Optimization process: Set the training learning rate to... The training batch size was set to 4, the training epochs were set to 12, and the AdamW optimizer was used to optimize the model parameters using stochastic gradient descent. Perform iterative optimization until the loss converges.

[0079] After fine-tuning with the above instructions, the parameters of the pre-trained student model are updated, resulting in the fine-tuned student model. This model can autonomously generate reasonable knowledge gap planning and output accurate answers to input questions, thereby completing knowledge reasoning and answering for specific tasks.

[0080] S4. To improve the quality of the knowledge gap planning generated by the student model after instruction fine-tuning and make it more in line with human preferences, the Direct Preference Optimization (DPO) method is introduced for further training; the specific process is as follows:

[0081] S4.1, Use knowledge gap annotations to train the dataset. Based on this, construct a preference alignment dataset. This dataset is used to guide the model in distinguishing the quality of different plans;

[0082] in, As a positive sample, Label the training dataset for knowledge gaps = , Indicates the text of the question. The optimal knowledge gap planning, i.e., high-quality planning that conforms to human preferences; For negative samples, It is to label the knowledge gaps in the training dataset. middle In Transformation is performed on the original The knowledge points are marked as or , will originally or The knowledge points are marked as ; This indicates the corresponding inferior choice knowledge gap planning, i.e. planning that is of lower quality or does not conform to preferences.

[0083] S4.2. Use the student model after fine-tuning the instructions as the initial policy model, and denote its parameters as follows: The corresponding probability distribution is Simultaneously, the initial strategy model is frozen as a reference strategy model. (Parameters remain fixed) to constrain the direction of model updates during training, preventing it from deviating too far from its original capabilities; the core objective of DPO is to optimize the initial policy model. This makes it possible for each problem The model provides optimal knowledge gap planning. The probability of success is higher than that of a poor choice in knowledge gap programming. Furthermore, this difference is improved compared to the reference policy model; therefore, the loss function is defined as follows:

[0084]

[0085] in: Use the Sigmoid activation function; This is a temperature coefficient, ranging from 0.05 to 0.5, used to adjust the smoothness of preference differences; This represents the log probability difference between the preferred knowledge gap planning and the undesired knowledge gap planning under the current initial strategy model; This represents the corresponding log-probability difference under the reference policy model; expectation. The calculation is performed on all samples in the preference alignment dataset, which is approximated in practice through batch sampling.

[0086] Training learning rate size set The training batch size was set to 22, the training epochs to 12, and the AdamW optimizer was used to minimize the loss function using stochastic gradient descent. Iteratively update the initial policy model parameters During training, refer to the policy model. Keep it fixed, optimize only After several rounds of training, the model converges, yielding the final large-scale knowledge gap planning model. .

[0087] S5. Submit the text of the query question. Input knowledge gap planning large model To obtain knowledge gap planning for all knowledge points According to cognitive confidence labels Determine whether a search has been triggered.

[0088] S6. For each knowledge point that triggers the retrieval, use the retrieval tool to retrieve Top-level knowledge points from the corpus. A collection of documents; and aggregate the document collections obtained from all knowledge points that trigger the retrieval into global evidence; the specific process is as follows:

[0089] S6.1. Obtain word segmentation results from the files in the corpus using the Porter stemmer.

[0090] S6.2. Segment all documents in the corpus, scan the segmentation results of all documents, and build a large dictionary with "keyword" as the key and "a list of document IDs containing the word" as the value;

[0091] S6.3 Setting Hyperparameters In knowledge gap planning middle, For the first A query statement that triggers the retrieval of knowledge points ( Using the same Porter stemmer to segment... Perform word segmentation and use a search engine The BM25 model for the corpus Calculate a relevance score for each document, and retrieve the top-scoring documents. A collection of documents ;

[0092] The collection of documents retrieved from all knowledge points that trigger the search in the text of the query question is aggregated into global evidence. .

[0093] S7. Submit the text of the query question. With global evidence Input knowledge gap planning large model Knowledge Gap Planning Model Generate the final answer.

[0094] This embodiment conducted experiments on the single-hop question-answering dataset NaturalQuestion, using EM as the evaluation metric. Natural Questions (NQ) is a top-tier open-source question-answering dataset from Google, designed specifically for training and evaluating automated question-answering systems. It contains questions posed by real users to Google Search and authoritative answers from knowledge resources, making it an essential resource for NLP researchers and developers to improve machine reading comprehension. Unlike manually constructed datasets, all questions in NQ come from real search requests by anonymous users. This means the data naturally includes colloquial expressions, ambiguous questions, and complex reasoning requirements, perfectly simulating real-world application scenarios. Furthermore, this embodiment also conducted experiments on the HotpotQA dataset, which is based on Wikipedia and contains approximately 113k question-answer pairs. Its question design requires multi-step reasoning across multiple documents to answer and provides sentence-level supporting facts to enhance the interpretability of the answers. The method of this invention is compared with the Atlas, RECOMP, Self-RAG, FLARE, and RADIO models; the experimental results are shown in Tables 1 and 2.

[0095] Table 1 Experimental results of the NaturalQuestion dataset

[0096]

[0097] Table 2 Experimental results on the HotpotQA dataset

[0098]

[0099] Based on the experimental results in Tables 1 and 2, the data retrieval enhancement strategy implemented in this invention significantly optimizes the model's performance on the exact matching metric. This performance improvement can be attributed to the fact that the method of this invention optimizes the collaboration between the retrieval unit and the generator through more effective data augmentation techniques. Compared to the baseline model, the retrieval documents or paragraphs generated by this invention more accurately cover the core entities and relationships of the question. The performance leap of this invention can be attributed to the strategy enhancing the model's learning of "cross-document dependencies" and "intermediate evidence chains" during the training phase, enabling the model to more accurately reproduce the standard answer string that requires multiple steps of reasoning during the inference phase, rather than just shallow information matching. The EM metric requires the model output to perfectly match the standard answer, which places extremely high demands on the spelling of named entities (such as people's names and place names), numbers, and specific phrases. This self-reflective approach, with its emphasis on precise character-level alignment between the output and the original text, gives this invention an advantage over the stringent EM metric.

[0100] Finally, it should be noted that the above embodiments are intended to illustrate the technical solutions of the present invention and do not constitute any limitation on the present invention. Those skilled in the art should fully understand that modifications to the technical solutions described in the foregoing embodiments or equivalent substitutions for any part or all of the technical features are entirely feasible. Such modifications or substitutions, as long as they do not depart from the scope of protection defined by the claims of the present invention, should be considered reasonable extensions of the present invention.

Claims

1. A retrieval enhancement generation method based on knowledge boundary awareness, characterized in that, include: S1: Construct a mainstream open-domain question-answering benchmark dataset, which includes question texts and their corresponding real answers; S2: Using a pre-trained large model as the teacher model, knowledge gap planning is generated for each question text in the mainstream open-domain question answering benchmark dataset. The knowledge gap planning includes knowledge points decomposed from the question text, cognitive confidence labels for each knowledge point, and query statements. Based on the text of each question, its corresponding knowledge gap planning, and the actual answers, a knowledge gap annotation training dataset is constructed. S3: Use the knowledge gap annotation dataset to perform imperative fine-tuning on the pre-trained student model to obtain the imperatively fine-tuned student model; S4: Based on the knowledge gap labeled dataset, construct a preference alignment dataset by batch modifying accurate knowledge points; Based on the preference alignment dataset, the student model after fine-tuning the instructions obtained from S3 is trained by DPO to obtain a large knowledge gap planning model. S5: Input the question text to be queried into the knowledge gap planning model to obtain the knowledge gap plan; based on the cognitive confidence label of each knowledge point in the knowledge gap plan, decide whether to trigger the retrieval; S6: For each knowledge point that triggers the retrieval, use the retrieval tool to retrieve Top-level knowledge points from the corpus. A collection of documents; and aggregate the document collections obtained from all knowledge points that trigger the search into global evidence; S7: The knowledge gap planning model generates the final answer based on the question text to be queried and global evidence.

2. The retrieval enhancement generation method based on knowledge boundary awareness according to claim 1, characterized in that, In step S2, the process of constructing the knowledge gap annotation training dataset includes: Question text from mainstream open-domain question-answering benchmark datasets Input teacher model , Generate knowledge gap planning for the model parameters: in, , It represents the total number of question texts in a mainstream open-domain question-answering benchmark dataset, with each question text representing the total number of question texts. Decomposed into One knowledge point; It is the first The textual description of each knowledge point is considered as a token sequence. , For vocabulary medium length is The token sequence, for The length of the token sequence; The teacher model is for the first Cognitive confidence labels for each knowledge point, among which To express certainty, Indicates uncertainty. He indicated that he did not know; For the first The query statement for each knowledge point, the content of the query statement is composed of... Decision, if The query statement Empty; if The query statement For the first Search for individual knowledge points; All question text and its corresponding knowledge gap planning and the real answer Composition of knowledge gap annotation training dataset .

3. The retrieval enhancement generation method based on knowledge boundary awareness according to claim 2, characterized in that, In step S3, the pre-trained student model is a pre-trained language model based on the Transformer architecture; the pre-trained student model is trained in a supervised manner using an instruction fine-tuning method, and the training process includes: Label the knowledge gaps in the training dataset. As input to the pre-trained student model, Each problem sample Planning for the corresponding knowledge gap Concatenate them into a complete target sequence; Maximize the joint probability that the pre-trained student model generates the correct planned trajectory under given problem conditions; this is achieved by minimizing the negative log-likelihood loss function. in, The probabilistic expression representing the pre-trained student model generating planned trajectories sequentially in an autoregressive manner is as follows: in, Planning for the knowledge gap The length of the token; Use stochastic gradient descent or its variants to test the model parameters. Perform iterative optimization until the loss converges; the parameters of the pre-trained student model are updated, and the student model after fine-tuning is obtained.

4. The retrieval enhancement generation method based on knowledge boundary awareness according to claim 3, characterized in that, In step S2 and step S4, the preference alignment dataset is constructed based on the following method: Training dataset labeled with knowledge gaps Based on this, construct a preference alignment dataset. ; in, As a positive sample, Label the training dataset for knowledge gaps = , Indicates the text of the question. Optimal knowledge gap planning; For negative samples, It is to label the knowledge gaps in the training dataset. middle In Transformation is performed on the original The knowledge points are marked as or , will the original or The knowledge points are marked as ; This represents the corresponding knowledge gap planning for the inferior choice.

5. The retrieval enhancement generation method based on knowledge boundary awareness according to claim 4, characterized in that, In step S4, the student model after instruction fine-tuning is trained using DPO based on the preference alignment dataset, including: The student model after fine-tuning the instructions is used as the initial policy model, and its parameters are denoted as follows: The corresponding probability distribution is Simultaneously, the initial strategy model is frozen as a reference strategy model. It is used to constrain the direction of model updates during training to prevent it from deviating too far from the original capability; the core objective of DPO is to optimize the initial policy model. This makes it possible for each problem The model provides optimal knowledge gap planning. The probability of success is higher than that of a poor choice in knowledge gap programming. Furthermore, this difference is improved compared to the reference policy model; therefore, the loss function is defined as follows: in: Use the Sigmoid activation function; This is a temperature coefficient used to adjust the smoothness of preference differences; This represents the log probability difference between the preferred knowledge gap planning and the undesired knowledge gap planning under the current initial strategy model; This represents the corresponding log-probability difference under the reference policy model; expectation. Calculate for all samples in the preference alignment dataset; Minimize the loss function using stochastic gradient descent Iteratively update the initial policy model parameters During training, refer to the policy model. Keep it fixed, optimize only After several rounds of training, the model converges, yielding the final large-scale knowledge gap planning model. .

6. The retrieval enhancement generation method based on knowledge boundary awareness according to claim 5, characterized in that, In step S2 and step S6, the global evidence is obtained based on the following methods: The files in the corpus are segmented using the Porter stemmer to obtain the word segmentation results; All documents in the corpus are segmented into words, the segmentation results of all documents are scanned, and a large dictionary is built with "keywords" as the key and "a list of document IDs containing the word" as the value. Set hyperparameters In the knowledge gap planning generated in step S5, For the first A query statement that triggers the retrieval of knowledge points. Using the same Porter stemmer to segment the word Perform word segmentation and use a search engine The BM25 model for the corpus Calculate a relevance score for each document, and retrieve the top-scoring documents. A collection of documents ; The collection of documents retrieved from all knowledge points that trigger the search in the text of the query question is aggregated into global evidence. .

7. The retrieval enhancement generation method based on knowledge boundary awareness according to claim 1, characterized in that, The teacher model includes the GPT model, the Claude model, or the Gemini model.

8. A knowledge boundary-aware retrieval enhancement generation system, used to execute the knowledge boundary-aware retrieval enhancement generation method according to any one of claims 1 to 7, characterized in that, include: The query receiving module is used to receive input query text and perform preprocessing. The knowledge gap planning generation module is used to call the large-scale knowledge gap planning model to generate knowledge gap plans; The retrieval decision module is used to determine whether to trigger a retrieval based on the cognitive confidence tags in the knowledge gap planning. The retrieval execution module is used to retrieve Top-level keywords from the corpus for each knowledge point that triggers the retrieval. A collection of documents and aggregate the document collections into global evidence; The answer generation module is used by the knowledge gap planning big model to generate the final answer based on the question text to be queried and global evidence.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor; characterized in that, When the processor executes the computer program, it causes the electronic device to perform the knowledge boundary awareness-based retrieval enhancement generation method as described in any one of claims 1 to 7.

10. A storage medium comprising a computer program, characterized in that, When the computer program is run on an electronic device, the electronic device performs the knowledge boundary-aware retrieval enhancement generation method as described in any one of claims 1 to 7.