Question and answer data processing method, equipment and program product
By combining question-answering pairs with a large business model and processing them comprehensively according to the characteristics of the questions, the problem of insufficient recognition of professional terms in specific business scenarios by the large model is solved, thereby improving the accuracy and comprehensiveness of the question-answering answers.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2026-03-10
AI Technical Summary
Existing large models cannot accurately identify professional terms in specific business scenarios, resulting in low accuracy of question-and-answer answers. The relationship between database results based on question keywords and the size of the data also leads to low accuracy of answers.
By combining question-answering pairs datasets with a large business model, and taking into account the characteristics of questions such as word count and vectors, the question-answering pairs datasets and the large business model are used in a comprehensive manner to process questions and obtain answers.
It improves the accuracy and comprehensiveness of question-and-answer answers, saves computing resources, and enhances the user experience.
Smart Images

Figure CN121638434A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, specifically to a question-and-answer data processing method, device, and program product. Background Technology
[0002] As people's living standards improve, customer service is increasingly deployed in various business scenarios such as online shopping and logistics to provide pre-sales and after-sales support and answer customers' questions. Currently, customer service representatives typically respond to customer inquiries in two ways: one is to use a large model to answer the input content and question, but existing large models cannot accurately identify professional terms in specific business scenarios, resulting in low accuracy of the answers; the other is to search directly in the database based on the question's keywords, but the search results are related to the comprehensiveness and size of the database, which also leads to low accuracy of the answers. Summary of the Invention
[0003] Based on the shortcomings and deficiencies of the existing technology, this application proposes a question-and-answer data processing method, device, and program product that can combine the advantages of question-and-answer pair datasets and large business models to improve the accuracy of the answers to the questions to be processed.
[0004] According to a first aspect of the embodiments of this application, a question-and-answer data processing method is provided, comprising: acquiring a question to be processed; if the question characteristics of the question to be processed meet preset characteristic conditions, processing the question to be processed based on a question-and-answer pair dataset and a business big model to obtain an answer to the question to be processed, wherein the question-and-answer pair dataset includes at least one first question-and-answer pair, the first question-and-answer pair includes a first sample question and a corresponding first sample answer, and the business big model is a big model based on the business scenario in which the question to be processed is located.
[0005] According to the question-and-answer data processing method provided in the first aspect of the embodiments of this application, if the question characteristics of the question to be processed meet the preset characteristic conditions, the question to be processed is processed based on the question-and-answer pair dataset and the business big model to obtain the answer to the question to be processed, including: if the number of words in the question to be processed is greater than or equal to a word count threshold, the question to be processed is processed based on the question-and-answer pair dataset to obtain a first answer to the question to be processed, and the question to be processed is processed based on the business big model to obtain a second answer to the question to be processed; wherein, the answer to the question to be processed includes the first answer and the second answer.
[0006] According to the question-and-answer data processing method provided in the first aspect of the embodiments of this application, the step of processing the question to be processed based on the question-and-answer pair dataset to obtain a first answer to the question to be processed includes: calculating a first similarity between the question to be processed and each of the first sample questions; if there is only one first similarity greater than a first similarity threshold, taking the first sample answer corresponding to the first sample question with the first similarity greater than the first similarity threshold as the first answer to the question to be processed; if at least two first similarities are greater than the first similarity threshold, taking the first sample answer corresponding to the first sample question with the highest first similarity as the first standard answer to the question to be processed, and excluding The first sample answers corresponding to other first sample questions with a first similarity greater than the first similarity threshold, excluding the first sample question with the highest first similarity, are used as the first suggested answers to the question to be processed, wherein the first answers include the first standard answer and the first suggested answer; if each of the first similarities is less than or equal to the first similarity threshold, and at least one of the first similarities is greater than the second similarity threshold, the first sample answers corresponding to the first sample questions with the first similarity greater than the second similarity threshold are used as the second suggested answers to the question to be processed, wherein the first answers include the second suggested answers, and the first similarity threshold is greater than the second similarity threshold.
[0007] According to the question-and-answer data processing method provided in the first aspect of the embodiments of this application, after calculating the similarity between the question to be processed and each of the first sample questions, the method further includes: if each of the first similarities is less than or equal to the second similarity threshold, processing the question to be processed based on the business big model to obtain the second answer to the question to be processed.
[0008] According to the question-and-answer data processing method provided in the first aspect of the embodiments of this application, the step of processing the question to be processed based on the business big model to obtain a second answer to the question to be processed includes: calculating the second similarity between the question to be processed and each document slice in the business document database, wherein the question to be processed and the business scenario in which the business document database is located are the same; taking the N document slices with the highest second similarity as context slices of the question to be processed, wherein N is a positive integer; inputting the question to be processed and the context slices into the business big model to obtain the second answer output by the business big model.
[0009] According to the question-and-answer data processing method provided in the first aspect of the embodiments of this application, the step of inputting the question to be processed and the context slice into the business big model to obtain the second answer output by the business big model includes: inputting the question to be processed and the context slice into a prompting module to obtain a prompting question output by the prompting module, wherein the prompting module is used to generate the prompting question after adding prompting information to the question to be processed and the context slice; inputting the prompting question into the business big model to obtain the second answer output by the business big model.
[0010] According to the question-and-answer data processing method provided in the first aspect of the embodiments of this application, the business big model is obtained through training; the training process of the business big model is as follows: obtaining training sample data in the business scenario where the question to be processed is located, wherein the training sample data includes at least one second question-and-answer pair, the second question-and-answer pair including a second sample question and a corresponding second sample answer; based on the training sample data, using model fine-tuning technology, training the original big model; and using the trained original big model as the business big model.
[0011] According to the question-and-answer data processing method provided in the first aspect of the embodiments of this application, the process of obtaining the training sample data is as follows: Based on the existing original question-and-answer pairs, similar question-and-answer pairs are generated through the original large model, and the similar question-and-answer pairs are used as the training sample data, wherein the similarity between the questions in the similar question-and-answer pairs and the questions in the original question-and-answer pairs is greater than a third similarity threshold, and the original question-and-answer pairs are in the same business scenario as the question to be processed; and / or, business documents related to the original question-and-answer pairs are obtained, and document question-and-answer pairs in the business documents are extracted as the training sample data; and / or, based on the question to be processed, prompt question-and-answer pairs are generated through the original large model, and the prompt question-and-answer pairs with a similarity greater than a fourth similarity threshold to the question to be processed are used as the training sample data.
[0012] According to a second aspect of the present application, an electronic device is provided, comprising: a memory and a processor; the memory is connected to the processor and is used to store a program; the processor is used to implement the question-and-answer data processing method as described in the first aspect by running the program in the memory.
[0013] According to a third aspect of the embodiments of this application, a computer program product is provided, including computer program instructions; the computer program instructions, when executed by a processor, cause the processor to perform the question-and-answer data processing method as described in the first aspect.
[0014] In this embodiment, a question to be processed is obtained. If the characteristics of the question to be processed meet preset characteristic conditions, the question to be processed is processed based on a question-answer pair dataset and a business big model to obtain an answer to the question to be processed. The question-answer pair dataset includes at least one first question-answer pair, each first question-answer pair including a first sample question and a corresponding first sample answer. The business big model is a big model based on the business scenario in which the question to be processed exists. In the above process, when obtaining an answer to the question to be processed, the question-answer pair dataset or the business big model is not directly processed alone. Instead, based on the characteristics of the question to be processed, both the question-answer pair dataset and the business big model are used comprehensively to improve the accuracy of the answer to the question to be processed. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0016] Figure 1 One of the flowcharts of a question-and-answer data processing method provided in this application embodiment;
[0017] Figure 2 A second schematic flowchart illustrating a question-and-answer data processing method provided in an embodiment of this application;
[0018] Figure 3 A block diagram of a question-and-answer data processing device provided in an embodiment of this application;
[0019] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0020] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0021] Exemplary methods
[0022] This application addresses the issue of low accuracy in automated question-answering by providing a question-and-answer data processing method. This method can be implemented using a software algorithm, which can be run on any device with data processing capabilities, such as a local computer, a remote cloud platform, or a smart mobile device. The scope of protection of this application is not limited to the type of device used to run the software algorithm implementing this method.
[0023] In one embodiment, such as Figure 1 As shown, the workflow steps for implementing the question-and-answer data processing method are as follows:
[0024] Step 101: Obtain the issues to be processed.
[0025] In this embodiment, the problem to be processed is a question that needs to be answered. This problem can be a question directly input by the customer in a specific business scenario. For example, in an online shopping scenario, the problem to be processed can be a question transmitted by the online shopping user to the device running this method via the network. Alternatively, it can be a question further raised by customer service based on the original question provided by the customer in that business scenario. For example, in a logistics scenario, the problem to be processed can be a question further raised by after-sales personnel based on the information provided by the customer. The way the problem to be processed is raised does not limit the scope of protection of this application.
[0026] Step 102: If the characteristics of the problem to be processed meet the preset characteristic conditions, the problem to be processed is processed based on the question-answer pair dataset and the business big model to obtain the answer to the problem to be processed. The question-answer pair dataset includes at least one first question-answer pair, and the first question-answer pair includes a first sample question and a corresponding first sample answer. The business big model is a big model based on the business scenario in which the problem to be processed is located.
[0027] In this embodiment, the frequently asked questions (FAQ) dataset is a pre-set dataset. This dataset includes multiple first question-answer pairs, each consisting of a first sample question and its corresponding first sample answer. The first question-answer pairs in the dataset are all collected based on the business scenario in which the question to be processed exists. To further improve the accuracy of the answers to the questions, the dataset should cover the business scenario as comprehensively and from multiple perspectives as possible, thereby ensuring that when an answer to a question is obtained based on the dataset, the answer is more comprehensive and accurate.
[0028] In this embodiment, the business large model refers to a large model based on the business scenario in which the problem to be processed exists. A simple large model has a more generalized ability to handle problems, but it cannot analyze the problem specifically. In fact, due to a weak understanding of professional terminology in the business scenario, the general large model's ability to summarize professional domain texts is reduced, thus decreasing the accuracy of the answer to the problem. On the other hand, the business large model improves the specificity of the business scenario in which the problem to be processed exists, enhances the understanding of the business scenario in which the problem to be processed exists, and thus improves the accuracy of the answer to the problem.
[0029] In this embodiment, instead of directly processing the question-and-answer pair dataset or the business model alone, the problem to be processed is determined to see if the characteristics of the problem meet the preset characteristic conditions. If the characteristics of the problem meet the preset characteristic conditions, the question-and-answer pair dataset and the business model are used in combination. This not only retains the advantages of the question-and-answer pair dataset in terms of its strong targeting and understanding of professional terms, but also combines the high level of intelligence of the business model in the business scenario where the problem is located. Furthermore, it breaks through the limitations of the question-and-answer pair dataset in terms of data scope, thereby improving the accuracy of the answer to the problem.
[0030] In one embodiment, the problem characteristics of the question to be processed include the number of characters in the question, with a preset characteristic condition being whether it is greater than or equal to a character count threshold. If the problem characteristics of the question to be processed meet the preset characteristic condition, the question to be processed is processed based on the question-and-answer dataset and the business big model to obtain the answer to the question to be processed, as follows: if the number of characters in the question to be processed is greater than or equal to the character count threshold, the question to be processed is processed based on the question-and-answer dataset to obtain a first answer to the question to be processed, and the question to be processed is processed based on the business big model to obtain a second answer to the question to be processed; wherein, the answer to the question to be processed includes the first answer and the second answer.
[0031] In this embodiment, after obtaining the question to be processed, it is determined whether the number of characters in the question to be processed is greater than or equal to the character threshold; if not, the question to be processed is processed based on the question and answer dataset to obtain the first answer to the question to be processed; if yes, the question to be processed is processed based on the question and answer dataset to obtain the first answer to the question to be processed, and the question to be processed is also processed based on the business big model to obtain the second answer to the question to be processed.
[0032] In this embodiment, if the number of characters in the question to be processed is less than the character count threshold, it indicates that the question has too few characters, and the semantic information it contains is inevitably limited. Using the business model alone cannot yield a reasonable and accurate answer. Furthermore, questions with fewer characters tend to have a higher proportion of keywords. Therefore, question-and-answer processing can be directly applied to the dataset to process the question, resulting in a more accurate first answer while avoiding the large computational cost of calling the business model, thus saving computational resources. If the number of characters in the question to be processed is greater than or equal to the character count threshold, it indicates that the question has more characters and contains more semantic information. Correspondingly, the proportion of keywords in the question may be lower. In this case, using the business model can better analyze and understand the semantics of the question, resulting in a more accurate second answer. Furthermore, if the number of characters in the question to be processed is greater than or equal to the character count threshold, while processing using the business model, question-and-answer processing can also be applied to the dataset to process the question. The resulting first and second answers can be compared, thereby further improving the accuracy and comprehensiveness of the answer to the question. The word count threshold can be set according to the actual situation and needs. For example, the word count threshold can be set to 6. The scope of protection of this application is not limited by the specific value of the word count threshold.
[0033] In one embodiment, the problem characteristics of the problem to be processed include the size of the problem vector, and the preset characteristic conditions include whether the problem vector is greater than or equal to a vector threshold. If the problem characteristics of the problem to be processed meet the preset characteristic conditions, the problem to be processed is processed based on the question-and-answer dataset and the business big model to obtain the answer to the problem, as follows: the problem to be processed is vectorized to obtain the problem vector corresponding to the problem to be processed; if the problem vector is greater than or equal to the vector threshold, the problem to be processed is processed based on the question-and-answer dataset to obtain the first answer to the problem to be processed, and the problem to be processed is processed based on the business big model to obtain the second answer to the problem to be processed.
[0034] In this embodiment, it is determined whether the vector of the problem to be processed is greater than or equal to the vector threshold; if not, the problem to be processed in the dataset is processed based on the question and answer to obtain the first answer to the problem; if yes, the problem to be processed in the dataset is processed based on the question and answer to obtain the first answer to the problem, and the problem to be processed is processed based on the business big model to obtain the second answer to the problem.
[0035] In this embodiment, in addition to the number of characters in the question to be processed, the size of the question vector can also be used to measure the amount of semantic information contained in the question. The smaller the question vector, the less semantic information the question contains, making it unsuitable for processing using a large business model; in this case, only question-and-answer processing is used on the dataset. Conversely, the larger the question vector, the more semantic information the question contains. In this case, both a large business model and question-and-answer processing are used on the dataset to process the question, with the first and second answers used as a comparison to improve the accuracy and comprehensiveness of the answers to the question.
[0036] Of course, the above embodiments only provide two problem characteristics: word count and vectorization. Depending on the actual business scenario and business needs, any other problem characteristic of the problem to be processed can be used to select the specific processing method for the problem to be processed.
[0037] In one embodiment, the first question-answer pair in the question-answer pair dataset can be a question-answer pair collected in advance in the business scenario where the question to be processed is located. The question-and-answer dataset is used to process the questions to be processed and obtain the first answer to the questions to be processed. The specific process is as follows: Calculate the first similarity between the question to be processed and each first sample question; if there is one and only one first similarity greater than the first similarity threshold, the first sample answer corresponding to the first sample question with the first similarity greater than the first similarity threshold is taken as the first answer to the question to be processed; if at least two first similarities are greater than the first similarity threshold, the first sample answer corresponding to the first sample question with the highest first similarity is taken as the first standard answer to the question to be processed, and the first sample answers corresponding to the other first sample questions with the first similarity greater than the first similarity threshold (excluding the first sample question with the highest first similarity) are taken as the first hint answers to the question to be processed, where the first answer includes the first standard answer and the first hint answer; if each first similarity is less than or equal to the first similarity threshold, and at least one first similarity is greater than the second similarity threshold, the first sample answer corresponding to the first sample question with the first similarity greater than the second similarity threshold is taken as the second hint answer to the question to be processed, where the first answer includes the second hint answer, and the first similarity threshold is greater than the second similarity threshold.
[0038] In this embodiment, the first answer to the question to be processed is matched based on the first similarity between the question to be processed and each first sample question in the question-answer pair dataset. The first similarity threshold is a threshold set according to the actual situation and business needs. The value of the first similarity threshold is relatively large. When the first similarity between any first sample question and the question to be processed is greater than the first similarity threshold, it means that the question to be processed and the first sample question are very similar. If there is one and only one first similarity greater than the first similarity threshold, it means that there is one and only one first sample question that is very similar to the question to be processed. In this case, the first sample answer corresponding to the first sample question with the first similarity greater than the first similarity threshold is directly used as the first answer to the question to be processed.
[0039] If at least two first-similar questions have a first-similarity score greater than the first-similarity threshold, it indicates that multiple first-sample questions are very similar to the question to be processed. In this case, the first-sample answer corresponding to the first-sample question with the highest first-similarity score is taken as the first standard answer to the question to be processed. This first standard answer is also the most reliable answer for the question to be processed. Simultaneously, the first-sample answers corresponding to other first-sample questions (excluding the one with the highest first-similarity score) with a first-similarity score greater than the first-similarity threshold are taken as the first suggested answers to the question to be processed. These first suggested answers can be returned to the user in a list format, prompting the user to further search for answers using similar first-sample questions, thus providing the user with more comprehensive and reliable first-similar answers.
[0040] In this embodiment, the second similarity threshold is less than the first similarity threshold. If each first similarity is less than or equal to the first similarity threshold, it indicates that there is no first sample question in the question-answering pair dataset that is very similar to the question to be processed. If at least one first similarity is greater than the second similarity threshold, it indicates that there is at least one first sample question in the question-answering pair dataset that is relatively similar to the question to be processed. In this case, the first sample answer corresponding to the first sample question with a first similarity greater than the second similarity threshold is used as the second suggested answer for the question to be processed. Through the second suggested answer, the user is prompted to search for answers using similar first sample questions, thus avoiding the situation where the user does not receive any effective information related to the answer after submitting the question to be processed, thereby improving the user experience.
[0041] In one embodiment, calculating the first similarity between the problem to be processed and each of the first sample problems includes: vectorizing the problem to be processed to obtain the problem vector corresponding to the problem to be processed; and calculating the first similarity between the problem vector to be processed and the first sample vector corresponding to each of the first sample problems.
[0042] In this embodiment, the problem to be processed is vectorized, including: inputting the problem to be processed into a vectorization module and obtaining the problem vector output by the vectorization module. This vectorization module includes an embedding module; for example, the embedding module can use the open-source bge-large-zh-v1.5 model. However, general embedding models may have weak analytical capabilities for the domain knowledge specific to the business scenario in which the problem is being processed. Therefore, depending on the situation and needs, embedding training sample data specific to the business scenario in which the problem is being processed can be used to train the original embedding model, thereby obtaining a trained embedding module that is more suitable for problem analysis and vectorization processing within the business scenario in which the problem is being processed.
[0043] Similarly, when vectorizing each first sample problem, a pre-set vectorization module can be called to vectorize each first sample problem separately, thereby obtaining the first sample vector corresponding to each first sample problem.
[0044] In this embodiment, the first similarity between the problem vector to be processed and each first sample vector includes the cosine similarity between the problem vector to be processed and each first sample vector, and the cosine value between the vectors is used as the value to measure the similarity between the vectors.
[0045] The cosine similarity between the problem vector to be processed and each first sample vector is calculated, and the first sample vectors that are very similar or relatively similar to the problem vector are searched. Optionally, libraries such as Faiss and Qdrant can be used to manage the first sample vectors to achieve fast search functionality. Faiss is an efficient similarity search and clustering library that can quickly process large-scale data and supports similarity searches in high-dimensional spaces. Qdrant is a vector similarity search engine and vector database designed specifically to extend filtering support, making it suitable for various applications such as neural network-based semantic matching and image search. Of course, depending on the actual situation and needs, other values such as the sine or Euclidean distance between the problem vector to be processed and each first sample vector can also be used as the first similarity.
[0046] In one embodiment, after calculating the similarity between the problem to be processed and each of the first sample problems, if each first similarity is less than or equal to a second similarity threshold, the problem to be processed is processed based on the business big model to obtain a second answer to the problem to be processed.
[0047] In this embodiment, if the first similarity corresponding to each first sample question is less than or equal to the second similarity threshold, it indicates that there are no first sample questions in the question-answer pair dataset that are very similar to the question to be processed, nor are there any first sample questions that are relatively similar to the question to be processed. All first sample questions in the question-answer pair dataset have low similarity to the question to be processed. In this case, the business big model is invoked to process the question to be processed and obtain a second answer. Although the question to be processed may contain less semantic information at this time, the question-answer pair dataset can no longer provide any answer to the question to be processed. To avoid a situation where there is no answer, the business big model analyzes the limited semantic information in the question to be processed to obtain a second answer, thereby ensuring that the user can obtain an answer to the question to a certain extent and improving the reliability of the processing of the question to be processed.
[0048] In this embodiment, the problem to be processed is processed based on the business big model to obtain a second answer to the problem. The implementation process of other embodiments of this application can be referred to, and the repeated parts will not be described again.
[0049] In one embodiment, processing the problem to be processed based on a large business model to obtain a second answer to the problem includes: calculating the second similarity between the problem to be processed and each document slice in the business document database, wherein the problem to be processed and the business document database are in the same business scenario; taking the N document slices with the highest second similarity as context slices of the problem to be processed, wherein N is a positive integer; and inputting the problem to be processed and the context slices into the large business model to obtain the second answer output by the large business model.
[0050] In this embodiment, the business document database includes at least one document slice generated from multiple business documents. A business document refers to a document within the business environment where the problem to be addressed exists. Multiple business documents can be collected in advance, as extensively and comprehensively as possible, based on the business environment of the problem. These business documents can be in formats such as doc, txt, ppt, html, csv, pdf, or any other format within the business environment of the problem. When slicing any business document, a large document can be divided into document slices based on a pre-set maximum slice length (e.g., a maximum slice length of 128 characters) combined with various document symbols such as commas, periods, carriage returns, separators, and paragraph marks. Furthermore, the document slicing method of langchain-chatchat for Chinese documents can be referenced, and adjustments can be made based on the document characteristics of the business documents. Here, langchain-chatchat refers to a local knowledge base question-and-answer application implementation based on large models such as Langchain and ChatGLM. Specifically, langchain-chatchat is a question-and-answer application based on a local knowledge base implemented using the Langchain concept, aiming to establish a knowledge base question-and-answer solution that is friendly to Chinese scenarios and open-source models and can run offline. Of course, business documents are not limited to Chinese.
[0051] In this embodiment, among the document slices in the business document database, the N document slices with the highest second similarity to the question to be processed are determined as context slices of the question to be processed. Then, the question to be processed and the context slices are input together into the business big model for processing. Through the context slices, more semantic information related to the question to be processed can be provided to the business big model, thereby improving the accuracy and reliability of the second answer output by the business big model.
[0052] In one embodiment, calculating the second similarity between the problem to be processed and each document slice in the business document database includes: vectorizing the problem to be processed to obtain the problem vector corresponding to the problem to be processed; and calculating the second similarity between the problem vector and the slice vector corresponding to each document slice.
[0053] In this embodiment, the problem to be processed is vectorized, including: inputting the problem to be processed into a vectorization module and obtaining the problem vector output by the vectorization module. The implementation of the vectorization module can be found in other embodiments of this application. Similarly, when vectorizing each document slice, a pre-set vectorization module can be invoked to perform vectorization on each document slice separately, obtaining the slice vector corresponding to each document slice.
[0054] In this embodiment, the second similarity between the problem vector to be processed and each slice vector includes the cosine similarity between the problem vector to be processed and each slice vector, using the cosine value between the vectors as a measure of the similarity between them. Of course, depending on the actual situation and needs, other values such as the sine or Euclidean distance between the problem vector to be processed and each slice vector can also be used as the second similarity.
[0055] In one embodiment, inputting the problem to be processed and the context slice into a large business model to obtain a second answer output by the large business model includes: inputting the problem to be processed and the context slice into a prompting module to obtain a prompting question output by the prompting module, wherein the prompting module is used to generate a prompting question after adding prompting information to the problem to be processed and the context slice; inputting the prompting question into the large business model to obtain a second answer output by the large business model.
[0056] In this embodiment, to further improve the accuracy of the second answer output by the large business model, a prompt technique is used before the question to be processed and the context slice are input into the large business model. The prompt module preprocesses the question to be processed and the context slice, adding prompt information to them before generating a prompt question. Optionally, the specific method by which the prompt module adds prompt information to the question to be processed and the context slice can be pre-customized according to the business environment and actual needs of the question to be processed. For example, assuming the user is a customer service representative, the prompt information is added as follows:
[0057] Please answer the questions based on the information in "A, B, C, D". Please answer strictly according to the text content. If the relevant content cannot be located in the text, please output "Based on the known information, we cannot answer the questions related to {query}". The question is: {query}. Here, `query` is the hyperparameter of the question, and the input is the text content of the question; A, B, C, and D are different context slices.
[0058] In this embodiment, the prompting module not only further improves the accuracy, comprehensiveness, and reliability of the business big model analysis of the problems to be processed, but also provides users with flexible prompting methods, enhancing the user experience.
[0059] In one embodiment, the business big model is obtained through training. The training process of the business big model is as follows: obtain training sample data in the business scenario where the problem to be processed is located, wherein the training sample data includes at least one second question-answer pair, and the second question-answer pair includes a second sample question and a corresponding second sample answer; based on the training sample data, the original big model is trained using model fine-tuning technology; the trained original big model is used as the business big model.
[0060] In this embodiment, the original large model can answer questions based on the input content and the question itself. However, the existing original large model cannot effectively identify the specialized vocabulary within the business scenario of the problem to be processed. This can lead to problems such as segmenting specialized vocabulary into separate words during text segmentation, resulting in a decline in the general ability of the original large model to summarize professional domain texts. Therefore, training sample data from the business scenario of the problem to be processed is used, and model fine-tuning techniques are employed to train the original large model. Fine-tuning techniques are used in deep learning to continuously train and update the model's parameters (weights) in deep networks to obtain a model that achieves the expected results. Optionally, LoRa or p-tuning v2 can be used to fine-tune the original large model, enabling the final business large model to better understand the problem to be processed and contextual slices within the business scenario. Among them, LoRa (Low-Rank Adaptation of Large Language Models) is a low-resource fine-tuning method for large models. Using LoRa, the training parameters are only one ten-thousandth of the total parameters, GPU memory usage is reduced by 2 / 3, and no additional inference time is introduced. p-tuning v2 is an efficient parameter fine-tuning method for LLM.
[0061] In this embodiment, the original large model, which serves as the original basic architecture, can be selected based on the actual situation and business needs of the business scenario in which the problem to be addressed exists. For example, the original large model can be the baichuan2-13b-chat model.
[0062] In one embodiment, the process of obtaining training sample data is as follows: Based on existing original question-answer pairs, similar question-answer pairs are generated through the original large model, and the similar question-answer pairs are used as training sample data. The similar question-answer pairs have a similarity greater than a third similarity threshold with the questions in the original question-answer pairs. The original question-answer pairs are located in the same business scenario as the question to be processed. And / or, business documents related to the original question-answer pairs are obtained, and document question-answer pairs in the business documents are extracted as training sample data. And / or, based on the question to be processed, prompt question-answer pairs are generated through the original large model, and prompt question-answer pairs with a similarity greater than a fourth similarity threshold with the question to be processed are used as training sample data.
[0063] In this embodiment, in order to expand the training sample data, a variety of methods can be used to obtain as much training sample data as possible.
[0064] Existing original question-answer pairs can be collected in advance in the business scenario where the problem to be processed is located. Then, based on the existing original question-answer pairs, similar question-answer pairs are generated through the original large model. The similar question-answer pairs are used as training sample data. A small number of original question-answer pairs are expanded to obtain more similar question-answer pairs. Then, both the original question-answer pairs and the similar question-answer pairs are used as training sample data to enrich the training sample data.
[0065] For the business documents related to the original question-answer pairs, most of the business documents will summarize the common question-answer pairs based on the business document, that is, document question-answer pairs. Then, extract the document question-answer pairs from the business documents related to the original question-answer pairs and add them to the training sample data to further enrich the training sample data.
[0066] If only the problem to be addressed is known, but existing original question-and-answer pairs within the business scenario of the problem cannot be collected, then based on the problem, several hint question-and-answer pairs can be directly generated using the capabilities of the original large model. Then, through similarity filtering based on a fourth similarity threshold, hint question-and-answer pairs with a similarity greater than the fourth similarity threshold to the problem can be used as training sample data to further enrich the training sample data. The specific value of the fourth similarity threshold can be adjusted and set according to the business scenario and actual needs.
[0067] In one embodiment, the process of processing the question-and-answer dataset based on the question to be processed to obtain a first answer to the question can be represented by a corresponding first function button. Users can enable or disable this function by using the first function button. Simultaneously, the process of processing the question based on the business model to obtain a second answer to the question can be represented by a corresponding second function button. Users can enable or disable this function by using the second function button. Users can flexibly enable or disable both the question-and-answer dataset and business model-based processing of the question to be processed according to actual circumstances and needs. If only the question-and-answer dataset-based processing is enabled, all questions to be processed will be processed solely based on the question-and-answer dataset. If only the business model-based processing is enabled, all questions to be processed will be processed solely based on the business model. If both question-and-answer dataset-based and business model-based processing are enabled simultaneously, the question to be processed will be comprehensively processed by combining both methods.
[0068] In a specific implementation, taking a logistics scenario as an example, pre-sales and after-sales customer service staff need to respond to user inquiries based on a vast amount of business documents. While existing business documents are structured, their search methods still rely on keywords entered by customer service users, failing to summarize and output the content of the documents. General-purpose large-scale models can answer questions based on input questions and content, but existing large-scale models cannot effectively recognize specialized terminology in logistics-related business documents. This leads to problems such as segmenting specialized terms into separate words during text segmentation, resulting in a decline in the large-scale model's ability to summarize specialized domain text. Furthermore, existing customer service document search methods still rely on keywords entered by customer service staff, failing to summarize and output the content of the business documents.
[0069] In this embodiment, as Figure 2 The specific implementation process of the question-and-answer data processing method shown is as follows:
[0070] Customer service staff enter the issue to be processed;
[0071] Determine whether the number of characters in the problem to be processed is greater than or equal to the character count threshold thr;
[0072] If not, the embedding module is called to vectorize the question to be processed, obtaining the question vector; then the first similarity between the question vector and each first sample vector in the question-answer pair vector database is calculated, and the first answer is output based on the first similarity; wherein, each first sample vector in the question-answer pair vector database is obtained by calling the embedding module to vectorize each first sample question in the question-answer pair dataset;
[0073] If so, the embedding module is invoked to vectorize the question to be processed, obtaining the question vector; then, the first similarity between the question vector and each first sample vector in the question-answer pair vector database is calculated, and the first answer is output based on the first similarity; and the second similarity between the question vector and each slice vector in the customer service document vector database is calculated, and the N context vectors most similar to the question vector are output based on the second similarity. The slice vectors in the customer service document vector database are obtained by vectorizing each document slice generated from the segmentation of each business document in the customer service document database using the embedding module; the prompt module adds prompt information to the question to be processed and each context slice to obtain the prompt question; the prompt question is input into the business big model to obtain the second answer output by the business big model.
[0074] In this embodiment, when processing the problem to be processed based on the business big model, the business big model is trained and combined with the prompting module to realize Retrieval-Augmented Generation (RAG). RAG is a concept that provides external knowledge sources for the big model, which enables the big model to generate accurate and context-aware answers, while reducing model illusion.
[0075] In this embodiment, a question to be processed is obtained. If the characteristics of the question to be processed meet preset characteristic conditions, the question to be processed is processed based on a question-answer pair dataset and a business big model to obtain an answer to the question to be processed. The question-answer pair dataset includes at least one first question-answer pair, each first question-answer pair including a first sample question and a corresponding first sample answer. The business big model is a big model based on the business scenario in which the question to be processed exists. In the above process, when obtaining an answer to the question to be processed, the question-answer pair dataset or the business big model is not directly processed alone. Instead, based on the characteristics of the question to be processed, both the question-answer pair dataset and the business big model are used comprehensively to improve the accuracy of the answer to the question to be processed.
[0076] Furthermore, this application uses training sample data from business scenarios to fine-tune the original large model, enhancing its understanding of proprietary knowledge within those scenarios. This application proposes a complete RAG-based business large model solution paradigm, which can be adapted to various professional fields based on different business scenarios, exhibiting strong generalization capabilities. This application can leverage the capabilities of RAG and the large model to perform reverse lookups on business documents, enabling further searches of the business document database through both automatically retrieved answers to pending questions and double verification by professionals.
[0077] Exemplary device
[0078] Accordingly, embodiments of this application also provide a question-and-answer data processing device, such as... Figure 3 As shown, the device may include:
[0079] Module 301 is used to acquire problems to be processed;
[0080] Processing module 302 is used to process the question to be processed based on the question-answer pair dataset and the business big model if the question characteristics of the question to be processed meet the preset characteristic conditions, and obtain the answer to the question to be processed. The question-answer pair dataset includes at least one first question-answer pair, and the first question-answer pair includes a first sample question and a corresponding first sample answer. The business big model is a big model based on the business scenario in which the question to be processed is located.
[0081] In one embodiment, the processing module 302 is used to process the question to be processed based on the question-and-answer dataset to obtain a first answer to the question to be processed if the number of characters in the question to be processed is greater than or equal to a character threshold, and to process the question to be processed based on the business big model to obtain a second answer to the question to be processed; wherein, the answer to the question to be processed includes the first answer and the second answer.
[0082] In one embodiment, the processing module 302 is configured to calculate the first similarity between the question to be processed and each of the first sample questions; if there is only one first similarity greater than the first similarity threshold, the first sample answer corresponding to the first sample question with the first similarity greater than the first similarity threshold is taken as the first answer of the question to be processed; if at least two first similarities are greater than the first similarity threshold, the first sample answer corresponding to the first sample question with the highest first similarity is taken as the first standard answer of the question to be processed, and the first sample answers corresponding to other first sample questions with the first similarity greater than the first similarity threshold (excluding the first sample question with the highest first similarity) are taken as the first hint answers of the question to be processed, wherein the first answer includes the first standard answer and the first hint answer; if each first similarity is less than or equal to the first similarity threshold, and at least one first similarity is greater than the second similarity threshold, the first sample answer corresponding to the first sample question with the first similarity greater than the second similarity threshold is taken as the second hint answer of the question to be processed, wherein the first answer includes the second hint answer, and the first similarity threshold is greater than the second similarity threshold.
[0083] In one embodiment, the processing module 302 is used to calculate the similarity between the problem to be processed and each of the first sample problems. If each first similarity is less than or equal to a second similarity threshold, the problem to be processed is processed based on the business big model to obtain a second answer to the problem to be processed.
[0084] In one embodiment, the processing module 302 is used to calculate the second similarity between the problem to be processed and each document slice in the business document database, wherein the problem to be processed and the business scenario in which the business document database is located are the same; the N document slices with the highest second similarity are used as the context slices of the problem to be processed, wherein N is a positive integer; the problem to be processed and the context slices are input into the business big model to obtain the second answer output by the business big model.
[0085] In one embodiment, the processing module 302 is used to input the question to be processed and the context slice into the prompting module to obtain the prompting question output by the prompting module. The prompting module is used to generate the prompting question after adding prompting information to the question to be processed and the context slice; and input the prompting question into the business big model to obtain the second answer output by the business big model.
[0086] In one embodiment, the question-and-answer data processing device further includes a model training module, used to acquire training sample data in the business scenario where the question to be processed is located, wherein the training sample data includes at least one second question-and-answer pair, the second question-and-answer pair including a second sample question and a corresponding second sample answer; based on the training sample data, the original large model is trained using model fine-tuning technology; and the trained original large model is used as the business large model.
[0087] In one embodiment, the model training module is further configured to acquire training sample data as follows: based on existing original question-answer pairs, similar question-answer pairs are generated using the original large model, and these similar question-answer pairs are used as training sample data. The similarity between the questions in the similar question-answer pairs and the questions in the original question-answer pairs is greater than a third similarity threshold. The original question-answer pairs are located in the same business scenario as the question to be processed. And / or, business documents related to the original question-answer pairs are acquired, and document question-answer pairs are extracted from the business documents as training sample data. And / or, based on the question to be processed, prompt question-answer pairs are generated using the original large model, and prompt question-answer pairs with a similarity greater than a fourth similarity threshold to the question to be processed are used as training sample data.
[0088] The question-and-answer data processing apparatus provided in this embodiment belongs to the same concept as the question-and-answer data processing method provided in the above embodiments of this application. It can execute the question-and-answer data processing method provided in any of the above embodiments of this application and has the corresponding functional modules and beneficial effects of the method. Technical details not described in detail in this embodiment can be found in the specific processing content of the question-and-answer data processing method provided in the above embodiments of this application, and will not be repeated here.
[0089] Exemplary electronic devices
[0090] This application also provides an electronic device, such as... Figure 4 As shown, the electronic device includes a memory 400 and a processor 401.
[0091] The memory 400 is connected to the processor 401 and is used to store programs.
[0092] The processor 401 is used to implement the question-and-answer data processing method in the above embodiments by running the program stored in the memory 400.
[0093] Specifically, the aforementioned electronic device may also include: a communication interface 402, an input device 403, an output device 404, and a bus 405.
[0094] The processor 401, memory 400, communication interface 402, input device 403, and output device 404 are interconnected via a bus. Among them:
[0095] Bus 405 may include a pathway for transmitting information between various components of a computer system.
[0096] Processor 401 can be a general-purpose processor, such as a general-purpose central processing unit (CPU), a microprocessor, etc., or an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the program of the present invention. It can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0097] Processor 401 may include a main processor, as well as a baseband chip, modem, etc.
[0098] The memory 400 stores a program that executes the technical solution of this invention, and may also store an operating system and other key business functions. Specifically, the program may include program code, which includes computer operation instructions. More specifically, the memory 400 may include read-only memory (ROM), other types of static storage devices capable of storing static information and instructions, random access memory (RAM), other types of dynamic storage devices capable of storing information and instructions, disk storage, flash memory, etc.
[0099] Input device 403 may include a device for receiving data and information input by the user, such as a keyboard, mouse, camera, scanner, light pen, voice input device, touch screen, pedometer, or gravity sensor.
[0100] Output device 404 may include devices that allow information to be output to a user, such as a display screen, printer, speaker, etc.
[0101] The communication interface 402 may include a device that uses any transceiver to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Network (WLAN), etc.
[0102] The processor 401 executes the program stored in the memory 400 and calls other devices, which can be used to implement the various steps of the question-and-answer data processing method provided in the above embodiments of this application.
[0103] Exemplary computer program products and storage media
[0104] In addition to the methods and devices described above, embodiments of this application may also be computer program products, which include computer program instructions that, when executed by a processor, cause the processor to perform the steps in the question-and-answer data processing method described in the embodiments of this application.
[0105] The computer program product can be written in any combination of one or more programming languages to perform the operations of the embodiments of this application. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0106] Furthermore, embodiments of this application may also be storage media storing a computer program, which is executed by a processor of the steps in the question-and-answer data processing method described in the embodiments of this application.
[0107] For the foregoing method embodiments, in order to simplify the description, they are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0108] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For apparatus embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0109] The steps in the methods of the various embodiments of this application can be adjusted, merged, or deleted in order according to actual needs, and the technical features described in each embodiment can be replaced or combined.
[0110] The modules and sub-modules in the devices and terminals provided in the various embodiments of this application can be merged, divided, and deleted according to actual needs.
[0111] It should be understood that the disclosed terminals, devices, and methods can be implemented in other ways, given the several embodiments provided in this application. For example, the terminal embodiments described above are merely illustrative. For instance, the division of modules or sub-modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple sub-modules or modules may be combined or integrated into another module, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or modules, and may be electrical, mechanical, or other forms.
[0112] The modules or submodules described as separate components may or may not be physically separate. The components that constitute a module or submodule may or may not be physical modules or submodules; that is, they may be located in one place or distributed across multiple network modules or submodules. Some or all of the modules or submodules can be selected to achieve the purpose of this embodiment's solution, depending on actual needs.
[0113] Furthermore, the functional modules or sub-modules in the various embodiments of this application can be integrated into one processing module, or each module or sub-module can exist physically separately, or two or more modules or sub-modules can be integrated into one module. The integrated modules or sub-modules described above can be implemented in hardware or in the form of software functional modules or sub-modules.
[0114] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0115] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software unit executed by a processor, or a combination of both. The software unit can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0116] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0117] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A question and answer data processing method characterized by, The method comprises: acquiring a to-be-processed question; if a question characteristic of the to-be-processed question reaches a preset characteristic condition, processing the to-be-processed question based on a question and answer pair data set and a business large model to obtain an answer to the to-be-processed question, wherein the question and answer pair data set comprises at least one first question and answer pair, the first question and answer pair comprises a first sample question and a corresponding first sample answer, and the business large model is a large model based on a business scenario in which the to-be-processed question is located.
2. The question and answer data processing method according to claim 1, characterized by, The processing, if the question characteristic of the to-be-processed question reaches the preset characteristic condition, the to-be-processed question based on the question and answer pair data set and the business large model to obtain the answer to the to-be-processed question, comprises: if the number of words of the to-be-processed question is greater than or equal to a word number threshold, processing the to-be-processed question based on the question and answer pair data set to obtain a first answer to the to-be-processed question, and processing the to-be-processed question based on the business large model to obtain a second answer to the to-be-processed question; wherein the answer to the to-be-processed question comprises the first answer and the second answer.
3. The question and answer data processing method according to claim 2, characterized by, The processing, based on the question and answer pair data set, the to-be-processed question to obtain the first answer to the to-be-processed question, comprises: calculating a first similarity of the to-be-processed question with each first sample question; if only one of the first similarities is greater than a first similarity threshold, taking the first sample answer corresponding to the first sample question with the first similarity greater than the first similarity threshold as the first answer to the to-be-processed question; if at least two of the first similarities are greater than the first similarity threshold, taking the first sample answer corresponding to the first sample question with the highest first similarity as the first standard answer to the to-be-processed question, and taking the first sample answers corresponding to the other first sample questions with the first similarity greater than the first similarity threshold except for the first sample question with the highest first similarity as first prompt answers to the to-be-processed question, wherein the first answer comprises the first standard answer and the first prompt answers; if each of the first similarities is less than or equal to the first similarity threshold and at least one of the first similarities is greater than a second similarity threshold, taking the first sample answer corresponding to the first sample question with the first similarity greater than the second similarity threshold as a second prompt answer to the to-be-processed question, wherein the first answer comprises the second prompt answer, and the first similarity threshold is greater than the second similarity threshold.
4. The question and answer data processing method according to claim 3, characterized by, After the calculation of the similarity of the to-be-processed question with each first sample question, the method further comprises: if each of the first similarities is less than or equal to the second similarity threshold, processing the to-be-processed question based on the business large model to obtain the second answer to the to-be-processed question.
5. The question and answer data processing method according to claim 2, characterized by, The processing, based on the business large model, the to-be-processed question to obtain the second answer to the to-be-processed question, comprises: calculate a second similarity between the to-be-processed question and each document slice in a business document database, wherein the to-be-processed question is in the same business scenario as the business document database; select N document slices with the highest second similarity as context slices of the to-be-processed question, wherein N is a positive integer; input the to-be-processed question and the context slices into the business large model to obtain a second answer output by the business large model.
6. The question and answer data processing method according to claim 5, characterized by, The inputting of the to-be-processed question and the context slices into the business large model to obtain the second answer output by the business large model comprises: inputting the to-be-processed question and the context slices into a prompt module to obtain a prompt question output by the prompt module, wherein the prompt module is configured to generate the prompt question by adding prompt information to the to-be-processed question and the context slices; inputting the prompt question into the business large model to obtain the second answer output by the business large model.
7. The question and answer data processing method according to any one of claims 1 to 6, characterized in that, The business large model is obtained by training; The training process of the business large model comprises the following steps: obtain training sample data in a business scenario of the to-be-processed question, wherein the training sample data comprises at least one second question and answer pair, and the second question and answer pair comprises a second sample question and a corresponding second sample answer; train an original large model based on the training sample data by using a model fine-tuning technique; use the trained original large model as the business large model.
8. The question and answer data processing method according to claim 7, characterized by, The training sample data is obtained by the following process: generate a similar question and answer pair by using the original large model based on an existing original question and answer pair, and use the similar question and answer pair as the training sample data, wherein the similarity between the question in the similar question and answer pair and the question in the original question and answer pair is greater than a third similarity threshold, and the original question and answer pair is in the same business scenario as the to-be-processed question; and / or, obtain a business document related to the original question and answer pair, extract a document question and answer pair in the business document as the training sample data; and / or, generate a prompt question and answer pair by using the original large model based on the to-be-processed question, and use the prompt question and answer pair with a similarity greater than a fourth similarity threshold to the to-be-processed question as the training sample data.
9. An electronic device, comprising: comprise: a memory and a processor; the memory is connected to the processor and is configured to store programs; the processor is configured to realize the question and answer data processing method of any one of claims 1-8 by running the programs in the memory.
10. A computer program product, characterised in that, comprise computer program instructions; the computer program instructions enable the processor to execute the question and answer data processing method of any one of claims 1-8 when the computer program instructions are run by the processor.