Question retrieval method and device based on question and answer pair information base and medium

Through the pre-retrieval and cache answer mechanism of the question-answering information database, the problem of slow response speed of the existing question-answering system is solved, a balance between fast response and answer accuracy is achieved, and the user experience is improved.

CN120705286APending Publication Date: 2025-09-26INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510789029.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-13
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

The existing question-answering system has a slow response speed due to the large amount of knowledge base data and low similarity calculation efficiency, which makes it difficult to meet users' real-time interaction needs, especially when asking high-frequency repeated questions, the response delay is serious.

Method used

Use questions and answers to pre-search the information database, match vectorized user questions with historical question and answer pairs, directly call cached answers or generate answers through knowledge base retrieval, reduce direct searches of massive knowledge bases, and improve response speed.

Benefits of technology

By pre-searching the information database through questions and answers, similar matching items of users' historical questions can be quickly located, reducing the amount of calculation, improving the system response speed, ensuring the accuracy and completeness of the answers, and avoiding invalid answers due to missing information in the database.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120705286A_ABST
    Figure CN120705286A_ABST
Patent Text Reader

Abstract

The invention discloses a question retrieval method and device based on a question-answer pair information library and a medium, and is applied to the field of artificial intelligence, and the method comprises the following steps: obtaining a user question, and matching the user question through the pre-constructed question-answer pair information library to determine a matching condition; judging whether the matching condition is that a matched question-answer pair exists or not, and if yes, generating a target question answer according to a cached answer in a question-answer pair information base; otherwise, matching the questions of the user through a pre-constructed knowledge base to generate an answer to the target question. Through pre-retrieval of questions and answers on an information base, similar matching items of historical questions of a user are quickly positioned, direct retrieval of massive knowledge bases is avoided, and the calculation amount is reduced. And for the matched questions, the cached answers are directly called without triggering knowledge base retrieval and large model regeneration processes, so that the system response speed is increased. For unmatched new questions, the accuracy and integrity of answers are ensured through bottom retrieval of the knowledge base, and the answer failure caused by information base deficiency is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a question retrieval method, device and medium based on a question-answer pair information database. Background Art

[0002] In the development of artificial intelligence (AI), question-answering systems, as a crucial vehicle for human-computer interaction, are finding increasingly widespread application across a wide range of fields, including intelligent customer service, knowledge retrieval, and information consulting. To improve the accuracy and reliability of responses, retrieval-augmented generation technology has been widely adopted. This technology, which retrieves external knowledge bases to provide additional context for the generative model, has become a core technology architecture for current question-answering systems.

[0003] Existing question-answering systems generally employ a retrieval-enhanced mechanism, searching for relevant knowledge fragments within a knowledge base and feeding the retrieval results into a large model to generate answers. However, existing question-answering systems employing retrieval-enhanced mechanisms have significant drawbacks in practical applications. Because the knowledge base contains a vast amount of data, each time a user asks a question, a retrieval calculation must be performed. This inefficient computation results in slow system responses and makes it difficult to meet users' demands for real-time interaction. This is especially true for frequently asked questions, as repeated searches of the massive knowledge base further exacerbate response delays, impacting the user experience. Summary of the Invention

[0004] The present invention provides a question retrieval method, device and medium based on a question-answer pair information database, which solves the problem of slow response speed caused by the large amount of knowledge base vector data and low similarity calculation efficiency in the retrieval enhanced question-answering system.

[0005] According to one aspect of the present invention, a question retrieval method based on a question-answer pair information database is provided, the method comprising:

[0006] Obtain user questions and match them against a pre-built question-answer pair database to determine a match. The question-answer pair database includes question-answer pairs, each of which includes a question, a question vector, a cached answer, and an information source.

[0007] Determine whether there is a matching question-answer pair. If so, generate the answer to the target question based on the cached answer in the question-answer pair information database;

[0008] Otherwise, the user question is matched with a pre-built knowledge base to generate an answer to the target question, where the knowledge base includes the vectorized texts.

[0009] Optionally, user questions are matched with a pre-built question-answer pair information library to determine the matching situation, including: vectorizing the user questions to generate question vectors; calculating the first semantic similarity between each question vector and the question vector in the question-answer pair information library, and taking the question vector with the highest first semantic similarity as the target question vector; judging whether the semantic similarity of the target question vector is greater than a preset similarity threshold, and if so, determining that the matching situation is that there is a matching question-answer pair; otherwise, determining that the matching situation is that there is no matching question-answer pair.

