Question answering method and related device

By introducing similar questions to assist in answering questions in the large language model, the problem of poor performance in the traditional model in the question-solving task is solved, and more efficient and accurate answering results are achieved.

CN119886357APending Publication Date: 2025-04-25IFLYTEK CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510054909.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-14
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

The performance of traditional large language models in question-solving tasks still needs to be improved, and the learning cost is high and it cannot achieve better answering results.

Method used

By obtaining the questions to be answered, determining their similar questions and their analysis, and calling the trained answering model to answer the questions to be answered based on similar questions and analytics, and finally determining the final answer of the question based on multiple answers.

Benefits of technology

It improves the diversity of model-generated answers and the accuracy of question answers, reduces learning costs, and improves the ability to identify and repair errors in complex inference processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119886357A_ABST
    Figure CN119886357A_ABST
Patent Text Reader

Abstract

The invention discloses a question answering method and a related device, and relates to the technical field of large language models.According to the question answering method, a large language model which is obtained through pre-training and has the capacity of discovering the association between a question to be answered and similar questions and utilizing the similar questions for answering serves as an answering model, and after the question to be answered is obtained, the question to be answered is answered through the association between the question to be answered and the similar questions; the method comprises the steps of determining similar questions corresponding to questions and analysis of each similar question, calling a trained answering model to answer to-be-answered questions based on the similar questions and the analysis of the similar questions for each similar question, and obtaining answers output by the answering model; and finally, determining a final answer of the question based on each answer output by the answer model. According to the scheme, the model can give answers by referring to the answering process of the similar questions or obtain'heuristic 'from the answering thought of the similar questions to solve the difficult problem that the questions cannot be answered during direct answering, so that the diversity of the answers generated by the model is improved, and the question answering accuracy 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 large language models, and in particular to a question answering method and related devices. Background Art

[0002] With the rapid development of large language model technology, large language models have shown broad application prospects and achieved good performance in various tasks (dialogue systems, retrieval systems, and AI-assisted creation, etc.). Large language models have good reasoning capabilities, and the problem-solving task is essentially a task of exploring and generating a logically correct and rigorous problem-solving text. Therefore, the performance of large language models in problem-solving tasks has also received more and more attention.

[0003] At present, the application of large language models in question answering tasks mainly uses large language models to build question answering models to achieve question answering. However, the traditional question answering models built using large language models have high learning costs and cannot achieve good answering results. Therefore, the performance of large language models in question answering tasks still needs to be improved. Summary of the invention

[0004] In view of the above problems, this application provides a question answering method and related devices to achieve the purpose of improving the performance of large language models in question answering tasks. The specific scheme is as follows:

[0005] The first aspect of the present application provides a method for answering a question, comprising:

[0006] Get the questions to be answered;

[0007] Determine similar questions corresponding to the question, and the analysis of each similar question;

[0008] For each similar question, a trained answering model is called to answer the question to be answered based on the similar question and the analysis of the similar question, and the answer output by the answering model is obtained; the answering model is a large language model that has been trained to discover the relationship between the question to be answered and similar questions, and to answer the question using similar questions;

[0009] Based on the answers output by the question-answering model, a final answer to the question is determined.

[0010] In a possible implementation, calling the trained answering model to answer the question to be answered based on the similar questions and the analysis of the similar questions to obtain the answer output by the answering model includes:

[0011] Generate a question-solving instruction based on the question to be solved, the similar questions and the solutions to the similar questions;

[0012] The question answering instruction is input into the question answering model to obtain the answer output by the question answering model.

[0013] In a possible implementation, the generating of the question answering instruction based on the question to be answered, the similar question and the analysis of the similar question includes:

[0014] Obtain a preconfigured question answer prompt template, wherein the question answer prompt template includes preset question answer task description information, a question filling slot, a similar question filling slot, and a similar question analysis filling slot;

[0015] The question to be answered is filled into the question filling slot, the similar question is filled into the similar question filling slot, and the solution of the similar question is filled into the similar question solution filling slot to obtain the question answering instruction.

[0016] In a possible implementation, the training method of the question answering model includes:

