A retrieval-enhanced question-answering method and system combining historical data

By using historical data to fine-tune the text representation model and enhance the data in the intelligent question answering system, the problem of the system's insufficient understanding of user questions is solved and a more accurate and efficient question and answer effect is achieved.

CN118467706BActive Publication Date: 2024-10-22NANJING SKYTECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410917630.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-10
Publication Date
2024-10-22
Estimated Expiration
2044-07-10

AI Technical Summary

Technical Problem

The existing intelligent question and answer system fails to effectively utilize historical data after use, resulting in insufficient understanding of user questions and poor question and answer results.

Method used

By fine-tuning the pre-trained text representation model, using user questioning methods and language patterns in historical data, we build an expanded question library to enhance the data diversity of the Q&A system, and optimize the enhancement effect of historical data through text enhancement instructions to improve the Q&A system's Ability to understand user problems.

Benefits of technology

It significantly improves the Q&A system's ability to understand user questions and the accuracy of Q&A results, and improves the system's Q&A effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118467706B_ABST
    Figure CN118467706B_ABST
Patent Text Reader

Abstract

The present application provides a retrieval-enhanced question-answering method and system in combination with historical data, which relates to the field of artificial intelligence technology. Considering that the historical data obtained after the system is put into use contains a large amount of information such as the user's questioning methods and language patterns, the present application injects the knowledge in the historical data into the question text representation model through fine-tuning, so that the question-answering system can learn the language characteristics of the user's questioning process, thereby improving the question-answering system's ability to understand user questions. Furthermore, historical data is enhanced based on text enhancement instructions and large models to increase data diversity. And, the enhancement effect of historical data is further improved by optimizing text enhancement instructions. The present application enhances the question-answering system's understanding of user questions and improves the accuracy of question-answering results by reflowing and effectively utilizing historical data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a retrieval-enhanced question-answering method and system combining historical data. Background Art

[0002] As an important part of the human-computer interaction field, intelligent question-answering uses natural language processing and artificial intelligence technology to understand user questions through computers, thereby providing accurate and effective knowledge services. With the continuous advancement of science and technology, intelligent question-answering systems have played a significant role in improving the efficiency of knowledge acquisition and reducing manual labor. Therefore, the degree to which the question-answering system understands user questions directly affects the effectiveness of intelligent question-answering.

[0003] Retrieval-based question answering is a question answering method based on information retrieval. It can quickly and accurately obtain the required information by indexing and matching large amounts of text data. It is widely used in scenarios such as product consulting services and business knowledge training. Typical retrieval-based question answering extracts keywords or elements from questions and uses knowledge bases to query to obtain knowledge related to the keywords or elements. This type of method relies on the acquisition effect of keywords or elements in the question, and the adaptability of the question answering process is poor. Therefore, it is gradually replaced by retrieval-based question answering methods based on deep learning semantics.

[0004] Deep learning methods use neural network models to automatically extract the correlation features between questions and answers by learning the semantic information in the data, or use the semantic similarity between the query questions and similar questions in the knowledge base to give answers to the query questions. The construction of these models usually uses pre-constructed question and answer data to train the models, and the construction process focuses on the training and testing phases of the models. However, after the model is released, the model will generate a large amount of interactive data when it is used, and this data is usually not well utilized. However, the query questions in the actual question and answer process can usually reflect information such as the user's questioning method and language pattern, so historical question and answer data is of great value in improving the model's ability to understand user questions.

[0005] A text representation model is a model used to convert text data into a mathematical representation that can be understood and processed by computers. This mathematical representation is usually in the form of a vector or matrix, which can capture the semantic and structural information in the text. The text representation model learns from a large amount of text data through supervised learning or unsupervised learning, so that similar texts are close in the representation space. Therefore, the text representation model is used in tasks such as text retrieval and classification.

[0006] To sum up, how to utilize the historical data generated by the question-answering system after it is put into use and learn from the user's question-asking methods and language patterns is an effective way to improve the question-answering effect of the question-answering system. Summary of the invention

[0007] The present application provides a retrieval-enhanced question-answering method and system in combination with historical data. Considering that the historical data obtained after the system is put into use contains a large amount of information such as the user's questioning methods and language patterns, the present application injects the knowledge in the historical data into the question text representation model through fine-tuning, so that the question-answering system can learn the language characteristics of the user's questioning process, thereby improving the question-answering system's ability to understand user questions. Furthermore, historical data is enhanced based on text enhancement instructions and large models to increase data diversity. And, the enhancement effect of historical data is further improved by optimizing text enhancement instructions. The present application enhances the question-answering system's understanding of user questions and improves the accuracy of question-answering results by reflowing and effectively utilizing historical data.

[0008] In a first aspect, the present application provides a retrieval enhanced question answering method combined with historical data, which is applied to a retrieval enhanced question answering system combined with historical data, and the method comprises:

[0009] Obtain historical data, which includes questions and corresponding answers accumulated by the system during the historical question-and-answer process;

[0010] Constructing a question-and-answer database and a first question database. The question-and-answer database includes question-and-answer pairs consisting of questions in historical data and corresponding answers. The first question database includes question pairs consisting of standard questions and non-standard questions with similar semantics to the standard questions. The standard questions and the corresponding non-standard questions have the same answers and are all questions in historical data.

[0011] Using the first language model to perform data augmentation on non-standard questions in the first question library, to obtain expanded questions with similar semantics to the non-standard questions;

[0012] Using any expanded questions to update the first question library to obtain a second question library;

[0013] Using the question pairs in the second question library to fine-tune the pre-trained representation model to obtain a question text representation model, where the question text representation model is used to encode the input text;

[0014] Using the question text representation model, we can obtain the vector representation of the target question and the vector representation of any standard question.

[0015] According to the similarity between the vector representation of the target problem and the vector representation of any standard problem, determine the standard problem with the highest similarity to the target problem;

[0016] Determine the target answer corresponding to the standard question with the highest similarity from the question and answer database.

[0017] In a feasible design, data augmentation includes the following steps:

[0018] Determine text enhancement instructions;

[0019] Fill the text enhancement prompt word template with text enhancement instructions and non-standard questions to obtain text enhancement prompt words;

[0020] The text enhancement prompt word is input into the first language model to obtain an expanded question output by the first language model that is semantically similar to the non-standard question.

[0021] In a feasible design, determining the text enhancement instruction includes the following steps:

[0022] Obtaining an initial text enhancement instruction, and evaluating the text enhancement instruction using any question in an evaluation data set to obtain a score of the initial text enhancement instruction, wherein the evaluation data set is constructed by a portion of questions in the first question bank;

[0023] Using the initial text enhancement instruction and the corresponding score to fill in the optimized text enhancement instruction prompt word template to obtain the optimized text enhancement instruction prompt word;

[0024] Inputting the optimized text enhancement instruction prompt words into the second largest language model to obtain the intermediate text enhancement instruction;

[0025] Use any questions in the evaluation dataset to evaluate the text enhancement instructions and get the scores of the intermediate text enhancement instructions;

[0026] Use the intermediate text enhancement instructions and the corresponding scores to continue filling in the optimized text enhancement instruction prompt word template to obtain a new optimized text enhancement instruction prompt word;

[0027] If the number of text enhancement instructions included in the new optimized text enhancement instruction prompt is greater than the preset number, deleting the instructions to be deleted and the corresponding scores in the new optimized text enhancement instruction prompt, the instructions to be deleted are the text enhancement instructions with the lowest scores;

