Retrieval enhancement generation question and answer determination method and device, equipment and storage medium

By using multimodal search library and pre-trained query response model in search enhancement generation technology, the search scope and response results are accurately solved, and the problems of low recall of complex problems and difficult semantic association processing in the existing technology are solved, and efficient and accurate question-and-answer search is achieved.

CN120196735AInactive Publication Date: 2025-06-24GUSU LAB OF MATERIALS

Patent Information

Application Number
CN202510686196.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2025-06-24
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing search enhancement generation technology has limited recall rate for complex problems, and it is difficult to deal with cross-block semantic association, resulting in low retrieval efficiency and poor accuracy, and unable to meet the actual application needs.

Method used

By obtaining the user's query text, based on the pre-constructed multimodal search library (including text library, graphics library and vector library), the search range is accurately determined, the target text collection is determined, and input it into the pre-trained query response model for question-and-answer search, and the response result is generated.

Benefits of technology

It improves the accuracy and efficiency of the response results, simplifies the search process, reduces the search time, and meets the needs of practical applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120196735A_ABST
    Figure CN120196735A_ABST
Patent Text Reader

Abstract

The invention discloses a retrieval enhancement generation question and answer determination method and device, equipment and a storage medium. The method comprises the following steps: acquiring a first query text for querying by a query object; based on a pre-constructed target retrieval library and the first query text, determining a target text set used for providing a response basis for the first query text, the target retrieval library comprises a first text library composed of texts segmented by an original document, a first graphics library obtained by performing triple composition on the original document segments, a first vector library composed of vectors segmented by the original document, and a second vector library composed of triple graph structure vectors; and inputting the target text set and the first query text into the target query response large model, and determining a target response result corresponding to the first query text. According to the technical scheme provided by the embodiment of the invention, the to-be-retrieved document text closely related to the question of the user is extracted from the retrieval library, so that the actual retrieval range is accurate, and the response efficiency and the response accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data retrieval, and particularly to a method, device, equipment and storage medium for determining retrieval enhanced generation questions and answers. Background Art

[0002] With the rapid development of large language models (LLMs, such as GPT-4, LLaMA, etc.), generative AI has demonstrated powerful capabilities in fields such as question answering, customer service, and content creation. Retrieval-Augmented Generation (RAG) has emerged as a result.

[0003] Retrieval-Augmented Generation is a technology that combines information retrieval and text generation, aiming to improve the accuracy, timeliness, and interpretability of large models. Although traditional pure generative models can generate fluent text, they suffer from problems such as knowledge ossification (inability to update), hallucinations, and lack of verifiable sources. RAG can enable the model to access the latest and trustworthy information by dynamically retrieving external knowledge bases, thereby generating more reliable answers.

[0004] Currently, a variety of innovative solutions have been developed in the field of retrieval enhanced generation technology. The original RAG is based on a benchmark framework of text chunking and dense vector retrieval, adopting a linear process of "chunking - embedding - retrieval". However, although the original RAG is simple to implement and has fast computational efficiency, its recall rate for complex questions is limited, and it is difficult to handle cross-chunk semantic association problems, resulting in low retrieval efficiency and poor accuracy, unable to meet the actual application requirements. Summary of the Invention

[0005] The present invention provides a method, device, equipment and storage medium for determining retrieval enhanced generation questions and answers, which extracts text of documents to be retrieved that is closely related to the user's question from the retrieval library to precisify the actual retrieval scope and improve the reply efficiency and response accuracy.

[0006] According to one aspect of the present invention, there is provided a method for determining retrieval enhanced generation questions and answers. The method includes:

[0007] Obtain a first query text for querying a query object;

[0008] Based on a pre-constructed target retrieval library and the first query text, determine a target text set for providing a response basis for the first query text, wherein the target retrieval library includes a first text library composed of texts segmented from the original document, a first graph library obtained by constructing triple graphs from the segmented original document, a first vector library composed of vectors of the segmented original document, and a second vector library composed of triple graph structure vectors;

[0009] Input the target text set and the first query text into a pre-trained target query answering model for question-answering retrieval to determine the target answer result corresponding to the first query text.

[0010] According to another aspect of the present invention, a retrieval-enhanced generation question-answering determination device is provided. The device includes:

[0011] A query text determination module, configured to obtain a first query text for querying a query object;

[0012] A text set determination module, configured to determine a target text set for providing an answer basis for the first query text based on a pre-constructed target retrieval library and the first query text, where the target retrieval library includes a first text library composed of texts segmented from an original document, a first graph library obtained by constructing triples from the segmented original document, a first vector library composed of vectors of the segmented original document, and a second vector library composed of triple graph structure vectors;