[0017] Determine a base language model and training data, wherein the input of the training data includes a question sample, a similar question sample corresponding to the question sample, and an analysis of the similar question sample; the output of the training data includes an analysis content in the form of a thought chain and answer data of the question sample; the analysis content in the form of a thought chain is used to indicate the correlation between the question sample and the similar question sample, and an analysis of the analysis of the similar question sample;

[0018] The training data is used to perform supervised fine-tuning training on the base large language model to obtain the question-answering model after supervised fine-tuning training.

[0019] In a possible implementation, the method for determining the training data includes:

[0020] Generate synthetic training data through data synthesis based on a general large language model;

[0021] The synthetic training data is screened based on the reference answer of each question sample to obtain the training data.

[0022] In a possible implementation, determining the final answer to the question based on the answers output by the question answering model includes:

[0023] Input each answer output by the answering model into the judging model to obtain the score of each answer output by the judging model; the judging model is trained with the training data as training samples and the output score being close to the score of the training data as the training target;

[0024] The answer with the highest score is determined as the final answer to the question.

[0025] In a possible implementation, after obtaining the score of each answer output by the evaluation model, the method further includes:

[0026] The score of each answer output by the evaluation model is used as a reward to perform reinforcement learning training on the answering model to obtain the answering model after reinforcement learning training.

[0027] A second aspect of the present application provides a question answering device, comprising:

[0028] An acquisition unit, used for acquiring questions to be answered;

[0029] A similar question information determination unit, used to determine similar questions corresponding to the question, and the analysis of each similar question;

[0030] The answer model answering unit is used to call the trained answer model for each similar question to answer the question to be answered based on the similar question and the analysis of the similar question, and obtain the answer output by the answer model; the answer model is a large language model that has been trained to discover the relationship between the question to be answered and similar questions, and use similar questions to answer;

[0031] The final answer determination unit is used to determine the final answer to the question based on the answers output by the question answering model.

[0032] In a possible implementation, the question answering model solving unit includes:

[0033] A question answering instruction generating unit, configured to generate a question answering instruction based on the question to be answered, the similar questions and the solutions to the similar questions;

[0034] The input unit is used to input the question answering instruction into the question answering model to obtain the answer output by the question answering model.

[0035] In a possible implementation, the question answering instruction generating unit is specifically used to:

[0036] Obtain a preconfigured question answer prompt template, wherein the question answer prompt template includes preset question answer task description information, a question filling slot, a similar question filling slot, and a similar question analysis filling slot;

[0037] The question to be answered is filled into the question filling slot, the similar question is filled into the similar question filling slot, and the solution of the similar question is filled into the similar question solution filling slot to obtain the question answering instruction.

[0038] In a possible implementation, the device further includes: a question answering model training unit;

[0039] The question answering model training unit comprises:

[0040] A base large language model and training data determination unit, used to determine a base large language model and training data, wherein the input of the training data includes a question sample, a similar question sample corresponding to the question sample, and an analysis of the similar question sample; the output of the training data includes an analysis content in the form of a thought chain and answer data of the question sample; the analysis content in the form of a thought chain is used to indicate the correlation between the question sample and the similar question sample, and an analysis of the analysis of the similar question sample;

[0041] A supervised fine-tuning training unit is used to perform supervised fine-tuning training on the base large language model using the training data to obtain the question-answering model after the supervised fine-tuning training.

[0042] In a possible implementation, the base large language model and the training data determination unit include a training data determination unit, and the training data determination unit is specifically used to:

[0043] Generate synthetic training data through data synthesis based on a general large language model;

[0044] The synthetic training data is screened based on the reference answer of each question sample to obtain the training data.

[0045] In a possible implementation, the final answer determination unit is specifically configured to:

[0046] Input each answer output by the answering model into the judging model to obtain the score of each answer output by the judging model; the judging model is trained with the training data as training samples and the output score being close to the score of the training data as the training target;

[0047] The answer with the highest score is determined as the final answer to the question.

[0048] In a possible implementation, the device further includes:

[0049] The reinforcement learning training unit is used to perform reinforcement learning training on the answering model after obtaining the scores of each answer output by the evaluation model, using the scores of each answer output by the evaluation model as rewards, to obtain the answering model after reinforcement learning training.

[0050] A third aspect of the present application provides a computer program product, comprising computer-readable instructions, which, when executed on an electronic device, enables the electronic device to implement the method for answering questions according to the first aspect or any implementation of the first aspect.