[0028] If the number of text enhancement instructions included in the new optimized text enhancement instruction prompt word is less than or equal to the preset number, or after deleting the to-be-deleted instructions and the corresponding scores in the new optimized text enhancement instruction prompt word, input the new optimized text enhancement instruction prompt word into the second largest language model to obtain a new intermediate text enhancement instruction;

[0029] The text enhancement instruction is evaluated again using any question in the evaluation data set to obtain the score of the new intermediate text enhancement instruction, until the number of times the second largest language model is used to iterate the intermediate text enhancement instruction is equal to the preset number of optimizations, and the text enhancement instruction with the highest score is determined as the final text enhancement instruction.

[0030] In a feasible design, the text augmentation instructions are evaluated using any questions in the evaluation dataset, including the following steps:

[0031] Use the text enhancement instructions and any questions in the evaluation dataset to fill in the text enhancement prompt word template to obtain the text enhancement prompt word corresponding to any question;

[0032] Inputting the text enhancement prompt words corresponding to any question into the first language model, the first language model generates and outputs each expanded question corresponding to the arbitrary question according to the arbitrary question;

[0033] The score of the text enhancement instruction is determined according to the difference scores between the expanded questions corresponding to any question, and the difference scores are used to evaluate the degree of difference between the expanded questions.

[0034] In a feasible design, the score of the text enhancement instruction is determined according to the difference scores between the expanded questions corresponding to any question, including:

[0035] Based on the N-gram model, the text of any extended question corresponding to any question is segmented to obtain a segmentation set consisting of the segmentations of any extended question;

[0036] Determine the difference scores between the expanded questions corresponding to any question according to the number of the segmentation set of any expanded question;

[0037] The mean of the difference scores corresponding to the questions in the evaluation dataset is determined as the score of the text enhancement instruction.

[0038] In a feasible design, according to the similarity between the vector representation of the target problem and the vector representation of any standard problem, the standard problem with the highest similarity to the target problem is determined, including:

[0039] Obtain a cosine similarity calculation model, where the cosine similarity calculation model is used to calculate the cosine similarity between multiple input vector representations;

[0040] Use the cosine similarity calculation model to determine the cosine similarity between the vector representation of the target problem and the vector representation of any standard problem;

[0041] Based on the cosine similarity between the vector representation of the target problem and the vector representation of any standard problem, the standard problem with the highest similarity to the target problem is determined.

[0042] In a feasible design, based on the cosine similarity between the vector representation of the target problem and the vector representation of any standard problem, the standard problem with the highest similarity to the target problem is determined, including:

[0043] According to the cosine similarity between the vector representation of the target problem and the vector representation of any standard problem, any standard problem is sorted in descending order according to the similarity value;

[0044] The standard question that is ranked first in the order is determined as the standard question that has the highest similarity to the target question.

[0045] In a second aspect, the present application provides a retrieval enhanced question answering system combined with historical data, comprising:

[0046] A historical data acquisition module is used to acquire historical data, which includes questions and corresponding answers accumulated by the system in the historical question-answering process;

[0047] A data construction module is used to construct a question-answer library and a first question library, wherein the question-answer library includes question-answer pairs consisting of questions in historical data and corresponding answers, and the first question library includes question pairs consisting of standard questions and non-standard questions with similar semantics to the standard questions, wherein the standard questions and corresponding non-standard questions have the same answers and are all questions in historical data;

[0048] A data enhancement module, used to perform data enhancement on non-standard questions in the first question library using the first language model to obtain expanded questions with similar semantics to the non-standard questions;

[0049] The data enhancement module is also used to update the first question library using any expanded questions to obtain a second question library;

[0050] A model training module, used to fine-tune the pre-trained representation model using the question pairs in the second question library to obtain a question text representation model, and the question text representation model is used to encode the input text;

[0051] A question representation acquisition module is used to obtain the vector representation of the target question and the vector representation of any standard question using the question text representation model;

[0052] A standard question selection module, for determining the standard question with the highest similarity to the target question based on the similarity between the vector representation of the target question and the vector representation of any standard question;

[0053] The answer acquisition module is used to determine the target answer corresponding to the standard question with the highest similarity from the question and answer database.

[0054] Considering that the questions in the historical data obtained after the system is put into use contain a large amount of information such as the questioning methods and language patterns of users, the embodiment of the present application uses the questions in the historical data to construct a first question library, and the first question library includes a question pair consisting of a standard question and a non-standard question with similar semantics to the standard question, wherein the standard question and the corresponding non-standard question have the same answer. Then, the non-standard questions in the first question library are rewritten and expanded using the first large language model to obtain the expanded questions corresponding to the non-standard questions, and the expanded questions are made similar in semantics to the non-standard questions, thereby realizing data enhancement of the data in the first question library and increasing the diversity of the data in the first question library. The pre-trained representation model is fine-tuned using the first question library (i.e., the second question library) after data enhancement, and the obtained question text representation model can learn the language features in the user's questioning process. Therefore, the question-answering system based on the question text representation model has improved its ability to understand user questions, thereby improving the question-answering effect of the question-answering system. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0056] Figure 1 is a schematic flow chart of a retrieval enhanced question-answering method combined with historical data provided by an exemplary embodiment of the present application;

[0057] Figure 2 is a schematic flow chart of an example of evaluating a text enhancement instruction provided by an exemplary embodiment of the present application;

[0058] Figure 3 is a schematic flow chart of an example of optimizing text enhancement instructions provided by an exemplary embodiment of the present application;

[0059] Figure 4 It is a schematic diagram of a retrieval enhanced question-answering system combined with historical data provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0060] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0061] The present application provides a retrieval enhanced question-answering method combined with historical data, which is applied to a retrieval enhanced question-answering system combined with historical data. The method rewrites and expands a large amount of historical data containing information such as the user's questioning method and language pattern, and uses the enhanced historical data to fine-tune the pre-trained representation model to obtain a question text representation model. The question text representation model can learn the language features of the user's questioning process, thereby improving the question-answering system's ability to understand the user's questions and improving the accuracy of the question-answering results.

[0062] Figure 1 : is a schematic flow chart of a method for enhancing question answering by searching historical data provided by an exemplary embodiment of the present application, the method comprising:

[0063] S110, obtaining historical data.

[0064] Among them, historical data includes questions and corresponding answers accumulated by the system in the historical question-answering process. A large amount of historical data contains information such as user questioning methods and language patterns, which can enhance the ability of the question text representation model to understand user questions.

[0065] S120, constructing a question and answer database and a first question database.

[0066] Among them, the question and answer database includes question and answer pairs consisting of questions in historical data and corresponding answers. The first question database includes question pairs consisting of standard questions and non-standard questions with similar semantics to the standard questions. The answers corresponding to the standard questions and the corresponding non-standard questions are the same and are all questions in historical data.

[0067] The standard and non-standard questions used to construct question pairs can be understood as follows:

[0068] A standard question is a standard way of asking a question, usually based on the habits of most people. For example:

[0069] ‘What’s your name?’ It’s a standard question;

[0070] "What's your name?" and "What's your last name?" are both non-standard questions corresponding to the above standard questions.

[0071] Another example:

[0072] Standard question: "Can a foreign trade enterprise get a tax refund if it obtains a general invoice issued by a supplier?"

[0073] Non-standard question: "I am a foreign trade company. I received a general invoice from the other party. Can I apply for a tax refund?"

