Multi-round question and answer model training method, multi-round question and answer method and related device

By determining the attribute relationship between the current round of question-and-answer problem in multiple rounds of question-and-answer model training, and adjusting the model parameters using matching prompt instructions, the problem of low answer prediction accuracy in the existing multi-round question-and-answer model training methods is solved, achieving higher answer prediction accuracy and adaptability.

CN120069061APending Publication Date: 2025-05-30IFLYTEK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510057978.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-14
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

The existing multi-round question-and-answer model training methods are not highly accurate enough.

Method used

By using at least one round of questions in the multi-round question-answer training data as the current round question, determining its attribute relationship with the historical round question, obtaining matching prompt instructions for big model answer prediction, and adjusting model parameters based on the predicted answer and reference answer.

Benefits of technology

The accuracy of the multi-round question-and-answer model for the current round of question-and-answer model has been improved, and it can adapt to user questions with diverse attributes during multiple rounds of question-and-answer.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120069061A_ABST
    Figure CN120069061A_ABST
Patent Text Reader

Abstract

The invention discloses a training method of a multi-round question and answer model, a multi-round question and answer method and a related device. The multi-round question and answer model training method comprises the following steps: respectively taking at least one round of question in multi-round question and answer training data as a current round of question, and determining an attribute relationship between the current round of question and a historical round of question; a prompt instruction with the prompt type matched with the attribute relation is obtained and serves as a current prompt instruction corresponding to the current round of questions, and the prompt instruction is used for instructing the large model to conduct answer prediction; performing answer prediction on the current round of questions based on the current prompt instruction by using the large model to obtain predicted answers corresponding to the current round of questions; and based on the predicted answer and the reference answer corresponding to the at least one round of question, adjusting parameters of the large model to obtain a multi-round question and answer model. According to the scheme, the multi-round question and answer model obtained through training can adapt to user questions with diversified attributes in the multi-round question and answer process, and the accuracy of answer prediction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of natural language processing, and in particular, to a training method for a multi-turn question answering model, a multi-turn question answering method, a training device for a multi-turn question answering model, a multi-turn question answering device, an electronic device, and a computer-readable storage medium. Background Art

[0002] With the popularization of intelligent devices and the development of the Internet, the demand for human-computer interaction is increasing continuously. Multi-turn Question Answering (Multi-turn QA), as one of the important human-computer interaction methods, has been widely applied in multiple fields such as academia and industry.

[0003] During a multi-turn question answering process, the multi-turn question answering system and the user solve the user's needs through multiple questions and answers. The process of a single question and answer between the multi-turn question answering system and the user may include: receiving a question input by the user; performing semantic parsing on the question; and generating an answer based on the semantic parsing result to obtain a predicted answer.

[0004] One of the implementation ways of existing multi-turn question answering methods is an artificial intelligence model with multi-turn question answering capabilities. Before applying the artificial intelligence model to multi-turn question answering, it needs to be trained to enable it to have multi-turn question answering capabilities. However, the accuracy of answer prediction by the artificial intelligence model trained by the existing training methods is not high enough. Summary of the Invention

[0005] The present application provides a training method for a multi-turn question answering model, a multi-turn question answering method, a training device for a multi-turn question answering model, a multi-turn question answering device, an electronic device, and a computer-readable storage medium. It can solve the problem that the accuracy of answer prediction by the artificial intelligence model trained by the existing training methods is not high enough.

[0006] The present application provides a training method for a multi-turn question answering model, including: respectively using at least one round of questions in the multi-turn question answering training data as the current round of questions, and determining the attribute relationship between the current round of questions and the historical round of questions; obtaining a hint instruction whose hint type matches the attribute relationship as the current hint instruction corresponding to the current round of questions, where the hint instruction is used to instruct the large model to perform answer prediction; using the large model to perform answer prediction on the current round of questions based on the current hint instruction to obtain a predicted answer corresponding to the current round of questions; and adjusting the parameters of the large model based on the predicted answers and reference answers corresponding to at least one round of questions to obtain a multi-turn question answering model.

[0007] This application provides a multi-round question-and-answer method, including: obtaining the target-round question in the multi-round question-and-answer process; using a multi-round question-and-answer model to predict an answer to the target-round question to obtain the target-round answer; wherein, the multi-round question-and-answer model is trained based on the foregoing training method.

[0008] This application provides a training device for a multi-round question-and-answer model, including: a determination module, an acquisition module, a prediction module, and an adjustment module. Among them, the determination module is used to respectively use at least one round of questions in the multi-round question-and-answer training data as the current-round question, and determine the attribute relationship between the current-round question and the historical-round questions; the acquisition module is used to obtain a prompt instruction whose prompt type matches the attribute relationship as the current prompt instruction corresponding to the current-round question, wherein the prompt instruction is used to instruct a large model to perform answer prediction; the prediction module is used to use the large model to predict an answer to the current-round question based on the current prompt instruction to obtain the predicted answer corresponding to the current-round question; the adjustment module is used to adjust the parameters of the large model based on the predicted answers and reference answers corresponding to at least one round of questions to obtain a multi-round question-and-answer model.

[0009] This application provides a multi-round question-and-answer device, including: an acquisition module, a prediction module. Among them, the acquisition module is used to obtain the target-round question in the multi-round question-and-answer process; the prediction module is used to use a multi-round question-and-answer model to predict an answer to the target-round question to obtain the target-round answer; wherein, the multi-round question-and-answer model is trained based on the foregoing training method.

[0010] This application provides an electronic device, including a memory and a processor, and the processor is used to execute program instructions stored in the memory to implement the above method.