[0013] An answer result determination module, configured to input the target text set and the first query text into a pre-trained target query answering model for question-answering retrieval to determine the target answer result corresponding to the first query text.

[0014] According to another aspect of the present invention, an electronic device is provided. The electronic device includes:

[0015] At least one processor; and,

[0016] A memory communicatively connected to the at least one processor; wherein,

[0017] The memory stores a computer program executable by the at least one processor, and when the computer program is executed by the at least one processor, the at least one processor is enabled to execute the retrieval-enhanced generation question-answering determination method according to any embodiment of the present invention.

[0018] According to another aspect of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores computer instructions, and when the computer instructions are used by a processor, the retrieval-enhanced generation question-answering determination method according to any embodiment of the present invention is implemented.

[0019] The technical solution of the embodiment of the present invention obtains a first query text for querying a query object. Based on a pre-constructed target retrieval library and the first query text, a target text set for providing a response basis for the first query text is determined. The target retrieval library includes a first text library composed of texts segmented from the original document, a first graph library obtained by constructing triple graphs from the segmented original document, a first vector library composed of vectors segmented from the original document, and a second vector library composed of triple graph structure vectors. The target text set and the first query text are input into a pre-trained target query response model for question-and-answer retrieval to determine a target response result corresponding to the first query text, and the retrieval range of the target retrieval library is reduced to the target text set, thereby highly precisely defining the retrieval range of the first query text, simplifying the retrieval process, reducing the retrieval time, and improving the accuracy of the response result at the same time.

[0020] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present invention, nor is it used to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts.

[0022] Figure 1 is a flowchart of a method for determining retrieval enhanced generation question and answer according to Embodiment 1 of the present invention;

[0023] Figure 2 is a flowchart of a method for determining retrieval enhanced generation question and answer according to Embodiment 2 of the present invention;

[0024] Figure 3 is a flowchart of a method for determining retrieval enhanced generation question and answer according to Embodiment 3 of the present invention;

[0025] Figure 4 is a structural diagram of a device for determining retrieval enhanced generation question and answer according to Embodiment 4 of the present invention;

[0026] Figure 5 is a schematic structural diagram of an electronic device for implementing the method for determining retrieval enhanced generation question and answer of the embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0027] To enable those skilled in the art to better understand the solution of the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present invention.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described here can be implemented in an order different from those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0029] Embodiment 1

[0030] Figure 1 FIG. 10 is a flowchart of a method for determining a retrieval-enhanced generation question and answer provided in Embodiment 1 of the present invention. This embodiment is applicable to the situation of accurately answering query questions. This method can be executed by a retrieval-enhanced generation question and answer determination device, which can be implemented in the form of hardware and / or software, and the retrieval-enhanced generation question and answer determination device can be configured in an electronic device. As Figure 1 shown, the method includes:

[0031] S101. Obtain a first query text for querying by a query object.

[0032] Among them, the query object may refer to an object that needs to perform a data query, which may be an operator or other service devices that need to ask questions. The first query text may refer to the question text for querying by the query object.

[0033] Specifically, obtain the query question that the operation object inputs and needs to query, and perform text processing on the query question to obtain the first query text. It should be noted that the present invention is applied to an application scenario that needs to perform information queries. For example, the business supervisor inputs a query through voice at the local operation terminal to determine what are the daily behavior requirements of the employees in the business department?

[0034] S102. Based on the pre-constructed target retrieval library and the first query text, determine a set of target texts for providing a basis for answering the first query text.

[0035] Among them, the target retrieval library may include a first text library, a first graphics library, a first vector library, and a second vector library. The first text library is composed of texts segmented from the original document, the first graphics library is obtained by constructing triple graphs from the segmented original document, the first vector library is composed of vectors segmented from the original document, and the second vector library is composed of triple graph structure vectors.

[0036] The set of target texts may refer to a set of relevant text segments in the target retrieval library that can provide a basis for answering the first query text. Exemplarily, if the first query text is what are the daily behavior requirements for employees in the business department?, the set of target texts may include, but is not limited to, a set of text segments of the company's internal employee behavior specification requirements, a set of text segments of the employee handbook, a set of text segments of the business part requirements specification, etc.

[0037] Exemplarily, the construction process of the target retrieval library includes:

[0038] Obtain the original document for constructing the retrieval library, and segment the original document to obtain multiple original document segments; construct the text information of all the original document segments to obtain the first text library; for each original document segment, perform vectorization processing on the original document segment to obtain a document segment vector, and construct all the document segment vectors to obtain the first vector library; for each original document segment, perform triple graph construction processing on the original document segment to determine the graph points and graph edges of the triple graph, and construct the first graphics library and the second vector library according to the graph points and the graph edges.

