Retrieval enhancement generation method and device based on large model and medium

Through the search-enhanced generation method based on the big model, users' intentions are identified and query information is rewritten, and high-quality text content is generated by combining the document information with the highest similarity, which solves the problem of low accuracy in document synthesis response in the prior art and improves the Accuracy and efficiency of retrieval and text generation.

CN119312917APending Publication Date: 2025-01-14SICHUAN SHUWEI TEA YUN SUPPLY CHAIN CO LTD

Patent Information

Application Number
CN202411336016.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

The existing document synthesis response based on search enhancement methods is not very accurate, and it is difficult to quickly and accurately retrieve the required documents and generate high-quality text content in massive information.

Method used

Using a large model-based search enhancement generation method, the user query knowledge base is identified through the intent recognition module, semantic rewrite query information is carried out, and text generation is generated by combining query information and documents with the highest similarity, and the language model that has been trained is used to generate high Quality text content.

Benefits of technology

It improves the accuracy and efficiency of retrieval, enhances the accuracy and quality of text generation, and ensures that the generated text content is more relevant and accurate to user needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119312917A_ABST
    Figure CN119312917A_ABST
Patent Text Reader

Abstract

The invention discloses a retrieval enhancement generation method and device based on a large model and a medium, and the method comprises the following steps: receiving query information of a user, and adopting an intention recognition module to recognize a knowledge base to be queried by the user according to the query information and label data of the knowledge base; the number of the knowledge bases is at least two, document types stored in each knowledge base are different, and the tag data comprises category tags representing categories to which the knowledge bases belong and entries representing key contents of documents in the knowledge bases; rewriting the query information based on semantic maintenance to obtain a standard query statement; retrieving a document with the highest similarity with the standard query statement from a knowledge base to be queried by the user based on the standard query statement; and combining the standard query statement and the document with the highest similarity with the standard query statement to form a context environment, and inputting the context environment into the trained language model for text content writing. By adopting the method, the accuracy of the document obtained by synthesizing the response can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of retrieval enhancement, and in particular relates to a retrieval enhancement generation method, device and medium based on a large model. Background Art

[0002] In today's information society, document retrieval and generation technologies play a vital role in information management and knowledge management. With the rapid development of the Internet, the amount of information is growing exponentially. How to quickly and accurately retrieve the required documents from massive information and generate high-quality text content is an extremely challenging task. In recent years, large models based on deep learning have made significant progress in the field of natural language processing (NLP). In particular, large-scale pre-trained models represented by GPT-4 and Wenxin Yiyan have demonstrated excellent language understanding and generation capabilities.

[0003] The existing retrieval enhancement method adopts the "A large model retrieval enhancement generation method and device" disclosed in the invention patent with application number CN202410282289.4. It first designs a block algorithm, improves the current vector block strategy, performs vector indexing, builds two indexes, and conducts in-depth search; then enters the design of the post-processor, uses a cross encoder to rearrange the search results, and performs intelligent re-ranking. Finally, response synthesis is performed, and the answers obtained are integrated or refined and summarized to form the final reply.

[0004] However, the accuracy of the document synthesized by the existing method is not high. Summary of the invention

[0005] In order to solve the problem that the document accuracy obtained by synthesizing responses in the existing methods is not high, the present invention proposes a retrieval enhancement generation method, device and medium based on a large model, which can improve the accuracy of the document obtained by synthesizing responses.

[0006] The objective of the present invention is achieved through the following technical solutions: The first aspect of the present invention discloses a retrieval enhancement generation method based on a large model, comprising the following steps: Receive query information from a user and use an intent recognition module to identify the knowledge base that the user wants to query based on the query information and label data of the knowledge base, wherein there are at least two knowledge bases and each knowledge base stores different types of documents, and the label data includes a category label representing a category to which the knowledge base belongs and a term representing key content of a document in the knowledge base; Rewriting the query information based on semantic preservation to obtain a standard query statement, wherein the standard query statement includes entities and keywords; Retrieving the document with the highest similarity to the standard query statement in the knowledge base to be queried by the user based on the standard query statement; The standard query statement and the document with the highest similarity to the standard query statement are combined to form a context environment and input into the trained language model to write text content.

[0007] The second aspect of the present invention discloses a retrieval enhancement generation device based on a large model, comprising a memory and a controller that are communicatively connected in sequence, wherein a computer program is stored in the memory, and the controller is used to read the computer program and execute the retrieval enhancement generation method based on a large model described in the first aspect.