[0010] Optionally, the answer to the target question is generated based on the cached answers in the question-answer pair information library, including: taking the question-answer pair corresponding to the target question vector as the target question-answer pair; processing the cached answers in the target question-answer pair through a large model to generate the answer to the target question.

[0011] Optionally, user questions are matched with a pre-built knowledge base to generate answers to target questions, including: vectorizing user questions to generate question vectors; calculating the second semantic similarity between each vectorized text in the knowledge base and the question vector, and taking the vectorized text with the highest second semantic similarity as the target vectorized text; processing the target vectorized text through a large model to generate answers to target questions.

[0012] Optionally, the method also includes: when receiving a question-answer pair update instruction confirmed by the user, obtaining the target information source corresponding to the target vectorized text; forming an updated question-answer pair consisting of the user question, question vector, target question answer and target information source, and adding the updated question-answer pair to the question-answer pair information library.

[0013] Optionally, the knowledge base construction process includes: obtaining each original document, segmenting each original document based on semantic recognition technology to generate each text segment; vectorizing each text segment to generate each vectorized text, and constructing a knowledge base based on each vectorized text.

[0014] Optionally, the method also includes: determining the generation time and information source corresponding to each question and answer pair in the question and answer pair information database; when the generation time exceeds a preset time threshold or the information source changes or a question and answer pair deletion instruction is received, deleting the corresponding question and answer pair.

[0015] According to another aspect of the present invention, an electronic device is provided, comprising:

[0016] at least one processor;

[0017] and a memory communicatively coupled to the at least one processor;

[0018] In which, the memory stores a computer program that can be executed 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 a question retrieval method based on a question-answer pair information database as described in any embodiment of the present invention.

[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement a question retrieval method based on a question-answer pair information database as described in any embodiment of the present invention when executed.

[0020] According to another aspect of the present invention, a computer program product is provided, which includes a computer program. When the computer program is executed by a processor, it implements a question retrieval method based on a question-answer pair information database according to any embodiment of the present invention.

[0021] The technical solution of this embodiment of the present invention uses a pre-search of the information database using questions and answers to quickly locate similar matches to a user's past questions, avoiding the need to directly search the massive knowledge base and reducing computational complexity. For matching questions, cached answers are directly called, eliminating the need to trigger a knowledge base search and large model regeneration process, thus improving system response speed. For new, unmatched questions, a comprehensive search of the knowledge base ensures the accuracy and completeness of the answers, preventing invalid answers due to missing information from the database.

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

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. 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 creative work.

[0024] Figure 1 This is a flowchart of a question retrieval method based on a question-answer pair information database provided according to the first embodiment of the present invention;

[0025] Figure 2 is a flowchart of another question retrieval method based on a question-answer pair information database provided according to the second embodiment of the present invention;

[0026] Figure 3 2 is a schematic diagram of the structure of a question retrieval device based on a question-answer pair information database provided according to a third embodiment of the present invention;

[0027] Figure 4 It is a structural diagram of an electronic device for implementing a question retrieval method based on a question-answer pair information database according to an embodiment of the present invention. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the solutions of the present invention, 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 embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0029] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0030] Example 1

[0031] Figure 1 A flowchart of a question retrieval method based on a question-answer pair information database is provided for the first embodiment of the present invention. This embodiment is applicable to user questioning scenarios. The method can be executed by a question retrieval device based on a question-answer pair information database. The question retrieval device can be implemented in the form of hardware and / or software. The question retrieval device can be configured in a computer controller. Figure 1 As shown, the method includes:

[0032] S110. Obtain user questions, and match the user questions with a pre-built question-answer pair information library to determine a match, wherein the question-answer pair information library includes each question-answer pair, and the question-answer pair includes a question, a question vector, a cached answer, and an information source.

[0033] Among them, the question-answer pair information database is a collection that stores the user's historical question and answer information, and is composed of several question-answer pairs. Each question-answer pair consists of four parts: question, question vector, cached answer, and information source. The question refers to the content of the user's question, and the question vector refers to the semantic vector obtained after processing the user's question through a vectorization model, which is used to capture the semantic features of the question for semantic similarity calculation and retrieval. The cached answer refers to the answer corresponding to the question stored in the question-answer pair information database. When the user's question matches the question in the question-answer pair information database, the answer can be directly called to generate the answer to the target question. The information source refers to the specific document used to indicate the source of the question-answer pair. When a document is deleted or updated, all question-answer pairs under the corresponding information source will be triggered for deletion to ensure the accuracy of the information database.