[0039] Among them, the original document may refer to the original document for constructing the retrieval library, such as all documents that can be publicly displayed within an enterprise.

[0040] It should be noted that the construction of the target retrieval library is the core link of the retrieval response information system. Traditional methods mainly rely on inverted indexes and are difficult to capture the deep semantic relationships in the text. The indexing construction method based on the knowledge graph in the present invention realizes the transformation from unstructured text to a structured knowledge graph through the collaborative cooperation of a large language model and a traditional extraction model. This method significantly improves the semantic expression ability of the index while ensuring the accuracy.

[0041] Specifically, the collected original documents are segmented. To maintain the semantic coherence of the original documents, a semantic-aware sliding window algorithm is used for paragraph segmentation. Among them, the sliding window algorithm adopts a multi-modal feature fusion strategy, comprehensively considering dimensions such as lexical distribution, syntactic structure, and semantic coherence. By using a pre-trained language model to calculate the semantic features of text units in real time, combined with the LDA topic model and entity density analysis, an all-round boundary determination system is constructed, so that multiple segments of the original documents can be obtained.

[0042] The text information of the segmented original documents is stored, so that a first text library can be obtained. On the other hand, each segmented original document is vectorized, and the vector information of the obtained document segment vectors is stored, so that a first vector library can be obtained.

[0043] Each segmented original document is processed based on multiple stages to extract and construct a triple graph, so that the graph points and graph edges of the triple graph can be determined, and a first graph library and a second vector library are constructed according to the graph points and graph edges.

[0044] Exemplarily, the processing of the segmented original documents to determine the graph points and graph edges of the triple graph includes: performing entity recognition processing on the segmented original documents to determine document entity information and entity relationship information; determining the document entity information as the graph points of the triple graph, and determining the entity relationship information as the graph edges of the triple graph.

[0045] It should be noted that the triple graph is a knowledge representation method based on triples, usually used in knowledge graph semantic webs. In the triple graph, points and edges represent different semantic information respectively. In the triple graph, points usually represent entities. For example, entities can be Li Si (person), City A (location), Country A (country), and basketball player (occupation), etc. In the triple graph, edges represent relationships. For example, Li Si was born in City A, and "was born in" is a relationship; City A belongs to Country A, and "belongs to" is a relationship.

[0046] Specifically, a large model is used to scan the text, and entities are identified through its powerful semantic understanding ability. At the same time, combined with the entity monitoring ability of the deep learning model, various entities are accurately identified and normalized, and the same entity with different expressions is unified to a standard, so that document entity information can be obtained.

[0047] On the other hand, in the stage of generating relationship candidate pairs, a strategy combining syntactic constraints and semantic similarity is adopted to establish a preliminary association between entities, perform full-connection pairing on the entities within the same sentence, calculate the initial relationship possibility, and for cross-sentence entities, construct potential relationship paths through overall analysis, and retain entity candidate pairs with a probability higher than the threshold.

[0048] In the refined relationship classification stage, the present invention uses a multi-granularity judgment strategy. First, the relationship is classified into a superordinate category through a coarse classification module, then the specific relationship type is distinguished through a fine classification module, and finally, domain adaptation is performed according to the requirements of the application scenario. This process fully considers the semantic clues of the context environment, including information such as modifiers and tenses, and strictly verifies the compatibility between the entity type and the relationship type to ensure the logical coherence of cross-paragraph relationships, so as to determine the entity relationship information.

[0049] Determine the document entity information as the graph points of the triple graph, and determine the entity relationship information as the graph edges of the triple graph. Assemble triples according to the graph points and graph edges to construct a triple graph. In the triple assembly and optimization stage, a multi-evidence fusion mechanism is adopted to integrate the reasoning ability of the large language model and the structural output advantages of the deep learning model. When there are conflicting assertions, a three-level arbitration mechanism based on timestamp, data source authority, and the number of supporting evidences is automatically enabled, and an artificial review process is introduced for uncertain triples. Each generated triple will be attached with rich context attributes such as time, location, and source, and marked with a confidence score and verification status. At the same time, a complete traceability link is established to record the processing process. For each entity node and relationship edge, a text key-value pair (K, V) is generated for efficient retrieval, and the corresponding value is a summary of relevant fragments from external data to assist text generation. Finally, a deduplication function is used to identify and merge the same entities and relationships from different paragraphs.