[0051] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:

[0052] The memory is used to store computer programs;

[0053] The processor is used to execute the computer program so that the electronic device can implement the problem-solving method of the first aspect or any implementation manner of the first aspect.

[0054] A fifth aspect of the present application provides a computer-readable storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the method for solving problems according to the first aspect or any implementation of the first aspect.

[0055] By means of the above technical scheme, the question answering method and related devices provided by the present application use a pre-trained large language model with the ability to discover the relationship between the question to be answered and similar questions, and use similar questions to answer them as a question answering model. After obtaining the question to be answered, the similar questions corresponding to the question and the analysis of each similar question are first determined. For each similar question, the trained question answering model is called to answer the question to be answered based on the similar questions and the analysis of similar questions, and the answer output by the question answering model is obtained; finally, the final answer to the question is determined based on the answers output by the question answering model. This scheme can guide the answer generation process of the model differently by searching for different types of similar questions that are similar to the original question and can play an auxiliary role in answering the question, and their analysis as the answer reference of the model, so that the model can refer to the answering process of similar questions to give answers, or get "inspiration" from the answering ideas of similar questions to solve difficult problems that cannot be answered when answering questions directly, thereby improving the diversity of answers generated by the model and improving the accuracy of question answers. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0057] Figure 1 A flowchart of a method for answering a question provided in an embodiment of the present application;

[0058] Figure 2 A flowchart of a question answering model training method provided in an embodiment of the present application;

[0059] Figure 3 A flowchart of a specific implementation method for determining the final answer to a question based on the answers output by the answering model provided in an embodiment of the present application;

[0060] Figure 4 A schematic diagram of a method for answering a question provided in an embodiment of the present application;

[0061] Figure 5 A schematic diagram of the structure of a question answering device provided in an embodiment of the present application;

[0062] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0063] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0064] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0065] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0066] With the rapid development of large language model technology, large language models have shown broad application prospects and achieved good performance in various tasks (dialogue systems, retrieval systems, and AI-assisted creation, etc.). Large language models have good reasoning capabilities, and the problem-solving task is essentially a task of exploring and generating a logically correct and rigorous problem-solving text. Therefore, the performance of large language models in problem-solving tasks has also received more and more attention.

[0067] At present, the application of large language models in question answering tasks mainly uses large language models to build answering models to achieve question answering. From the perspective of generation methods, answering models can be divided into one-time generation and sampling and ranking (Sample-and-Rank). Greedy sampling, top k, top p, min p, and beam search sampling are common methods for selecting a generation path from the probability distribution output by large language models. Through several samplings, multiple candidates are generated, and after screening by the evaluation model, a more accurate answer text can be obtained. The evaluation model can be a majority vote, a reward model, a verification system based on symbolic logic, etc. From the perspective of plug-in tools, answering models can be divided into answering models that do not rely on additional plug-ins, introduce plug-ins such as calculation / equation solving / formula simplification, and answering models that are mainly based on symbolic logic reasoning and supplemented by neural networks.

[0068] However, the question answering task is a task that requires extremely high logical reasoning ability. In the question answering task, increasing the diversity of generated texts and increasing the logical correctness of generated texts are two important dimensions to improve the answering effect. The traditional question answering model built using a large language model is a large language model that has undergone supervised fine-tuning (SFT) or human feedback reinforcement learning (HFRL). While improving the logical correctness of the generated text, it often damages the diversity of the generated text. In addition, the current training methods represented by SFT are not close to the real human learning method. For example, when new data arrives, the existing SFT method needs to merge the new and old data and retrain on the complete data set. In contrast, humans do not need to review the old knowledge completely when learning new knowledge and new question types. The current training methods represented by SFT are expensive compared to the human learning method, and the learning cost is also higher.

[0069] In addition, human problem solving is a process of repeated exploration, and repeated searches and even trial and error are inevitable in this process. However, traditional answering models built with large language models do not have the ability to search repeatedly. Although the answering model memorizes a large amount of knowledge and real questions in a parameterized way during the learning process, it is unable to recall and accurately repeat similar questions that are useful for answering new questions, but directly reasoning. Therefore, in the complex reasoning process, if the traditional answering model built with large language models makes mistakes in the middle steps, it can neither identify the errors that occurred nor repair them, thus misleading its subsequent generation process.

