Model training method for improving search enhancement generation answer accuracy

By building a deep learning network model, the text fusion of search information and problems is realized, and the problem of insufficient correlation between information and problems in the existing technology is solved, and the accuracy and efficiency of retrieval is improved.

CN119646516APending Publication Date: 2025-03-18SHANGHAI YUEXUAN TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411792970.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-08
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

The existing search-enhanced generation technology lacks an effective correlation fusion method between information retrieval and generative model, resulting in inaccuracy and inefficiency in generating answers.

Method used

A deep learning network model is designed to build a text fusion model for retrieving information and problems, and combined with a low-rank decomposition fine-tuning model, the semantic correlation between information and problems is achieved, thereby improving the accuracy of generated answers.

Benefits of technology

Through effective information and questions, the accuracy of retrieval is improved to enhance the generated answers, reduce the dependence on prompt word design, and improve the generalization ability of usage scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119646516A_ABST
    Figure CN119646516A_ABST
Patent Text Reader

Abstract

The invention discloses a model training method for improving the accuracy of retrieval enhancement generation of answers, belongs to the technical field of model training methods, and designs a text fusion model architecture for associating information obtained by retrieval enhancement generation and retrieval with input questions, and the text fusion model architecture is used for constructing the relevance between the questions and the information. The method for fusing the retrieved information and the internal knowledge of the generation model is designed, targeted cue word design does not need to be carried out on the question, and the generalization ability of a use scene and the question answering accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a model training method, and in particular to a model training method for improving the accuracy of retrieval enhancement and generated answers, and belongs to the technical field of model training methods. Background Art

[0002] Retrieval-augmented generation is a technique that combines information retrieval and generative models to improve the performance and accuracy of generative models. Retrieval-augmented generation enhances the generation process by retrieving relevant information before generating text. It is particularly suitable for tasks that require the integration of external knowledge, such as question-answering systems, dialogue generation, and content creation. However, there are still several difficulties in using retrieval-augmented generation, as follows:

[0003] 1. The information obtained in the retrieval stage of retrieval enhancement generation directly affects the accuracy of the generated results, but there is no direct connection between this part of information and the question;

[0004] 2. There is a lack of general integration methods for the retrieved information and the intrinsic knowledge of the generative model. The answers to relevant questions rely on complex prompt word designs, which are inefficient.

[0005] To this end, a model training method is designed to improve the accuracy of retrieval-enhanced generated answers to solve the above problems. Summary of the invention

[0006] The main purpose of the present invention is to provide a model training method for improving the accuracy of retrieval enhanced generated answers.

[0007] The purpose of the present invention can be achieved by adopting the following technical solutions:

[0008] A model training method for improving the accuracy of retrieval enhancement generation answers, comprising the following steps:

[0009] Step 1: Build a deep learning network model to achieve text fusion of retrieval information and questions;

[0010] Step 2: Use the labeled question-answering text dataset to train the parameters of the association model in step 1 and the low-rank decomposition fine-tuning model in step 2;

[0011] Step 3: Calculate the loss function with the manually annotated reference text, and use the optimizer to iterate and update the parameters of the fusion network model in step 1 and the low-rank decomposition model in step 2.

[0012] Preferably, in step one, the construction of a deep learning network model for text fusion of retrieval information and question includes respectively passing the input question text and the retrieved reference knowledge content text into the general vector model BGE to obtain corresponding feature vectors, wherein I represents the feature vector of the input question text, and P represents the feature vector of the retrieved reference content. Then, through a cross-attention network, a fused feature vector is finally obtained to represent the intrinsic relationship between the input question text and the retrieved content as the input information in step two.

[0013] Preferably, the cross-attention mechanism network is defined as:

[0014]

[0015] W q is the query parameter matrix, W k is the key parameter matrix, W v is the value parameter matrix, d is the size of the feature vector dimension, Q is the query vector, K is the key vector, and V is the value vector; P represents the training sentence text vector data; I represents the training question text vector data.

[0016] Preferably, in step 2, the fused feature vector in step 1 is added to the output value of the low-rank decomposition matrix;

[0017] Input the text information of the input question into the large language model and superimpose the corresponding low-rank decomposition matrix output value in the attention layer;

[0018] The combined features are then used to calculate the large language model to obtain the probability value of the output text.

[0019] Preferably, the labeled question-answer text dataset used in step 2 includes three parts:

[0020] Input questions, reference knowledge data and manually annotated reference answers are output;

[0021] By manually screening high-quality question-answer text data, the number of iterations required for training can be effectively saved, thereby reducing time costs;