[0050] Exemplarily, constructing the first graph library and the second vector library according to the graph points and the graph edges includes: for each graph edge, determining a target graph point from the graph points that has a connection relationship with the graph edge; converting the graph edge and the target graph point into a node-relationship-node structure for graph construction to generate the first graph library; performing vectorization processing on the graph edge and the target graph point to obtain graph structure vectors, and constructing all the graph structure vectors to obtain the second vector library.

[0051] Specifically, for each graph edge, the target graph point having a connection relationship with the graph edge and the graph edge are structurally converted into a node-relationship-node structure, and a three-list is used to store the graph structure, so as to obtain the first graph library. On the other hand, perform vectorization processing on the graph edge and the target graph point to obtain graph structure vectors, and store all the graph structure vectors, so as to obtain the second vector library.

[0052] S103. Input the target text set and the first query text into a pre-trained target query and answer model for question and answer retrieval, and determine the target answer result corresponding to the first query text.

[0053] Among them, the target query answering model may refer to a large model used to provide an answer result for the first query text. Exemplarily, the target query answering model can be pre-trained based on sample query texts, sample text sets, and sample answer results.

[0054] Specifically, the target text set and the first query text are respectively input into the target query answering model to determine the query result, and based on the output of the target query answering model, the target answer result corresponding to the first query text is obtained.

[0055] The technical solution of the embodiment of the present invention obtains the first query text for querying by the query object. Based on the pre-constructed target retrieval library and the first query text, a target text set for providing an answer basis for the first query text is determined, where the target retrieval library includes a first text library composed of texts segmented from the original document, a first graphics library obtained by constructing triple graphs from the segmented original document, a first vector library composed of vectors of the segmented original document, and a second vector library composed of triple graph structure vectors; the target text set and the first query text are input into the pre-trained target query answering model for question-answering retrieval to determine the target answer result corresponding to the first query text, reducing the retrieval range of the target retrieval library to the target text set, thereby highly precisely defining the retrieval range of the first query text, simplifying the retrieval process, reducing the retrieval time, and at the same time improving the accuracy of the answer result.

[0056] Embodiment Two

[0057] Figure 2 The flowchart of a method for determining retrieval-enhanced generation question answering provided by the second embodiment of the present invention. On the basis of the above embodiments, the determination of the target text set according to the target retrieval library and the first query text is refined. As Figure 2 shown, the method includes:

[0058] S201. Obtain the first query text for querying by the query object.

[0059] S202. Based on the first text library and the first vector library in the target retrieval library, determine a first text set that matches the first query text.

[0060] Among them, the first text set may refer to a set of segments of the original document that match the first query text in the first text library and the first vector library.

[0061] Specifically, the first query text is respectively matched with the first text library and the first vector library, and the first text set is constructed according to the segments of the original document that match the first query text.

[0062] Exemplarily, determining a first text set that matches the first query text based on the first text library and the first vector library in the target retrieval library includes: performing keyword text similarity retrieval according to the first query text and the first text library to determine a first similarity score between each original document segment in the first text library and the first query text; performing keyword vector similarity retrieval according to the first query text and the first vector library to determine a second similarity score between each original document segment in the first vector library and the first query text; for each original document segment, determining a target similarity score of the original document segment according to the first similarity score, the second similarity score corresponding to the original document segment, and a predetermined target weight, where the target weight is determined according to the length of the first query text; and determining the first text set according to the target similarity score of each original document segment and a preset extraction threshold.

[0063] It should be noted that since the first text library and the first vector library are constructed from the same original document segments, the original document segments in the first text library and the first vector library are the same.

[0064] Among them, the first similarity score may refer to the similarity score between the keyword text of the first query text and the original document segment in the first text library. The second similarity score may refer to the similarity score between the keyword vector of the first query text and the original document segment in the first vector library.

[0065] Specifically, determine the keyword text and keyword vector of the first query text. Perform keyword text similarity retrieval on the keyword text and each original document segment in the first text library to determine the first similarity score of each original document segment. Perform keyword vector similarity retrieval on the keyword vector and the vector of each original document segment in the first vector library to determine the second similarity score of each original document segment.

[0066] For each original document segment, determine the target similarity score of the original document segment according to the first similarity score, the second similarity score corresponding to the original document segment, and a predetermined target weight. Exemplarily, the process of determining the target similarity score is as follows:

[0067]

[0068] Among them, refers to the target similarity score, refers to the first similarity score, refers to the second similarity score, refers to the predetermined target weight.

[0069] Exemplarily, the process of determining the predetermined target weight is as follows:

[0070] ;

[0071] wherein, refers to the predetermined target weight, refers to the text length of the first query text, refers to the preset text length, refers to the preset parameter.