[0074] It can be seen that the semantics of the standard questions and the corresponding non-standard questions are similar, and the corresponding answers are the same.

[0075] Since historical data contains a large amount of information such as users' question-asking methods and language patterns, this application uses historical data to fine-tune the pre-trained representation model. The resulting question text representation model can learn the language features of the user's question-asking process and can improve the question-answering system's ability to understand user questions.

[0076] S130, using the first language model to perform data enhancement on the non-standard questions in the first question library to obtain expanded questions with similar semantics to the non-standard questions.

[0077] Exemplarily, the first largest language model expands the non-standard questions by L times, that is, the expanded non-standard questions correspond to L expanded questions.

[0078] Exemplarily, the first language model is the ChatGPT model.

[0079] For example:

[0080] The first language model obtained 10 expanded questions based on the non-standard question "Do foreign trade companies have the qualifications for tax refunds when they receive ordinary invoices issued by the other party?" as follows:

[0081] Expanded question 1: "Can a foreign trade enterprise apply for a tax refund when the other party issues a general invoice?" ......

[0083] Expanded question 10: "Can I, as a foreign trade enterprise, apply for a tax refund for a general invoice issued by the other party?"

[0084] Using the first language model can efficiently rewrite and expand non-standard questions while ensuring semantic similarity, which can increase data diversity. Semantic similarity with non-standard questions can ensure that the expanded question corresponds to the same standard question as the non-standard question.

[0085] In one possible design, data augmentation is achieved in the following way:

[0086] S131, determining a text enhancement instruction.

[0087] S132, using the text enhancement instruction and the non-standard question to fill in the text enhancement prompt word template to obtain the text enhancement prompt word;

[0088] S133, inputting text enhancement prompt words into the first language model to obtain an expanded question output by the first language model that is semantically similar to the non-standard question.

[0089] Exemplarily, the text enhancement instruction includes content for specifying the requirements for the output text, such as the format of the output text, the amount of the output text, etc., which are generated by the first language model to process the input text to generate semantically similar output text.

[0090] For example, (1) taking the value of the number of output texts as 10 (i.e. L=10), the determined text enhancement instruction temp_ins is:

[0091] "I need you to replace synonyms, adjust sentence structure, add and delete details in the following text to generate 10 different texts. Please ensure that the generated texts are natural, appropriate, fluent, and grammatical."

[0092] The template for text enhancement prompt words is:

[0093] Hint: We hope you can generate the result according to the requirements of <input> for the text.

[0094] <command>: {temp_ins}

[0095] <input>: {INPUT}

[0096] <output>:

[0097] The final output format must be in json format: {{"output result": []}}.

[0098] Among them, INPUT is used to refer to non-standard questions, and temp_ins is used to refer to text enhancement instructions.

[0099] (2) Fill the text of the text enhancement instruction represented by temp_ins and the text of the non-standard question represented by INPUT into the text enhancement prompt word template, and the resulting text enhancement prompt word is:

[0100] Hint: We hope you can generate the result according to the requirements of <input> for the text.

[0101] <Instructions>: {"I need you to replace synonyms, adjust sentence structure, add and delete details in the following text to generate 10 different texts. Please ensure that the generated text is natural, appropriate, fluent, and conforms to grammatical rules."}

[0102] <Input>: {“I am a foreign trade company. I received a general invoice from the other party. Can I apply for a tax refund?”}

[0103] <output>:

[0104] The final output format must be in json format: {{"output result": []}}.

[0105] In the above example, the first language model can process the input text according to the content of the text enhancement prompt word to obtain the output text that meets the requirements of the text enhancement instruction. In addition, using the text enhancement prompt word template, it is possible to expand different non-standard questions by filling in different non-standard questions.

[0106] In a feasible design, the text enhancement instruction is determined by the following steps:

[0107] S1311, obtaining an initial text enhancement instruction, and evaluating the text enhancement instruction using any question in an evaluation data set to obtain a score of the initial text enhancement instruction, where the evaluation data set is constructed from some questions in a first question bank;

[0108] S1312, using the initial text enhancement instruction and the corresponding score to fill in the optimized text enhancement instruction prompt word template to obtain the optimized text enhancement instruction prompt word;

[0109] S1313, inputting the optimized text enhancement instruction prompt word into the second largest language model to obtain an intermediate text enhancement instruction;

[0110] S1314, using any question in the evaluation data set to evaluate the text enhancement instruction, and obtaining a score of the intermediate text enhancement instruction;

[0111] S1315, using the intermediate text enhancement instruction and the corresponding score to continue filling in the optimized text enhancement instruction prompt word template to obtain a new optimized text enhancement instruction prompt word;

[0112] S1316, if the number of text enhancement instructions included in the new optimized text enhancement instruction prompt is greater than the preset number, deleting the to-be-deleted instructions and the corresponding scores in the new optimized text enhancement instruction prompt, the to-be-deleted instructions being the text enhancement instructions with the lowest scores;

[0113] S1317, if the number of text enhancement instructions included in the new optimized text enhancement instruction prompt word is less than or equal to the preset number, or after deleting the to-be-deleted instructions and the corresponding scores in the new optimized text enhancement instruction prompt word, input the new optimized text enhancement instruction prompt word into the second largest language model to obtain a new intermediate text enhancement instruction;

[0114] S1318, use any question in the evaluation data set to evaluate the text enhancement instruction again to obtain the score of the new intermediate text enhancement instruction, until the number of times the second largest language model is used to iterate the intermediate text enhancement instruction is equal to the preset optimization number, and the text enhancement instruction with the highest score is determined as the final text enhancement instruction.

[0115] The initial text enhancement instruction may be given manually.

[0116] Exemplarily, the preset number is 20.

[0117] Exemplarily, the preset number of optimizations is 60.

[0118] Exemplarily, the second largest language model is the ChatGPT model.

[0119] In the above example, it is considered that a part of the questions in the first question bank can be used to evaluate the text enhancement instruction, so as to determine the enhancement effect of the text enhancement instruction on another part of the questions in the first question bank. The present application selects some questions in the first question bank to construct an evaluation data set, and then uses the evaluation data set to evaluate the initial text enhancement instruction to obtain the score of the initial text enhancement instruction. In order to optimize the text enhancement instruction, the present application uses the initial text enhancement instruction and the corresponding score to fill in the optimized text enhancement instruction prompt word template to obtain the optimized text enhancement instruction prompt word. The optimized text enhancement instruction prompt word is input into the second largest language model to obtain the intermediate text enhancement instruction. The score of the intermediate text enhancement instruction is obtained by evaluating the intermediate text enhancement instruction. The present application continuously obtains new intermediate text enhancement instructions and evaluates them to obtain corresponding scores, thereby determining the text enhancement instruction with the highest score as the final text enhancement instruction, thereby achieving the optimization of the text enhancement instruction.

[0120] Furthermore, in order to prevent the optimized text enhancement instruction prompt from being too long, the number of text enhancement instructions in the optimized text enhancement instruction prompt is controlled by judging whether the number of text enhancement instructions included in the optimized text enhancement instruction prompt is greater than a preset number.

[0121] Further, by judging whether the number of times the second largest language model is used to iteratively obtain the intermediate text enhancement instruction is equal to the preset optimization number, it is determined whether to terminate the process of obtaining the intermediate text enhancement instruction using the second largest language model.