[0034] Specifically, the controller can receive a natural language question input by the user. During the matching process, the controller uses a vectorization model to convert the user's current question into a question vector. It then calculates the semantic similarity, such as cosine similarity, between this vector and each question vector in the question-answer pair database to find the question-answer pair that is most semantically similar to the user's question and determine a match.

[0035] Optionally, user questions are matched with a pre-built question-answer pair information library to determine the matching situation, including: vectorizing the user questions to generate question vectors; calculating the first semantic similarity between each question vector and the question vector in the question-answer pair information library, and taking the question vector with the highest first semantic similarity as the target question vector; judging whether the semantic similarity of the target question vector is greater than a preset similarity threshold, and if so, determining that the matching situation is that there is a matching question-answer pair; otherwise, determining that the matching situation is that there is no matching question-answer pair.

[0036] Specifically, when a user asks a question, the controller vectorizes the user's question. Using a pre-trained vectorization model, the controller converts the user's natural language question into a corresponding question vector. The controller then calculates the first semantic similarity between each question vector and the current question vector in a pre-built database of question-answer pairs. The higher the similarity, the closer the semantics are. The controller selects the question vector with the highest first semantic similarity as the target question vector and compares the semantic similarity of the target question vector with a preset similarity threshold. The similarity threshold is set based on actual business needs and is used to determine whether a valid match exists. If the similarity of the target question vector exceeds the preset threshold, it indicates that the user's question is semantically close to a historical question in the database, and a matching question-answer pair is determined. If the similarity does not reach the threshold, a matching question-answer pair is determined. Based on this matching, the controller can determine whether the user's question has any matching historical question-answer information based on the database, thereby deciding whether to directly retrieve the cached answer or trigger a knowledge base search.

[0037] S120: Determine whether the matching situation is that there is a matching question-answer pair. If so, execute S130; otherwise, execute S140.

[0038] S130: Generate an answer to the target question based on the cached answers in the question-answer pair information database.

[0039] Specifically, when the controller determines that a question-answer pair matches the user's question, it directly retrieves the corresponding cached answer from the question-answer pair database. Cached answers are previous system responses to similar questions, verified and stored in the database. For example, if the question "What can the big model do?" and its corresponding detailed answer exist in the question-answer pair database, when the user asks a similar question again, the controller can directly return the cached answer to the user as the target question, without having to search the knowledge base again or ask the big model to generate an answer, thus improving response time.

[0040] Optionally, the answer to the target question is generated based on the cached answers in the question-answer pair information library, including: taking the question-answer pair corresponding to the target question vector as the target question-answer pair; processing the cached answers in the target question-answer pair through a large model to generate the answer to the target question.

[0041] Specifically, when the controller determines that there is a matching question-answer pair for the user's question, it will first find the question-answer pair corresponding to the target question vector, that is, the target question-answer pair, which contains the previously stored cached answer. The controller will then hand over the cached answer in the target question-answer pair to the large model for processing. The large model will analyze the cached answer and may adjust, optimize or supplement the answer based on the specific context of the current question to make the answer more in line with the user's current question needs, and finally generate the answer to the target question. For example, if the user has previously asked "What can the large model do", the system has stored the corresponding cached answer. When the user asks a similar question again, the large model will process the cached answer based on possible subtle semantic differences and generate a more accurate answer to return to the user. This can not only use historical data to improve response speed, but also ensure the adaptability of the answer through the processing of the large model.

[0042] S140 . Match the user question with a pre-built knowledge base to generate an answer to a target question, wherein the knowledge base includes various vectorized texts.

[0043] The knowledge base is a collection of documents that have been collected, segmented, and vectorized. The knowledge base contains vectorized text and is used to provide context for the large model to generate answers when there is no match in the question-answer database.

[0044] Specifically, when no matching question-answer pair is found in the Q&A database, the controller uses the pre-built knowledge base for search and matching. It first vectorizes the user's question, then searches the knowledge base for relevant knowledge fragments based on vector similarity. These fragments are then sent to the big model, which uses the knowledge fragments to understand and reason, generating an answer to the user's question and ultimately returning it to the user as the target answer. For example, if a user asks a completely new technical question that isn't recorded in the Q&A database, the controller will search the knowledge base for relevant technical information and have the big model generate an answer based on this information.