[0008] The third aspect of the present invention discloses a computer-readable storage medium, on which instructions are stored. When the instructions are run on a computer, the large model-based retrieval enhancement generation method described in the first aspect is executed.

[0009] The beneficial effects of the present invention are: The present invention first identifies the user's intention to identify a strongly related knowledge base, then standardizes and rewrites the user's query to determine the document with the highest similarity, and finally expands the text based on both the user's query information and the document information, thereby improving the accuracy and efficiency of retrieval while also improving the accuracy and quality of text generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0011] Figure 1 The present invention is a process of the method. DETAILED DESCRIPTION

[0012] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0013] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0014] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.

[0015] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0016] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, or the positions or positional relationships in which the product of the invention is usually placed when in use, or the positions or positional relationships commonly understood by those skilled in the art, which are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.

[0017] In the description of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0018] The first aspect of the present invention discloses a retrieval enhancement generation method based on a large model, such as Figure 1 As shown, the method includes steps S1 to S4. It should be noted that the step identifiers in this solution are only for the convenience of explaining the method and do not constitute a limitation on the order of precedence. The order of each step is based on its language description and the order of each signal.

[0019] Step S1, receiving the user's query information and using the intention recognition module to identify the knowledge base that the user wants to query based on the query information and the label data of the knowledge base, there are at least two knowledge bases and the document types stored in each knowledge base are different, and the label data includes a category label representing the category to which the knowledge base belongs and an entry representing the key content of the document in the knowledge base.

[0020] This solution classifies the knowledge base, and documents of different categories correspond to different knowledge bases. The categories are divided according to the actual usage scenarios. The finer the category division, the higher the accuracy of the corresponding documents, and the higher the accuracy and quality of subsequent document enhancement.

[0021] Example 1: The knowledge base can be divided into different categories according to the different disciplines, such as "mathematics", "physics", "chemistry", "biology", etc.

[0022] Example 2: The knowledge base can be divided into different categories according to the different sections to which the documents belong, such as "notice", "drinks", "contracts", "publicity", "physical operations", etc. The notification category corresponds to various documents on business notifications, the beverage category corresponds to documents on various beverage ingredients, preparation methods, etc., the contract category corresponds to various contract documents, and the publicity category corresponds to various posters, advertisements and other copywriting documents.

[0023] In this step, the intent recognition module recognizes the user's query information to identify and respond to the user's real needs. Specifically, the intent recognition module uses the advanced semantic understanding and context processing capabilities of the large model and prompt engineering to accurately grasp the user's query intention.

[0024] In order to improve the accuracy of identifying the knowledge base that the user wants to query, preferably, a prompt template can be used to interactively query the user. Specifically, steps S11 to S17 are used to implement it.

[0025] Step S11: accept the user's query information.

[0026] Step S12: Determine the nature of the query information, which may be a query nature or a non-query nature.

[0027] Step S13: if the property is a non-query property, generate a prompt template and display it and proceed to step S14. If the property is a query property, directly determine the relevance of the query information to all knowledge bases, and use the knowledge base with the greatest relevance as the knowledge base to be queried by the user.

[0028] Step S14: receiving query information fed back by the user according to the prompt template.

[0029] Step S15: Determine the relevance of the query information fed back by the user according to the prompt template and all knowledge bases.

[0030] Step S16: If the correlation between the query information fed back by the user according to the prompt template and all knowledge bases is less than a threshold, the label data of the knowledge base with the highest correlation with the query information fed back by the user according to the prompt template is added to the prompt template and displayed, and the process proceeds to step S17. If the correlation between the query information fed back by the user according to the prompt template and all knowledge bases is greater than or equal to the threshold, the knowledge base with the highest correlation is determined as the knowledge base to be queried by the user.

[0031] Step S17, repeating steps S14 to S16 until the correlation between the query information fed back by the user according to the prompt template and at least one knowledge base is greater than or equal to the threshold. At this time, the knowledge base with the greatest correlation is determined as the knowledge base to be queried by the user.

[0032] Example 3: When a user simply says “hello”, the intent recognition module identifies the non-query nature of the greeting and then uses a preset prompt template to establish a conversation opportunity to obtain the user’s query information again.

[0033] Example 4: When facing the user's query "Download the store manual", it can be determined that the query is strongly related to the documents in the above-mentioned "physical operation" category.