[0122] In a feasible design, the present application considers that the optimization effect of text enhancement instructions can be enhanced by improving the quality of the basic population of text enhancement instructions included in the optimized text enhancement instruction prompt words, wherein the basic population refers to the first X instructions included in the optimized text enhancement instruction prompt words, X = preset number. Therefore, the prompt word optimization method can also be implemented by the following steps:

[0123] S1311a, obtaining an initial text enhancement instruction;

[0124] S1312a, selecting some questions in the first question bank to construct an evaluation data set, and using any question in the evaluation data set to evaluate the text enhancement instruction to obtain an initial score of the text enhancement instruction;

[0125] S1313a, using the initial text enhancement instruction and the corresponding score to fill in the optimized text enhancement instruction prompt word template to obtain the optimized text enhancement instruction prompt word;

[0126] S1314a, inputting the optimized text enhancement instruction prompt words into the second largest language model to obtain an intermediate text enhancement instruction;

[0127] S1315a, using any question in the evaluation data set to evaluate the text enhancement instruction, and obtaining a score of the intermediate text enhancement instruction;

[0128] S1316a, if the score of the intermediate text enhancement instruction does not meet the preset condition, and the number of text enhancement instructions included in the optimized text enhancement instruction prompt words is less than or equal to the preset number, re-input the optimized text enhancement instruction prompt words into the second largest language model to obtain the intermediate text enhancement instruction, and calculate the score of the re-obtained intermediate text enhancement instruction, the preset condition being that the score of the intermediate text enhancement instruction is higher than the score of the existing text enhancement instruction;

[0129] S1317a, if the score of the intermediate text enhancement instruction meets the preset condition, and the number of text enhancement instructions included in the optimized text enhancement instruction prompt word is less than or equal to the preset number, or if the score of the intermediate text enhancement instruction obtained again meets the preset condition, and the number of text enhancement instructions included in the optimized text enhancement instruction prompt word is less than or equal to the preset number, the intermediate text enhancement instruction and the corresponding score are used to continue filling in the optimized text enhancement instruction prompt word template to obtain a new optimized text enhancement instruction prompt word;

[0130] S1318a, if the number of text enhancement instructions included in the new optimized text enhancement instruction prompt is greater than the preset number, deleting the to-be-deleted instructions and the corresponding scores in the new optimized text enhancement instruction prompt, the to-be-deleted instructions being the text enhancement instructions with the lowest scores;

[0131] S1319a, if the number of text enhancement instructions included in the new optimized text enhancement instruction prompt word is less than or equal to the preset number, or after deleting the instructions to be deleted and the corresponding scores in the new optimized text enhancement instruction prompt word, input the new optimized text enhancement instruction prompt word into the second largest language model to obtain a new intermediate text enhancement instruction;

[0132] S1320a, recalculate the score of the new intermediate text enhancement instruction until the number of times the second largest language model is used to iteratively obtain the intermediate text enhancement instruction is equal to the preset optimization number, and then determine the text enhancement instruction with the highest score as the final text enhancement instruction.

[0133] When the number of text enhancement instructions included in the optimized text enhancement instruction prompt words is less than the preset number, it means that the text enhancement instructions included in the optimized text enhancement instruction prompt words have not reached the scale of the basic population. In this case, the above example selects intermediate text enhancement instructions with higher scores than the existing text enhancement instructions in the optimized text enhancement instruction prompt words, and adds them to the optimized text enhancement instruction prompt words. This can ensure that each text enhancement instruction added to the basic population of the optimized text enhancement instruction prompt words is better than the text enhancement instructions added previously, thereby improving the quality of the basic population of the optimized text enhancement instruction prompt words. As the quality of the basic population is improved, the quality of the intermediate text enhancement instructions subsequently obtained by the second largest language model will also be improved accordingly, and therefore, the optimization effect of the final text enhancement instructions can be enhanced.

[0134] In one possible design, the text augmentation instructions are evaluated using any question in the evaluation dataset by following the steps below:

[0135] Use the text enhancement instructions and any questions in the evaluation dataset to fill in the text enhancement prompt word template to obtain the text enhancement prompt word corresponding to any question;

[0136] Inputting the text enhancement prompt words corresponding to any question into the first language model, the first language model generates and outputs each expanded question corresponding to the arbitrary question according to the arbitrary question;

[0137] The score of the text enhancement instruction is determined according to the difference scores between the expanded questions corresponding to any question, and the difference scores are used to evaluate the degree of difference between the expanded questions.

[0138] Among them, the score of text enhancement instructions is positively correlated with the difference score corresponding to any question.

[0139] It should be noted that the text enhancement instruction of the present application may refer to either the initial text enhancement instruction or the intermediate text enhancement instruction. Therefore, the step of evaluating the text enhancement instruction in the above example is applicable to both the initial text enhancement instruction and the intermediate text enhancement instruction.

[0140] It should be understood that the degree of difference in the above example refers to the size of the difference between multiple texts, but in this application, the semantics of the multiple texts are the same. For example, the first group of questions includes: "What is your name", "What is your name"; the second group of questions includes: "What is your name", "What is your surname". It can be clearly seen that the degree of difference between the two question texts in the first group of questions is small, and the degree of difference between the two question texts in the second group of questions is large, but the semantics of each question in each group of questions are similar, and the corresponding answers are the same.

[0141] The difference score is used to evaluate the degree of difference between the expanded questions, and the higher the difference score, that is, the higher the score of the text enhancement instruction, the greater the degree of difference between the expanded questions. The greater the degree of difference between the expanded questions, the better the effect of the first language model in rewriting and expanding non-standard questions according to the text enhancement instruction. That is, the more diverse the expressions between the expanded questions generated by the first language model are made by the text enhancement instruction, the higher the score of the text enhancement instruction will be. Therefore, the above example can evaluate the text enhancement instruction and determine the score of the text enhancement instruction based on the difference scores between the expanded questions corresponding to any question.

[0142] In a feasible design, the score of the text enhancement instruction is determined according to the difference scores between the expanded questions corresponding to any question in the following manner:

[0143] Based on the N-gram model, the text of any extended question corresponding to any question is segmented to obtain a segmentation set consisting of the segmentations of any extended question;

[0144] Determine the difference scores between the expanded questions corresponding to any question according to the number of the segmentation set of any expanded question;

[0145] The mean of the difference scores corresponding to the questions in the evaluation dataset is determined as the score of the text enhancement instruction.

[0146] The basic idea of ​​the N-gram model is to operate the content in the text according to a sliding window of a certain size to form a sequence of word fragments of length N (also represented by n), each of which is called a "gram".

[0147] The following example illustrates the text segmentation of any extended question corresponding to any question based on the N-gram model:

[0148] For example, for the text "I am in a meeting", if N=2, after segmenting the text based on the N-gram model, the segmentation results are: I am, meeting, and the segmentation set formed by these words is [(I am), (meeting), (meeting)].

[0149] For example, taking the value of N in N-gram as 2 and the evaluation data set containing M questions as an example, the difference scores between the expanded questions corresponding to any question are determined by the following formulas (1) and (2):

[0150] The difference score between any two expanded questions corresponding to the kth question is calculated using the following formula (1):

[0151] , formula (1);