[0045] Optionally, the knowledge base construction process includes: obtaining each original document, segmenting each original document based on semantic recognition technology to generate each text segment; vectorizing each text segment to generate each vectorized text, and constructing a knowledge base based on each vectorized text.

[0046] The knowledge base construction process begins with acquiring various original documents, which may include company business documents, regulatory documents, and other types of materials. The controller then segments the original documents based on semantic recognition technology. This technology analyzes the semantic structure of the document content and breaks down the complete document into independent text fragments that express specific information or concepts. Semantic coherence must be ensured during the segmentation process to avoid splitting a complete semantic unit into different fragments. After segmentation, the controller vectorizes each text fragment. Specifically, a vectorization model can be used to encode the text fragments and convert them into vectors that capture semantic features, namely vectorized text. The vectorized text contains the text's semantic information and can be used for subsequent retrieval and similarity calculations. Finally, the controller integrates all vectorized texts to form a knowledge base, providing data support for retrieval enhancement in the question-answering system.

[0047] Optionally, the method also includes: determining the generation time and information source corresponding to each question and answer pair in the question and answer pair information database; when the generation time exceeds a preset time threshold or the information source changes or a question and answer pair deletion instruction is received, deleting the corresponding question and answer pair.

[0048] The generation time is the specific time when the question-answer pair was added to the information database, and the information source refers to the original document corresponding to the question-answer pair. The controller will delete the corresponding question-answer pair in the following situations: First, if the generation time of a question-answer pair exceeds the preset time threshold (for example, the preset threshold is 3 months), and the generation time of a question-answer pair has exceeded 3 months, it means that it may be outdated and will be automatically deleted; Second, if the information source of the question-answer pair changes, such as the corresponding original document is deleted or updated, then all question-answer pairs under this information source need to be deleted to ensure that the content in the information database is consistent with the original document; Third, when the controller receives a question-answer pair deletion instruction, such as when a user finds that the answer to a question-answer pair is inaccurate and manually clicks the delete button, the controller will remove the corresponding question-answer pair from the information database. Through this deletion mechanism, the content of the question-answer pair information database can be guaranteed to remain concise and accurate, preventing outdated or erroneous information from affecting the response quality of the system.

[0049] The technical solution of this embodiment of the present invention uses a pre-search of the information database using questions and answers to quickly locate similar matches to a user's past questions, avoiding the need to directly search the massive knowledge base and reducing computational complexity. For matching questions, cached answers are directly called, eliminating the need to trigger a knowledge base search and large model regeneration process, thus improving system response speed. For new, unmatched questions, a comprehensive search of the knowledge base ensures the accuracy and completeness of the answers, preventing invalid answers due to missing information from the database.

[0050] Example 2

[0051] Figure 2 This is a flowchart of a question retrieval method based on a question-answer pair information base provided in the second embodiment of the present invention. This embodiment adds a specific process of matching the user's question with a pre-built knowledge base to generate the answer to the target question on the basis of the above-mentioned first embodiment. Among them, the specific content of steps S250-S260 is roughly the same as that of steps S120-S130 in the first embodiment, so they will not be repeated in this embodiment. Figure 2 As shown, the method includes:

[0052] S210. Obtain user questions, and match the user questions with a pre-built question-answer pair information library to determine a match, wherein the question-answer pair information library includes each question-answer pair, and the question-answer pair includes a question, a question vector, a cached answer, and an information source.

[0053] Optionally, user questions are matched with a pre-built question-answer pair information library to determine the matching situation, including: vectorizing the user questions to generate question vectors; calculating the first semantic similarity between each question vector and the question vector in the question-answer pair information library, and taking the question vector with the highest first semantic similarity as the target question vector; judging whether the semantic similarity of the target question vector is greater than a preset similarity threshold, and if so, determining that the matching situation is that there is a matching question-answer pair; otherwise, determining that the matching situation is that there is no matching question-answer pair.

[0054] S220: Determine whether the matching situation is that there is a matching question-answer pair. If so, execute S230; otherwise, execute S240-S260.

[0055] S230: Generate an answer to the target question based on the cached answers in the question-answer pair information database.