[0070] It can be seen that the traditional question-answering model built using a large language model has a high learning cost and cannot achieve good answering results. Therefore, the performance of the large language model in question-answering tasks still needs to be improved.

[0071] In order to solve the above problems, humans can often answer questions by referring to questions with similar knowledge points that they have practiced before. Inspired by this, the present application embodiment provides a method for answering questions.

[0072] The following is a detailed introduction to the method for answering questions in the embodiment of the present application in conjunction with the accompanying drawings.

[0073] Reference Figure 1 , Figure 1 A flowchart of a method for solving a problem provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, a method for answering a question provided in an embodiment of the present application may include the following steps, which are described in detail below.

[0074] S101: Obtain questions to be answered;

[0075] In this application, the questions to be answered can be questions of any subject such as mathematics, physics, chemistry, etc.

[0076] S102: Determine similar questions corresponding to the question, and the analysis of each similar question;

[0077] In the present application, the question can be input into the retrieval system to obtain n similar questions corresponding to the question and the analysis of each similar question, where n is an integer greater than or equal to 1, and the specific value can be determined based on scenario requirements.

[0078] In order to control the degree of difference of similar questions, this scheme proposes to increase the diversity of similar question data returned by the retrieval system through the non-maximum suppression method. Specifically, suppose the retrieval system returns m similar question data through rough sorting, where m is much larger than n, and the hyperparameter w∈[0,1] is set. The retrieval system sorts by similarity and preferentially returns the data most similar to the question to be answered from the m similar question data. At the same time, the wer (normalized edit distance) of the two similar question data returned is limited to be greater than or equal to w.

[0079] S103: For each similar question, calling a trained answering model to answer the question to be answered based on the similar question and the analysis of the similar question, and obtaining an answer output by the answering model; the answering model is a large language model that has been trained to discover the relationship between the question to be answered and similar questions, and to answer the question using similar questions;

[0080] In the present application, the trained question-answering model may be the question-answering model after supervised fine-tuning training, or may be the question-answering model after reinforcement learning training.

[0081] In a possible implementation, the calling of the question answering model to answer the question to be answered based on the similar questions and the analysis of the similar questions to obtain the answer output by the question answering model includes:

[0082] Generate a question-solving instruction based on the question to be solved, the similar questions and the solutions to the similar questions;

[0083] The question answering instruction is input into the question answering model to obtain the answer output by the question answering model.

[0084] The step of generating a question answering instruction based on the question to be answered, the similar question and the analysis of the similar question includes:

[0085] Obtain a preconfigured question answer prompt template, wherein the question answer prompt template includes preset question answer task description information, a question filling slot, a similar question filling slot, and a similar question analysis filling slot;

[0086] The question to be answered is filled into the question filling slot, the similar question is filled into the similar question filling slot, and the solution of the similar question is filled into the similar question solution filling slot to obtain the question answering instruction.

[0087] S104: Determine the final answer to the question based on the answers output by the question-answering model.

[0088] In the present application, each answer output by the question-answering model may be scored, and the answer with the highest score may be determined as the final answer to the question.

[0089] The question answering method provided in this embodiment uses a pre-trained large language model with the ability to discover the relationship between the question to be answered and similar questions, and use similar questions to answer them as a question answering model. After obtaining the question to be answered, the similar questions corresponding to the question and the analysis of each similar question are first determined. For each similar question, the trained question answering model is called to answer the question to be answered based on the similar questions and the analysis of the similar questions, and the answer output by the question answering model is obtained; finally, the final answer to the question is determined based on the answers output by the question answering model. This solution can guide the model's answer generation process differently by searching for different types of similar questions that are similar to the original question and can play an auxiliary role in answering the question, as the model's answer reference, so that the model can refer to the answering process of similar questions to give answers, or get "inspiration" from the answering ideas of similar questions to solve difficult problems that cannot be answered when answering questions directly, thereby improving the diversity of answers generated by the model and improving the accuracy of question answers.

[0090] In another embodiment of the present application, the training method of the question answering model is described.

[0091] Reference Figure 2 , Figure 2 A flowchart of a question answering model training method provided in an embodiment of the present application, the method may include the following steps:

[0092] S201: Determine a base language model and training data, wherein the input of the training data includes a question sample, a similar question sample corresponding to the question sample, and an analysis of the similar question sample; the output of the training data includes an analysis content in the form of a thought chain and answer data of the question sample; the analysis content in the form of a thought chain is used to indicate the correlation between the question sample and the similar question sample, and an analysis of the analysis of the similar question sample;

[0093] In this application, in order to enable the base large language model to be trained to discover the relationship between the question to be answered and similar questions, and to use similar questions to answer them, the output of the training data is divided into two parts: In the first part, the correlation between the question sample and the corresponding similar question sample is analyzed in the form of COT (Chain of Thought), pointing out which parts of the analysis of the similar question sample are usable and which parts are irrelevant to the original question, and analyzing the advantages and disadvantages of the analysis of the similar question sample. The second part contains the formal answer data of the question sample. This part of the data should refer to the reference part of the analysis of the corresponding similar question sample in an appropriate form, while maintaining independence and integrity (that is, the second part of the data can be separated from the first part of the data, the similar question sample and the analysis of the similar question sample to form an independent and complete analysis).

[0094] Then, in the present application, the input of the training data includes question samples, similar question samples corresponding to the question samples, and analyses of the similar question samples; the output of the training data includes analysis content in the form of thought chains and answer data of the question samples; the analysis content in the form of thought chains is used to indicate the correlation between the question samples and the similar question samples, as well as the analysis of the analyses of the similar question samples; the analysis of the analyses of the similar question samples is used to indicate which parts of the analyses of the similar question samples are usable and which parts are irrelevant to the original questions, as well as the advantages and disadvantages of the analyses of the similar question samples.

[0095] The base large language model can be any existing large language model, such as the iFlytek Spark large language model, and this application does not impose any limitation on this.

[0096] In one achievable manner, the training data is determined by:

[0097] S2011: Data synthesis based on a general large language model to generate synthetic training data;

[0098] The purpose of data synthesis is to generate training data in batches in an automated manner. In this application, an untrained general large language model with good general instruction following ability can be sampled through Self-Play to obtain the above-mentioned form of synthetic training data. When constructing prompt instructions (prompt), several examples can be given in the form of few-shot to utilize the In Context Learning capability of the general large language model to improve the quality of synthetic training data.

[0099] S2012: Screening the synthetic training data based on the reference answer of each question sample to obtain the training data.

[0100] In this application, the synthetic training data will be screened again by the same general large language model. During the screening, for each synthetic training data, the general large language model will obtain the reference answer of the question sample in the synthetic training data, and give the score of the synthetic training data based on the difference between the reference answer of the question sample and the answer in the synthetic training data. After obtaining the score of each synthetic training data, the synthetic training data with a score greater than or equal to the preset threshold t is retained as the final training data.

[0101] S202: Perform supervised fine-tuning training on the base large language model using the training data to obtain the question answering model after supervised fine-tuning training.

[0102] In this application, the specific implementation method of using the training data to perform supervised fine-tuning training on the base large language model will not be described in detail. It should be noted that in addition to using the training data to perform supervised fine-tuning (SFT) on the base large language model, other general training data (such as programming training data, logical reasoning training data, etc.) can also be introduced to maintain and enhance the general instruction following ability and logical reasoning ability of the base large language model.

[0103] In another embodiment of the present application, a specific implementation method for determining the final answer to the question based on the answers output by the question answering model is described.

[0104] Reference Figure 3 , Figure 3 A flowchart of a specific implementation method for determining the final answer to a question based on the answers output by the answering model provided in an embodiment of the present application, the method may include the following steps:

[0105] S301: Inputting each answer output by the question answering model into the evaluation model to obtain the score of each answer output by the evaluation model; the evaluation model is trained with the training data as training samples and the output score being close to the score of the training data as the training target;

[0106] It should be noted that, during the training phase of the evaluation model, the scores of the training data obtained in the training data determination step are reused.

[0107] S302: Determine the answer with the highest score as the final answer to the question.

[0108] In a possible implementation, after obtaining the score of each answer output by the evaluation model, the method further includes:

[0109] The score of each answer output by the evaluation model is used as a reward to perform reinforcement learning training on the answering model to obtain the answering model after reinforcement learning training.