[0152] Where k represents the index of the kth question among the M questions, that is, 1≤k≤M, i represents the index of the ith expanded question among the L expanded questions corresponding to the kth question, j represents the index of the jth expanded question among the L expanded questions corresponding to the kth question, i≠j, The text of the i-th expanded question corresponding to the k-th question, The text of the jth extended question corresponding to the kth question, Indicates the number of word segments contained in the word set of the i-th expanded question corresponding to the k-th question, Indicates the number of participles contained in the participle set of the j-th expanded question corresponding to the k-th question, The number of segmentations contained in the intersection of the segmentation set of the i-th expanded question corresponding to the k-th question and the segmentation set of the j-th expanded question corresponding to the k-th question, It represents the difference score between the i-th expanded question corresponding to the k-th question and the j-th expanded question.

[0153] The difference scores between the L expanded questions corresponding to the kth question are calculated using the following formula (2):

[0154] , formula (2);

[0155] in, represents the number of combinations of any n (n=2) different expansion problems from L expansion problems, that is, The present application uses the average of the difference scores between any two different expanded questions in the L expanded questions as the difference score between the L expanded questions. Score(k) represents the difference score between the L expanded questions corresponding to the kth question.

[0156] In the above example, formula (1) and formula (2) are used to calculate the difference scores between the L expanded questions corresponding to the kth question.

[0157] Exemplarily, the following formula (3) is used to implement the method of determining the average of the difference scores corresponding to all questions in the evaluation data set as the score of the text enhancement instruction:

[0158] , formula (3);

[0159] Among them, Score_ins represents the score of the text enhancement instruction.

[0160] In combination with the above-mentioned embodiment of evaluating text enhancement instructions, the present application also provides the following Figure 2 The exemplary embodiment of evaluating text enhancement instructions shown includes the following steps:

[0161] Step a1: construct an evaluation dataset;

[0162] Step a2: Select the kth question among the M questions as the text to be expanded, and the initial value of k is 1;

[0163] Step a3: construct text enhancement prompt words according to the kth question and the current text enhancement instruction;

[0164] Step a4: Use the first language model to generate L expanded questions based on the text enhancement prompt words;

[0165] Step a5: Calculate the difference scores between the L expanded questions;

[0166] Step a6: Determine whether all M questions have been expanded. If so, execute step a7; if not, execute step a2, where k=k+1;

[0167] Step a7: Determine the score of the current text enhancement instruction according to the difference scores between the expanded questions corresponding to any question, and end the process.

[0168] In combination with the above embodiment of calculating the difference scores between the expanded questions corresponding to any question, the optimized text enhancement instruction prompt word template may be:

[0169] Hint: Below are i instructions and their corresponding scores. Instructions are used to rewrite the input text in the task. The greater the difference between the 10 rewritten texts, the higher the instruction score. I hope you can generate an instruction i+1 with a higher score than all the existing instructions.

[0170] Command S1: ***. <Command S1 score>: +++

[0171] Command S2: ***. <Command S2 score>: +++

[0172] Command Si: ***. <Command Si score>: +++

[0173] Generate instruction i+1. Please do not output the thinking process. Output the optimal instruction <instruction i+1>. The final output must be in the standard JSON format: {"instruction i+1":""}.

[0174] Among them: *** represents the text description content of instruction Si, and +++ represents the score of instruction Si. Instructions S1 to Si are the results of sorting the 1st instruction to the i-th instruction in ascending order according to the instruction scores.

[0175] Based on the above embodiments of evaluating text enhancement instructions and optimizing text enhancement instructions, the present application also provides the following Figure 3 The exemplary embodiment of the optimized text enhancement instruction shown includes the following steps:

[0176] Step b1: obtaining initial text enhancement instructions;

[0177] Step b2: Use the evaluation data set to evaluate the initial text enhancement instruction to obtain the score of the initial text enhancement instruction;

[0178] Step b3: constructing an optimized text enhancement instruction prompt word based on the current text enhancement instruction and the score of the instruction;

[0179] Step b4: using the second largest language model to optimize the text enhancement instruction prompt words to obtain the intermediate text enhancement instruction;

[0180] Step b5: Use the evaluation data set to evaluate the current intermediate text enhancement instruction to obtain the score of the current intermediate text enhancement instruction;

[0181] Step b6: Determine whether the number of text enhancement instruction optimizations z is equal to the preset number of optimizations, the initial value of z is 1, if yes, execute step b7, if no, execute step b3, wherein z=z+1;

[0182] Step b7: Determine the text enhancement instruction with the highest score as the final text enhancement instruction, and end the process.

[0183] S140, using any extended questions to update the first question library to obtain a second question library.

[0184] Specifically, the standard question in the question pair to which the non-standard question corresponding to any extended question belongs is combined with the corresponding extended question to form a new question pair, and the new question pair is added to the first question library to obtain the second question library.

[0185] The following example illustrates a new pair of questions consisting of an extended question and a standard question:

[0186] Question pair 1: The standard question is "Can a foreign trade enterprise get a tax refund if it obtains a general invoice issued by a supplier?" The expanded question is "Does a foreign trade enterprise qualify for a tax refund if it receives a general invoice issued by the other party?"

[0187] Question pair 2: The standard question is “Can a foreign trade enterprise apply for a tax refund if it obtains a general invoice issued by a supplier?”, and the expanded question is “Can a foreign trade enterprise apply for a tax refund if the other party issues a general invoice?”;

[0188] Question 3: The standard question is "Can a foreign trade enterprise get a tax refund if it obtains a general invoice issued by a supplier?" The expanded question is "Can I, as a foreign trade enterprise, apply for a tax refund if the other party issues a general invoice?"

[0189] S150, fine-tuning the pre-trained representation model using question pairs in the second question library to obtain a question text representation model.

[0190] Among them, the question text representation model is used to encode the input text.

[0191] Exemplarily, a Moka Massive Mixed Embedding (M3E) model is used as a pre-trained representation model.

[0192] Specifically, the question pairs in the second question library are used as training data sets to train the pre-trained representation model to obtain a question text representation model.

[0193] S160, using the question text representation model to obtain a vector representation of the target question and a vector representation of any standard question.

[0194] Specifically, any standard question is input into the question text representation model, a vector representation of the standard question encoded by the question text representation model is obtained, and these vectors are stored in a database. The database may be an Elasticsearch database. After obtaining the target question, the target question is input into the question text representation model, and a vector representation of the target question encoded by the question text representation model is obtained.

[0195] S170, determining a standard question having the highest similarity to the target question based on the similarity between the vector representation of the target question and the vector representation of any standard question.

[0196] Specifically, the vector representation of the target problem is matched with the vector representation of any standard problem in the database to determine the standard problem with the highest similarity to the target problem.

[0197] In a feasible design, this is achieved by determining the standard problem with the highest similarity to the target problem based on the similarity between the vector representation of the target problem and the vector representation of any standard problem:

[0198] Obtain a cosine similarity calculation model, where the cosine similarity calculation model is used to calculate the cosine similarity between multiple input vector representations;

[0199] Use the cosine similarity calculation model to determine the cosine similarity between the vector representation of the target problem and the vector representation of any standard problem;

[0200] Based on the cosine similarity between the vector representation of the target problem and the vector representation of any standard problem, the standard problem with the highest similarity to the target problem is determined.

[0201] The above example uses the cosine similarity calculation model to accurately calculate the cosine similarity between the vector representation of the target question and the vector representation of any standard question, thereby determining the standard question with the highest similarity to the target question.

[0202] In a feasible design, this is achieved by determining the standard problem with the highest similarity to the target problem based on the cosine similarity between the vector representation of the target problem and the vector representation of any standard problem:

[0203] According to the cosine similarity between the vector representation of the target problem and the vector representation of any standard problem, any standard problem is sorted in descending order according to the similarity value;