[0072] After obtaining the target similarity scores of each original document segment, all the original document segments are sorted in descending order according to the target similarity scores, and a first text set is extracted from the sorted original document segments in descending order according to a preset extraction threshold. Through the text retrieval method that integrates the dynamic target weight, the technical solution of the present invention can clarify the extraction offset of the first text set in the first text library or the first vector library, thereby effectively improving the accuracy of the first text set and further improving the accuracy of the target text set.

[0073] S203. Based on the first graphics library and the second vector library in the target retrieval library, determine a second text set that matches the entity of the first query text, and determine a third text set that matches the theme of the first query text.

[0074] Among them, the second text set may refer to a set of original document segments that match the entity of the first query text in the first graphics library and the second vector library. The third text set may refer to a set of original document segments that match the theme of the first query text in the first graphics library and the second vector library.

[0075] Exemplarily, the determining, based on the first graphics library and the second vector library in the target retrieval library, of a second text set that matches the entity of the first query text includes:

[0076] Performing entity recognition processing on the first query text to obtain a query text entity; performing entity text retrieval according to the query text entity and the first graphics library to determine a first document segment that matches the query text entity; performing entity vector retrieval according to the query text entity and the second vector library to determine a second document segment that matches the query text entity; and performing combination processing on the first document segment and the second document segment to obtain the second text set.

[0077] Specifically, after performing entity recognition processing on the first query text to obtain a query text entity, determine the entity text and entity vector of the query text entity. Perform text retrieval and matching processing on the entity text with the first graphics library to obtain a first document segment. Perform vector retrieval and matching processing on the entity vector with the second vector library to obtain a second document segment. Combine the first document segment and the second document segment to obtain a second text set. The technical solution of the embodiment of the present invention can effectively improve the accuracy of the second text set through the retrieval method of entities, and further improve the accuracy of the target text set.

[0078] Exemplarily, determining a third text set that matches the theme of the first query text based on the first graphics library and the second vector library in the target retrieval library includes:

[0079] Perform theme recognition processing on the first query text to obtain a query text theme; perform theme text retrieval based on the query text theme and the first graphics library to determine a third document segment that matches the query text theme; perform theme vector retrieval based on the query text theme and the second vector library to determine a fourth document segment that matches the query text theme; combine the third document segment and the fourth document segment to obtain a third text set.

[0080] It should be noted that the determination process of the third text set is similar to the determination process of the second text set. The difference between the two is that the third text set is determined by the text theme of the first query text. Specifically, after performing theme recognition processing on the first query text to obtain a query text theme, determine the theme text and theme vector of the query text theme. Perform text retrieval and matching processing on the theme text with the first graphics library to obtain a third document segment. Perform vector retrieval and matching processing on the theme vector with the second vector library to obtain a fourth document segment. Combine the third document segment and the fourth document segment to obtain a third text set. The technical solution of the embodiment of the present invention can effectively improve the accuracy of the third text set through the retrieval method of entities, and further improve the accuracy of the target text set.

[0081] S204. Filter the first text set, the second text set, and the third text set to obtain a target text set for providing a response basis for the first query text.

[0082] Specifically, filter the first text set, the second text set, and the third text set through an organizer to screen out duplicate original document segments in the first text set, the second text set, and the third text set, and determine the remaining original document segments as the target text set.

[0083] S205. Input the target text set and the first query text into a pre-trained target query answering model for question-answering retrieval to determine the target answer result corresponding to the first query text.

[0084] The technical solution of the present invention is implemented. Based on the first text library and the first vector library in the target retrieval library, a first text set matching the first query text is determined. Based on the first graphics library and the second vector library in the target retrieval library, a second text set matching the entity of the first query text and a third text set matching the theme of the first query text are determined. Filter the first text set, the second text set, and the third text set to obtain a target text set for providing an answer basis for the first query text. The technical solution of the embodiment of the present invention includes a text retrieval method integrating dynamic weights, an entity-based retrieval method, and a theme-based retrieval method. By integrating multiple retrieval strategies, the retrieval algorithm can effectively utilize local and global keywords, simplify the search process, and improve the relevance of the results.

[0085] Embodiment III

[0086] Figure 3 This is a preferred implementation of a retrieval-enhanced generation question-answering determination method provided in Embodiment III of the present invention. As Figure 3 shown, the method includes:

[0087] Perform a three-level retrieval on the first query text proposed by the user to obtain a target text set. The three-level retrieval includes a text retrieval method integrating dynamic weights, an entity retrieval method, and a theme retrieval method.