[0011] This application provides a computer-readable storage medium, on which program instructions are stored, and when the program instructions are executed by a processor, the above method is implemented.

[0012] In the above solution, during the training of the large model using the multi-round question-and-answer training data, with the attributes of the historical-round questions as a reference, the attribute relationship between the current-round question and the historical-round questions is determined, and the prompt instruction whose prompt type matches the attribute relationship is used for the large model to predict the answer to the current-round question, which can make the answer prediction of the large model for the current-round question match the attribute relationship. Thus, the training effect can be improved, and furthermore, the trained multi-round question-and-answer model can adapt to user questions with diverse attributes in the multi-round question-and-answer process, improving the accuracy of answer prediction.

[0013] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and do not limit this application. Brief Description of the Drawings

[0014] The accompanying drawings here are incorporated into the specification and form a part of this specification. These drawings illustrate embodiments consistent with the present application and, together with the specification, are used to explain the technical solutions of the present application.

[0015] Figure 1 It is a schematic flowchart of an embodiment of the training method for a multi-turn question-answering model provided by the present application;

[0016] Figure 2 It is a schematic flowchart of an embodiment of the training method for a multi-turn question-answering model provided by the present application;

[0017] Figure 3 It is a schematic flowchart of an embodiment of the training method for a multi-turn question-answering model provided by the present application;

[0018] Figure 4 It is a schematic flowchart of an embodiment of the training method for a multi-turn question-answering model provided by the present application;

[0019] Figure 5 It is a schematic flowchart of an embodiment of the training method for a multi-turn question-answering model provided by the present application;

[0020] Figure 6 It is a schematic flowchart of an embodiment of the training method for a multi-turn question-answering model provided by the present application;

[0021] Figure 7 It is a schematic flowchart of the training method for implementing a multi-turn question-answering model in the training architecture of the present application;

[0022] Figure 8 It is a schematic flowchart of an embodiment of the multi-turn question-answering method provided by the present application;

[0023] Figure 9 It is a schematic structural diagram of an embodiment of the training device for a multi-turn question-answering model provided by the present application;

[0024] Figure 10 It is a schematic structural diagram of an embodiment of the multi-turn question-answering device provided by the present application;

[0025] Figure 11 It is a schematic structural diagram of an embodiment of the electronic device of the present application;

[0026] Figure 12 It is a schematic structural diagram of an embodiment of the computer-readable storage medium of the present application. Detailed implementation manners

[0027] The solutions of the embodiments of the present application will be described in detail below with reference to the accompanying drawings of the specification.

[0028] In the following description, specific details such as specific system architectures, interfaces, and technologies are presented for the purpose of illustration rather than limitation, in order to provide a thorough understanding of the present application.

[0029] The term "and / or" in this article is merely a description of the association relationship between associated objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this article generally represents an "or" relationship between the associated objects before and after. In addition, "multiple" in this article means two or more than two. In addition, the term "at least one" in this article means any one of multiple types or any combination of at least two of multiple types. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set composed of A, B, and C.

[0030] The training method for the multi-round question-and-answer model and the multi-round question-and-answer method provided by the present application can be applied to various multi-round question-and-answer requirement scenarios. For example, it can be applied to open-domain question answering (ODQA) or specific-domain question answering.

[0031] Figure 1 It is a schematic flowchart of an embodiment of the training method for the multi-round question-and-answer model provided by the present application. As Figure 1 shown, in this embodiment, the training method for the multi-round question-and-answer model may include the following steps:

[0032] S11: Respectively use at least one round of questions in the multi-round question-and-answer training data as the current round of questions, and determine the attribute relationship between the current round of questions and the historical round of questions.

[0033] The multi-round question-and-answer training data is a sequence of question-and-answer pairs, and this sequence of question-and-answer pairs includes multiple rounds of question-and-answer pairs with a chronological order. Each round of question-and-answer pair includes the question of that round and the corresponding reference answer. For example, the multi-round question-and-answer training data is:

[0034] {(Q1, A1), (Q2, A2), (Q3, A3)}.

[0035] Among them, (Q1, A1), (Q2, A2), and (Q3, A3) respectively represent the first, second, and third rounds of question-and-answer pairs. Q1, Q2, and Q3 respectively represent the first, second, and third rounds of questions, and A1, A2, and A3 respectively represent the first, second, and third rounds of reference answers.

[0036] At least one round of questions in the multi-round question-and-answer training data is used for the training of the training method provided by the present application. Respectively using at least one round of questions in the multi-round question-and-answer training data as the current round of questions means that each round of questions in the at least one round of questions used for training is respectively used as the current round of questions.

[0037] The historical rounds refer to the rounds that participated in the training and whose training time was prior to the current round. The historical round problem can be the problem of the previous round, or can be the problems of the previous two rounds, or can be the problems of all historical rounds.

[0038] The problem attributes can include at least one of the problem domain, problem theme, problem type, etc. The problem domain can include science, technology, history, daily life, etc. The problem themes include career development themes, travel themes, legal themes, family themes, etc. The problem type represents the way of asking questions, including method type, advice type, opinion type, prediction type, analysis type, creation type, etc. The method type refers to asking about the methods to solve problems, such as life, work skills, learning methods, etc. The advice type refers to asking for advice on giving a certain behavior or decision, such as travel guides, recipes, songs, websites, etc. The opinion type refers to asking for the subjective views on a certain thing or person. The prediction type refers to asking about the future situation of things. The analysis type refers to analyzing things or people. The creation type refers to problems that have not occurred or are impossible to occur in reality and require innovative thinking and imagination.