[0056] Optionally, the answer to the target question is generated based on the cached answers in the question-answer pair information library, including: taking the question-answer pair corresponding to the target question vector as the target question-answer pair; processing the cached answers in the target question-answer pair through a large model to generate the answer to the target question.

[0057] S240: Vectorize the user's question to generate a question vector.

[0058] Specifically, the vectorization process of user questions relies on semantic representation technology in natural language processing. By encoding the user's natural language question, the text is converted into a dense numerical vector, namely the question vector. It should be noted that vector representation is not a simple word frequency statistics, but rather captures the contextual semantic associations of words through model learning. For example, for a user question such as "How can a large model optimize retrieval efficiency?", each dimension of the vector after vectorization will reflect the distribution of semantic features such as "large model," "retrieval efficiency," and "optimization method," allowing the computer to understand the semantic connotation of the question at a numerical level.

[0059] S250: Calculate the second semantic similarity between each vectorized text in the knowledge base and the question vector, and use the vectorized text with the highest second semantic similarity as the target vectorized text.

[0060] Specifically, during the knowledge base matching phase, the controller will traverse all vectorized texts in the knowledge base and calculate the second semantic similarity between each vectorized text and the question vector. Taking the cosine similarity algorithm as an example, by calculating the cosine value of the angle between two vectors, the value range is between [-1,1]. The closer the value is to 1, the more similar the semantics are. For example, assuming that there is a vectorized text in the knowledge base corresponding to "The large model optimizes retrieval efficiency through retrieval enhancement technology", the cosine similarity between its vector and the question vector is 0.92, and the similarities of other texts are all lower than this value, then the text will be determined as the target vectorized text. The essence of the retrieval and matching process based on semantic similarity is to find the knowledge fragment closest to the user's question in the high-dimensional semantic space. Compared with directly retrieving text strings, semantic vector matching can more accurately capture synonyms, antonyms and semantic equivalence.

[0061] S260. Process the target vectorized text through the large model to generate the answer to the target question.

[0062] Specifically, the large model's processing of the target vectorized text involves the generative model's reasoning mechanism. The large model uses the knowledge fragment corresponding to the target vectorized text as contextual input. Combining its pre-trained language understanding capabilities, it analyzes the user's question intent and contextual logic to generate a natural language answer. For example, if the target vectorized text describes the specific steps of retrieval enhancement techniques, the large model will combine the target vectorized text content with the user's question, "How to optimize retrieval efficiency?" to generate a structured answer, such as, "Using retrieval enhancement techniques, the large model first vectorizes the question and retrieves relevant knowledge fragments from the knowledge base, then integrates these into answer generation, thereby improving retrieval efficiency, accuracy, and responsiveness." During this process, the large model not only conveys the information of the knowledge fragment but also reorganizes, interprets, and expands this information based on the question context to ensure the coherence and readability of the answer.

[0063] In addition, the construction logic of the knowledge base is closely related to the matching process: after the original document is semantically segmented and vectorized, the vectorized text library formed provides a semantic indexing basis for retrieval, and the mechanism of triggering knowledge base retrieval when the question and answer do not match the information database realizes a layered strategy of cache priority and knowledge base backup. It not only uses historical questions and answers to improve efficiency, but also ensures the accuracy of answers to cold start questions or new questions through the knowledge base, ultimately achieving a balance between response speed and answer correctness.

[0064] Optionally, the method also includes: when receiving a question-answer pair update instruction confirmed by the user, obtaining the target information source corresponding to the target vectorized text; forming an updated question-answer pair consisting of the user question, question vector, target question answer and target information source, and adding the updated question-answer pair to the question-answer pair information library.

[0065] Specifically, when the controller receives the question-answer pair update instruction confirmed by the user, it will obtain the target information source corresponding to the target vectorized text. The information source indicates the original document source of the relevant knowledge fragment. Then, the controller will form a new updated question-answer pair with the user's current question, the question vector generated by vectorization processing, the target question answer obtained after processing the target vectorized text by the large model, and the target information source just obtained. Finally, this updated question-answer pair is added to the question-answer pair information library. Through the question-answer pair update instruction, the question-answer pair information library can continuously supplement new question and answer data. As the user's use gradually becomes richer, when encountering similar questions in the future, the controller can directly retrieve matches from the information library to improve response efficiency. At the same time, it ensures that the content in the information library remains associated with the knowledge source of the knowledge base, ensuring the accuracy and traceability of the data.