[0088] For the first query text proposed by the user, first pass through the first text library and the first vector library respectively to obtain relevant first similarity scores and second similarity scores, and then determine the target similarity score according to a pre-determined target weight, and determine the first text set according to the target similarity score and a preset extraction threshold.

[0089] In addition, the present invention also proposes to generate query keywords at the low layer and the high layer. Among them, the low-layer keywords refer to specific entities, and the high-layer keywords are concept queries, extracting broader themes. Generate queries for the first graphics library and the second vector library according to the extracted keywords, and use the vector database for matching. The low-layer keywords will match relevant entities to obtain a second text set; the high-layer keywords will match the corresponding entity relationships to obtain a third text set. To enhance the accuracy of the retrieval, we will process the adjacent nodes of the graph elements collected and retrieved, as well as the entities and their relationship contexts involved. In this way, complex queries can be processed and accurate and relevant answers can be provided.

[0090] Finally, we filter the extracted first text set, second text set, and third text set through an organizer, and then segment the original documents that meet the requirements and input them into the target query answering model to obtain relevant target answer results.

[0091] Embodiment 4

[0092] Figure 4 FIG. is a schematic structural diagram of a retrieval enhanced generation question answering determination device provided in Embodiment 4 of the present invention. As Figure 4 shown, the device includes:

[0093] A query text determination module 401, configured to obtain a first query text for querying a query object;

[0094] A text set determination module 402, configured to determine a target text set for providing an answer basis for the first query text based on a pre-constructed target retrieval library and the first query text, where the target retrieval library includes a first text library composed of texts segmented from the original document, a first graph library obtained by constructing a triple graph from the segmented original document, a first vector library composed of vectors segmented from the original document, and a second vector library composed of triple graph structure vectors;

[0095] An answer result determination module 403, configured to input the target text set and the first query text into a pre-trained target query answering model for question answering retrieval, and determine a target answer result corresponding to the first query text.

[0096] The technical solution of the embodiment of the present invention obtains a first query text for querying a query object. Based on a pre-constructed target retrieval library and the first query text, a target text set for providing an answer basis for the first query text is determined, where the target retrieval library includes a first text library composed of texts segmented from the original document, a first graph library obtained by constructing a triple graph from the segmented original document, a first vector library composed of vectors segmented from the original document, and a second vector library composed of triple graph structure vectors; the target text set and the first query text are input into a pre-trained target query answering model for question answering retrieval, and a target answer result corresponding to the first query text is determined, reducing the retrieval range of the target retrieval library to the target text set, thereby highly precisionizing the retrieval range of the first query text, simplifying the retrieval process, reducing the retrieval time, and improving the accuracy of the answer result at the same time.

[0097] Optionally, the device includes a retrieval library construction module. Among them, the retrieval library construction module includes:

[0098] An original document segmentation unit, configured to obtain original documents for constructing a retrieval library, and segment the original documents to obtain a plurality of original document segments;

[0099] A first text library construction unit, configured to construct text information of all the original document segments to obtain the first text library;

[0100] A first vector library construction unit, configured to perform vectorization processing on each of the original document segments to obtain document segment vectors, and construct all the document segment vectors to obtain the first vector library;

[0101] A graphic vector library construction unit, configured to perform triple graph construction processing on each of the original document segments to determine graph points and graph edges of a triple graph, and construct the first graphic library and the second vector library according to the graph points and the graph edges.

[0102] Optionally, the graphic vector library construction unit is configured to:

[0103] Perform entity recognition processing on the original document segment to determine document entity information and entity relationship information;

[0104] Determine the document entity information as graph points of the triple graph, and determine the entity relationship information as graph edges of the triple graph.

[0105] Optionally, the graphic vector library construction unit is further configured to:

[0106] For each of the graph edges, determine target graph points in the graph points that have a connection relationship with the graph edge;

[0107] Convert the graph edge and the target graph points into a node-relationship-node structure for graph construction to generate the first graphic library;

[0108] Perform vectorization processing on the graph edge and the target graph points to obtain graph structure vectors, and construct all the graph structure vectors to obtain the second vector library.

[0109] Optionally, the text set determination module 402 includes:

[0110] A first text set determination unit, configured to determine a first text set that matches the first query text based on the first text library and the first vector library in the target retrieval library;

[0111] A second text set determination unit, configured to determine a second text set that matches the entity of the first query text and a third text set that matches the theme of the first query text based on the first graphic library and the second vector library in the target retrieval library;

[0112] A third text set determination unit, configured to perform a filtering process on the first text set, the second text set, and the third text set to obtain a target text set for providing a response basis for the first query text.