[0039] The attribute relationship can be the same attributes, different attributes, or can be attribute association, non-attribute association, etc. For example, the type of the current round problem is the same as the type of the historical round problem, or the type of the current round problem is different from the type of the historical round problem. Another example, the type of the current round problem is associated with the theme of the historical round problem (expanded around the same theme), or the type of the current round problem is not associated with the theme of the historical round problem (expanded around different themes). Another example, there is a theme of the historical round problem associated with the theme of the current round problem, or there is no theme of the historical round problem associated with the theme of the current round problem. Another example, the domain of the current round problem is the same as the domain of the historical round problem, or the domain of the current round problem is different from the domain of the historical round problem.

[0040] The attribute relationship between the current round problem and the historical round problem can characterize whether the attributes of the current round problem (such as the problem type) have changed relative to the attributes of the historical round problem, whether the current round problem and the historical round problem are expanded around the same attribute (such as the problem theme, problem domain), and so on. For example, the same attributes indicate that the attributes have not changed, and different attributes indicate that the attributes have changed. Attribute association indicates that the current round problem and the historical round problem are expanded around the same attribute, and non-attribute association indicates that the current round problem and the historical round problem are expanded around different attributes.

[0041] S12: Obtain the hint instruction whose hint type matches the attribute relationship as the current hint instruction corresponding to the current round problem.

[0042] Among them, the hint instruction is used to instruct the large model to make answer predictions.

[0043] The hint types of hint instructions for matching different attribute relationships are different.

[0044] In some embodiments, when the attribute relationship is that the attributes are the same, the hint instructions of the matching hint type do not include the hints related to the attributes of the current round of questions. When the attribute relationship is that the attributes are different, the hint instructions of the matching hint type include the hints related to the attributes of the current round of questions. The hints related to the attributes of the current round of questions can instruct the large model to perform answer prediction according to the personalized requirements matching the current round of questions, or instruct the large model to perform answer prediction based on the historical round of question-and-answer pairs matching the current round of questions, etc., improving the accuracy of the large model in performing answer prediction.

[0045] It can be understood that when the attribute relationship is that the attributes are different, it means that the attributes of the current round of questions have not changed relative to the attributes of the historical round of questions. Attributes will affect the accuracy of the large model in performing answer prediction. Therefore, it is necessary to give hints related to the changed attributes during the process of the large model performing answer prediction, so that the answer prediction of the large model adapts to the change of attributes, thereby improving the accuracy of the large model in performing answer prediction. When the attribute relationship is that the attributes are the same, it means that the attributes of the current round of questions have changed relative to the attributes of the historical round of questions, and the attributes have no influence on the accuracy of the large model's answer prediction. Therefore, there is no need to give hints related to the changed attributes during the process of the large model performing answer prediction.

[0046] In some embodiments, when the attribute relationship is that there are historically relevant questions with attribute associations, the hint instructions of the matching hint type include the associated historical round hints. When the attribute relationship is that there are no historically relevant questions with attribute associations, the hint instructions of the matching hint type do not include the associated historical round hints. The associated historical round hints can instruct the large model to perform answer prediction on the historical round question pairs associated with the attributes of the current round of questions, etc.

[0047] In some embodiments, the hint types include a first hint type and a second hint type. The hint instructions of the first hint type are used to instruct the large model to perform answer prediction based on the first associated historical round of question-and-answer pairs. The hint instructions of the second hint type are used to instruct the large model to perform answer prediction according to the personalized requirements matching the current round of questions, or to instruct the large model to perform answer prediction based on the second associated historical round of question-and-answer pairs and according to the personalized requirements. Among them, the first associated historical round of question-and-answer pairs is at least one historical round of question-and-answer pairs in the multi-round question-and-answer training data, and the second associated historical round of question-and-answer pairs is the historical round of question-and-answer pairs in the multi-round question-and-answer training data that match the current round of questions.

[0048] It can be understood that the first associated historical round of question-and-answer pairs and the second associated historical round of question-and-answer pairs can improve the historical inheritance of answer prediction.

[0049] In some embodiments, the first associated historical round of question-answer pairs includes the first associated historical round of questions and the corresponding reference answers, and the second associated round of question-answer pairs includes the second associated historical round of questions and the corresponding reference answers. In some embodiments, the first associated historical round of question-answer pairs includes the first associated historical round of questions and the corresponding predicted answers, and the second associated round of question-answer pairs includes the second associated historical round of questions and the corresponding predicted answers. The predicted answers are obtained by using a large model to predict answers during the training process.

[0050] In some embodiments, the personalized requirement matching the current round of questions may be a personalized requirement matching the first attribute of the current round of questions. The historical round of question-answer pairs matching the current round of questions may be the historical round of question-answer pairs matching the second attribute of the current round of questions. The first attribute and the second attribute may be the same attribute or different attributes. For example, the first attribute is the question type, and the second attribute is the question topic. The first associated historical round of question-answer pairs may be specific historical round of question-answer pairs or any historical round of question-answer pairs (without limitation). The specific historical round of question-answer pairs may be all rounds of question-answer pairs, the previous round of question-answer pairs, the question-answer pairs associated with the topic of the current round of questions, the question-answer pairs of the same type as the current round of questions, etc.

[0051] In some embodiments, the prompting instructions of the first prompt type include the prompt for referring to the previous context (i.e., the first associated historical round of question-answer pairs) when predicting the answer. In some embodiments, the prompting instructions of the first prompt type include the previous context (i.e., the first associated historical round of question-answer pairs) that needs to be referred to when predicting the answer. In some embodiments, the prompting instructions of the first type include the current round of questions and the prompt for referring to the previous context. In some embodiments, the prompting instructions of the first type include the current round of questions and the previous context that needs to be referred to.