[0110] In this application, the answering model can be trained by reinforcement learning based on the PPO (Proximal Policy Optimization) algorithm in an On-Policy manner, with the scores of each answer output by the evaluation model as rewards. Of course, other reinforcement learning training methods can also be used, and this application does not impose any restrictions on this. The specific description will not be expanded.

[0111] In summary, the present application provides a question-solving solution that introduces similar questions to assist in answering questions. The solution can provide different guidance for the model's answer generation process by searching for different types of similar questions that are similar to the original question and can assist in answering questions, as well as their analyses, as answer references for the model. The model can then refer to the answering process of similar questions to give answers, or get "inspiration" from the answering ideas of similar questions to solve difficult problems that cannot be answered directly, thereby increasing the diversity of answers generated by the model and improving the accuracy of answering questions.

[0112] In addition, the solution enables the model to learn online (also known as incremental learning): when new questions come in, we can add them to the question bank without retraining the model, instantly improving the model's ability to solve similar problems. This makes our solution highly scalable and agile.

[0113] For easier understanding of the entire scheme, refer to Figure 4 , Figure 4 A schematic diagram of a method for solving a problem provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, the question to be answered obtains similar question 1 and similar question 2 through the retrieval system. This solution constructs prompt word 1 for the question to be answered + similar question 1, generates answer 1 through the question answering model, and constructs prompt word 2 for the question to be answered + similar question 2, generates answer 2 through the question answering model, and finally the final answer is selected by the evaluation model.

[0114] A method for solving a problem provided by an embodiment of the present application is introduced above, and a device for executing the method for solving a problem is introduced below.

[0115] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of a question-solving device provided in an embodiment of the present application. Figure 5 As shown, the question-solving device comprises:

[0116] An acquisition unit 11, used to acquire a question to be answered;

[0117] A similar question information determination unit 12, used to determine similar questions corresponding to the question, and the analysis of each similar question;

[0118] The answer model answering unit 13 is used to call the trained answer model for each similar question to answer the question to be answered based on the similar question and the analysis of the similar question, and obtain the answer output by the answer model; the answer model is a large language model that has been trained to find the relationship between the question to be answered and similar questions, and use similar questions to answer;

[0119] The final answer determination unit 14 is used to determine the final answer to the question based on the answers output by the question answering model.

[0120] In a possible implementation, the question answering model solving unit includes:

[0121] A question answering instruction generating unit, configured to generate a question answering instruction based on the question to be answered, the similar questions and the solutions to the similar questions;

[0122] The input unit is used to input the question answering instruction into the question answering model to obtain the answer output by the question answering model.

[0123] In a possible implementation, the question answering instruction generating unit is specifically used to:

[0124] Obtain a preconfigured question answer prompt template, wherein the question answer prompt template includes preset question answer task description information, a question filling slot, a similar question filling slot, and a similar question analysis filling slot;

[0125] The question to be answered is filled into the question filling slot, the similar question is filled into the similar question filling slot, and the solution of the similar question is filled into the similar question solution filling slot to obtain the question answering instruction.

[0126] In a possible implementation, the device further includes: a question answering model training unit;

[0127] The question answering model training unit comprises:

[0128] A base large language model and training data determination unit, used to determine a base large language model and training data, wherein the input of the training data includes a question sample, a similar question sample corresponding to the question sample, and an analysis of the similar question sample; the output of the training data includes an analysis content in the form of a thought chain and answer data of the question sample; the analysis content in the form of a thought chain is used to indicate the correlation between the question sample and the similar question sample, and an analysis of the analysis of the similar question sample;

[0129] A supervised fine-tuning training unit is used to perform supervised fine-tuning training on the base large language model using the training data to obtain the question-answering model after the supervised fine-tuning training.

[0130] In a possible implementation, the base large language model and the training data determination unit include a training data determination unit, and the training data determination unit is specifically used to:

[0131] Generate synthetic training data through data synthesis based on a general large language model;

[0132] The synthetic training data is screened based on the reference answer of each question sample to obtain the training data.

[0133] In a possible implementation, the final answer determination unit is specifically configured to:

[0134] Input each answer output by the answering model into the judging model to obtain the score of each answer output by the judging model; the judging model is trained with the training data as training samples and the output score being close to the score of the training data as the training target;

[0135] The answer with the highest score is determined as the final answer to the question.