[0113] Optionally, the first text library has the same original document segments as the first vector library; the first text set determination unit is configured to:

[0114] Perform keyword text similarity retrieval according to the first query text and the first text library to determine a first similarity score between each original document segment in the first text library and the first query text;

[0115] Perform keyword vector similarity retrieval according to the first query text and the first vector library to determine a second similarity score between each original document segment in the first vector library and the first query text;

[0116] For each of the original document segments, determine a target similarity score of the original document segment according to the first similarity score, the second similarity score corresponding to the original document segment, and a pre-determined target weight, where the target weight is determined according to the length of the first query text;

[0117] Determine the first text set according to the target similarity score of each original document segment and a preset extraction threshold.

[0118] Optionally, the second text set determination unit is configured to:

[0119] Perform entity recognition processing on the first query text to obtain a query text entity;

[0120] Perform entity text retrieval according to the query text entity and the first graphic library to determine a first document segment that matches the query text entity;

[0121] Perform entity vector retrieval according to the query text entity and the second vector library to determine a second document segment that matches the query text entity;

[0122] Perform a combination process on the first document segment and the second document segment to obtain a second text set.

[0123] Optionally, the third text set determination unit is configured to:

[0124] Perform topic recognition processing on the first query text to obtain the query text topic;

[0125] Perform topic text retrieval based on the query text topic and the first graphics library to determine a third document segment that matches the query text topic;

[0126] Perform topic vector retrieval based on the query text topic and the second vector library to determine a fourth document segment that matches the query text topic;

[0127] Combine the third document segment and the fourth document segment to obtain a third text set.

[0128] The retrieval enhancement generation Q&A determination device provided by the embodiments of the present invention can execute the retrieval enhancement generation Q&A determination method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the method.

[0129] Embodiment 5

[0130] Figure 5 FIG. shows a schematic structural diagram of an electronic device 10 that can be used to implement the embodiments of the present invention. The electronic device is intended to represent various forms of digital computers, such as, for example, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, for example, personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0131] As Figure 5 shown, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc. Among them, the memory stores a computer program executable by the at least one processor. The processor 11 can execute various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.

[0132] Multiple components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disc, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0133] The processor 11 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the retrieval-augmented generation question-answering determination method.

[0134] In some embodiments, the retrieval-augmented generation question-answering determination method can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the retrieval-augmented generation question-answering determination method described above can be executed. Alternatively, in other embodiments, the processor 11 can be configured to execute the retrieval-augmented generation question-answering determination method by any other suitable means (e.g., by means of firmware).

[0135] The various embodiments of the systems and technologies described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs, which can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special or general programmable processor, and can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit the data and instructions to the storage system, the at least one input device, and the at least one output device.

[0136] A computer program for implementing the method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, a special purpose computer, or other programmable data processing device, such that the computer programs, when executed by the processor, cause the functions / operations specified in the flowchart and / or block diagram to be implemented. The computer programs can be executed entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine, or entirely on the remote machine or server.

[0137] In the context of the present invention, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0138] In order to provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0139] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), blockchain network, and the Internet.

[0140] A computing system can include a client and a server. The client and the server are generally far from each other and typically interact through a communication network. The client-server relationship is created by computer programs running on respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, solving the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services.

[0141] It should be understood that various forms of the processes shown above can be used, with steps reordered, added, or deleted. For example, the steps recited in the present invention can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved, and no limitation is imposed herein.

[0142] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A method for determining retrieval-augmented generation question answering, characterized in that, Including: Obtaining a first query text for querying a query object; Based on a pre-constructed target retrieval library and the first query text, determining a target text set for providing a response basis for the first query text, where the target retrieval library includes a first text library composed of texts segmented from an original document, a first graph library obtained by constructing triple graphs from the segmented original document, a first vector library composed of vectors of the segmented original document, and a second vector library composed of triple graph structure vectors; Inputting the target text set and the first query text into a target query response model for question-answering retrieval to determine a target response result corresponding to the first query text.

2. The retrieval-enhanced generation question and answer determination method according to claim 1, wherein The construction process of the target retrieval library includes: Obtaining an original document for constructing the retrieval library, and segmenting the original document to obtain a plurality of segmented original documents; Constructing the text information of all the segmented original documents to obtain the first text library; For each of the segmented original documents, performing vectorization processing on the segmented original document to obtain a document segment vector, and constructing all the document segment vectors to obtain the first vector library; For each of the segmented original documents, performing triple graph construction processing on the segmented original document to determine graph nodes and graph edges of a triple graph, and constructing the first graph library and the second vector library according to the graph nodes and the graph edges.

