Answer method and device in multi-round question and answer scene, medium and equipment
By analyzing the third question with consistent problem correlation and generating intentions in multiple rounds of question answering systems for knowledge retrieval, problems that are difficult to accurately grasp by user intentions in the prior art are solved, and more accurate and coherent answers are achieved, which improves user experience and system performance.
Patent Information
- Application Number
- CN202510364630.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-26
- Publication Date
- 2025-07-18
AI Technical Summary
The existing multi-round dialogue system is difficult to accurately grasp user intentions when handling complex and coherent dialogues, resulting in inaccurate answers.
By receiving user questions and using the question-and-answer model to generate preliminary answers, analyzing the relevance of the questions, generating a third question consistent with the user's intention for knowledge retrieval, combining the search content to generate more accurate answers, using a caching mechanism to improve response speed, and enhancing the anti-interference and generalization capabilities of the model through adversarial sample training and multi-task learning.
It improves the accuracy and user satisfaction of answers in multiple rounds of Q&A scenarios, enhances context comprehension, ensures the consistency and richness of the answers, and improves the system's response speed and reliability.
Smart Images

Figure CN120336462A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of question - answering systems, and in particular, to a method and device, medium, and equipment for answering in a multi - turn question - answering scenario. Background Art
[0002] With the development of natural language processing technology, multi - turn dialogue systems have been widely used in fields such as intelligent customer service and virtual assistants. However, existing multi - turn dialogue systems often have difficulty accurately grasping the user's intention when dealing with complex and coherent conversations, resulting in inaccurate answers. Summary of the Invention
[0003] In view of the above - mentioned at least one technical problem, embodiments of the present invention provide a method and device, medium, and equipment for monitoring enterprise brand reputation based on a large - model.
[0004] According to a first aspect, the answering method in a multi - turn question - answering scenario provided by embodiments of the present invention includes:
[0005] Receiving a first question from a user;
[0006] Generating a first answer corresponding to the first question by using a question - answering model, and returning the first answer to the user;
[0007] Receiving a second question from the user;
[0008] Analyzing whether the first question and the second question are relevant;
[0009] If the first question and the second question are relevant, then generating a third question consistent with the second question according to the first question and the second question; Figure 1 Generating a third question;
[0010] Performing knowledge retrieval by using the third question to obtain retrieval content;
[0011] Generating a corresponding second answer according to the retrieval content and the second question, and returning the second answer to the user.
[0012] In one embodiment, before generating the first answer corresponding to the first question by using the question - answering model, the method further includes: denoising and normalizing the first question.
[0013] In one embodiment, before generating the first answer corresponding to the first question by using the question - answering model, the method further includes:
[0014] Searching for the first answer corresponding to the first question in a cache;
[0015] If the first answer can be found, then returning the found first answer to the user;
[0016] If not found, execute generating a first answer corresponding to the first question using the Q&A model.
[0017] In one embodiment, analyzing whether the first question and the second question are relevant includes:
[0018] Convert each word in the first question and the second question into their respective corresponding word vectors by means of word embedding;
[0019] Calculate the similarity between each word vector corresponding to each word in the first question and each word vector corresponding to each word in the second question;
[0020] Determine whether the first question and the second question are relevant according to the similarity between each word vector corresponding to each word in the first question and each word vector corresponding to each word in the second question.
[0021] In one embodiment, the method further includes:
[0022] If the first question and the second question are not relevant, generate a second answer corresponding to the second question using the Q&A model, and return the second answer to the user.
[0023] In one embodiment, generating a third question consistent with the second question according to the first question and the second question includes: Figure 1 including:
[0024] Input the first question and the second question into a question generation model, so that the question generation model rewrites the second question to obtain the third question.
[0025] In one embodiment, before inputting the first question and the second question into the question generation model, the method further includes at least one of the following:
[0026] Train the question generation model using adversarial samples;
[0027] Perform joint training through a multi-task learning framework to obtain the question generation model with multi-task processing capabilities;
[0028] Optimize the question generation model using knowledge distillation.
[0029] According to a second aspect, an answering device in a multi-round Q&A scenario provided by an embodiment of the present invention includes:
[0030] A first receiving module, configured to receive a first question from a user;
[0031] A first answering module, configured to generate a first answer corresponding to the first question by using a question-answering model, and return the first answer to the user;
[0032] A second receiving module, configured to receive a second question from the user;
[0033] An association analysis module, configured to analyze whether the first question and the second question are relevant;
[0034] A question generation module, configured to, if the first question and the second question are relevant, generate a third question consistent with the second question according to the first question and the second question; Figure 1
[0035] A knowledge retrieval module, configured to perform knowledge retrieval by using the third question to obtain retrieval content;
[0036] A second answering module, configured to generate a corresponding second answer according to the retrieval content and the second question, and return the second answer to the user.
[0037] In one embodiment, before the first answering module generates the first answer corresponding to the first question by using the question-answering model, it is further configured to: denoise and standardize the first question.
[0038] In one embodiment, before the first answering module generates the first answer corresponding to the first question by using the question-answering model, it is further configured to: search for the first answer corresponding to the first question in the cache; if the first answer can be found, return the found first answer to the user; if the first answer cannot be found, execute generating the first answer corresponding to the first question by using the question-answering model.
[0039] In one embodiment, the association analysis module is specifically configured to: respectively convert each word in the first question and the second question into its corresponding word vector in a word embedding manner; calculate the similarity between each word vector corresponding to each word in the first question and each word vector corresponding to each word in the second question; determine whether the first question and the second question are relevant according to the similarity between each word vector corresponding to each word in the first question and each word vector corresponding to each word in the second question.
[0040] In one embodiment, the apparatus further includes:
[0041] A third answering module, configured to, if the first question and the second question are not relevant, generate a second answer corresponding to the second question by using the question-answering model, and return the second answer to the user.
[0042] In one embodiment, the problem generation module is specifically configured to: input the first problem and the second problem into a problem generation model, so that the problem generation model rewrites the second problem to obtain the third problem.
[0043] In one embodiment, before inputting the first problem and the second problem into the problem generation model, the problem generation module is further configured to perform at least one of the following: training the problem generation model using adversarial samples; performing joint training through a multi-task learning framework to obtain the problem generation model with multi-task processing capabilities; optimizing the problem generation model by means of knowledge distillation.
[0044] According to a third aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed on a computer, the computer is made to execute the method provided in the first aspect.
[0045] According to a fourth aspect, a computing device provided by an embodiment of the present invention includes a memory and a processor. An executable code is stored in the memory. When the processor executes the executable code, the method provided in the first aspect is implemented.
[0046] In the answering method, device, medium, and device in a multi-turn question-and-answer scenario provided by an embodiment of the present invention, when the backend server receives a user's first question, it then uses a question-and-answer model to generate a first answer corresponding to the first question and returns the first answer to the user. When receiving the user's second question, if the first question and the second question are relevant, then according to the first question and the second question, a third question consistent with the second question is generated, and then knowledge retrieval is performed using the third question to obtain retrieval content; finally, according to the retrieval content and the second question, a corresponding second answer is generated and the second answer is returned to the user. By context relevance analysis and question rewriting technology, the model in the embodiment of the present invention can better understand the conversation history, accurately grasp the user's intention, and thus provide more relevant and accurate answers. Moreover, by generating a corresponding second answer based on the retrieval content and the second question, that is, through a knowledge retrieval and question fusion strategy, a more comprehensive and accurate answer can be generated, ensuring the richness and depth of the answer content and improving user satisfaction. Figure 1 BRIEF DESCRIPTION OF THE DRAWINGS It is a schematic flowchart of an answering method in a multi-turn question-and-answer scenario according to an embodiment of the present invention;
[0047] Figure 1 It is a structural block diagram of an answering device in a multi-turn question-and-answer scenario according to an embodiment of the present invention.
[0048] Figure 2 It is a structural block diagram of an answering device in a multi-turn question-and-answer scenario according to an embodiment of the present invention. Specific Embodiment
[0049] In a first aspect, an embodiment of the present invention provides a method for answering questions in a multi-round Q&A scenario. Refer to Figure 1 , the method includes the following steps S110 to S170:
[0050] S110. Receive the first question from the user;
[0051] Specifically, the method provided by the embodiment of the present invention can be executed by a server.
[0052] In an actual scenario, the user inputs the first question through a front-end interface (such as a web page, a mobile application, or a chatbot). The front-end interface should be designed to be simple and easy to use, support multiple input methods (such as text input, speech recognition, etc.), and ensure a good user experience. The front-end performs basic verification on the first question input by the user. For example, it checks whether the input is empty and whether it meets the format requirements (such as the maximum character limit) to reduce invalid requests. After the verification passes, the front-end sends the first question input by the user to the back-end server. Specifically, the HTTP / HTTPS protocol can be used for data transmission to ensure the security and integrity of the data.
[0053] In one embodiment, before generating the first answer corresponding to the first question using the Q&A model, the method may further include: denoising and normalizing the first question.
[0054] It can be seen that after the back-end server receives the first question, it first performs preliminary processing:
[0055] 1. Denoising: Remove irrelevant characters, such as special symbols, HTML tags, etc.
[0056] 2. Normalization: Unify the text format, such as converting case, expanding abbreviations, etc., to ensure the consistency of subsequent processing.
[0057] Of course, the back-end server can also record the received first question in a log for subsequent debugging and analysis.
[0058] S120. Generate the first answer corresponding to the first question using the Q&A model and return the first answer to the user;
[0059] It can be seen that the back-end server calls a pre-trained Q&A model, such as a Q&A model based on Transformer. The model generates a preliminary answer, that is, the first answer, according to the first question. Among them, the model uses the existing knowledge base and pre-trained parameters to quickly give the first answer. The main purpose of this step is to quickly respond to the user's first question and provide a basis for subsequent processing.
[0060] In one embodiment, before generating the first answer corresponding to the first question using the question-and-answer model, the method may further include:
[0061] Search for the first answer corresponding to the first question in the cache;
[0062] If the first answer can be found, return the found first answer to the user;
[0063] If the first answer cannot be found, execute generating the first answer corresponding to the first question using the question-and-answer model.
[0064] It can be seen that in order to improve the response speed, the embodiment of the present invention introduces a cache mechanism, directly obtaining the answer from the cache for common questions instead of calling the model every time.
[0065] In an actual scenario, the first answer is presented to the user through the front end. The front end only shows the first answer and hides the first question, aiming to use the first question as a historical question in the next round of question and answer. Moreover, the front end saves the status information of the current conversation, such as the conversation ID, timestamp, etc., for continuing the conversation in subsequent rounds.
[0066] S130. Receive the second question from the user;
[0067] That is, when the user still has doubts after seeing the first answer on the front end, the user will raise a second question based on the first question, and the back-end server receives the second question. When the user no longer has doubts after seeing the first answer on the front end, the user will raise a second question that has nothing to do with the first question, and the back-end server receives the second question.
[0068] It can be understood that since multi-round conversations are supported, the historical conversation records will be considered during the preliminary answer to ensure the coherence of the answer.
[0069] S140. Analyze whether the first question and the second question are relevant;
[0070] In one embodiment, the analysis of whether the first question and the second question are relevant in S140 may include:
[0071] S141. Convert each word in the first question and the second question into their respective corresponding word vectors in a word embedding manner;
[0072] S142. Calculate the similarity between each word vector corresponding to each word in the first question and each word vector corresponding to each word in the second question;
[0073] S143. Determine whether the first question and the second question are relevant based on the similarity between the word vectors corresponding to the words in the first question and the word vectors corresponding to the words in the second question.
[0074] It can be seen that in order to accurately understand the user's intention in the embodiments of the present invention, it is necessary to analyze the relevance between the new question and the historical question. This step can specifically use semantic analysis technology to identify and extract key information in the context. The specific implementation steps are as follows:
[0075] 1. Obtain the historical conversation
[0076] Dialogue transfer: The front end passes the first question of the previous round as the historical question to the back end together with the second question. The dialogue history can be passed through the API interface to ensure data synchronization between the front end and the back end.
[0077] Dialogue storage: The back-end server maintains a dialogue storage module for saving the historical records of each round of conversations, and supports querying the historical conversation by the conversation ID.
[0078] 2. Semantic analysis technology
[0079] Convert words into vector representations in a word embedding way (such as Word2Vec, GloVe, etc.) to facilitate the calculation of similarity. A pre-trained word vector model can be selected, or a word vector can be trained according to a specific domain. Of course, syntactic analysis tools (such as Stanford Parser, spaCy, etc.) can also be used to parse the sentence structure and extract key syntactic components. Syntactic analysis can help identify the subject-predicate-object relationship in the sentence and further understand the intention of the question.
[0080] 3. Relevance judgment
[0081] By calculating the similarity between the first question and the second question, such as cosine similarity, Jaccard similarity, etc., determine whether the second question is a further question based on the first question. Multiple thresholds can be set, corresponding to different association strengths respectively. If the similarity exceeds the preset threshold, it is considered that the second question is a further question based on the first question; otherwise, the second question is regarded as an independent question.
[0082] S150. If the first question and the second question are relevant, then generate a third question consistent with the meaning of the second question according to the first question and the second question; Figure 1 In one embodiment, the generating, according to the first question and the second question, a third question consistent with the meaning of the second question;
[0083] In one embodiment, the generating, according to the first question and the second question, a third question consistent with the meaning of the second question; Figure 1For the consistent third question, it may include: inputting the first question and the second question into a question generation model, so that the question generation model rewrites the second question to obtain the third question.
[0084] It can be seen that if there is a relevance, the first question and the second question are concatenated to form a new input prompt, which is then given to the question generation model for question rewriting to obtain the third question; if there is no relevance, the second question is directly retained. When concatenating, attention should be paid to the fluency and logic of the sentences.
[0085] That is, if the second question is a further question based on the first question, the second question is rewritten while maintaining the questioning intention unchanged, and the rewritten question always maintains logical consistency with the first question to ensure that the user's intention is not changed. Specifically, methods such as template matching and sequence-to-sequence generation can be used for rewriting.
[0086] S160. Use the third question for knowledge retrieval to obtain retrieval content;
[0087] It can be seen that the rewritten third question is used to retrieve relevant knowledge points from the knowledge base. The knowledge base can be an external knowledge graph, an encyclopedia, etc., to ensure the accuracy and richness of the retrieval results.
[0088] S170. Generate a corresponding second answer according to the retrieval content and the second question, and return the second answer to the user.
[0089] Specifically, text generation technology can be adopted to combine the retrieved knowledge information with the second question and give it to the model to generate a more comprehensive and accurate second answer. The answer fusion strategy can include methods such as template matching and sequence-to-sequence generation to ensure the coherence and integrity of the answer.
[0090] In one embodiment, the method may further include:
[0091] If the first question and the second question have no relevance, use the question-and-answer model to generate a second answer corresponding to the second question, and return the second answer to the user.
[0092] It can be seen that if the second question is an independent new question, the new question is directly retained without being rewritten. Ensure that the original expression of the question is not modified to avoid introducing unnecessary errors. Then directly input the second question into the question-and-answer model to obtain a second answer, and return the second answer to the user.
[0093] In one embodiment, before inputting the first question and the second question into the question generation model, the method may further include at least one of the following:
[0094] Train the problem generation model using adversarial examples;
[0095] Through joint training in a multi-task learning framework, obtain the problem generation model with multi-task processing capabilities;
[0096] Optimize the problem generation model using knowledge distillation.
[0097] It can be seen that in order to enhance the anti-interference ability and generalization ability of the model, the embodiments of the present invention adopt adversarial training, multi-task learning and knowledge distillation techniques. The specific implementation steps are as follows:
[0098] 1. Adversarial training
[0099] Adversarial example generation: Add adversarial examples during the training process to enhance the model's anti-interference ability to noise and abnormal inputs. Adversarial examples can be generated by introducing small perturbations or incorrect information, such as inserting typos or reversing the order of words in the text.
[0100] Robustness testing: Use adversarial examples to test the robustness of the model to ensure that the model can still give reasonable answers when faced with abnormal inputs. The performance of the model can be evaluated through methods such as A / B testing.
[0101] 2. Multi-task learning
[0102] Task selection: Enable the model to learn related tasks while answering questions to improve its generalization ability. Related tasks can include named entity recognition, sentiment analysis, keyword extraction, etc.
[0103] Joint training: Through a multi-task learning framework (such as the multi-task version of BERT) for joint training, share the underlying feature representations, and improve the overall performance of the model. The weights of different tasks can be dynamically adjusted during training to ensure the balance between tasks.
[0104] 3. Knowledge distillation
[0105] Teacher-student framework: Transfer the knowledge of a large and complex model to a lightweight model to improve the inference efficiency. The large model guides the learning of the lightweight model through the teacher-student framework to ensure that the lightweight model can reach a high performance level.
[0106] Distillation loss function: Introduce a distillation loss function, such as KL divergence, to measure the difference between the output distributions of the teacher model and the student model, and optimize the parameters of the student model.
[0107] In an actual scenario, the performance of the model can also be evaluated using a test set, and the model can be iteratively optimized according to the evaluation results to further improve the accuracy of the answers. The specific implementation steps are as follows:
[0108] 1. Evaluation Metrics: Evaluate the performance of the model on the test set, including metrics such as accuracy, recall, F1-score, etc. Natural language generation evaluation metrics can also be introduced to comprehensively evaluate the performance of the model.
[0109] 2. Test Set Construction: The test set should cover a variety of dialogue scenarios and question types to ensure the comprehensiveness and reliability of the evaluation results. Samples can be extracted from real user conversations to simulate actual application scenarios.
[0110] 3. Hyperparameter Tuning: Iteratively optimize the model based on the evaluation results, adjust the model parameters and structure to further improve the answer accuracy. Specifically, methods such as grid search and random search can be used to find the optimal hyperparameter combination.
[0111] 4. Architecture Improvement: Explore new model architectures or improve existing architectures, such as introducing attention mechanisms, memory networks, etc., to enhance the model's expressive ability and generalization ability.
[0112] 5. Continuous Learning: Establish a continuous learning mechanism to regularly update the model so that it can adapt to the changing user needs and dialogue scenarios.
[0113] The embodiments of the present invention have the following beneficial effects:
[0114] 1. Significantly improve answer accuracy: Through a comprehensive solution, ensure that the model can accurately grasp the user's intention and generate more accurate answers. Context relevance analysis and question rewriting techniques enable the model to better understand the dialogue history, thereby providing more relevant and accurate answers.
[0115] 2. Enhance context understanding ability: Use semantic analysis technology to identify and extract key information in the context to ensure that the model can understand the dialogue history and current state.
[0116] 3. Improve training strategies: Implement adversarial training to enhance the model's anti-interference ability to noise and abnormal inputs. Adopt a multi-task learning strategy to enable the model to learn related tasks while answering questions, improving its generalization ability. Use knowledge distillation technology to transfer the knowledge of large complex models to lightweight models, improving the inference efficiency.
[0117] 4. Effectively integrate external knowledge: Through the knowledge retrieval and question fusion strategy, combine the information of the external knowledge base and the question and hand it over to the model to generate more comprehensive and accurate answers. This fusion strategy ensures the richness and depth of the answer content and improves user satisfaction.
[0118] 5. Continuous iterative optimization: Evaluate the performance of the model on the test set, and iteratively optimize the model based on the evaluation results to further improve the accuracy of the answers. The iterative optimization mechanism ensures that the model can continuously improve and adapt to new dialogue scenarios and requirements.
[0119] 6. Improve user experience and performance: Through the above comprehensive solution, the accuracy of the model's answers in multi-turn Q&A scenarios has been significantly improved, enhancing the user experience. The overall performance of the system has been optimized, with faster response speed, higher answer quality, and enhanced reliability and stability.
[0120] 7. Broad application prospects: This method is applicable to various dialogue systems, including scenarios such as intelligent customer service, virtual assistants, and educational tutoring. It has important practical value and broad application prospects, and can promote the development of natural language processing and artificial intelligence technologies.
[0121] In summary, the present invention not only significantly improves the accuracy of the model's answers in multi-turn Q&A scenarios, but also optimizes the response speed and system performance, enhances the user experience, and has important practical value and broad application prospects.
[0122] In a second aspect, an embodiment of the present invention provides an answering device in a multi-turn Q&A scenario. Refer to Figure 2 , the device 100 includes:
[0123] A first receiving module 110, configured to receive a first question from a user;
[0124] A first answering module 120, configured to generate a first answer corresponding to the first question by using a Q&A model and return the first answer to the user;
[0125] A second receiving module 130, configured to receive a second question from the user;
[0126] A correlation analysis module 140, configured to analyze whether the first question and the second question are relevant;
[0127] A question generation module 150, configured to, if the first question and the second question are relevant, generate a third question consistent with the second question according to the first question and the second question; Figure 1 and return the third question;
[0128] A knowledge retrieval module 160, configured to perform knowledge retrieval by using the third question to obtain retrieval content;
[0129] A second answering module 170, configured to generate a corresponding second answer according to the retrieval content and the second question and return the second answer to the user.
[0130] In one embodiment, before the first answer module generates the first answer corresponding to the first question by using a question-answering model, it is further configured to: denoise and standardize the first question.
[0131] In one embodiment, before the first answer module generates the first answer corresponding to the first question by using a question-answering model, it is further configured to: search for the first answer corresponding to the first question in a cache; if the first answer can be found, return the found first answer to the user; if the first answer cannot be found, then execute generating the first answer corresponding to the first question by using the question-answering model.
[0132] In one embodiment, the association analysis module is specifically configured to: convert each word in the first question and the second question into its corresponding word vector respectively by using word embedding; calculate the similarity between each word vector corresponding to each word in the first question and each word vector corresponding to each word in the second question; determine whether the first question and the second question are relevant according to the similarity between each word vector corresponding to each word in the first question and each word vector corresponding to each word in the second question.
[0133] In one embodiment, the device further includes:
[0134] A third answer module, configured to, if the first question and the second question are not relevant, generate the second answer corresponding to the second question by using the question-answering model, and return the second answer to the user.
[0135] In one embodiment, the question generation module is specifically configured to: input the first question and the second question into a question generation model, so that the question generation model rewrites the second question to obtain the third question.
[0136] In one embodiment, before the question generation module inputs the first question and the second question into the question generation model, it is further configured to perform at least one of the following: train the question generation model by using adversarial samples; perform joint training through a multi-task learning framework to obtain the question generation model with multi-task processing capabilities; optimize the question generation model by using knowledge distillation.
[0137] It can be understood that the explanations, specific implementation manners, beneficial effects, examples, etc. of the relevant content in the device provided by the embodiments of the present invention can refer to the corresponding parts in the method provided in the first aspect, and will not be elaborated here.
[0138] In a third aspect, an embodiment of the present invention provides a computer-readable medium, on which computer instructions are stored. When the computer instructions are executed by a processor, the processor is caused to execute the method provided in the first aspect.
[0139] Specifically, a system or device equipped with a storage medium can be provided, on which software program code for implementing the functions of any one of the above embodiments is stored, and the computer (or CPU or MPU) of the system or device is caused to read and execute the program code stored in the storage medium.
[0140] In this case, the program code read from the storage medium itself can implement the functions of any one of the above embodiments. Therefore, the program code and the storage medium storing the program code constitute a part of the present invention.
[0141] Examples of storage media for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Optionally, the program code can be downloaded from a server computer via a communication network.
[0142] In addition, it should be clear that not only can the functions of any one of the above embodiments be implemented by executing the program code read by the computer, but also by causing an operating system or the like operating on the computer based on the instructions of the program code to complete part or all of the actual operations.
[0143] In addition, it can be understood that the program code read from the storage medium is written into a memory provided in an expansion board inserted into the computer or a memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU or the like installed on the expansion board or the expansion module is caused to execute part or all of the actual operations, thereby implementing the functions of any one of the above embodiments.
[0144] It can be understood that for the explanations, specific implementation manners, beneficial effects, examples, etc. of the content related to the computer-readable medium provided in the embodiments of the present invention, reference can be made to the corresponding parts in the method provided in the first aspect, and details are not described herein again.
[0145] In a fourth aspect, an embodiment of this specification provides a computing device, including a memory and a processor. An executable code is stored in the memory. When the processor executes the executable code, the method in any one of the embodiments described in the specification is implemented.
[0146] It should be understood that for the explanations, specific implementation manners, beneficial effects, examples, etc. of the relevant content in the computing device provided in the embodiments of the present invention, reference may be made to the corresponding parts in the method provided in the first aspect, and details are not described herein again.
[0147] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the device embodiments, since they are basically similar to the method embodiments, the descriptions are relatively simple, and for the relevant parts, reference can be made to the partial descriptions of the method embodiments.
[0148] Those skilled in the art should be able to realize that in the above one or more examples, the functions described in the present invention can be implemented by hardware, software, add-ons, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.
[0149] The specific implementation manners described above further elaborate on the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above are only the specific implementation manners of the present invention and are not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solution of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for answering in a multi-round Q&A scenario, characterized in that, Including: Receiving a first question from a user; Generating a first answer corresponding to the first question using a question-and-answer model and returning the first answer to the user; Receiving a second question from the user; Analyzing whether the first question and the second question are relevant; If the first question and the second question are relevant, generating a third question consistent with the intention of the second question based on the first question and the second question; Performing knowledge retrieval using the third question to obtain retrieval content; Generating a corresponding second answer based on the retrieval content and the second question and returning the second answer to the user.
2. The method according to claim 1, characterized in that, Before generating the first answer corresponding to the first question using the question-and-answer model, the method further includes: Denosing and normalizing the first question.
3. The method according to claim 1, wherein Before generating the first answer corresponding to the first question using the question-and-answer model, the method further includes: Searching for the first answer corresponding to the first question in a cache; If found, returning the found first answer to the user; If not found, performing generating the first answer corresponding to the first question using the question-and-answer model.
4. The method according to claim 1, wherein The analyzing whether the first question and the second question are relevant includes: Converting each word in the first question and the second question into their respective corresponding word vectors respectively in a word embedding manner; Calculating the similarity between each word vector corresponding to each word in the first question and each word vector corresponding to each word in the second question; Determining whether the first question and the second question are relevant based on the similarity between each word vector corresponding to each word in the first question and each word vector corresponding to each word in the second question.
5. The method according to claim 1, wherein Also including: If the first question and the second question are not relevant, generating a second answer corresponding to the second question using the question-and-answer model and returning the second answer to the user.
6. The method according to claim 1, wherein The generating a third question consistent with the intention of the second question based on the first question and the second question includes: Inputting the first question and the second question into a question generation model so that the question generation model rewrites the second question to obtain the third question.
7. The method according to claim 6, wherein Before inputting the first question and the second question into the question generation model, the method further includes at least one of the following: Training the question generation model using adversarial samples; Performing joint training through a multi-task learning framework to obtain the question generation model with multi-task processing capabilities; Optimizing the question generation model using knowledge distillation.
8. An answering device in a multi-round question-and-answer scenario, characterized in that, Including: A first receiving module for receiving a first question from a user; A first answering module for generating a first answer corresponding to the first question using a question-and-answer model and returning the first answer to the user; A second receiving module for receiving a second question from the user; A relevance analysis module for analyzing whether the first question and the second question are relevant; A problem generation module, configured to generate a third problem consistent with the intention of the second problem according to the first problem and the second problem if the first problem and the second problem are relevant; A knowledge retrieval module, configured to perform knowledge retrieval using the third problem to obtain retrieval content; A second answer module, configured to generate a corresponding second answer according to the retrieval content and the second problem, and return the second answer to the user.
9. A computer-readable storage medium, characterized in that, A computer program is stored thereon, and when the computer program is executed in a computer, the computer is made to execute the method according to any one of claims 1 to 7.
10. A computing device, characterized in that, It includes a memory and a processor. An executable code is stored in the memory. When the processor executes the executable code, the method according to any one of claims 1 to 7 is implemented.