[0136] In a possible implementation, the device further includes:

[0137] The reinforcement learning training unit is used to perform reinforcement learning training on the answering model after obtaining the scores of each answer output by the evaluation model, using the scores of each answer output by the evaluation model as rewards, to obtain the answering model after reinforcement learning training.

[0138] The present application also provides an electronic device in an embodiment. Figure 6 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 6 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0139] like Figure 6 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 to a random access memory (RAM) 603. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0140] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a memory card, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0141] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any one of the question-solving methods provided in the embodiments of the present application.

[0142] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any one of the question-solving methods provided in the embodiment of the present application.

[0143] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0144] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0145] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0146] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.

Claims

1. A method for solving a problem, characterized in that: include: Get the questions to be answered; Determine similar questions corresponding to the question, and the analysis of each similar question; For each similar question, call the trained answering model to answer the question to be answered based on the similar question and the analysis of the similar question, and obtain the answer output by the answering model; The question answering model is a large language model that is trained to discover the relationship between the question to be answered and similar questions, and to answer the questions using similar questions; Based on the answers output by the question-answering model, a final answer to the question is determined.

2. The method according to claim 1, characterized in that The calling of the trained answering model to answer the question to be answered based on the similar questions and the analysis of the similar questions to obtain the answer output by the answering model includes: Generate a question-solving instruction based on the question to be solved, the similar questions and the solutions to the similar questions; The question answering instruction is input into the question answering model to obtain the answer output by the question answering model.

3. The method according to claim 2, characterized in that The generating of a question answering instruction based on the question to be answered, the similar question and the analysis of the similar question comprises: Obtain a preconfigured question answer prompt template, wherein the question answer prompt template includes preset question answer task description information, a question filling slot, a similar question filling slot, and a similar question analysis filling slot; The question to be answered is filled into the question filling slot, the similar question is filled into the similar question filling slot, and the solution of the similar question is filled into the similar question solution filling slot to obtain the question answering instruction.

4. The method according to claim 1, characterized in that: The training method of the answering model includes: Determine a base language model and training data, wherein the input of the training data includes a question sample, a similar question sample corresponding to the question sample, and an analysis of the similar question sample; the output of the training data includes an analysis content in the form of a thought chain and answer data of the question sample; the analysis content in the form of a thought chain is used to indicate the correlation between the question sample and the similar question sample, and an analysis of the analysis of the similar question sample; The training data is used to perform supervised fine-tuning training on the base large language model to obtain the question-answering model after supervised fine-tuning training.

5. The method according to claim 4, characterized in that The method for determining the training data includes: Generate synthetic training data through data synthesis based on a general large language model; The synthetic training data is screened based on the reference answer of each question sample to obtain the training data.

6. The method according to claim 4, characterized in that Determining the final answer to the question based on the answers output by the question answering model includes: Input each answer output by the answering model into the judging model to obtain the score of each answer output by the judging model; the judging model is trained with the training data as training samples and the output score being close to the score of the training data as the training target; The answer with the highest score is determined as the final answer to the question.

7. The method according to claim 6, characterized in that After obtaining the scores of the answers output by the evaluation model, the method further includes: The score of each answer output by the evaluation model is used as a reward to perform reinforcement learning training on the answering model to obtain the answering model after reinforcement learning training.

8. A question-solving device, characterized in that: include: An acquisition unit, used for acquiring questions to be answered; A similar question information determination unit, used to determine similar questions corresponding to the question, and the analysis of each similar question; A question answering model answering unit is used to call a trained question answering model for each similar question to answer the question to be answered based on the similar question and the analysis of the similar question, and obtain the answer output by the question answering model; The question answering model is a large language model that is trained to discover the relationship between the question to be answered and similar questions, and to answer the questions using similar questions; The final answer determination unit is used to determine the final answer to the question based on the answers output by the question answering model.

9. A computer program product, characterized in that It comprises computer-readable instructions, and when the computer-readable instructions are executed on an electronic device, the electronic device implements the question-solving method as claimed in any one of claims 1 to 7.

10. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the question-solving method as described in any one of claims 1 to 7.

11. A computer-readable storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the question-solving method as described in any one of claims 1 to 7.

Citation Information

Cited By

  • Question solving model training method, problem solving method, device and equipment

    CN120598064A