3. The retrieval-enhanced generation question-answering determination method according to claim 2, wherein The performing triple graph construction processing on the segmented original document to determine graph nodes and graph edges of a triple graph includes: Performing entity recognition processing on the segmented original document to determine document entity information and entity relationship information; Determining the document entity information as graph nodes of the triple graph, and determining the entity relationship information as graph edges of the triple graph.

4. The retrieval-enhanced generation question and answer determination method according to claim 2, wherein The constructing the first graph library and the second vector library according to the graph nodes and the graph edges includes: For each of the graph edges, determining target graph nodes in the graph nodes that have a connection relationship with the graph edge; Converting the graph edge and the target graph nodes into a node-relationship-node structure for graph construction to generate the first graph library; Performing vectorization processing on the graph edge and the target graph nodes to obtain graph structure vectors, and constructing all the graph structure vectors to obtain the second vector library.

5. The retrieval-enhanced generation question-answering determination method according to claim 1, wherein The determining a target text set for providing a response basis for the first query text based on the pre-constructed target retrieval library and the first query text includes: Based on the first text library and the first vector library in the target retrieval library, determining a first text set that matches the first query text; Based on the first graph library and the second vector library in the target retrieval library, determining a second text set that matches the entity of the first query text and determining a third text set that matches the theme of the first query text; Performing filtering processing on the first text set, the second text set, and the third text set to obtain a target text set for providing a response basis for the first query text.

6. The retrieval-enhanced generation question and answer determination method according to claim 5, wherein The first text library has the same segmentation as the original documents in the first vector library; determining a first text set that matches the first query text based on the first text library and the first vector library in the target retrieval library includes: Performing keyword text similarity retrieval according to the first query text and the first text library to determine a first similarity score between each original document segment in the first text library and the first query text; Performing keyword vector similarity retrieval according to the first query text and the first vector library to determine a second similarity score between each original document segment in the first vector library and the first query text; For each of the original document segments, determining a target similarity score of the original document segment according to the first similarity score, the second similarity score corresponding to the original document segment, and a predetermined target weight, where the target weight is determined according to the length of the first query text; Determining the first text set according to the target similarity scores of each of the original document segments and a preset extraction threshold.

7. The retrieval-enhanced generation question and answer determination method according to claim 5, characterized in that Determining a second text set that matches the entity of the first query text based on the first graphics library and the second vector library in the target retrieval library includes: Performing entity recognition processing on the first query text to obtain a query text entity; Performing entity text retrieval according to the query text entity and the first graphics library to determine a first document segment that matches the query text entity; Performing entity vector retrieval according to the query text entity and the second vector library to determine a second document segment that matches the query text entity; Performing combination processing on the first document segment and the second document segment to obtain a second text set.

8. The retrieval enhanced generation question and answer determination method according to claim 5, characterized in that, Determining a third text set that matches the theme of the first query text based on the first graphics library and the second vector library in the target retrieval library includes: Performing theme recognition processing on the first query text to obtain a query text theme; Performing theme text retrieval according to the query text theme and the first graphics library to determine a third document segment that matches the query text theme; Performing theme vector retrieval according to the query text theme and the second vector library to determine a fourth document segment that matches the query text theme; Performing combination processing on the third document segment and the fourth document segment to obtain a third text set.

9. A retrieval-augmented generation question-answering determination device, characterized in that, Including: A query text determination module, configured to obtain a first query text for querying by a query object; A text set determination module, configured to determine a target text set for providing a response basis for the first query text based on a pre-constructed target retrieval library and the first query text, where the target retrieval library includes a first text library composed of texts of original document segments, a first graphics library obtained by constructing a triple graph from the original document segments, a first vector library composed of vectors of the original document segments, and a second vector library composed of triple graph structure vectors; A response result determination module, configured to input the target text set and the first query text into a target query response model for question-and-answer retrieval, and determine a target response result corresponding to the first query text.

10. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the retrieval enhanced generation question-and-answer determination method according to any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions, and the computer instructions are used to implement the retrieval enhanced generation question-and-answer determination method according to any one of claims 1-8 when executed by a processor.

Citation Information

Patent Citations

  • Method and system for enhancing RAG questions and answers through mixed retrieval method

    CN118627625A

  • Backbone optical communication equipment document retrieval optimization method and system

    CN118916445A

  • Method and system for generating enhanced knowledge questions and answers for mixed retrieval of heterogeneous database

    CN119311831A

  • Method for enhancing AI large model generation by using structured context-assisted retrieval

    CN119917616A

Cited By

  • Emergency plan generation method and device and electronic equipment

    CN120723893A