[0204] The standard question that is ranked first in the order is determined as the standard question that has the highest similarity to the target question.

[0205] In the above example, by sorting any standard questions in descending order according to the cosine similarity, the standard question ranked first in the order can be accurately and efficiently determined as the standard question with the highest similarity.

[0206] S180, determining the target answer corresponding to the standard question with the highest similarity from the question and answer database.

[0207] Exemplarily, the method further comprises:

[0208] S190, determine the standard questions that are in the first P positions in the order as candidate questions, and determine the answers corresponding to the standard questions in the question and answer database except for the standard question with the highest similarity among the candidate questions as candidate answers corresponding to the target question.

[0209] S1100, displaying a target answer and candidate answers to the user, wherein the target answer is displayed before the candidate answers.

[0210] The following describes the question-and-answer effects of the question-and-answer system provided in different embodiments of the present application in conjunction with specific experiments.

[0211] Embodiment 1:

[0212] The user's target question is obtained, and the target question and any standard question are encoded using a pre-trained representation model to obtain a vector representation of the target question and a vector representation of any standard question, respectively. The M3E model is used as the pre-trained representation model.

[0213] Based on the similarity between the vector representation of the target problem and the vector representation of any standard problem, the standard problem with the highest similarity to the target problem is determined.

[0214] Determine the target answer corresponding to the standard question with the highest similarity from the question and answer database.

[0215] Embodiment 2:

[0216] Get the initial text enhancement instructions given manually.

[0217] The text enhancement prompt words determined according to the initial text enhancement instruction are input into the first language model, so that the first language model rewrites and expands the non-standard questions in the first question library to generate a second question library. The first language model is the ChatGPT model.

[0218] The pre-trained representation model is fine-tuned according to the questions in the second question bank to obtain a question text representation model. The M3E model is used as the pre-trained representation model, and the expanded non-standard questions correspond to 10 expanded questions.

[0219] The target question and any standard question are encoded using the question text representation model to obtain a vector representation of the target question and a vector representation of the any standard question, respectively.

[0220] Based on the similarity between the vector representation of the target problem and the vector representation of any standard problem, the standard problem with the highest similarity to the target problem is determined.

[0221] Determine the target answer corresponding to the standard question with the highest similarity from the question and answer database.

[0222] Embodiment three:

[0223] Get the initial text enhancement instructions given manually.

[0224] Based on the initial text enhancement instructions, the optimized text enhancement instruction prompt words are used to iteratively optimize the second largest language model to obtain the text enhancement instructions. The number of iterations is 60 times, and the second largest language model is the ChatGPT model.

[0225] The text enhancement prompt words determined according to the optimized text enhancement instructions are input into the first language model, so that the first language rewrites and expands the non-standard questions in the first question library to generate a second question library. The first language model is the ChatGPT model.

[0226] The pre-trained representation model is fine-tuned according to the questions in the second question bank to obtain a question text representation model. The M3E model is used as the pre-trained representation model, and the expanded non-standard questions correspond to 10 expanded questions.

[0227] The target question and any standard question are encoded using the question text representation model to obtain a vector representation of the target question and a vector representation of the any standard question, respectively.

[0228] Based on the similarity between the vector representation of the target problem and the vector representation of any standard problem, the standard problem with the highest similarity to the target problem is determined.

[0229] Determine the target answer corresponding to the standard question with the highest similarity from the question and answer database.

[0230] By calculating the recall rate index of the three embodiments, the question answering effects of the question answering system using three different text representation models (i.e., the pre-trained representation model in Embodiment 1, the question text representation model in Embodiment 2, and the question text representation model in Embodiment 3) are compared.

[0231] In the first embodiment, a pre-trained representation model that has not been fine-tuned is used to understand the target question of the user's query. Since the pre-trained representation model that has not been fine-tuned has not learned the language features of the user's questioning process, the question-answering effect of the question-answering system is poor, and the recall rate of the question-answering result is only 51.38%. In the second embodiment, the scale of the first question library containing historical data is expanded by data enhancement, which can increase the diversity of data. By fine-tuning the pre-trained representation model, the obtained question text representation model can learn the language features of the user's questioning process, improve the question-answering system's ability to understand user questions, and the recall rate of the question-answering result is increased to 66.28%. Compared with the first embodiment, the question-answering effect is improved by 14.9%. Compared with the second embodiment, the non-standard questions in the first question library are expanded and rewritten using the manually given initial text enhancement instructions. In the third embodiment, the optimized text enhancement instructions are obtained by using the prompt word optimization method, and the non-standard questions in the first question library are expanded and rewritten using the optimized text enhancement instructions, which can further improve the enhancement effect of historical data. The third embodiment uses the question text representation model trained by the second question bank expanded in this way, and the ability to understand user questions is further improved, and the recall rate of question and answer results is increased to 72.56%. Compared with the first embodiment, the question and answer effect of the third embodiment is improved by 21.18%.

[0232] It can be seen that this application constructs the first question library by introducing historical data obtained by the question-answering system, and rewrites and expands the first question library through the first language model, which can improve the question text representation model's ability to understand user questions, thereby improving the question-answering effect of the question-answering system. Furthermore, compared to expanding the first question library based on manually given text enhancement instructions, the diversity of the expanded questions after expanding the first question library based on optimized text enhancement instructions is improved, thereby further improving the question-answering effect of the system.

[0233] Considering that the questions in the historical data obtained after the system is put into use contain a large amount of information such as the questioning methods and language patterns of users, the embodiment of the present application uses the questions in the historical data to construct a first question library, and the first question library includes a question pair consisting of a standard question and a non-standard question with similar semantics to the standard question, wherein the standard question and the corresponding non-standard question have the same answer. Then, the non-standard questions in the first question library are rewritten and expanded using the first large language model to obtain the expanded questions corresponding to the non-standard questions, and the expanded questions are made similar in semantics to the non-standard questions, thereby realizing data enhancement of the data in the first question library and increasing the diversity of the data in the first question library. The pre-trained representation model is fine-tuned using the first question library (i.e., the second question library) after data enhancement, and the obtained question text representation model can learn the language features in the user's questioning process. Therefore, the question-answering system based on the question text representation model has improved its ability to understand user questions, thereby improving the question-answering effect of the question-answering system.

[0234] Based on the above embodiment of the retrieval enhanced question answering method combined with historical data, Figure 4 As shown, the present application also provides a retrieval enhanced question answering system combined with historical data, including:

[0235] A historical data acquisition module is used to acquire historical data, which includes questions and corresponding answers accumulated by the system in the historical question-answering process;

[0236] A data construction module is used to construct a question-answer library and a first question library, wherein the question-answer library includes question-answer pairs consisting of questions in historical data and corresponding answers, and the first question library includes question pairs consisting of standard questions and non-standard questions with similar semantics to the standard questions, wherein the standard questions and corresponding non-standard questions have the same answers and are all questions in historical data;

[0237] A data enhancement module, used to perform data enhancement on non-standard questions in the first question library using the first language model to obtain expanded questions with similar semantics to the non-standard questions;

[0238] The data enhancement module is also used to update the first question library using any expanded questions to obtain a second question library;

[0239] A model training module, used to fine-tune the pre-trained representation model using the question pairs in the second question library to obtain a question text representation model, and the question text representation model is used to encode the input text;

[0240] A question representation acquisition module is used to obtain the vector representation of the target question and the vector representation of any standard question using the question text representation model;