[0052] In some embodiments, the prompting instructions of the second type include the personalized requirement matching the current round of questions and the historical round of question-answer pairs matching the current round of questions (i.e., the second associated historical round of question-answer pairs). In some embodiments, the prompting instructions of the second type include the personalized requirement matching the current round of questions, the historical round of question-answer pairs matching the current round of questions, and the current round of questions. In some embodiments, the prompting instructions of the second type include the personalized requirement matching the current round of questions, the prompt for referring to the historical round of question-answer pairs (i.e., the second associated historical round of question-answer pairs) that needs to be referred to when predicting the answer, and the current round of questions.

[0053] In some embodiments, the personalized requirement includes the paradigm of the predicted answer. The paradigm includes reply format, effect, coherence, logic, subheadings, etc. In some embodiments, the personalized requirement further includes the background of the current round of questions, etc. For example, when the question type is a method type, the corresponding personalized requirement points out the need for practical and effective methods.

[0054] S13: Use the large model to predict the answer to the current round of question based on the current prompt instruction, and obtain the predicted answer corresponding to the current round of question.

[0055] Prompt instructions of different prompt types are matched with different attribute relationships and are used for the answer prediction of the large model. It can be regarded as selectively prompting the answer prediction of the large model according to different attribute relationships, or enhancing the current round of question selectively using different types of prompt instructions.

[0056] S14: Based on the predicted answers and reference answers corresponding to at least one round of questions, adjust the parameters of the large model to obtain a multi-round Q&A model.

[0057] In this embodiment, the training method for the large model includes but is not limited to autoregressive training.

[0058] It can be understood that the large model is an artificial intelligence model pre-trained on a large-scale dataset. The large model has learned knowledge during the pre-training process and can be used for multi-round Q&A. After long-term research by the inventors of this application, it is found that the attributes of user questions involved in multi-round Q&A tend to be diversified, and the large model cannot adapt to user questions with diversified attributes when making answer predictions, resulting in inaccurate answer prediction results. The training method provided in this application is equivalent to further adjusting the parameters of the large model on the basis of pre-training, so that the finally obtained multi-round Q&A model can adapt to user questions with diversified attributes.

[0059] Through the implementation of this embodiment, during the training process of the large model using multi-round Q&A training data, with the attributes of historical round questions as a reference, determine the attribute relationship between the current round of question and historical round questions, and use the prompt instructions whose prompt types are matched with the attribute relationship for the large model to predict the answer to the current round of question, which can make the answer prediction of the large model for the current round of question match the attribute relationship. Thus, the training effect can be improved, and furthermore, the trained multi-round Q&A model can adapt to user questions with diversified attributes in the multi-round Q&A process and improve the accuracy of answer prediction.

[0060] Figure 2 It is a schematic flowchart of an embodiment of the training method for the multi-round Q&A model provided in this application. This embodiment is a further expansion of the above embodiment. The question attributes include question types. The attribute relationship is that the question types are the same or different. As Figure 2 shown, in this embodiment, S21 is a further expansion of S11, and S22 - S23 are further expansions of S12. Specifically as follows:

[0061] S21: Determine whether the current question type is the same as the previous question type.

[0062] Wherein, the current question type is the type of the current round of questions, and the previous question type is the type of the previous round of questions.

[0063] In some embodiments, a type change discrimination model can be used to determine whether the current question type is the same as the previous question type.

[0064] In some embodiments, the matching degree between the current round of questions and the previous round of questions can be obtained, and based on the matching degree, it can be determined whether the current question type is the same as the previous question type.

[0065] In response to the current question type being the same as the previous question type, execute S22. In response to the current question type being different from the previous question type, execute S23.

[0066] S22: Obtain the prompt instruction of the first prompt type.

[0067] In S22, the prompt instruction of the first prompt type is used to instruct the large model to perform answer prediction based on the first associated historical round of Q&A pairs. The first associated historical round of Q&A pairs can be all historical round of Q&A pairs, or the previous historical round of Q&A pairs, or all historical Q&A pairs of the current question type, or any historical round of Q&A pairs (without restrictions on historical round of Q&A pairs).

[0068] S23: Obtain the prompt instruction of the second prompt type.

[0069] In S23, the prompt instruction of the second prompt type is used to instruct the large model to perform answer prediction according to the personalized requirements matching the current question type, or to instruct the large model to perform answer prediction based on the second associated historical round of Q&A pairs and according to the personalized requirements. The second associated historical round of Q&A pairs can be at least one of the historical Q&A pairs associated with the current question theme and the historical Q&A pairs with the same current question type.

[0070] For other detailed descriptions of this embodiment, please refer to the previous embodiments and will not be elaborated here.

[0071] Through the implementation of this embodiment, it is possible to selectively obtain the prompt instruction of the first prompt type and the prompt instruction of the second prompt type based on whether the question types of the current round of questions and the previous round of questions are the same.

[0072] Figure 3 It is a schematic flowchart of an embodiment of the training method of the multi-round Q&A model provided by the present application. This embodiment is a further expansion of the above embodiment. The question attributes include question type and question theme. The attribute relationship is that the question types are the same, or the question types are different, and the question themes are associated, or the question themes are not associated. As Figure 3 shown, S31 and S32 are further expansions of S11, and S33 - S35 are further expansions of S12. Specifically as follows:

[0073] S31: Determine whether the current question type is the same as the previous question type.

[0074] In response to the current question type being different from the previous question type, execute S32 - S34. In response to the current question type being the same as the previous question type, execute S35.