[0022] For a given word sequence u={u t , ..., u t The goal of the language modeling task is defined as the word prediction task: based on the word sequence u before the current position in the sequence <t , using autoregressive method for the target word u t Make predictions.

[0023] Preferably, during training, the model is typically optimized according to a likelihood function:

[0024]

[0025] Among them, P(ut|u<t) represents the probability of outputting the next token ut given the input text token sequence u<t. log represents the logarithmic operation. It means decomposing a token sequence of input length T into T segments, taking the logarithm of the token output probability of each segment and then superimposing them to obtain the final loss function L(u). The training data is fed into the model in batches of size 128, and finally the network model parameters are iteratively optimized and updated through the AdamW optimizer.

[0026] Advantageous technical effects of the present invention:

[0027] A model training method for improving the accuracy of retrieval-augmented generation answers provided by the present invention. The present invention designs a text fusion model architecture for associating the information retrieved by retrieval-augmented generation with the input question to construct the relevance between the question and the information.

[0028] 2. The present invention designs a method for fusing the retrieved information and the internal knowledge of the generation model, without the need for targeted prompt word design for the question, increasing the generalization ability of the usage scenario and the accuracy of question answering. Brief Description of the Drawings

[0029] Figure 1 It is a schematic diagram of the architecture of the text fusion model of retrieval information and question according to a preferred embodiment of a model training method for improving the accuracy of retrieval-augmented generation answers of the present invention;

[0030] Figure 2 It is a schematic diagram of the architecture of the fusion model of retrieval information and the internal knowledge of the large language model according to a preferred embodiment of a model training method for improving the accuracy of retrieval-augmented generation answers of the present invention;

[0031] Figure 3 It is a schematic diagram of the overall process logic for question answering according to a preferred embodiment of a model training method for improving the accuracy of retrieval-augmented generation answers of the present invention. Detailed Description of the Embodiment

[0032] To make the technical solutions of the present invention clearer and more definite for those skilled in the art, the present invention will be further described in detail below in conjunction with the embodiments and the drawings, but the embodiments of the present invention are not limited thereto.

[0033] Such as Figure 1-Figure 3As shown, this embodiment provides a model training method for improving the accuracy of retrieval enhancement generation answers. This patent mainly includes three steps: the construction of a text fusion model of retrieval information and questions, a method for fusing retrieval information with the internal knowledge of a large prediction generation model, and the overall process logic for question answering. Among them, the "Construction of a Text Fusion Model of Retrieval Information and Questions" section explains the specific model architecture; the "Method for Fusing Retrieval Information with the Internal Knowledge of a Large Language Generation Model" section explains the specific model architecture and training methods, and the "Overall Process Logic for Question Answering" section mainly explains the overall logic of question and answer execution.

[0034] First, in step one, this patent constructs a deep learning network model that can realize the text fusion of retrieval information and questions. This model will be used to pre-process the input text and retrieval information in step two, and the output fusion feature vector will be used as part of the input of the step two model, together with the input question text as the overall input of the model. Please refer to step three for the detailed process. In step two, this patent uses a manually annotated data set to simultaneously implement the parameter training of the association model in step one and the low rank decomposition (Low Rank Adaption, LoRA) fine-tuning model in step two. The trained model will be used to output the final answer result in step three, and please refer to step three for the detailed logic. Finally, step three explains in detail the data execution logic used to improve the accuracy of knowledge questions and answers after the model training of steps one and two is completed.

[0035] Construction of text fusion model for retrieval information and questions;

[0036] At present, the mainstream question retrieval method in the industry is to use a vector model to process the input question text and knowledge base information to obtain the corresponding vector data. Then, the vector of the input question text is matched with the knowledge base vector in the future for similarity, and a set of knowledge base information with the highest similarity is selected as reference information for reference input for subsequent question answers. However, this processing method is not flexible enough when it is necessary to summarize the correlation between knowledge base information. It is necessary to construct prompt word engineering text for different question descriptions, which usually ignores the intrinsic semantic connection between questions and knowledge information and is difficult to generalize to general usage scenarios;

[0037] The present invention proposes a text fusion model of retrieval information and questions, which is used to realize the construction of semantic association between retrieval information and input question text. The fused output vector is the result of the information integration of the two, which contains the inherent feature data association and can be used as input information in subsequent steps, such as Figure 1 As shown;

[0038] First, the input question text and the retrieved reference knowledge content text are respectively passed into the general vector model BGE to obtain the corresponding feature vectors. Among them, I represents the feature vector of the input question text, and P represents the feature vector of the retrieved reference content. Then, through the cross-attention network, the fused feature vector is finally obtained to represent the intrinsic relationship between the input question text and the retrieved content, which is used as the input information in step 2. Among them, the cross-attention mechanism network is defined as follows;

[0039]

[0040] W q is the query parameter matrix, W k is the key parameter matrix, W v is the value parameter matrix, d is the size of the feature vector dimension, Q is the query vector, K is the key vector, and V is the value vector; P represents the training sentence text vector data; I represents the training question text vector data.

[0041] Methods for integrating retrieval information with the intrinsic knowledge of large language generation models;

[0042] The fusion feature vector of question text and reference knowledge information obtained in step 1 above will be used as input information of the low-rank decomposition model of the large language model for model training. The specific model architecture is as follows: Figure 2 shown.

[0043] The training process of step two is as follows: first, add the fused feature vector in step one to the output value of the low-rank decomposition matrix; input the text information of the input question into the large language model, and superimpose the corresponding low-rank decomposition matrix output value in the attention layer; continue to calculate the combined features with the large language model to obtain the probability value of the output text, and then calculate the loss function by comparing it with the manually annotated reference text, and use the optimizer to iterate and update the parameters of the fused network model of step one and the low-rank decomposition model of step two at the same time.

[0044] The labeled question-answer text dataset used in this patent mainly consists of three parts: input questions, reference knowledge data, and manually labeled reference answer output. By manually selecting high-quality question-answer text data, the number of iterations required for training can be effectively saved, thereby reducing time costs.

[0045] For a given word sequence u={u t , ..., u t The goal of the language modeling task is defined as the word prediction task: based on the word sequence u before the current position in the sequence <t , using autoregressive method for the target word u t Make predictions.

[0046] During the training process, the model is usually optimized according to the likelihood function:

[0047]

[0048] Among them, P(ut|u<t) represents the probability of outputting the next token ut given the input text token sequence u<t. log represents the logarithmic operation. It means decomposing a token sequence of input length T into T segments, taking the logarithm of the token output probability of each segment and then superimposing them to obtain the final loss function L(u). The training data is fed into the model in batches of size 128, and finally the network model parameters are iteratively optimized and updated through the AdamW optimizer.

[0049] The overall process logic for question answering;

[0050] After the model training in Step 1 and Step 2 is completed, it can be used to answer questions related to the knowledge base. The specific process is as Figure 3 shown.

[0051] Input the text input vector of the question into the vector model to obtain a vectorized representation.

[0052] Compare the similarity between the vector data in 1 and the information in the vector knowledge base, and select the K = 10 groups of knowledge text information with the highest similarity.

[0053] Input the text of the input question in 1 and the knowledge text information retrieved in 2 into the association and fusion model in Step 1 to obtain a fused feature vector.

[0054] Input the fused vector in 3 and the input question text in 1 into the large language model and the corresponding low-rank decomposition model in Step 2 respectively to obtain the probability of the output text.

[0055] As described above, this is only a further embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the scope disclosed by the present invention, according to the technical solution and its concept of the present invention, makes equivalent substitutions or changes, all belong to the protection scope of the present invention.

Claims

1. A model training method for improving the accuracy of retrieval enhancement generation answers, characterized by: The steps include: Step 1: Build a deep learning network model to achieve text fusion of retrieval information and questions; Step 2: Use the labeled question-answering text dataset to train the parameters of the association model in step 1 and the low-rank decomposition fine-tuning model in step 2; Step 3: Calculate the loss function with the manually annotated reference text, and use the optimizer to iterate and update the parameters of the fusion network model in step 1 and the low-rank decomposition model in step 2.

2. A model training method for improving the accuracy of retrieval enhancement generation answers, characterized in that: In step one, the construction of a deep learning network model for text fusion of retrieval information and question includes respectively passing the input question text and the retrieved reference knowledge content text into the general vector model BGE to obtain corresponding feature vectors, wherein the feature vector representing the input question text and the feature vector representing the retrieved reference content are passed through a cross-attention network to finally obtain a fused feature vector, which is used to represent the intrinsic relationship between the input question text and the retrieved content as the input information in step two.

3. A model training method for improving the accuracy of retrieval enhancement generation answers, characterized in that: The cross-attention network is defined as: W q is the query parameter matrix, W k is the key parameter matrix, W v is the value parameter matrix, d is the size of the feature vector dimension, Q is the query vector, K is the key vector, and V is the value vector; P represents the training sentence text vector data; I represents the training question text vector data.

4. A model training method for improving the accuracy of retrieval enhancement generation answers according to claim 3, characterized in that: In step 2, the fused feature vector in step 1 is added to the output value of the low-rank decomposition matrix; Input the text information of the input question into the large language model and superimpose the corresponding low-rank decomposition matrix output value in the attention layer; The combined features are then used to calculate the large language model to obtain the probability value of the output text.

5. A model training method for improving the accuracy of retrieval enhancement generation answers according to claim 4, characterized in that: The labeled question-answering text dataset used in step 2 consists of three parts: Input questions, reference knowledge data and manually annotated reference answers are output; By manually screening high-quality question-answer text data, the number of iterations required for training can be effectively saved, thereby reducing time costs; For a given word sequence u={u t , ..., u t The goal of the language modeling task is defined as the word prediction task: based on the word sequence u before the current position in the sequence <t , using autoregressive method for the target word u t Make predictions.

6. A model training method for improving the accuracy of retrieval enhancement generation answers according to claim 5, characterized in that: During training, the model is usually optimized according to the likelihood function: Among them, P(u t |u <t ) means that given an input text word sequence u <t Next, output the next word u t The probability of, log represents the logarithmic operation, It means that a word sequence with an input length of T is decomposed into T segments, the logarithm of the word output probability of each segment is taken and superimposed to obtain the final loss function L(u), the training data is passed into the model in batches of 128, and finally the AdamW optimizer is used to iteratively optimize and update the network model parameters.