RAG end-to-end retrieval optimization method
By treating the RAG system as a whole, using manual annotation data and backpropagation training to optimize the ranking model, it solves the problem of insufficient performance improvement space caused by independent optimization of each module of the traditional RAG system, and achieves more efficient retrieval and generation effects. Stronger generalization ability.
Patent Information
- Application Number
- CN202411484816.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-01-21
AI Technical Summary
During the optimization of traditional RAG systems, each module is optimized independently, and the overall performance improvement space has not been fully utilized.
By treating the RAG system as a whole, artificially annotated data and backpropagation training are used to optimize the ranking model, thereby improving the overall performance of the system.
It improves the overall performance and retrieval generation effect of the RAG system, enhances the generalization ability of the system, and is suitable for different application scenarios.
Smart Images

Figure CN119336894A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of RAG optimization, and in particular to a RAG end-to-end retrieval optimization method. Background Art
[0002] The statements in this section merely provide background information related to the present disclosure and may not constitute prior art.
[0003] The Retrieval-Augmented Generation (RAG) system combines the retrieval model and the generation model to improve the performance of text generation tasks; the RAG system usually includes modules such as embedding model and ranking model.
[0004] When optimizing traditional RAG systems, each module is optimized independently, which fails to fully utilize the room for improving the overall performance of the system. Summary of the invention
[0005] The purpose of the present invention is to provide a RAG end-to-end retrieval optimization method to address the problems existing in the prior art. Based on manual labeling and back-propagation training, the RAG system is regarded as a whole, and the manually labeled data is used to train the sorting model through back-propagation, thereby optimizing the overall performance of the system and improving the overall performance of the RAG system.
[0006] The technical solution of the present invention is as follows:
[0007] A RAG end-to-end retrieval optimization method, comprising:
[0008] Step S1: scoring the output of the RAG system;
[0009] Step S2: Map the scores to the text blocks retrieved by the ranking model as training sets;
[0010] Step S3: Using the back propagation algorithm, the parameters of the sorting model are trained according to the training set to complete the optimization.
[0011] Further, the RAG system includes: an embedding model and a sorting model;
[0012] The embedding model is responsible for converting the input text into a vector representation;
[0013] The ranking model ranks the candidate text blocks according to the input vectors.
[0014] Furthermore, the step S1 comprises:
[0015] The output of the RAG system is scored by people with professional background knowledge, and the score is a floating point number between 0 and 1.
[0016] Furthermore, the content of the scoring includes:
[0017] Annotate the output of the RAG system and the correct search text blocks;
[0018] The content of the annotation includes:
[0019] Accuracy and relevance of RAG system outputs.
[0020] Furthermore, the text block retrieved by the sorting model is the label of the sorting model.
[0021] Furthermore, the step S2 comprises:
[0022] Map the scores to the text blocks retrieved by the sorting model, that is, the labels of the sorting model, as the training set.
[0023] Furthermore, the step S3 comprises:
[0024] Use the back propagation algorithm to train the parameters of the sorting model according to the label.
[0025] Furthermore, during the training process, the parameters of the embedded model are kept unchanged, the sorting model is optimized, and multiple iterations are performed to gradually improve the overall performance of the system.
[0026] Compared with the prior art, the present invention has the following beneficial effects:
[0027] 1. The present invention optimizes the RAG system as a whole, making full use of the synergy between various modules to improve the overall performance of the system. At the same time, by using artificially annotated data and training the sorting model through back propagation, the model parameters can be adjusted more accurately, the retrieval and generation effects of the system can be improved, and the overall optimization method can adapt to different application scenarios and improve the generalization ability of the RAG system.
[0028] 2. The method of the present invention is not only applicable to the existing RAG system, but also can be applied to other retrieval generation systems including embedding models and ranking models. The method of the present invention can be used in any system involving text retrieval and generation and requiring improved ranking accuracy and overall performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 The figure is a flow chart of a RAG end-to-end retrieval optimization method. DETAILED DESCRIPTION
[0030] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0031] The features and performance of the present invention are further described in detail below in conjunction with the embodiments.
[0032] Embodiment 1
[0033] See also Figure 1 , a RAG end-to-end retrieval optimization method, specifically comprising the following steps:
[0034] Step S1: scoring the output of the RAG system; it should be noted that the RAG system includes: an embedding model and a sorting model and other modules; wherein the embedding model is responsible for converting the input text into a vector representation; and the sorting model sorts the candidate text blocks according to the input vector;
[0035] Step S2: Map the scores to the text blocks retrieved by the ranking model as training sets;
[0036] Step S3: Using the back propagation algorithm, the parameters of the sorting model are trained according to the training set to complete the optimization.
[0037] In this embodiment, specifically, step S1 includes:
[0038] The output of the RAG system is scored by people with professional background knowledge, and the score is a floating point number between 0 and 1.
[0039] In this embodiment, specifically, the scoring content includes:
[0040] Annotate the output of the RAG system and the correct search text blocks;
[0041] The content of the annotation includes:
[0042] Accuracy and relevance of RAG system outputs.
[0043] In this embodiment, specifically, the text block retrieved by the sorting model is the label of the sorting model.
[0044] In this embodiment, specifically, step S2 includes:
[0045] Map the scores to the text blocks retrieved by the sorting model, that is, the labels of the sorting model, as the training set.
[0046] In this embodiment, specifically, step S3 includes:
[0047] Use the back propagation algorithm to train the parameters of the sorting model according to the label.
[0048] In this embodiment, specifically, the parameters of the embedded model are kept unchanged during the training process, and the sorting model is mainly optimized, and the overall performance of the system is gradually improved through multiple iterations. It should be noted that if the embedded model also needs to be optimized in a specific implementation, the embedded model can be optimized in combination with the method of the present invention, but it should be ensured that the main optimization object is still the sorting model.
[0049] Embodiment 2
[0050] This embodiment uses a specific scenario of the RAG system to further explain the RAG end-to-end search optimization method proposed in the first embodiment. The specific implementation steps are as follows:
[0051] 1. System architecture construction: Build a RAG system, including an embedding model (such as BERT) and a sorting model (such as a neural network sorting model).
[0052] 2. Data collection: Choose a specific application scenario, such as a question-answering system, and collect user queries and corresponding candidate answers.
[0053] 3. Manually annotated data generation: In a question-answering system, the answers generated by the system are output and compared with the correct answers. Manual annotators annotate the system output and the correct answers, including the accuracy and relevance of the output, to generate a training data set.
[0054] 4. Model training: Input the labeled training data set into the sorting model. Use the back propagation algorithm to train the sorting model, adjust the model parameters according to the labeled data, and optimize the sorting effect. During the training process, the embedding model remains unchanged, and the sorting model is mainly optimized.
[0055] 5. Model evaluation and optimization: Through multiple iterations of training, evaluate and optimize the performance of the sorting model, and gradually improve the overall performance of the system.
[0056] 6. Implementation effect evaluation: Through user feedback and actual application of the question-answering system, the difference in system performance before and after optimization is evaluated to verify the effectiveness of the method of the present invention.
[0057] The above-mentioned embodiments only express the specific implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the protection scope of the present application. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the technical solution concept of the present application, and these all belong to the protection scope of the present application.
[0058] This background section is provided to generally present the context of the invention, and the work of the presently named inventors, the work to the extent described in this background section, and aspects of this section that did not constitute prior art at the time of application are neither explicitly nor implicitly admitted to be prior art to the present invention.
Claims
1. A RAG end-to-end retrieval optimization method, characterized in that: include: Step S1: scoring the output of the RAG system; Step S2: Map the scores to the text blocks retrieved by the ranking model as training sets; Step S3: Using the back propagation algorithm, the parameters of the sorting model are trained according to the training set to complete the optimization.
2. A RAG end-to-end retrieval optimization method according to claim 1, characterized in that: The RAG system includes: an embedding model and a sorting model; The embedding model is responsible for converting the input text into a vector representation; The ranking model ranks the candidate text blocks according to the input vectors.
3. A RAG end-to-end retrieval optimization method according to claim 2, characterized in that: The step S1 comprises: The output of the RAG system is scored by people with professional background knowledge, and the score is a floating point number between 0 and 1.
4. A RAG end-to-end retrieval optimization method according to claim 3, characterized in that: The scoring content includes: Annotate the output of the RAG system and the correct search text blocks; The content of the annotation includes: Accuracy and relevance of RAG system outputs.
5. A RAG end-to-end search optimization method according to claim 4, characterized in that: The text block retrieved by the sorting model is the label of the sorting model.
6. A RAG end-to-end search optimization method according to claim 5, characterized in that: The step S2 comprises: Map the scores to the text blocks retrieved by the sorting model, that is, the labels of the sorting model, as the training set.
7. A RAG end-to-end search optimization method according to claim 6, characterized in that: The step S3 comprises: Use the back propagation algorithm to train the parameters of the sorting model according to the label.
8. A RAG end-to-end search optimization method according to claim 7, characterized in that: During the training process, the parameters of the embedded model are kept unchanged, the sorting model is optimized, and multiple iterations are performed to gradually improve the overall performance of the system.
Citation Information
Cited By
Dynamic collaborative scheduling method and system for question-answering system based on MCP
CN121543703A