[0075] S32: Determine whether there is a historical round question associated with the current round question theme in the multi-round Q&A training data.

[0076] In response to the current question type being different from the previous question type and there being no historical round question associated with the current round question theme, execute S33. In response to the current question type being different from the previous question type and there being a historical round question associated with the current round question theme, execute S34.

[0077] S33: Obtain the first prompt instruction of the second prompt type.

[0078] Among them, the first prompt instruction is used to instruct the large model to perform answer prediction according to personalized requirements.

[0079] S34: Obtain the second prompt instruction of the second prompt type.

[0080] Among them, the second prompt instruction is used to instruct the large model to perform answer prediction based on the second associated historical round Q&A pair and according to personalized requirements.

[0081] S35: Obtain the prompt instruction of the first prompt type.

[0082] For other detailed descriptions of this embodiment, please refer to the previous embodiments and will not be elaborated here.

[0083] Through the implementation of this embodiment, it is possible to selectively obtain the prompt instruction of the first prompt type and the second prompt type based on whether the question types of the current round question and the previous round question are the same. Further, it is possible to selectively obtain the first prompt instruction and the second prompt instruction of the second prompt type based on whether the historical round question is associated with the current round question theme.

[0084] Figure 4 It is a schematic flowchart of an embodiment of the training method of the multi-round Q&A model provided by this application. This embodiment is a further expansion of the above embodiment. As Figure 4 shown, S41 - S44 are further expansions of S12, and S45 is a further expansion of S13. Specifically as follows:

[0085] S41: Obtain the preset prompt template of the first prompt type or the second prompt type.

[0086] In some embodiments, the preset prompt template of the first prompt type includes the first associated historical round of Q&A pairs and the current round question.

[0087] In some embodiments, the preset prompt template of the second prompt type includes the second associated historical round of Q&A pairs and the current round question. In some embodiments, the preset prompt template of the second prompt type further includes the personalized requirements matching the current round question.

[0088] For example, the preset prompt template of the first prompt type is to answer based on {the first associated historical round of Q&A pairs} + {the question}. Wherein, if there is no first associated historical round of Q&A pairs, it is empty. The template of the second prompt type is to answer based on {the second associated historical round of Q&A pairs} + {the question} + {the paradigm corresponding to the question type}. Wherein, if there is no second associated historical round of Q&A pairs, it is empty.

[0089] S42: Determine whether there is an associated historical round of Q&A pairs for the current round question.

[0090] In response to the existence of an associated historical round of Q&A pairs for the current round question, execute S43 and S45. In response to the non-existence of an associated historical round of Q&A pairs for the current round question, execute S44 and S45.

[0091] In the case of the first prompt type, in S42, determine whether there is a first associated historical round of Q&A pairs for the current round question.

[0092] In the case of the second prompt type, in S42, determine whether there is a second associated historical round of Q&A pairs for the current round question.

[0093] S43: Fill the associated historical round of Q&A pairs and the current round question into the preset prompt template to obtain a prompt instruction.

[0094] In the case of the first prompt type, in S43, fill the first associated historical round of Q&A pairs and the current round question into the preset prompt template of the first prompt type to obtain a prompt instruction of the first prompt type.

[0095] In the case of the second prompt type, in S43, fill the second associated historical round of Q&A pairs and the current round question into the preset prompt template of the second prompt type to obtain a prompt instruction of the second prompt type. Or, fill the second associated historical round of Q&A pairs, the current round question, and the personalized requirements matching the current round question into the preset prompt template of the second prompt type to obtain a prompt instruction of the second prompt type.

[0096] S44: Fill the current round question into the preset prompt template to obtain a prompt instruction.

[0097] In the case of the first hint type, in S44, fill the current round question into the preset hint template of the first hint type to obtain the hint instruction of the first hint type.

[0098] In the case of the second hint type, in S44, fill the current round question into the preset hint template of the second hint type to obtain the hint instruction of the second hint type. Or, fill the current round question and the personalized requirements matching the current round question into the preset hint template of the second hint type to obtain the hint instruction of the second hint type. At this time, the second associated historical round Q&A pair is empty.

[0099] S45: Input the current hint instruction into the large model to obtain the predicted answer corresponding to the current round question output by the large model.

[0100] Through the implementation of this embodiment, the form of the current hint instruction is the preset hint template, and the current hint instruction includes the current round question and the reference information (associated historical round Q&A pair, personalized requirements) for understanding the current round question. Therefore, by only inputting the current hint instruction into the large model, the large model can be used to predict the answer to the current round question.

[0101] Figure 5 It is a schematic flowchart of an embodiment of the training method of the multi-round Q&A model provided by the present application. This embodiment is a further expansion of the above-mentioned embodiment S13. In this embodiment, as Figure 5 shown, the specific steps are as follows:

[0102] S51: Determine whether there is an associated historical round Q&A pair for the current round question.

[0103] In response to the existence of an associated historical round Q&A pair for the current round question, execute S52. In response to the non-existence of an associated historical round Q&A pair for the current round question, execute S53.

[0104] The associated historical round Q&A pair is the aforementioned first associated historical round Q&A pair or the second associated historical round Q&A pair.

[0105] S52: Input the associated historical round Q&A pair, the current round question, and the current hint instruction into the large model to obtain the predicted answer corresponding to the current round question output by the large model.

[0106] In S52, the current hint instruction includes the indication information of the associated historical round Q&A pair, which is used to instruct the large model to contact the associated historical round Q&A pair and the current round question for answer prediction.

[0107] In S52, the current hint instruction also includes the personalized requirements of the current question type, which are used to instruct the large model to perform answer prediction on the current round question according to the personalized requirements.