[0241] A standard question selection module, for determining the standard question with the highest similarity to the target question based on the similarity between the vector representation of the target question and the vector representation of any standard question;

[0242] The answer acquisition module is used to determine the target answer corresponding to the standard question with the highest similarity from the question and answer database.

[0243] In a feasible design, the data enhancement module implements data enhancement in the following ways:

[0244] Determine text enhancement instructions;

[0245] Fill the text enhancement prompt word template with text enhancement instructions and non-standard questions to obtain text enhancement prompt words;

[0246] The text enhancement prompt word is input into the first language model to obtain an expanded question output by the first language model that is semantically similar to the non-standard question.

[0247] In a feasible design, the data enhancement module determines the text enhancement instructions in the following way:

[0248] Obtaining an initial text enhancement instruction, and evaluating the text enhancement instruction using any question in an evaluation data set to obtain a score of the initial text enhancement instruction, wherein the evaluation data set is constructed by a portion of questions in the first question bank;

[0249] Using the initial text enhancement instruction and the corresponding score to fill in the optimized text enhancement instruction prompt word template to obtain the optimized text enhancement instruction prompt word;

[0250] Inputting the optimized text enhancement instruction prompt words into the second largest language model to obtain the intermediate text enhancement instruction;

[0251] Use any questions in the evaluation dataset to evaluate the text enhancement instructions and get the scores of the intermediate text enhancement instructions;

[0252] Use the intermediate text enhancement instructions and the corresponding scores to continue filling in the optimized text enhancement instruction prompt word template to obtain a new optimized text enhancement instruction prompt word;

[0253] If the number of text enhancement instructions included in the new optimized text enhancement instruction prompt is greater than the preset number, deleting the instructions to be deleted and the corresponding scores in the new optimized text enhancement instruction prompt, and the instructions to be deleted are the text enhancement instructions with the lowest scores;

[0254] If the number of text enhancement instructions included in the new optimized text enhancement instruction prompt word is less than or equal to the preset number, or after deleting the to-be-deleted instructions and the corresponding scores in the new optimized text enhancement instruction prompt word, input the new optimized text enhancement instruction prompt word into the second largest language model to obtain a new intermediate text enhancement instruction;

[0255] The text enhancement instruction is evaluated again using any question in the evaluation data set to obtain the score of the new intermediate text enhancement instruction, until the number of times the second largest language model is used to iterate the intermediate text enhancement instruction is equal to the preset number of optimizations, and the text enhancement instruction with the highest score is determined as the final text enhancement instruction.

[0256] In one possible design, the data augmentation module is also implemented in the following way to evaluate the text augmentation instructions using any questions in the evaluation dataset:

[0257] Use the text enhancement instructions and any questions in the evaluation dataset to fill in the text enhancement prompt word template to obtain the text enhancement prompt word corresponding to any question;

[0258] Inputting the text enhancement prompt words corresponding to any question into the first language model, the first language model generates and outputs each expanded question corresponding to the arbitrary question according to the arbitrary question;

[0259] The score of the text enhancement instruction is determined according to the difference scores between the expanded questions corresponding to any question, and the difference scores are used to evaluate the degree of difference between the expanded questions.

[0260] In a feasible design, the data augmentation module is implemented in the following way, and the score of the text augmentation instruction is determined according to the difference scores between the augmented questions corresponding to any question:

[0261] Based on the N-gram model, the text of any extended question corresponding to any question is segmented to obtain a segmentation set consisting of the segmentations of any extended question;

[0262] Determine the difference scores between the expanded questions corresponding to any question according to the number of the segmentation set of any expanded question;

[0263] The mean of the difference scores corresponding to the questions in the evaluation dataset is determined as the score of the text enhancement instruction.

[0264] In one feasible design, the standard question selection module is implemented in the following way, based on the similarity between the vector representation of the target question and the vector representation of any standard question, to determine the standard question with the highest similarity to the target question:

[0265] Obtain a cosine similarity calculation model, where the cosine similarity calculation model is used to calculate the cosine similarity between multiple input vector representations;

[0266] Use the cosine similarity calculation model to determine the cosine similarity between the vector representation of the target problem and the vector representation of any standard problem;

[0267] Based on the cosine similarity between the vector representation of the target problem and the vector representation of any standard problem, the standard problem with the highest similarity to the target problem is determined.

[0268] In one feasible design, the standard question selection module is implemented in the following way, and the standard question with the highest similarity to the target question is determined based on the cosine similarity between the vector representation of the target question and the vector representation of any standard question:

[0269] According to the cosine similarity between the vector representation of the target problem and the vector representation of any standard problem, any standard problem is sorted in descending order according to the similarity value;

[0270] The standard question that is ranked first in the order is determined as the standard question that has the highest similarity to the target question.

[0271] For other implementation methods and effects of the above system, please refer to the description in the embodiment of the retrieval enhanced question and answer method combined with historical data, which will not be repeated here.

[0272] The basic principles of the present application are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present application are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present application. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, not for limitation, and the above details do not limit the present application to being implemented by adopting the above specific details.

[0273] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0274] The block diagrams of the devices, apparatuses, equipment, and systems involved in this application are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagram. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open words, referring to "including but not limited to", and can be used interchangeably with them. The words "or" and "and" used here refer to the words "and / or" and can be used interchangeably with them, unless the context clearly indicates otherwise. The words "such as" used here refer to the phrase "such as but not limited to", and can be used interchangeably with them.

[0275] It should also be noted that in the apparatus, device and method of the present application, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present application.

[0276] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present application. Therefore, the present application is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

[0277] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present application to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.

Claims

