Retrieval enhancement generation method and device based on reciprocal ranking fusion and medium
Through the search-enhanced generation method of inverse ranking fusion, combined with language model and semantic vectorization technology, the problem of insufficient intention capture and incomplete answer generation of intelligent question-and-answer systems in complex query processing is solved, achieving more efficient retrieval and answer generation.
Patent Information
- Application Number
- CN202510088865.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-02-25
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When existing intelligent question-and-answer systems handle complex queries, it is difficult to fully capture user intentions, resulting in insufficient diversity and robustness of search results, and the accuracy and comprehensiveness of generating answers are also limited.
The search enhancement generation method based on reciprocal ranking fusion is adopted, multiple extended queries are generated through the first major language model, and relevant documents are retrieved in the document database in combination with semantic vectorization, and document sorting is used using the reciprocal ranking fusion algorithm. Finally, the sorted documents, extended queries and original queries are input into the second major language model to generate question-and-answer output.
It effectively improves the ability to capture user intentions, enhances the diversity and robustness of search results, and optimizes the accuracy and comprehensiveness of generated answers.
Smart Images

Figure CN119513141A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent question answering and document processing technology, and in particular to a retrieval enhancement generation method, device and medium based on reciprocal ranking fusion. Background Art
[0002] With the rapid development of information technology and the advent of the big data era, intelligent question answering and document processing technologies are playing an increasingly important role in all walks of life. Especially when dealing with complex query tasks, extremely high requirements are placed on the system's natural language understanding and generation capabilities. As the latest progress in the field of natural language processing, the Large Language Model (LLM) has brought significant breakthroughs in many tasks with its powerful generation capabilities. However, in practical applications, relying solely on generative models to answer complex questions still faces many challenges.
[0003] First, insufficient query intent coverage is a significant problem. Users' queries often imply multiple sub-intents, and a single query cannot fully express all needs. This makes it difficult for the system to fully capture the user's true intent, thus affecting the accuracy of retrieval and answer generation.
[0004] Secondly, the single ranking of search results is also a major drawback of existing technologies. Traditional search ranking methods are often based on simple similarity calculations or keyword matching, which easily leads to the results being concentrated on certain local optima while ignoring other potential related documents. This ranking method not only limits the diversity of search results, but may also affect users' trust and satisfaction with the system.
[0005] In addition, limited generation capabilities are also one of the problems that the current intelligent question-answering system needs to solve. When the input context information is incomplete or ambiguous, the quality of the generated model's answers is often difficult to guarantee. This may lead to one-sided or incorrect answers due to a lack of sufficient information support, or the model may be unable to cope with complex and changing query scenarios due to insufficient generalization capabilities.
[0006] In order to solve the above problems, retrieval-augmented generation (RAG) technology came into being. This technology provides an effective solution for complex query tasks by combining the natural language generation capabilities of the generative model with document retrieval technology. However, the existing RAG technology still has certain limitations when processing massive documents, especially when processing user queries involving multi-angle information, which is prone to problems of insufficient recall and limited generation capabilities. Summary of the invention
[0007] The embodiments of the present application provide a retrieval enhancement generation method, device and medium based on reciprocal ranking fusion to solve the following technical problems: for a question-answering model, how to fully capture user intent, improve the diversity and robustness of retrieval results, and optimize the accuracy and comprehensiveness of generated answers.
[0008] In the first aspect, an embodiment of the present application provides a retrieval enhancement generation method based on reciprocal ranking fusion, the method comprising: receiving an original query input by a user, and processing the original query using a preset first language model to generate multiple extended queries; using a semantic vectorization method to retrieve corresponding relevant documents for each extended query in a document database; calculating the reciprocal ranking scores of the relevant documents corresponding to each extended query according to the reciprocal ranking fusion algorithm, and comprehensively ranking each relevant document according to the reciprocal ranking scores; inputting the comprehensively ranked relevant documents, each extended query and the original query into a preset second language model to generate a question and answer output.
[0009] In one implementation of the present application, a semantic vectorization method is used to retrieve corresponding relevant documents for each extended query in a document database, specifically including: encoding each extended query into a corresponding query vector through a semantic vectorization model; based on each query vector, performing vector retrieval in the document database in parallel to find relevant documents corresponding to the semantics of each query vector.
[0010] In one implementation of the present application, the same relevant document can be retrieved by different extended queries; after finding the relevant documents corresponding to the query vector semantics, the method also includes: performing preliminary relevance ranking of the relevant documents corresponding to each extended query based on the semantic vectorization model to obtain a preliminary relevance ranked document set containing several repeated relevant documents.
[0011] In one implementation of the present application, the reciprocal ranking scores of the relevant documents corresponding to each extended query are calculated according to the reciprocal ranking fusion algorithm, specifically including: calculating the reciprocal ranking scores of each relevant document in the preliminary relevance sorted document set based on a preset ranking score calculation formula; wherein the ranking score calculation formula is represented by the following formula:
[0012] rank of the documents in the preliminary relevance sorting set, is the smoothing constant.
[0013] In one implementation of the present application, each relevant document is comprehensively ranked according to the reciprocal ranking score, specifically including: accumulating the reciprocal ranking scores of the same relevant documents in the preliminary relevance ranking document set to determine the combined score of the corresponding relevant documents; deduplicating documents in the preliminary relevance ranking document set to obtain a deduplicated document set, and comprehensively ranking each relevant document in the deduplicated document set based on the combined score.
[0014] In one implementation of the present application, the first largest language model is constructed based on the Qwen2.5-7B-Instruct model; the second largest language model is constructed based on the Qwen2.5-32B-Instruct model; and the semantic vectorization model is constructed based on the bce-embedding-base_v1 model.
[0015] In one implementation of the present application, before inputting the comprehensively ranked relevant documents, each extended query and the original query into a preset second language model, the method also includes: extracting summaries of the comprehensively ranked relevant documents to retain key information and eliminate redundancy; splicing the extracted summaries, each extended query and the original query to form structured input data; and converting the input data based on a preset format conversion logic to obtain standardized input data.
[0016] In one implementation of the present application, after generating the question and answer output, the method also includes: monitoring the user's feedback information on the question and answer output, and dynamically adjusting the number and strategy of the extended queries generated by the first language model based on the feedback information; wherein the feedback information includes: re-querying the original query or supplementing the query on the question and answer output.
[0017] In the second aspect, an embodiment of the present application also provides a retrieval enhancement generation device based on reciprocal ranking fusion, the device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a retrieval enhancement generation method based on reciprocal ranking fusion as any one of the above items.
[0018] In a third aspect, an embodiment of the present application also provides a non-volatile computer storage medium for retrieval enhancement generation based on reciprocal ranking fusion, which stores computer executable instructions. When the computer executable instructions are executed, a retrieval enhancement generation method based on reciprocal ranking fusion as described above is implemented.
[0019] The embodiment of the present application provides a retrieval enhancement generation method, device and medium based on reciprocal ranking fusion, which has the following beneficial effects: 1. Generate multiple extended queries through a large language model, interpret the original query from different angles, and capture different aspects of user intent from multiple angles, effectively increasing the breadth of retrieval and thus increasing the possibility of retrieving relevant information from the database.
[0020] 2. The reciprocal ranking fusion algorithm is used to re-rank the retrieved documents. The algorithm calculates the reciprocal ranking score of each document, adds these scores to generate a combined score, and then finally sorts the documents according to the combined score. This can generate more reliable sorting results, effectively avoid the local optimal problem that may be caused by traditional retrieval and sorting methods, and improve the robustness of the sorting and the diversity of the results.
[0021] 3. Combine the sorted documents, generated queries, and original queries, and input them into a large language model with high contextual understanding capabilities to generate the final answer. This multimodal input method not only makes full use of the retrieved relevant information, but also combines the powerful generation capabilities of the generative model, thereby ensuring the accuracy and comprehensiveness of the generated answers. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 A flow chart of a retrieval enhancement generation method based on reciprocal ranking fusion provided in an embodiment of the present application; Figure 2 A schematic diagram of the internal structure of a retrieval enhancement generation device based on reciprocal ranking fusion provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0024] The embodiments of the present application provide a retrieval enhancement generation method, device and medium based on reciprocal ranking fusion to solve the following technical problems: for a question-answering model, how to fully capture user intent, improve the diversity and robustness of retrieval results, and optimize the accuracy and comprehensiveness of generated answers.
[0025] The technical solution proposed in the embodiments of the present application is described in detail below with reference to the accompanying drawings.
[0026] Figure 1 A flowchart of a search enhancement generation method based on reciprocal ranking fusion provided in an embodiment of the present application. Figure 1 As shown, the embodiment of the present application provides a retrieval enhancement generation method based on reciprocal ranking fusion, which specifically includes the following steps: Step 101: Receive an original query input by a user, and use a preset first language model to process the original query to generate a plurality of extended queries.
[0027] In one embodiment, in an actual application scenario, when the user enters the original query through the interactive interface of the system, the system will immediately trigger the processing mechanism of the preset first language model (based on the Qwen2.5-7B-Instruct model in this embodiment). For example, if the user enters the original query "the current status and development trend of artificial intelligence in the medical field", the first language model will generate multiple extended queries such as "the current status and development trend of artificial intelligence in disease diagnosis", "the application of artificial intelligence in the drug development process and future trends", "the latest progress and prospects of artificial intelligence in the field of medical image analysis" based on its internal language knowledge and training logic. These extended queries are designed to explore the user's potential information needs from different professional segmentation perspectives, thereby broadening the search scope and improving the information recall rate.
[0028] Step 102: Use semantic vectorization to retrieve corresponding relevant documents for each extended query in the document database.
[0029] In one embodiment of the present application, after the original query is processed using a preset first language model to generate multiple extended queries, a semantic vectorization method is used to retrieve corresponding relevant documents for each extended query in a document database.
[0030] Specifically, each extended query is encoded into a corresponding query vector through a semantic vectorization model; based on each query vector, vector retrieval is performed in parallel in a document database to find relevant documents corresponding to the semantics of each query vector.
[0031] In an embodiment of the present application, a semantic vectorization model is constructed based on the bce-embedding-base_v1 model. Using the semantic vectorization method, the corresponding relevant documents are retrieved for each extended query in the document database. First, each extended query needs to be converted into a corresponding semantic vector. The semantic vectorization model of the embodiment of the present application is trained and optimized with a large amount of semantic data, and can accurately capture the semantic features of the query statement. For example, for the extended query "the current application status and development trend of artificial intelligence in disease diagnosis", the semantic vectorization model will encode it into a specific vector representation, which can reflect the position and characteristics of this query in the semantic space. Subsequently, based on these vectors, the system performs vector retrieval operations in parallel in the document database. Through an efficient retrieval algorithm, the system can quickly locate documents that are highly similar to each vector in semantics. For example, a series of academic research papers, industry reports, and application cases of medical institutions on artificial intelligence disease diagnosis technology may be retrieved.
[0032] In one embodiment of the present application, the same relevant document can be retrieved by different extended queries. After finding the relevant documents corresponding to the query vector semantics, the method further includes: performing preliminary relevance ranking on the relevant documents corresponding to each extended query based on the semantic vectorization model to obtain a preliminary relevance ranking document set containing a plurality of repeated relevant documents.
[0033] In one embodiment, after the relevant documents corresponding to the semantics of each query vector are found through vector retrieval, the bce-embedding-base_v1 model is used to perform preliminary relevance ranking on the relevant documents corresponding to each extended query. The model analyzes the closeness between the document and the corresponding extended query at the semantic level. For example, for the extended query "the current status and development trend of the application of artificial intelligence in disease diagnosis", documents D1, D2, D3, etc. are retrieved. The model will score according to the fit between the semantic content in the document and the query. Assume that after model calculation, the preliminary relevance score of document D1 is 0.75, D2 is 0.6, and D3 is 0.8. Then, these documents are arranged in descending order according to the score to form a preliminary relevance ranking document set. Similarly, similar operations are performed on the document sets retrieved for other extended queries such as "the application of artificial intelligence in the drug development process and future trends", and finally multiple preliminary relevance ranking document sets containing repeated relevant documents are obtained.
[0034] Step 103: Calculate the reciprocal ranking scores of the relevant documents corresponding to each extended query according to the reciprocal ranking fusion algorithm, and comprehensively sort the relevant documents according to the reciprocal ranking scores.
[0035] In one embodiment of the present application, after respectively retrieving the corresponding relevant documents for each extended query in the document database using the semantic vectorization method, the reciprocal ranking scores of the relevant documents corresponding to each extended query are first calculated according to the reciprocal ranking fusion algorithm.
[0036] Specifically, based on a preset ranking score calculation formula, the inverse ranking score of each relevant document in the preliminary relevance sorted document set is calculated; wherein the ranking score calculation formula is represented by the following formula:
[0037] rank for relevance in the set of documents ranked in a preliminary relevance order, is the smoothing constant.
[0038] Furthermore, the relevant documents are comprehensively ranked according to the inverse ranking scores. Specifically, the inverse ranking scores of the same relevant documents in the preliminary relevance-ranked document set are accumulated to determine the merged scores of the corresponding relevant documents; the preliminary relevance-ranked document set is deduplicated to obtain a deduplicated document set, and based on the merged scores, each relevant document in the deduplicated document set is comprehensively ranked.
[0039] In one embodiment, the reciprocal ranking score of each relevant document in the preliminary relevance-ranked document set is calculated according to the preset ranking score calculation formula score=1 / (r+k). Taking a certain preliminary relevance-ranked document set as an example, assuming that there are 5 documents, document E1 ranks r=1 in the set, and the smoothing constant k=0.1 is set, then the reciprocal ranking score of document E1 is 1 / (1+0.1)≈0.909. For document E2, if its ranking is r=3, its reciprocal ranking score is 1 / (3+0.1)≈0.323. Similarly, the corresponding reciprocal ranking score is calculated for each document in the document set. This operation is performed for all preliminary relevance-ranked document sets.
[0040] After determining the reciprocal ranking scores of the relevant documents corresponding to each extended query, for each repeated relevant document, the reciprocal ranking scores in different preliminary relevance ranking document sets are accumulated. For example, if document F obtains reciprocal ranking scores of 0.2 and 0.3 in two different preliminary relevance ranking document sets, its combined score is 0.5. After completing the score accumulation, the document deduplication operation is performed on all preliminary relevance ranking document sets to remove duplicate document entries and obtain a deduplication document set. Finally, the documents in the deduplication document set are sorted according to the combined score of each document. Usually, they are sorted in descending order from high to low according to the combined score. The higher the score, the stronger the comprehensive relevance of the document to the user's original query and the extended query. For example, if the combined score of document G is 0.6 and the combined score of document H is 0.4, then in the final comprehensive ranking result, document G will be ranked before document H, thereby providing a document sequence with more reference value for subsequent answer generation.
[0041] Step 104: Input the comprehensively ranked relevant documents, the expanded queries and the original query into a preset second language model to generate a question-answering output.
[0042] In one embodiment of the present application, after comprehensively ranking each relevant document according to the inverse ranking score, each comprehensively ranked relevant document, each expanded query and the original query are input into a preset second largest language model to generate a question-answering output.
[0043] In one embodiment of the present application, it also includes: extracting summaries of the relevant documents after comprehensive sorting to retain key information and eliminate redundancy; splicing the extracted summaries, each extended query and the original query to form structured input data; and converting the input data based on a preset format conversion logic to obtain standardized input data.
[0044] In the embodiment of the present application, an advanced text summary algorithm is used to process the relevant documents after fusion sorting. Taking a research paper on the application of artificial intelligence drug development as an example, the summary extraction algorithm will extract key technical principles, experimental results, application effects and other core information, and remove redundant content such as lengthy experimental process details and complex mathematical derivations. Then, these extracted summaries are spliced with the previously generated extended queries and original queries according to specific structural rules to form a logically coherent and information-rich input data block. For example, the summary is placed in the front, and the extended query and the original query are arranged in sequence behind, and are distinguished by specific delimiters. Then, according to the preset format conversion rules, the input data is converted into a standardized format that can be efficiently processed by the second largest language model (Qwen2.5-32B-Instruct model in this embodiment). For example, the text data is converted into a specific encoding format required by the model, and the length and structure of the data are adjusted and standardized to ensure that the model can accurately understand the input information.
[0045] In the embodiment of the present application, the second largest language model uses its powerful contextual reasoning and complex task processing capabilities to deeply analyze and integrate the input standardized data. For example, for the above-mentioned query on the application status and development trend of artificial intelligence in the medical field, the model will comprehensively consider the disease diagnosis, drug development, medical image analysis and other information extracted from the document to generate a comprehensive and logically clear answer, such as "Artificial intelligence has made significant progress in the medical field. In terms of disease diagnosis, algorithms based on deep learning can quickly analyze medical images and improve diagnostic accuracy; in drug development, it can be used for drug molecule design and clinical trial data analysis, greatly shortening the research and development cycle; in the field of medical image analysis, it can accurately identify lesion characteristics." In one embodiment of the present application, after generating the question and answer output, the method further includes: monitoring user feedback information regarding the question and answer output, and dynamically adjusting the number and strategy of the expanded queries generated by the first language model based on the feedback information; wherein the feedback information includes: re-querying the original query or supplementing the query with respect to the question and answer output.
[0046] In the embodiment of the present application, after the question and answer output is displayed to the user, the user's feedback information will be collected in a variety of ways. If the user chooses to re-query the original query, this may mean that the answer generated by the system before does not fully meet the user's needs. At this time, the system will use natural language processing technology to analyze the keywords and semantic focus of the user's re-query. If it is found that the user is more interested in the specific technical details of artificial intelligence in medical image analysis, the system will appropriately add extended queries such as "details of deep learning algorithms in artificial intelligence in medical image analysis" and "differences in the application of artificial intelligence in the analysis of different types of medical images (such as CT, MRI)" when processing similar original queries in the subsequent process. If the user makes a supplementary query for the question and answer output, such as asking about the cost-effectiveness of artificial intelligence drug development, the system will take such information into consideration, adjust the generation strategy of subsequent extended queries, and add relevant economic analysis and cost-effectiveness evaluation queries, such as "cost composition and benefit analysis of artificial intelligence in various stages of drug development" and "cost comparison of different artificial intelligence technologies in drug development", etc., to continuously optimize the system's ability to capture user intent and generate answers, and improve user experience.
[0047] The above is an embodiment of the method proposed in this application. Based on the same inventive concept, this application embodiment also provides a retrieval enhancement generation device based on reciprocal ranking fusion, whose structure is as follows: Figure 2 shown.
[0048] Figure 2 A schematic diagram of the internal structure of a search enhancement generation device based on reciprocal ranking fusion provided in an embodiment of the present application. Figure 2 As shown, the device includes: at least one processor 201; and, a memory 202 communicatively connected to the at least one processor; The memory 202 stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor 201 to enable at least one processor 201 to: Receiving an original query input by a user, and processing the original query using a preset first language model to generate a plurality of expanded queries; Using semantic vectorization, the corresponding relevant documents are retrieved in the document database for each extended query; According to the reciprocal ranking fusion algorithm, the reciprocal ranking scores of the relevant documents corresponding to each extended query are calculated, and the relevant documents are comprehensively ranked according to the reciprocal ranking scores; The comprehensively ranked relevant documents, expanded queries and original queries are input into the preset second largest language model to generate question-answering output.
[0049] Some embodiments of the present application provide corresponding Figure 1 A non-volatile computer storage medium based on retrieval enhancement generation based on reciprocal ranking fusion, storing computer executable instructions, wherein the computer executable instructions are set as: Receiving an original query input by a user, and processing the original query using a preset first language model to generate a plurality of expanded queries; Using semantic vectorization, the corresponding relevant documents are retrieved in the document database for each extended query; According to the reciprocal ranking fusion algorithm, the reciprocal ranking scores of the relevant documents corresponding to each extended query are calculated, and the relevant documents are comprehensively ranked according to the reciprocal ranking scores; The comprehensively ranked relevant documents, expanded queries and original queries are input into the preset second largest language model to generate question-answering output.
[0050] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the IoT device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0051] The system and medium provided in the embodiments of the present application correspond one-to-one to the method. Therefore, the system and medium also have similar beneficial technical effects to the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the system and medium will not be repeated here.
[0052] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0053] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0054] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0055] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0056] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0057] Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0058] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0059] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity 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, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0060] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A retrieval enhancement generation method based on reciprocal ranking fusion, characterized in that: The method comprises: Receiving an original query input by a user, and processing the original query using a preset first language model to generate a plurality of expanded queries; Using semantic vectorization, the corresponding relevant documents are retrieved in the document database for each extended query; According to the reciprocal ranking fusion algorithm, the reciprocal ranking scores of the relevant documents corresponding to each extended query are calculated, and the relevant documents are comprehensively sorted according to the reciprocal ranking scores; The comprehensively ranked relevant documents, the expanded queries and the original query are input into a preset second language model to generate a question-answering output.
2. According to claim 1, a retrieval enhancement generation method based on reciprocal ranking fusion is characterized in that: Using semantic vectorization, we retrieve the corresponding relevant documents for each extended query in the document database, including: Each extended query is encoded into a corresponding query vector through a semantic vectorization model; Based on each query vector, vector retrieval is performed in parallel in the document database to find relevant documents corresponding to the semantics of each query vector.
3. The retrieval enhancement generation method based on reciprocal ranking fusion according to claim 2 is characterized in that: The same relevant document can be retrieved by different extended queries; After finding relevant documents corresponding to the query vector semantics, the method further includes: Based on the semantic vectorization model, the relevant documents corresponding to each extended query are preliminarily ranked in terms of relevance, so as to obtain a preliminarily ranked document set containing a number of repeated relevant documents.
4. The retrieval enhancement generation method based on reciprocal ranking fusion according to claim 3 is characterized in that: According to the reciprocal ranking fusion algorithm, the reciprocal ranking scores of the relevant documents corresponding to each extended query are calculated, including: Calculate the reciprocal ranking score of each relevant document in the preliminary relevance-ranked document set based on a preset ranking score calculation formula; Among them, the ranking score calculation formula is expressed by the following formula: is the ranking of the documents in the preliminary relevance ranking set, is a smoothing constant.
5. The retrieval enhancement generation method based on reciprocal ranking fusion according to claim 4 is characterized in that: The relevant documents are comprehensively sorted according to the inverse ranking scores, specifically including: Accumulating the reciprocal ranking scores of the same relevant documents in the preliminary relevance-ranked document set to determine a combined score of the corresponding relevant documents; Deduplication of documents is performed on the preliminary relevance-ranked document set to obtain a deduplication document set, and comprehensive ranking of the relevant documents in the deduplication document set is performed based on the combined score.
6. The retrieval enhancement generation method based on reciprocal ranking fusion according to claim 5 is characterized in that: The first language model is built on the basis of the Qwen2.5-7B-Instruct model; The second largest language model is built on the basis of the Qwen2.5-32B-Instruct model; The semantic vectorization model is built based on the bce-embedding-base_v1 model.
7. The retrieval enhancement generation method based on reciprocal ranking fusion according to claim 1 is characterized in that: Before inputting the comprehensively ranked relevant documents, the expanded queries and the original query into the preset second language model, the method further includes: Extract summaries of the relevant documents after comprehensive sorting to retain key information and eliminate redundancy; The extracted summary, each expanded query and the original query are concatenated to form structured input data; The input data is converted based on a preset format conversion logic to obtain standardized input data.
8. The retrieval enhancement generation method based on reciprocal ranking fusion according to claim 1 is characterized in that: After generating the question-answer output, the method further includes: Monitor user feedback information on the question and answer output, and dynamically adjust the number and strategy of the expanded queries generated by the first language model according to the feedback information; wherein the feedback information includes: re-querying the original query or supplementing the query on the question and answer output.
9. A retrieval enhancement generation device based on reciprocal ranking fusion, characterized in that: The device comprises: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a retrieval enhancement generation method based on reciprocal ranking fusion as described in any one of claims 1-8.
10. A non-volatile computer storage medium for retrieval enhancement generation based on reciprocal ranking fusion, storing computer executable instructions, characterized in that: When the computer executable instructions are executed, a retrieval enhancement generation method based on reciprocal ranking fusion as described in any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Secure storage and query method and system based on trust extension and computer storage medium
CN117251879A
Traditional Chinese medicine question and answer method and device based on long document retrieval enhancement generation and medium
CN117828050A
Knowledge retrieval enhancement-based large language model question and answer method and device
CN118113836A
Knowledge retrieval enhancement generation method and system based on large language model
CN118394890A
Real-time retrieval enhancement generation method and device based on industrial brain
CN118520074A
Cited By
Document retrieval method and device based on AI large model
CN121166844A
Database retrieval method and device based on large language model, equipment and medium
CN121579710A
Pumping well production condition analysis method based on cue word self-adaptive generation
CN121882220A
A pumping unit well production condition analysis method based on prompt word adaptive generation
CN121882220B
Improving execution speed and efficacy of semantic queries based on selection of relevant document subsets
WO2026187568A1