[0108] S53: Input the current round of question and the current prompt instruction into the large model to obtain the predicted answer corresponding to the current round of question output by the large model.

[0109] In some embodiments, when the current question type is the same as the previous question type, there is no associated historical round Q&A pair for the current round of question, which means the current round of question is the first round of question, and at this time the current prompt instruction is empty. Or, it means there are no historical round questions with the same or associated attributes, the current prompt instruction is empty, or the current promotion instruction is to refer to the previous context (without specifying which historical round Q&A pairs need to be referred to).

[0110] In some embodiments, when the current question type is different from the previous question type, the current prompt instruction includes personalized requirements matching the current question type, which are used to instruct the large model to predict the answer for the current round of question according to the personalized requirements.

[0111] Different from the foregoing S41 - S45, through the implementation of this embodiment (S51 - S53), the associated historical round Q&A pairs and the current round of question are not included in the current prompt instruction, and the associated historical round Q&A pairs, the current round of question, and the current prompt instruction need to be input into the large model together for answer prediction.

[0112] Figure 6 It is a schematic flowchart of an embodiment of the training method of the multi - round Q&A model provided by the present application. This embodiment is a further expansion of the above - mentioned embodiment S13. In this embodiment, as Figure 6 shown, specifically as follows:

[0113] S61: Use the large model to perform semantic parsing on the current round of question based on the current prompt instruction to obtain the semantic parsing result.

[0114] It can be understood that, under the indication of the current prompt instruction, the accuracy of semantic parsing can be improved.

[0115] S62: Use the large model to generate an answer based on the semantic parsing result and the current prompt instruction to obtain the predicted answer corresponding to the current round of question.

[0116] It can be understood that, under the indication of the current prompt instruction, the accuracy of answer generation can be improved.

[0117] In some embodiments, use the large model to obtain an answer generation result, and this answer generation result is the predicted answer.

[0118] In some embodiments, a large model is used to generate multiple candidate answers based on the semantic parsing result and the current prompt instruction, and the large model votes on each candidate answer to obtain a voting result. Based on the voting result, the predicted answer corresponding to the current round of question is selected from the multiple candidate answers. In this case, the multiple candidate answers are various possibilities of the predicted answer, and the large model can vote from dimensions such as answer practicality, matching degree with the question, richness, instruction following ability, and quality to obtain the optimal answer, and use the optimal answer as the predicted answer.

[0119] Through the implementation of this embodiment, a large model can be used to perform semantic parsing and answer generation on the current round of question based on the current prompt instruction, so as to obtain the predicted answer.

[0120] To facilitate understanding of the training method provided in this application, the following will be described in the form of a specific example:

[0121] Figure 7 It is a schematic flowchart of the training method for implementing a multi-round Q&A model in the training architecture of this application. As Figure 7 described, the training architecture includes an auxiliary model and a large model. The auxiliary model is used to generate prompt instructions for questions to assist in the training of the large model. The auxiliary model can be, but is not limited to, an LLM.

[0122] 1. Data collection and preprocessing

[0123] Collect open-domain multi-round Q&A training data. The open-domain multi-round Q&A training data is a sequence of multi-round Q&A pairs, including 5 rounds of Q&A pairs.

[0124] Six question types are preset according to user requirements, namely method type, suggestion type, opinion type, prediction type, analysis type, and creation type. Strengthened prompt instructions (strengthened prompts) corresponding to the six question types are preset. And simple prompt instructions (simple prompts) are preset. The strengthened prompt is used to prompt the answer paradigm corresponding to the question type. The simple prompt is used to prompt referring to the previous context. The simple prompts corresponding to the six question types are the same.

[0125] 2. Processing of the auxiliary model

[0126] (1) Respectively take each round of question as the current round of question, and judge whether the type of the current round of question changes relative to the previous round of question. In response to the type not changing, proceed to (2) and (6); in response to the type changing, proceed to (3)-(5) and (7).

[0127] For example, among the five rounds of questions included in the five-round Q&A pairs, the first-round question (Q1) is of the suggestion type, the second-round question (Q2) is of the suggestion type, the third-round question (Q3) is of the suggestion type, the fourth-round question (Q4) is of the creation type, and the fifth-round question (Q5) is of the suggestion type, indicating that the question type has changed twice.

[0128] (2) The answer paradigm for the current round does not need to be updated and inherits the answer paradigm of the previous round. Therefore, the current prompt instruction for the current round of question is determined to be a simple prompt.

[0129] (3) Determine whether there are historical round Q&A pairs (including historical round questions and corresponding reference answers) associated with the theme of the current round of question in the open-domain multi-round Q&A training data. In response to the existence, proceed to (4); in response to the non-existence, proceed to (5).

[0130] For example, both Q1 and Q5 are of the career theme, and Q2, Q3, and Q4 are of the family theme. If the current round of question is Q5, then the first-round Q&A pair (Q1, A1) is a historical round Q&A pair associated with the theme.

[0131] (4) Determine that the current prompt instruction for the current round of question is the enhanced prompt corresponding to the question type of the current round of question and the prompt that needs to be associated with the historical round Q&A pair related to the theme.

[0132] (5) Determine that the current prompt instruction for the current round of question is the enhanced prompt corresponding to the question type of the current round of question.

[0133] 3. Large model training

[0134] Use the large model to sequentially predict the answers for the five rounds of questions based on the corresponding prompt instructions to obtain the corresponding predicted answers. Adjust the parameters of the large model based on the differences between the predicted answers and the reference answers for the five rounds of questions to obtain a multi-round Q&A model. The process of predicting the answer for the current round of question is as follows:

[0135] (6) Concatenate the simple prompt before the current round of question and then input it into the large model to obtain the current predicted answer output by the large model.

[0136] (7) Input the current round of question, the current prompt instruction, and the historical round Q&A pair associated with the theme (empty if none) into the large model to obtain the current predicted answer output by the large model.

[0137] Figure 8 It is a schematic flowchart of an embodiment of the multi-round Q&A method provided by the present application. As Figure 8 shown, in this embodiment, the multi-round Q&A method may include the following steps:

[0138] S71: Obtain the target round of question in the multi-round Q&A process.

[0139] The target round question refers to the user question in the latest round during the multi-round Q&A process.

[0140] S72: Use the multi-round Q&A model to predict the answer to the target round question to obtain the target round answer.

[0141] Among them, the multi-round Q&A model is obtained by training with the aforementioned training method.

[0142] For other detailed descriptions of this embodiment, please refer to the previous embodiments and will not be elaborated here.

[0143] Through the implementation of this embodiment, during the multi-round Q&A process, use the multi-round Q&A model to predict the answer to the target question. Since the multi-round Q&A model is obtained by training with the aforementioned training method, it can adapt to user questions with diverse attributes and has a high answer prediction accuracy.

[0144] Figure 9 It is a schematic structural diagram of an embodiment of the training device for the multi-round Q&A model provided by this application. As Figure 9 shown, in this embodiment, the training device 80 for the multi-round Q&A model includes a determination module 81, an acquisition module 82, a prediction module 83, and an adjustment module 84.

[0145] Among them, the determination module 81 is used to respectively use at least one round of questions in the multi-round Q&A training data as the current round question and determine the attribute relationship between the current round question and the historical round questions;

[0146] The acquisition module 82 is used to acquire a prompt instruction whose prompt type matches the attribute relationship as the current prompt instruction corresponding to the current round question, where the prompt instruction is used to instruct the large model to perform answer prediction;

[0147] The prediction module 83 is used to use the large model to predict the answer to the current round question based on the current prompt instruction to obtain the predicted answer corresponding to the current round question;

[0148] The adjustment module 84 is used to adjust the parameters of the large model based on the predicted answers and reference answers corresponding to at least one round of questions to obtain the multi-round Q&A model.

[0149] For other detailed descriptions of the training device 80 for the multi-round Q&A model in this embodiment, please refer to the previous method embodiments and will not be elaborated here.

[0150] Figure 10 It is a schematic structural diagram of an embodiment of the multi-round Q&A device provided by this application. As Figure 10 shown, in this embodiment, the multi-round Q&A model device 90 includes an acquisition module 91 and a prediction module 92.

[0151] Among them, the acquisition module 91 is used to acquire the target round question in the multi-round question and answer process;

[0152] The prediction module 92 is used to predict the answer to the target round question by using the multi-round question and answer model, and obtain the target round answer. Among them, the multi-round question and answer model is trained based on the foregoing training method.

[0153] For other detailed descriptions of the multi-round question and answer model device 90 in this embodiment, please refer to the foregoing method embodiments, which will not be elaborated here.

[0154] Figure 11 It is a schematic structural diagram of an embodiment of an electronic device of the present application. As Figure 11 shown, the electronic device 100 includes a memory 101 and a processor 102. The processor 102 is used to execute the program instructions stored in the memory 101 to implement the steps in any of the foregoing method embodiments. In a specific implementation scenario, the electronic device 100 may include, but is not limited to: a microcomputer, a server. In addition, the electronic device 100 may also include a carrying device such as a laptop computer, a tablet computer, etc., which will not be limited here.

[0155] Specifically, the processor 102 is used to control itself and the memory 101 to implement the steps in any of the foregoing method embodiments. The processor 102 may also be referred to as a CPU (Central Processing Unit, central processing unit). The processor 102 may be an integrated circuit chip with signal processing capabilities. The processor 102 may also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. In addition, the processor 102 may be implemented jointly by integrated circuit chips.

[0156] Please refer to Figure 12 , Figure 12 It is a schematic structural diagram of an embodiment of a computer-readable storage medium of the present application. The computer-readable storage medium 110 stores program instructions 111 thereon, and when the program instructions 111 are executed by the processor, the steps in any of the foregoing method embodiments are implemented.

[0157] In some embodiments, the functions or modules included in the apparatus provided by the embodiments of the present disclosure can be used to execute the methods described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.

[0158] The above descriptions of the various embodiments tend to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to each other. For the sake of brevity, they will not be repeated here.

[0159] In several embodiments provided in the present application, it should be understood that the disclosed methods and apparatuses can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, units or components can be combined or integrated into another system, or some features can be ignored or not executed. In another image position, the coupling or direct coupling or communication connection shown or discussed with each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in electrical, mechanical or other forms.

[0160] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods in various embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.

Claims

1. A training method for a multi-round question-answering model, characterized in that: include: At least one round of questions in the multiple rounds of question-answering training data is respectively used as the current round of questions, and the attribute relationship between the current round of questions and the historical round of questions is determined; Obtaining a prompt instruction whose prompt type matches the attribute relationship as a current prompt instruction corresponding to the current round of questions, wherein the prompt instruction is used to instruct the large model to predict the answer; Using the large model to predict the answer to the current round of questions based on the current prompt instruction, to obtain a predicted answer corresponding to the current round of questions; Based on the predicted answers and reference answers corresponding to the at least one round of questions, the parameters of the large model are adjusted to obtain the multi-round question-answering model.