[0066] Furthermore, the controller can leverage newly added question-answer pairs and knowledge base updates to incrementally fine-tune the vectorization model and optimize the document segmentation algorithm. For example, when a large number of new question-answer pairs in a technical field are added, the controller uses this data to fine-tune the vectorization model to better adapt it to the semantic representation of domain terms. The vectorization models and segmentation strategies of traditional search enhancement systems are typically trained offline and cannot evolve with data updates. This incremental learning mechanism enables the system to continuously learn, automatically improving the accuracy of semantic representation and segmentation as users use it and data accumulates.

[0067] Optionally, the knowledge base construction process includes: obtaining each original document, segmenting each original document based on semantic recognition technology to generate each text segment; vectorizing each text segment to generate each vectorized text, and constructing a knowledge base based on each vectorized text.

[0068] Optionally, the method also includes: determining the generation time and information source corresponding to each question and answer pair in the question and answer pair information database; when the generation time exceeds a preset time threshold or the information source changes or a question and answer pair deletion instruction is received, deleting the corresponding question and answer pair.

[0069] The technical solution of the embodiment of the present invention converts natural language questions into computer-computable semantic vectors, providing a numerical basis for subsequent semantic retrieval of the knowledge base, enabling the system to capture the deep semantic features of the question. Through semantic similarity calculation, the knowledge fragments closest to the semantics of the user's question are accurately located from the knowledge base, ensuring the relevance of the retrieval results and providing accurate contextual information for the large model to generate answers. Through the language understanding and generation capabilities of the large model, the retrieved knowledge fragments are integrated, inferred, and converted into natural language to generate answers that meet the user's question intent, ensuring the accuracy and readability of the answers.

[0070] Example 3

[0071] Figure 3 This is a structural diagram of a question retrieval device based on a question-answer pair information database provided by the third embodiment of the present invention. Figure 3 As shown, the apparatus includes: a matching determination module 310, configured to obtain a user question and match the user question with a pre-built question-answer pair information library to determine a matching situation, wherein the question-answer pair information library includes each question-answer pair, and the question-answer pair includes a question, a question vector, a cached answer, and an information source;

[0072] The question-answer information database matching module 320 is used to determine whether a matching question-answer pair exists, and if so, to generate an answer to the target question based on the cached answers in the question-answer pair information database;

[0073] The target question answer determination module 330 matches the user question with a pre-built knowledge base to generate an answer to the target question, wherein the knowledge base includes various vectorized texts.

[0074] Optionally, the matching situation determination module 310 is specifically used to: vectorize the user's question to generate a question vector; calculate the first semantic similarity between each question vector and the question vector in the question-answer pair information library, and take the question vector with the highest first semantic similarity as the target question vector; determine whether the semantic similarity of the target question vector is greater than a preset similarity threshold, and if so, determine that the matching situation is that there is a matching question-answer pair; otherwise, determine that the matching situation is that there is no matching question-answer pair.

[0075] Optionally, the question and answer information library matching module 320 is specifically used to: take the question and answer pair corresponding to the target question vector as the target question and answer pair; and process the cached answers in the target question and answer pair through the large model to generate the answer to the target question.

[0076] Optionally, the target question answer determination module 330 is specifically used to: vectorize the user's question to generate a question vector; calculate the second semantic similarity between each vectorized text and the question vector in the knowledge base, and use the vectorized text with the highest second semantic similarity as the target vectorized text; process the target vectorized text through a large model to generate an answer to the target question.

[0077] Optionally, the device also includes: a question-answer pair adding module, which is used to: when receiving a question-answer pair update instruction confirmed by the user, obtain the target information source corresponding to the target vectorized text; combine the user question, question vector, target question answer and target information source into an updated question-answer pair, and add the updated question-answer pair to the question-answer pair information library.

[0078] Optionally, the device also includes: a knowledge base construction module, which is used to: obtain each original document, segment each original document based on semantic recognition technology to generate each text segment; vectorize each text segment to generate each vectorized text, and construct a knowledge base based on each vectorized text.

[0079] Optionally, the device also includes: a question-and-answer pair deletion module, which is used to: determine the generation time and information source corresponding to each question-and-answer pair in the question-and-answer pair information database; when the generation time exceeds a preset time threshold or the information source changes or a question-and-answer pair deletion instruction is received, the corresponding question-and-answer pair will be deleted.