[0034] When judging the relevance in this step, the judgment can be made based on the similarity between the query information and the label data.

[0035] The intent recognition module not only improves the accuracy of understanding user query intent, but also enhances the interactivity and effectiveness of the entire retrieval enhancement generation system by guiding users to ask more targeted questions.

[0036] Step S2: rewrite the query information based on semantic preservation to obtain a standard query statement, wherein the standard query statement includes entities and keywords.

[0037] The query information may contain unclear wording, vague words or information lacking sufficient context, which may affect the results of subsequent retrieval and generation. In this regard, this step rewrites the query information into a standard query statement to improve the accuracy and relevance of the user's query, thereby optimizing the retrieval and generation results.

[0038] Specifically, this step can first use natural language processing technology to perform semantic analysis on the query information to identify keywords and entities in the query information; then based on the semantic analysis, a standard query statement including the keywords and entities is generated according to a rewriting template while maintaining the semantics.

[0039] Taking the aforementioned "Dianwubao manual download" as an example, the rewritten standard query statement can be "The user wants to search for downloads, guides and other information on the Dianwubao manual, and the two noun entities "Dianwubao" and "Manual" cannot be changed."

[0040] This step can be implemented based on the existing Jieba language model, Bert (Bidirectional Encoder Representations from Transformers) model, etc.

[0041] Step S3: based on the standard query statement, retrieve the document with the highest similarity to the standard query statement in the knowledge base to be queried by the user.

[0042] This step is based on the search engine, which needs to be trained in advance. The search engine includes a recall module and a sorting module. The recall module mainly uses an unsupervised contrastive learning model and a supervised model with negative sampling within a batch to train documents. The trained model predicts the corresponding vectors for all document texts and saves them in the vector library. The sorting module is mainly divided into coarse sorting and fine sorting, which mainly re-sorts the recalled text. Coarse sorting uses feature engineering and text matching rules for re-ranking, and the fine sorting module mainly uses a pair-wise model for training and re-ranking.

[0043] Recall model construction: 1. Unsupervised data construction: Extract the characteristic content of the corpus, including title, abstract, keywords, etc., and construct an unlabeled data set. Each line of text represents a characteristic content of a certain corpus.

[0044] 2. Supervised data construction: The rewritten standard query statement and the document P finally selected by the user construct a text pair. The document P is constructed using feature content, which includes title, abstract, keywords, etc. Each line of text represents the feature content text of Q and the document.

[0045] 3. Use the SimCSE comparative learning model for unsupervised training. The trained model continues to be trained on the supervised dataset using the in-batch negative sampling method, calculates the cosine similarity and cross entropy loss functions, and back-propagates the updated gradient until the model training is completed.

[0046] If there is more unsupervised data, preliminary data enhancement pre-training can be performed. Supervised data training uses the model parameters obtained from unsupervised training to continue training and further improve the model accuracy.

[0047] Fine arrangement model construction: Data construction: Each row of data is a triple, namely query-positive example-negative example, where the positive example is the document confirmed after the standard query, and the negative example is the document displayed to the user after the query but not confirmed.

[0048] The refined ranking model adopts a pair-wise algorithm structure. The query and document title positive samples are passed through the encoder to obtain an output similarity S1, and the query and document title negative samples are passed through the encoder to obtain an output similarity S2. The model loss is calculated according to the loss function, and the gradient is updated by backpropagation. Finally, the similarity between the query and the positive example is increased, and the similarity between the query and the negative example is reduced to achieve the purpose of re-ranking.

[0049] In the specific retrieval process, the method includes steps S31 to S35.

[0050] Step S31: Calculate the similarity between the standard query statement and all documents in the knowledge base that the user wants to query.

[0051] For standard query statements and documents, the cosine similarity between them can be calculated based on their semantic vectors.

[0052] Step S32: Sort the similarities from large to small to select the documents corresponding to the top m similarities, where m is greater than or equal to 3.

[0053] Step S33: Use at least two matching methods to match the selected m documents with the standard query statement to obtain a matching degree.

[0054] For example, a broad matching method, a phrase matching method and an exact matching method may be used simultaneously to match the selected m documents and the standard query statement respectively.

[0055] Broad matching methods include matching methods where the standard query statement is the same as the first letter of the document, matching methods where the standard query statement is the same as the pinyin abbreviation of the document, and matching methods where the standard query statement is the same as the first letter of the document.