2. The method according to claim 1, characterized in that The prompt type includes a first prompt type and a second prompt type, the prompt instruction of the first prompt type is used to instruct the large model to predict an answer based on a first associated historical round question and answer pair, and the prompt instruction of the second prompt type is used to instruct the large model to predict an answer according to the personalized requirements matching the current round of questions, or to instruct the large model to predict an answer based on a second associated historical round question and answer pair and according to the personalized requirements, wherein the first associated historical round question and answer pair is at least one historical round question and answer pair in the multiple rounds of question and answer training data, and the second associated historical round question and answer pair is a historical round question and answer pair in the multiple rounds of question and answer training data that matches the current round of questions.

3. The method according to claim 2, characterized in that The personalized requirement includes a pattern for the predicted answer.

4. The method according to any one of claims 1 to 3, characterized in that: The determining of the attribute relationship between the current round problem and the historical round problem includes: Determine whether the current question type is the same as the previous question type, wherein the current question type is the type of the current round of questions, and the previous question type is the type of the previous round of questions; The obtaining prompt instruction of the prompt type matching the attribute relationship includes: In response to the current question type being the same as the previous question type, obtaining a prompt instruction of the first prompt type; In response to the current question type being different from the previous question type, a prompt instruction of the second prompt type is obtained.

5. The method according to claim 4, characterized in that The determining of the attribute relationship between the current round question and the historical round question also includes: In response to the current question type being different from the previous question type, determining whether there is the historical round question associated with the current round question topic in the multiple rounds of question-answering training data; In response to the current question type being different from the previous question type, obtaining a prompt instruction of the second prompt type includes: In response to the current question type being different from the previous question type and the absence of the historical round question associated with the current round question topic, obtaining a first prompt instruction of the second prompt type, wherein the first prompt instruction is used to instruct the large model to predict the answer according to the personalized requirement; In response to the current question type being different from the previous question type and the existence of a historical round question associated with the current round question topic, a second prompt instruction of the second prompt type is obtained, wherein the second prompt instruction is used to instruct the large model to predict an answer based on the second associated historical round question and answer pair and in accordance with the personalized requirements.

6. The method according to claim 4, characterized in that The step of obtaining a prompt instruction of the first prompt type or the second prompt type includes: Obtaining a preset prompt template of the first prompt type or the second prompt type; in response to the current round question having an associated historical round question-answer pair, filling the associated historical round question-answer pair and the current round question into the preset prompt template to obtain the prompt instruction; in response to the current round question not having an associated historical round question-answer pair, filling the current round question into the preset prompt template to obtain the prompt instruction; using the large model to predict the answer to the current round question based on the current prompt instruction to obtain a predicted answer corresponding to the current round question, including: inputting the current prompt instruction into the large model to obtain a predicted answer corresponding to the current round question output by the large model; Or, using the large model to predict the answer to the current round of questions based on the current prompt instruction to obtain the predicted answer corresponding to the current round of questions includes: In response to the current round question having the associated historical round question-answer pair, inputting the associated historical round question-answer pair, the current round question, and the current prompt instruction into the large model to obtain a predicted answer corresponding to the current round question output by the large model; In response to the current round question not having the associated historical round question-answer pair, the current round question and the current prompt instruction are input into the large model to obtain a predicted answer corresponding to the current round question output by the large model.

7. The method according to claim 1, characterized in that The using the large model to predict the answer to the current round question based on the current prompt instruction to obtain the predicted answer corresponding to the current round question includes: Using the large model to perform semantic analysis on the current round of questions based on the current prompt instruction to obtain a semantic analysis result; The large model is used to generate an answer based on the semantic parsing result and the current prompt instruction to obtain a predicted answer corresponding to the current round of questions.

8. The method according to claim 7, characterized in that The step of generating an answer based on the semantic parsing result and the current prompt instruction by using the large model to obtain a predicted answer corresponding to the current round of question includes: Generate an answer using the large model based on the semantic parsing result and the current prompt instruction to obtain multiple candidate answers; Using the large model to vote on each candidate answer to obtain a voting result; Based on the voting result, a predicted answer corresponding to the current round question is selected from the multiple candidate answers.

9. A multi-round question-answering method, characterized in that: include: Obtain the target round question of the multi-round question-answering process; A multi-round question-answering model is used to predict the answer to the target round question to obtain the target round answer; wherein the multi-round question-answering model is trained based on any one of the training methods in claims 1-8.

10. A training device for a multi-round question-answering model, characterized in that: include: A determination module, used to respectively use at least one round of questions in the multiple rounds of question-answering training data as the current round of questions, and determine the attribute relationship between the current round of questions and the historical round of questions; An acquisition module, used for acquiring a prompt instruction whose prompt type matches the attribute relationship as a current prompt instruction corresponding to the current round of questions, wherein the prompt instruction is used to instruct the large model to predict the answer; A prediction module, used to predict the answer to the current round of questions based on the current prompt instruction using the large model, and obtain a predicted answer corresponding to the current round of questions; An adjustment module is used to adjust the parameters of the large model based on the predicted answers and reference answers corresponding to the at least one round of questions to obtain the multi-round question-answering model.

11. A multi-round question-answering device, characterized in that: include: An acquisition module, used to acquire the target round question in a multi-round question-answering process; A prediction module is used to predict the answer to the target round question using a multi-round question-answering model to obtain a target round answer; wherein the multi-round question-answering model is trained based on any one of the training methods in claims 1-8.

12. An electronic device, characterized in that: The invention comprises a memory and a processor, wherein the processor is used to execute program instructions stored in the memory to implement the method according to any one of claims 1 to 9.

13. A computer-readable storage medium having program instructions stored thereon, wherein the program instructions implement the method according to any one of claims 1 to 9 when executed by a processor.