1. A retrieval-enhanced question-answering method combined with historical data, characterized in that: Applied to a retrieval-enhanced question-answering system combined with historical data, the method comprises: Acquire historical data, wherein the historical data includes questions and corresponding answers accumulated by the system in the historical question-answering process; Constructing a question-and-answer database and a first question database, wherein the question-and-answer database includes question-and-answer pairs consisting of questions in the historical data and corresponding answers, and the first question database includes question pairs consisting of standard questions and non-standard questions with semantic similarity to the standard questions, wherein the standard questions and the corresponding non-standard questions have the same answers and are all questions in the historical data; Using the first language model to perform data enhancement on the non-standard questions in the first question library to obtain expanded questions with similar semantics to the non-standard questions; The data enhancement includes the following steps: Determine text enhancement instructions; Fill in a text enhancement prompt word template using the text enhancement instruction and the non-standard question to obtain a text enhancement prompt word; Inputting the text enhancement prompt word into the first language model to obtain an expanded question output by the first language model that is semantically similar to the non-standard question; Wherein, the step of determining the text enhancement instruction comprises the following steps: Obtaining an initial text enhancement instruction, and evaluating the text enhancement instruction using any question in an evaluation data set to obtain a score of the initial text enhancement instruction, wherein the evaluation data set is constructed by a portion of the questions in the first question library; Filling an optimized text enhancement instruction prompt word template with the initial text enhancement instruction and the corresponding score to obtain an optimized text enhancement instruction prompt word; Inputting the optimized text enhancement instruction prompt words into the second largest language model to obtain an intermediate text enhancement instruction; Using any question in the evaluation data set to evaluate the text enhancement instruction, and obtaining a score for the intermediate text enhancement instruction; Use the intermediate text enhancement instruction and the corresponding score to continue filling the optimized text enhancement instruction prompt word template to obtain a new optimized text enhancement instruction prompt word; If the number of text enhancement instructions included in the new optimized text enhancement instruction prompt is greater than the preset number, deleting the instructions to be deleted and the corresponding scores in the new optimized text enhancement instruction prompt, the instructions to be deleted are the text enhancement instructions with the lowest scores; If the number of text enhancement instructions included in the new optimized text enhancement instruction prompt word is less than or equal to the preset number, or after deleting the to-be-deleted instructions and the corresponding scores in the new optimized text enhancement instruction prompt word, input the new optimized text enhancement instruction prompt word into the second largest language model to obtain a new intermediate text enhancement instruction; Using any question in the evaluation data set to evaluate the text enhancement instruction again, obtaining the score of the new intermediate text enhancement instruction, until the number of times the second largest language model is used to iteratively obtain the intermediate text enhancement instruction is equal to the preset optimization number, and the text enhancement instruction with the highest score is determined as the final text enhancement instruction; The step of evaluating the text enhancement instruction using any question in the evaluation data set comprises the following steps: Fill the text enhancement prompt word template using the text enhancement instruction and any question in the evaluation data set to obtain a text enhancement prompt word corresponding to any of the questions; Inputting the text enhancement prompt words corresponding to any of the questions into the first large language model, and the first large language model generates and outputs each expanded question corresponding to any of the questions according to any of the questions; Based on the N-gram model, text segmentation is performed on any extended question corresponding to any of the questions to obtain a segmentation set consisting of segmentations of any of the extended questions; Determining the difference scores between the expanded questions corresponding to any of the questions according to the number of the segmentation sets included in any of the expanded questions; Determine the mean of the difference scores corresponding to the questions in the evaluation data set as the score of the text enhancement instruction, wherein the difference score is used to evaluate the degree of difference between the expanded questions; Use any of the expanded questions to update the first question library to obtain a second question library; Using the questions in the second question library to fine-tune the pre-trained representation model to obtain a question text representation model, wherein the question text representation model is used to encode the input text; Using the question text representation model to obtain a vector representation of the target question and a vector representation of any of the standard questions; Determining a standard problem having the highest similarity to the target problem based on the similarity between the vector representation of the target problem and the vector representation of any of the standard problems; Determine the target answer corresponding to the standard question with the highest similarity from the question and answer database.

2. The method according to claim 1, characterized in that The step of determining the standard question having the highest similarity to the target question based on the similarity between the vector representation of the target question and the vector representation of any of the standard questions includes: Obtaining a cosine similarity calculation model, wherein the cosine similarity calculation model is used to calculate the cosine similarity between multiple input vector representations; Using the cosine similarity calculation model, determining the cosine similarity between the vector representation of the target question and the vector representation of any of the standard questions; According to the cosine similarity between the vector representation of the target problem and the vector representation of any of the standard problems, a standard problem having the highest similarity to the target problem is determined.

3. The method according to claim 2, characterized in that The step of determining the standard question having the highest similarity to the target question based on the cosine similarity between the vector representation of the target question and the vector representation of any of the standard questions comprises: According to the cosine similarity between the vector representation of the target problem and the vector representation of any of the standard problems, any of the standard problems are sorted in descending order according to the similarity value; The standard question ranked first in the order is determined as the standard question with the highest similarity to the target question.

4. A retrieval-enhanced question-answering system combined with historical data, characterized in that: include: A historical data acquisition module, used to acquire historical data, wherein the historical data includes questions and corresponding answers accumulated by the system in the historical question-answering process; A data construction module, used to construct a question-and-answer database and a first question database, wherein the question-and-answer database includes question-and-answer pairs consisting of questions in the historical data and corresponding answers, and the first question database includes question pairs consisting of standard questions and non-standard questions with semantic similarity to the standard questions, wherein the standard questions and the corresponding non-standard questions have the same answers and are all questions in the historical data; A data enhancement module, configured to perform data enhancement on the non-standard questions in the first question library using a first large language model to obtain expanded questions with similar semantics to the non-standard questions; The data enhancement includes the following steps: Determine text enhancement instructions; Fill in a text enhancement prompt word template using the text enhancement instruction and the non-standard question to obtain a text enhancement prompt word; Inputting the text enhancement prompt word into the first language model to obtain an expanded question output by the first language model that is semantically similar to the non-standard question; Wherein, the step of determining the text enhancement instruction comprises the following steps: Obtaining an initial text enhancement instruction, and evaluating the text enhancement instruction using any question in an evaluation data set to obtain a score of the initial text enhancement instruction, wherein the evaluation data set is constructed by a portion of the questions in the first question library; Filling an optimized text enhancement instruction prompt word template with the initial text enhancement instruction and the corresponding score to obtain an optimized text enhancement instruction prompt word; Inputting the optimized text enhancement instruction prompt words into the second largest language model to obtain an intermediate text enhancement instruction; Using any question in the evaluation data set to evaluate the text enhancement instruction, and obtaining a score for the intermediate text enhancement instruction; Use the intermediate text enhancement instruction and the corresponding score to continue filling the optimized text enhancement instruction prompt word template to obtain a new optimized text enhancement instruction prompt word; If the number of text enhancement instructions included in the new optimized text enhancement instruction prompt is greater than the preset number, deleting the instructions to be deleted and the corresponding scores in the new optimized text enhancement instruction prompt, the instructions to be deleted are the text enhancement instructions with the lowest scores; If the number of text enhancement instructions included in the new optimized text enhancement instruction prompt word is less than or equal to the preset number, or after deleting the to-be-deleted instructions and the corresponding scores in the new optimized text enhancement instruction prompt word, input the new optimized text enhancement instruction prompt word into the second largest language model to obtain a new intermediate text enhancement instruction; Using any question in the evaluation data set to evaluate the text enhancement instruction again, obtaining the score of the new intermediate text enhancement instruction, until the number of times the second largest language model is used to iteratively obtain the intermediate text enhancement instruction is equal to the preset optimization number, and the text enhancement instruction with the highest score is determined as the final text enhancement instruction; The step of evaluating the text enhancement instruction using any question in the evaluation data set comprises the following steps: Fill the text enhancement prompt word template using the text enhancement instruction and any question in the evaluation data set to obtain a text enhancement prompt word corresponding to any of the questions; Inputting the text enhancement prompt words corresponding to any of the questions into the first large language model, and the first large language model generates and outputs each expanded question corresponding to any of the questions according to any of the questions; Based on the N-gram model, text segmentation is performed on any extended question corresponding to any of the questions to obtain a segmentation set consisting of segmentations of any of the extended questions; Determining the difference scores between the expanded questions corresponding to any of the questions according to the number of the segmentation sets included in any of the expanded questions; Determine the mean of the difference scores corresponding to the questions in the evaluation data set as the score of the text enhancement instruction, wherein the difference score is used to evaluate the degree of difference between the expanded questions; The data enhancement module is further used to update the first question library using any of the expanded questions to obtain a second question library; A model training module, used to fine-tune the pre-trained representation model using the questions in the second question library to obtain a question text representation model, wherein the question text representation model is used to encode the input text; A question representation acquisition module, used to obtain a vector representation of a target question and a vector representation of any of the standard questions using the question text representation model; A standard question selection module, configured to determine the standard question having the highest similarity to the target question based on the similarity between the vector representation of the target question and the vector representation of any of the standard questions; The answer acquisition module is used to determine the target answer corresponding to the standard question with the highest similarity from the question and answer library.