[0056] The phrase matching methods include: a matching method in which a standard query statement is exactly the same as a sentence in a document, and a matching method in which a document is exactly the same as a sentence in a standard query statement.

[0057] The exact matching method includes a matching method in which the standard query statement is exactly the same as the pinyin of the document, and a matching method in which the standard query statement is exactly the same as the content of the document.

[0058] Then determine the matching degree based on the matching results of the broad matching method, phrase matching method and exact matching method. If the document and the standard query statement meet any of the three matching methods, the preset matching degree can be obtained. The matching degree can be measured by a specific value or percentage, and then the matching degree can be summarized to obtain the matching degree between the document and the standard query statement. For example, when using the matching method that the standard query statement is the same as the first letter of the document, the matching method that the standard query statement is the same as the pinyin abbreviation of the document, the matching method that the standard query statement is exactly the same as a sentence in the document, and the matching method that the standard query statement is exactly the same as the pinyin of the document, the document and the standard query statement meet the conditions, and the matching degree corresponding to each method is 1, then the matching degree between the document and the standard query statement is 4.

[0059] Step S34: sort the matching degrees from large to small to select two documents with top matching results.

[0060] For example, if m is 3, and the matching degrees of 3 documents with the standard query statement are 2, 3, and 4 respectively, then the documents corresponding to the matching degrees 3 and 4 can be selected.

[0061] Step S35: input the titles of the two documents with the highest matching results and the standard query statement into the trained pairing algorithm-based refined ranking model to obtain the document with the highest similarity to the standard query statement.

[0062] Step S4: The standard query statement and the document with the highest similarity to the standard query statement are combined to form a context environment and input into the trained language model to write text content.

[0063] Text content writing can be carried out based on the generator module, which is the core component of the retrieval enhancement generation process. Its main function is to convert the retrieved relevant document content into high-quality text that is readable by users.

[0064] The context is constructed based on both the standard query and the documents with the highest similarity to the standard query. It includes not only the user's original query but also relevant information extracted from the document fragments. In this way, the generator can obtain rich background knowledge and provide more accurate and relevant content when generating text.

[0065] The language model has been trained on a wide range of text data and has strong language understanding and generation capabilities. Based on the provided context, the model is able to generate coherent, relevant, and high-quality text content. The pre-trained model captures the complex relationships in language through deep learning technology, so that the generated content not only conforms to the context, but also maintains natural language fluency and logical consistency.

[0066] The language model provides the generated text content to the user terminal. During the output process, the system also stores the generated content, the original query, and the retrieved documents. This data is not only used to provide immediate feedback to the user, but also provides a basis for subsequent evaluation and improvement. Specifically, this stored data can help analyze the performance of the generator and provide guidance for future model training and optimization to continuously improve the quality and accuracy of the generated content.

[0067] Through the above steps, the generator module can effectively convert the retrieved document content into high-quality text, provide valuable information to users, and continuously optimize system performance and enhance user experience.

[0068] The second aspect of the present invention discloses a retrieval enhancement generation device based on a large model, including a memory and a controller that are sequentially connected in communication, the memory stores a computer program, and the controller is used to read the computer program and execute the retrieval enhancement generation method based on a large model described in the first aspect. For example, the memory may include, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a flash memory (Flash Memory), a first-in-first-out memory (FIFO) and or a first-in-last-out memory (FILO), etc.; the controller may not be limited to a microcontroller of the STM32F105 series. In addition, the computer device may also include, but is not limited to, a power supply unit, a display screen and other necessary components.

[0069] The third aspect of the present invention discloses a computer-readable storage medium, on which instructions are stored. When the instructions are run on a computer, the large model-based retrieval enhancement generation method described in the first aspect is executed.

[0070] The operation of the device and medium disclosed in the second and third aspects of the present invention is detailed in the first and second aspects and will not be described in detail here.

[0071] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and should be understood that the protection scope of the present invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific variations and combinations that do not deviate from the essence of the present invention based on the technical revelations disclosed by the present invention, and these variations and combinations are still within the protection scope of the present invention.

Claims

1. A retrieval enhancement generation method based on a large model, characterized in that: The following steps are involved: Receive query information from a user and use an intent recognition module to identify the knowledge base that the user wants to query based on the query information and label data of the knowledge base, wherein there are at least two knowledge bases and each knowledge base stores different types of documents, and the label data includes a category label representing a category to which the knowledge base belongs and a term representing key content of a document in the knowledge base; Rewriting the query information based on semantics to obtain a standard query statement, wherein the standard query statement includes entities and keywords; Retrieving the document with the highest similarity to the standard query statement in the knowledge base to be queried by the user based on the standard query statement; The standard query statement and the document with the highest similarity to the standard query statement are combined to form a context environment and input into the trained language model to write text content.