[0080] The technical solution of this embodiment of the present invention uses a pre-search of the information database using questions and answers to quickly locate similar matches to a user's past questions, avoiding the need to directly search the massive knowledge base and reducing computational complexity. For matching questions, cached answers are directly called, eliminating the need to trigger a knowledge base search and large model regeneration process, thus improving system response speed. For new, unmatched questions, a comprehensive search of the knowledge base ensures the accuracy and completeness of the answers, preventing invalid answers due to missing information from the database.

[0081] A question retrieval device based on a question-answer pair information database provided by an embodiment of the present invention can execute a question retrieval method based on a question-answer pair information database provided by any embodiment of the present invention, and has functional modules and beneficial effects corresponding to the execution method.

[0082] Example 4

[0083] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as 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 personal digital assistants, 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 examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0084] like Figure 4As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform 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. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0085] 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 magnetic disk, an optical disk, 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.

[0086] The processor 11 can be any general-purpose and / or specialized processing component 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 specialized 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 a question retrieval method based on a question-answer pair information database.

[0087] In some embodiments, a question retrieval method based on a question-answer pair information base may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on 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 question retrieval method based on a question-answer pair information base described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute a question retrieval method based on a question-answer pair information base in any other appropriate manner (for example, by means of firmware).

[0088] Various embodiments of the systems and techniques described 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-chip systems (SOCs), 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 that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0089] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0090] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0091] 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 pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types 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).

[0092] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0093] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem, addressing the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0094] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed 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. This is not limited herein.

[0095] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A question retrieval method based on a question-answer pair information database, characterized in that: include: Obtaining a user question and matching the user question with a pre-built question-answer pair information library to determine a match, wherein the question-answer pair information library includes question-answer pairs, each of which includes a question, a question vector, a cached answer, and an information source; Determine whether the matching situation is that there is a matching question-answer pair, and if so, generate an answer to the target question based on the cached answer in the question-answer pair information library; Otherwise, the user question is matched with a pre-built knowledge base to generate an answer to the target question, wherein the knowledge base includes various vectorized texts.

2. The method according to claim 1, characterized in that The matching of the user's question with the pre-built question-answer pair information database to determine a matching situation includes: Vectorizing the user question to generate a question vector; Calculating the first semantic similarity between each question vector in the question-answer pair information database and the question vector, and taking the question vector with the highest first semantic similarity as the target question vector; Determine whether the semantic similarity of the target question vector is greater than a preset similarity threshold, and if so, determine that a matching question-answer pair exists; Otherwise, it is determined that there is no matching question-answer pair.

3. The method according to claim 2, characterized in that Generating the target question answer based on the cached answers in the question-answer pair information database includes: Taking the question-answer pair corresponding to the target question vector as the target question-answer pair; The cached answers in the target question-answer pair are processed by the large model to generate an answer to the target question.

4. The method according to claim 1, wherein The user's question is matched with the pre-built knowledge base to generate the target question answer, including: Vectorizing the user question to generate a question vector; Calculating a second semantic similarity between each vectorized text in the knowledge base and the question vector, and taking the vectorized text with the highest second semantic similarity as the target vectorized text; The target vectorized text is processed by a large model to generate an answer to the target question.

5. The method according to claim 4, characterized in that The method further comprises: When receiving a question-answer pair update instruction confirmed by the user, obtaining a target information source corresponding to the target vectorized text; The user question, the question vector, the target question answer and the target information source are combined into an updated question-answer pair, and the updated question-answer pair is added to the question-answer pair information library.

6. The method according to claim 1, wherein The process of building the knowledge base includes: Obtaining each original document, and segmenting each original document based on semantic recognition technology to generate text segments; Vectorization processing is performed on each of the text segments to generate each vectorized text, and the knowledge base is constructed based on each of the vectorized texts.

7. The method according to claim 1, characterized in that The method further comprises: Determine the generation time and information source corresponding to each question and answer pair in the question and answer pair information database; When the generation time exceeds a preset time threshold, or the information source changes, or a question-answer pair deletion instruction is received, the corresponding question-answer pair will be deleted.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.

9. A computer storage medium, characterized in that The computer storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method according to any one of claims 1 to 7 when executed.

10. A computer program product, characterized in that The computer program product comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Answer retrieval method and device, equipment, storage medium and product

    CN121388094A

  • Retrieval method, device and equipment based on large model, medium and product

    CN121705395A