2. A retrieval enhancement generation method based on a large model according to claim 1, characterized in that: The receiving of the user's query information and using the intention recognition module to identify the knowledge base that the user wants to query according to the query information and the label data of the knowledge base includes: Step S11: receiving the user's query information, Step S12: determining the nature of the query information, which nature includes query nature or non-query nature; Step S13: in response to the property being a non-query property, generating and displaying a prompt template; Step S14: receiving query information fed back by the user according to the prompt template; Step S15: determining the relevance of the query information fed back by the user according to the prompt template and all knowledge bases; Step S16: in response to the query information fed back by the user according to the prompt template having a correlation with all knowledge bases less than a threshold, adding label data of the knowledge base with the highest correlation with the query information fed back by the user according to the prompt template to the prompt template and displaying it; Step S17, repeating steps S14 to S16 until the correlation between the query information fed back by the user according to the prompt template and at least one knowledge base is greater than or equal to the threshold.

3. A retrieval enhancement generation method based on a large model according to claim 2, characterized in that: After determining the nature of the query information, the method further includes: The relevance between the query information and all knowledge bases is determined, and the knowledge base with the greatest relevance is used as the knowledge base to be queried by the user.

4. The method for generating retrieval enhancement based on a large model according to claim 1, characterized in that: The step of rewriting the query information based on semantics to obtain a standard query statement includes: Performing semantic analysis on the query information using natural language processing technology to identify keywords and entities in the query information; Based on semantic analysis, a standard query sentence including the keywords and entities is generated according to a rewriting template while preserving the semantics.

5. The method for generating retrieval enhancement based on a large model according to claim 1, characterized in that: The step of retrieving the document with the highest similarity to the standard query statement from the knowledge base to be queried by the user based on the standard query statement comprises: Calculate the similarity between the standard query statement and all documents in the knowledge base that the user wants to query; The similarities are sorted from large to small to select documents corresponding to m similarities with the highest similarities, where m is greater than or equal to 3; Using at least two matching methods to match the selected m documents with the standard query statement to obtain a matching degree; Sorting the matching degrees from large to small to select two documents with top matching results; The titles and standard query statements of the two documents with the highest matching results are input into the trained pairing algorithm-based refined ranking model to obtain the document with the highest similarity to the standard query statement.

6. A retrieval enhancement generation method based on a large model according to claim 5, characterized in that: The at least two matching methods are used to match the selected m documents to obtain a matching degree, including: The selected m documents and the standard query statement are matched respectively by using a broad matching method, a phrase matching method and an exact matching method. The broad matching method includes a matching method in which the standard query statement is identical to the first letter of the document, a matching method in which the standard query statement is identical to the pinyin abbreviation of the document and a matching method in which the standard query statement is identical to the first letter of the document. The phrase matching method includes a matching method in which the standard query statement is identical to a sentence in the document and a matching method in which the document is identical to a sentence in the standard query statement. The exact matching method includes a matching method in which the standard query statement is identical to the pinyin of the document and a matching method in which the standard query statement is identical to the content of the document. The matching degree is determined based on the matching results of the broad matching method, the phrase matching method, and the exact matching method.

7. A retrieval enhancement generation device based on a large model, comprising a memory and a controller connected in sequence, characterized in that: The memory stores a computer program, and the controller is used to read the computer program and execute the large model-based retrieval enhancement generation method described in any one of claims 1 to 6.

8. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed on a computer, a large model-based retrieval enhancement generation method as described in any one of claims 1 to 6 is executed.

Citation Information

Patent Citations

  • A large model retrieval enhancement generation method and device

    CN117891838B

Cited By

  • LLM-driven internal and external knowledge dynamic fusion hybrid retrieval enhanced generation method and storage medium

    CN120104746A

  • Method and system for completing searching according to fuzzy significance label by using AI large model

    CN120386810A

  • Retrieval enhancement generation optimization method and device based on adaptive classification and autonomous reasoning

    CN120429449A

  • Text generation method based on large language model

    CN122113890A

  • A Text Generation Method Based on a Large Language Model

    CN122113890B