A question-answering method, device, electronic device and storage medium based on a large model

By using the joint question and answer model trained jointly by thinking chains in the large model, the problem of answer accuracy and controllability in the large model question and answer process is solved, and higher consistency and accuracy are achieved.

CN117312512BActive Publication Date: 2024-09-17TRANSWARP TECHNOLOGY (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311246958.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-25
Publication Date
2024-09-17
Estimated Expiration
2043-09-25

AI Technical Summary

Technical Problem

Existing large models have low answer accuracy during the question and answer process, and the prediction process is uncontrollable and lacks consistency, resulting in inaccurate intelligent question and answer results.

Method used

A joint question and answer model based on the thinking chain is adopted. By inputting the questions to be answered into the pre-trained joint question and answer model, the joint training of the first question and answer model and the second question and answer model is used to ensure the correlation between the input data and the output data. Improve the logic and controllability of answers.

Benefits of technology

It achieves an improvement in answer accuracy during the question-and-answer process and controllability of the prediction process, avoids inaccurate prediction results caused by the model's inability to standardize alignment, and improves the prediction accuracy and consistency of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117312512B
    Figure CN117312512B
Patent Text Reader

Abstract

The present invention discloses a question-and-answer method, device, electronic device and storage medium based on a large model; the method comprises: obtaining a question to be answered; inputting the question to be answered into a pre-trained joint question-and-answer model to obtain an output result of the joint question-and-answer model; determining the answer corresponding to the question to be answered according to the output result of the joint question-and-answer model, thereby solving the problems of low accuracy of answers and uncontrollable prediction process in the question-and-answer process, and jointly training a first question-and-answer model and a second question-and-answer model based on a thinking chain, thereby realizing the logic and controllability of the answer prediction process and result; in the process of predicting the answer, the input data of the second question-and-answer model is determined according to the output data of the first question-and-answer model and the question to be answered, thereby establishing an association relationship between the first question-and-answer model and the second question-and-answer model to maintain high consistency, thereby avoiding the occurrence of inaccurate prediction results due to the inability to align the models in a standardized manner, and improving the prediction accuracy of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a large model-based question-answering method, device, electronic device and storage medium. Background Art

[0002] With the rapid development of artificial intelligence, machine learning technology is also advancing. From machine learning ML to deep learning DL to large-scale learning LM, large models have shown good performance in generalization and logical thinking problems in the field of machine learning, providing the possibility for the realization of general artificial intelligence.

[0003] Current large models often have a variety of methods for data preprocessing, but their output results do not have strong logic in terms of credibility and controllability, resulting in inconsistent output results between different large models trained with the same data.

[0004] At present, large-scale model prediction methods, model training and standard alignment mostly rely on manual annotation and judgment, which is not only time-consuming and labor-intensive, but also the results generated by large models are affected by the subjective factors of the annotators and are not accurate enough; the degree of automation is low, the efficiency is low, which is not conducive to large-scale commercial use, and the prediction process and results are not intuitive and controllable. In the process of thinking and getting answers by large models, since large models cannot automatically and efficiently perform standard alignment, it further leads to the inability to accurately predict data and get accurate answers. Therefore, in the process of intelligent question answering, how to accurately predict and get reliable answers, and how to make the prediction process intuitive and controllable has become a problem to be solved. Summary of the invention

[0005] The present invention provides a question-answering method, device, electronic device and storage medium based on a large model to solve the problems of low accuracy of answers and uncontrollable prediction process in the question-answering process.

[0006] According to one aspect of the present invention, a question answering method based on a large model is provided, comprising:

[0007] Get questions to be answered;

[0008] Input the question to be answered into a pre-trained joint question-answering model to obtain an output result of the joint question-answering model; the joint question-answering model includes a first question-answering model and a second question-answering model, the first question-answering model and the second question-answering model are large models, the first question-answering model and the second question-answering model are jointly trained based on a thinking chain, and the input data of the second question-answering model is determined according to the output data of the first question-answering model and the question to be answered;

[0009] The answer to the question to be answered is determined according to the output result of the joint question-answering model.

[0010] According to another aspect of the present invention, there is provided a question-answering device based on a large model, comprising:

[0011] A question acquisition module is used to obtain questions to be answered;

[0012] A model input module, used for inputting the question to be answered into a pre-trained joint question-answering model to obtain an output result of the joint question-answering model; the joint question-answering model includes a first question-answering model and a second question-answering model, the first question-answering model and the second question-answering model are large models, the first question-answering model and the second question-answering model are jointly trained based on a thinking chain, and the input data of the second question-answering model is determined according to the output data of the first question-answering model and the question to be answered;

[0013] The answer determination module is used to determine the answer corresponding to the question to be answered based on the output result of the joint question-answering model.

[0014] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0015] at least one processor; and

[0016] a memory communicatively connected to the at least one processor; wherein,

[0017] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the large model-based question-answering method described in any embodiment of the present invention.

[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the large model-based question-answering method described in any embodiment of the present invention when executed.

[0019] The technical solution of the embodiment of the present invention obtains a question to be answered; inputs the question to be answered into a pre-trained joint question-answering model to obtain an output result of the joint question-answering model; the joint question-answering model includes a first question-answering model and a second question-answering model, the first question-answering model and the second question-answering model are large models, the first question-answering model and the second question-answering model are jointly trained based on a thinking chain, and the input data of the second question-answering model is determined according to the output data of the first question-answering model and the question to be answered; the answer corresponding to the question to be answered is determined according to the output result of the joint question-answering model, thereby solving the problem that the accuracy of the answer is low and the prediction accuracy is poor in the question-answering process. For problems that are uncontrollable in the process, the corresponding answers can be obtained by pre-training the joint question-answering model to answer the questions. The joint question-answering model is obtained by jointly training the first question-answering model and the second question-answering model. The first question-answering model and the second question-answering model are jointly trained based on the thinking chain to achieve the logic and controllability of the answer prediction process and results. In the process of predicting the answer, the input data of the second question-answering model is determined according to the output data of the first question-answering model and the question to be answered, so that the first question-answering model and the second question-answering model are associated to maintain high consistency, thereby avoiding the situation where inaccurate prediction results caused by the inability to align the models in a standardized manner, and improving the model prediction accuracy.

[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0022] Figure 1 is a flow chart of a question-answering method based on a large model provided according to Embodiment 1 of the present invention;

[0023] Figure 2 is a flow chart of a question-answering method based on a large model provided according to Embodiment 2 of the present invention;

[0024] Figure 3 is a structural diagram of a question-answering device based on a large model provided according to Embodiment 3 of the present invention;

[0025] Figure 4 It is a structural schematic diagram of an electronic device for implementing the large model-based question-answering method of an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0028] Embodiment 1

[0029] Figure 1 This is a flowchart of a question-answering method based on a large model provided in the first embodiment of the present invention. This embodiment is applicable to the case of intelligent question-answering. The method can be executed by a question-answering device, which can be implemented in the form of hardware and / or software, and can be configured in an electronic device. Figure 1 As shown, the method includes:

[0030] S101. Obtain questions to be answered.

[0031] In this embodiment, the problem to be solved can be specifically understood as a problem that needs to be answered by solving it. The type of the problem to be solved can be digital calculation type, language logic type, etc.

[0032] For example, question 1 to be answered is: Zheng Qiang knows the number 87654321, and Chen Mei's home phone number is exactly 87654321, so Zheng Qiang knows Chen Mei's home phone number. What is the logical error in this sentence?

[0033] Question 2 to be answered is: Xiaohua has 2 children. Each child needs to be taken care of for 5 hours a day. How much time does Xiaohua need to spend on the children in a week?

[0034] It should be noted that the method provided in the embodiment of the present application can be integrated as an application on a smart terminal, or presented as an application webpage on a smart terminal. For the user, the input interface can be opened by opening the application or logging into the application webpage, and the input of the question to be answered can be realized by manually entering text in the input interface, or the question to be answered can be input by voice. The execution subject can obtain the question to be answered by receiving the input operation of the user.

[0035] S102. Input the question to be answered into a pre-trained joint question-answering model to obtain an output result of the joint question-answering model; the joint question-answering model includes a first question-answering model and a second question-answering model, the first question-answering model and the second question-answering model are large models, the first question-answering model and the second question-answering model are jointly trained based on a thinking chain, and the input data of the second question-answering model is determined according to the output data of the first question-answering model and the question to be answered.

[0036] In this embodiment, the joint question-answering model can be specifically understood as a knowledge question-answering model obtained through joint training, which can answer questions and obtain corresponding answers. The first question-answering model and the second question-answering model are sub-models in the joint question-answering model. Both the first question-answering model and the second question-answering model can answer questions. The first question-answering model and the second question-answering model are large models, namely, large language models LLM. In the prediction process, the output data of the first question-answering model will be used as the input data of the second question-answering model. In the embodiment of the present application, the input data of the second question-answering model includes the output data of the first question-answering model and the question to be answered.

[0037] The initial model is pre-built, and the initial model also includes two sub-models. The initial model is trained through training samples. During the training process, the parameters of the model are continuously adjusted according to the loss function, and finally a model that meets the requirements is obtained as a joint question-answering model. The two sub-models in the joint question-answering model are the first question-answering model and the second question-answering model. During the training process, the input of the model includes the thinking chain data to realize the derivation of the prediction process and ensure the controllability of the prediction process, and the first question-answering model and the second question-answering model are jointly trained to improve the degree of association between the models and ensure the alignment of the model specifications. In an embodiment of the present application, the first question-answering model can predict the answer and the thinking chain data according to the question; the second question-answering model can predict the answer according to the question and the thinking chain data. For the trained joint question-answering model, after the question to be answered is input into the joint question-answering model, the question to be answered is first input into the first question-answering model to obtain the output data of the first question-answering model, and the output data of the first question-answering model includes the answer and the thinking chain data, and part or all of the data output by the first question-answering model is input into the second question-answering model to obtain the output data of the second question-answering model, and the output data of the second question-answering model includes the answer.

[0038] It should be noted that the first question-answering model and the second question-answering model can also be any type of neural network model as long as they can achieve question-answering through training.

[0039] S103. Determine the answer to the question to be answered based on the output result of the joint question-answering model.

[0040] The output result of the joint question-answering model may include the answer of the first question-answering model and the answer of the second question-answering model at the same time, or it may be the final answer determined by combining the answer of the first question-answering model and the answer of the second question-answering model. When the output result of the joint question-answering model includes the answer of the first question-answering model and the answer of the second question-answering model at the same time, the two answers can be compared. When the two answers are the same, the answer is directly used as the answer to the question to be answered; when the two answers are different, the answer predicted by the model with a higher priority can be selected as the answer to the question to be answered according to the preset priority of the answer of the first question-answering model and the second question-answering model, or the answer can be considered wrong, and it is determined that the answer to the question to be answered cannot be predicted or does not exist, etc. After obtaining the final result of the prediction, the user can be prompted by text, animation, voice, etc. For example, the answer can be displayed by text on the interface, or the answer can be broadcast by voice. When the answer is wrong, the text or voice prompt "Sorry, no answer found for the current question" is displayed.

[0041] An embodiment of the present invention provides a question-answering method based on a large model, which solves the problems of low answer accuracy and uncontrollable prediction process in the question-answering process. The questions are answered by pre-training a joint question-answering model to obtain corresponding answers. The joint question-answering model is obtained by jointly training a first question-answering model and a second question-answering model. The first question-answering model and the second question-answering model are jointly trained based on a thinking chain to achieve the logic and controllability of the answer prediction process and results, and enhance the interpretability of the model learning process. In the process of predicting the answer, the input data of the second question-answering model is determined according to the output data of the first question-answering model and the question to be answered, so that the first question-answering model and the second question-answering model are associated to maintain high consistency, thereby avoiding the occurrence of inaccurate prediction results due to the inability to align the models in a standardized manner, and improving the model prediction accuracy.

[0042] Embodiment 2

[0043] Figure 2 This is a flowchart of a question-answering method based on a large model provided in the second embodiment of the present invention. This embodiment is refined on the basis of the above embodiment. Figure 2 As shown, the method includes:

[0044] S201. Obtain questions to be answered.

[0045] S202. Input the question to be answered into the first question-answering model in the joint question-answering model, and obtain the first target answer and predicted thinking chain data output by the first question-answering model.

[0046] In this embodiment, the first target answer can be specifically understood as the answer obtained by the trained first question-answering model when predicting the question to be answered; the predicted thinking chain data can be specifically understood as the reasoning process of the trained first question-answering model when predicting the question to be answered.

[0047] The question to be answered is input into the first question-answering model in the joint question-answering model. The first question-answering model predicts the question to be answered based on the experience learned during the training process, obtains the first target answer, and simultaneously obtains the predicted thinking chain data to represent the reasoning process of the answer prediction.

[0048] S203. Input the question to be answered and the predicted thinking chain data into the second question-answering model in the joint question-answering model to obtain the second target answer output by the second question-answering model.

[0049] In this embodiment, the second target answer can be specifically understood as the answer obtained by predicting the question to be answered by the trained second question-answering model based on the thought chain.

[0050] The questions to be answered and the predicted thinking chain data are input into the second question-answering model in the joint question-answering model. The second question-answering model processes the questions to be answered and the predicted thinking chain data according to the experience learned during the training process, and predicts the second target answer.

[0051] As an optional embodiment of this embodiment, this optional embodiment further optimizes the training of the joint question-answering model, including steps A1-A7:

[0052] A1. Obtain a training sample set including at least one training sample, where the training sample includes a question to be predicted, standard thinking chain data, and a standard answer.

[0053] In this embodiment, the training sample can be specifically understood as data used to train the model; the training sample set can be specifically understood as a set consisting of one or more training samples. The problem to be predicted can be specifically understood as a problem that requires question and answer prediction during the training process. The standard thinking chain data can be specifically understood as the true value of the thinking chain data corresponding to the problem to be predicted, and the standard thinking chain data can be manually marked in advance. The standard answer can be specifically understood as the data used as the reference true value of the answer predicted according to the problem to be predicted during the training process. The training sample includes the problem to be predicted, the standard thinking chain data and the standard answer, wherein the problem to be predicted is used for prediction, the standard thinking chain data is used for both prediction and verification of the predicted thinking chain data, and the standard answer is used to verify the predicted answer.

[0054] A2. Input the question to be predicted in the corresponding training sample under the current iteration into the first question-answering model to be trained of the current network model to be trained, and obtain the first predicted answer and predicted thinking chain data output by the first question-answering model to be trained.

[0055] In this embodiment, the network model to be trained can be specifically understood as the initially constructed model, and the network model to be trained includes a first question-answering model to be trained and a second question-answering model to be trained. The first question-answering model to be trained can be specifically understood as a question-answering model that needs to be trained, and the first question-answering model to be trained can predict thought chain data and answers based on questions. The first predicted answer can be specifically understood as the answer predicted by the first question-answering model to be trained based on the question to be predicted; the predicted thought chain data can be specifically understood as the predicted thought chain data.

[0056] A training sample is selected from the training sample set as the training sample for the current iteration, and the question to be predicted in this training sample is input into the first question-answering model to be trained of the current network model to be trained. The first question-answering model to be trained processes and predicts the question to be predicted according to the current parameters of the model to obtain the first predicted answer and predicted thinking chain data.

[0057] A3. Input the question to be predicted and the standard thinking chain data in the training sample corresponding to the current iteration into the second question-answering model to be trained of the current network model to be trained, and obtain the second predicted answer output by the second question-answering model to be trained.

[0058] In this embodiment, the second question-answering model to be trained can be specifically understood as a question-answering model that needs to be trained. The second question-answering model to be trained realizes question-answering prediction and predicts the answer based on the question to be predicted and the standard thinking chain data.

[0059] The questions to be predicted and the standard thinking chain data in the training samples of the current iteration are input into the second question-answering model to be trained of the current network model to be trained. The second question-answering model to be trained processes and predicts the questions to be predicted and the standard thinking chain data according to the current parameters of the model to obtain a second predicted answer.

[0060] It should be noted that the corresponding training samples in steps A2 and A3 in the current iteration are the same training samples.

[0061] A4. Determine a first loss function based on the first predicted answer and the standard answer, as well as the predicted thinking chain data and the standard thinking chain data; determine a second loss function based on the second predicted answer and the standard answer; and determine a comparative loss function based on the first predicted answer and the second predicted answer.

[0062] In this embodiment, the first loss function can be specifically understood as the loss function corresponding to the difference between the output data of the first question and answer model to be trained and the true value; the second loss function can be specifically understood as the loss function corresponding to the difference between the output data of the second question and answer model to be trained and the true value; the comparative loss function can be specifically understood as the loss function corresponding to the difference between the predicted answers of the first question and answer model to be trained and the second question and answer model to be trained.

[0063] The type of loss function is determined in advance, and then the calculation formula of the loss function can be determined according to the type of loss function. The first predicted answer and the standard answer are substituted into the calculation formula of the loss function of the first question-answering model to be trained, and the predicted thinking chain data and the standard thinking chain data are brought into the calculation formula of the loss function to obtain the first loss function by calculation. In this embodiment, when calculating the first loss function, the first predicted answer and the standard answer can be first substituted into the calculation formula of the loss function to calculate and obtain the operation result; then the predicted thinking chain data and the standard thinking chain data are substituted into the calculation formula of the loss function to calculate and obtain the operation result, and the two operation results are summed, averaged and other comprehensive operations are performed to obtain the first loss function; or, the calculation formula of the first loss function includes four parameters, namely, the first predicted answer, the standard answer, the predicted thinking chain data and the standard thinking chain data, and the first loss function can be obtained by substituting the first predicted answer, the standard answer, the predicted thinking chain data and the standard thinking chain data into the calculation formula of the loss function. The second predicted answer and the standard answer are substituted into the calculation formula of the loss function of the second question-answering model to be trained, and the second loss function is obtained by calculation. The first predicted answer and the second predicted answer are substituted into the calculation formula of the contrast loss function to obtain the contrast loss function.

[0064] It should be noted that when calculating different loss functions, the embodiments of the present application may select the same loss function expression or different loss function expressions.

[0065] A5. Determine a first fitting function according to the first loss function and the contrast loss function, and determine a second fitting function according to the second loss function and the contrast loss function.

[0066] In this embodiment, the first fitting loss function can be specifically understood as a loss function obtained by fitting the first loss function and the contrast loss function; the second fitting loss function can be specifically understood as a loss function obtained by fitting the second loss function and the contrast loss function.

[0067] The first loss function and the contrast loss function are fitted by summing, weighting, averaging, etc. to obtain a first fitting function. The second loss function and the contrast loss function are fitted by summing, weighting, averaging, etc. to obtain a second fitting function.

[0068] A6. Back-propagate the first question-answering model to be trained based on the first fitting loss function, and back-propagate the second question-answering model to be trained based on the second fitting loss function to obtain a network model to be trained for the next iteration, until the first training end condition is met to obtain a target network model.

[0069] In this embodiment, the first training end condition can be specifically understood as the end condition of the model training. For example, after the value of the loss function approaches stability (i.e., cannot decrease) or is less than a certain threshold over a period of time, it is determined that the first training end condition is met.

[0070] During the training process of the neural network model, the model is continuously updated and adjusted through the back propagation method until the output of the model is consistent with the target. After determining the first fitting loss function and the second fitting loss function, the first fitting loss function is used to back propagate the first question-answering model to be trained, and the second fitting loss function is used to back propagate the second question-answering model to be trained to obtain the network model to be trained for the next iteration. When it is determined that the first training end condition is not met according to the first loss function, the second loss function and the comparison loss function, a new training sample is selected to continue training the network model to be trained for the next iteration until the first training end condition is met, and the target network model is obtained. The embodiment of the present invention does not limit the specific back propagation process, and it can be set according to the specific situation.

[0071] A7. Determine the joint question-answering model based on the target network model.

[0072] The target network model obtained in this step can be directly used as the joint question-answering model, or it can be adjusted again to obtain the joint question-answering model. For example, it is determined whether the accuracy of the target network model meets the requirements. If not, continue training to obtain the joint question-answering model; if it does, directly determine the target network model as the joint question-answering model. After obtaining the joint question-answering model, the joint question-answering model can be used to predict the questions to be answered.

[0073] When the embodiment of the present application performs model training, a training framework can be constructed. The basic framework for model training can use Deepspeed, Megatron, etc. The present application uses a twin network architecture to simultaneously learn the first question-and-answer model to be trained and the second question-and-answer model to be trained. The first question-and-answer model to be trained and the second question-and-answer model to be trained can be a large language model LLM. During the model training process, the contrast loss function is calculated based on the difference between the prediction results of the first question-and-answer model to be trained and the second question-and-answer model to be trained. The two models can be associated to improve consistency and ensure the standard alignment of the two models. In the traditional independent learning method of the capability model and the evaluation model, the inconsistency between the models is very obvious. In order to reduce the inconsistency of the model and improve the accuracy of the model, the embodiment of the present application designs a twin learning and contrast-enhanced learning method of the model. The first question-and-answer model to be trained and the second question-and-answer model to be trained are used as a combination to achieve standard alignment with the thinking chain CoT as the medium, thereby improving the accuracy of the model.

[0074] Exemplarily, the embodiment of the present application provides a training implementation process. Taking the first question-answering model to be trained as LLMA and the second question-answering model to be trained as LLM B as an example, the training process includes the following steps:

[0075] 1. Prepare the original question-answering training data, and prepare the training sample set train.json containing the three parts of data: Question, standard thinking chain data CoT, and standard answer Answer. The sample examples in the specific data set are as follows:

[0076]

[0077]

[0078] Among them, the standard thinking chain data CoT represents the step description of solving the problem, and the Index field represents the sequence number of the training sample in the training sample set.

[0079] 2. Twin LLM AB training framework construction and actual training. In this embodiment, Deepspeed is used as the basic framework for model training. The framework is stored in the server and called during model training. For example, the address path of the framework in the server is / opt / test / test_framework.py, and the statement for Multicard to call the framework is deepspeed--num_gpus=2your_program.py<normal cl args> --deepspeed ds_config.json. Maximize training speed and optimize GPU resource usage by adjusting model parameters and using Apex mixed precision (the sample is shown below).

[0080]

[0081] This implementation adopts a twin network architecture to simultaneously learn LLM A and LLM B. In the process of contrast enhancement learning, LLM A / B models use the same sample source at the same time. Taking the data sample in step 1 as the standard, the input of LLM A is the Question field of the training sample with Index 1, and the input of LLM B is the Question and CoT fields of the training sample with Index 1. The output of LLM A will include two parts: CoT and Answer. The example is as follows:

[0082]

[0083] The data output by LLM B does not carry CoT, and the rest is the same as the above format. During the training process, LLM A / B need to calculate the loss value of comparing their own output with the original data respectively to measure the loss of the output results of LLM A and LLM B and the label. Among them, the loss value of LLM A is recorded as L_A (i.e., the first loss function), and the loss value of LLM B is recorded as L_B (i.e., the second loss function). At the same time, since the loss measurement between the Answer results output by the two models is a contrastive loss value, it is recorded as L_AB (i.e., the contrastive loss function). When L_A, L_B, and L_AB all drop to the point where they cannot drop at the same time, it is determined that the training end condition is met and the reinforcement learning of the model is completed.

[0084] After model training is completed, LLM A, when working independently, has the ability to input problems and provide steps and answers to solve them. When LLM A / B work together, the reliability of the answers can be further measured. In actual application scenarios, LLM A or LLM B can also be deployed and used separately to reduce costs and improve reasoning efficiency.

[0085] As an optional embodiment of this embodiment, this optional embodiment further optimizes the joint question-answering model determined based on the target network model to B1-B6:

[0086] B1. Obtain at least one question to be reasoned.

[0087] In this embodiment, the questions to be inferred can be specifically understood as questions that need to be inferred. The questions to be inferred can be collected in advance, and can be manually raised and collected uniformly, or extracted from books, web pages, etc. through data extraction technology.

[0088] B2. For each question to be inferred, the question to be inferred is input into the first question-answering model to be trained of the target network model to obtain the first inference answer and inference thinking chain data.

[0089] In this embodiment, the first inference answer can be specifically understood as the answer predicted by the first question-answering model to be trained; the reasoning thinking chain data can be specifically understood as the reasoning thinking process of the first question-answering model to be trained to infer the answer to the question.

[0090] The question to be inferred is input into the first question-answering model to be trained in the target network model. The first question-answering model to be trained performs reasoning and prediction on the question to be inferred based on the experience learned during the training process, and obtains the first reasoning answer and reasoning thinking chain data output by the model.

[0091] For example, the user inputs the question to be inferred, "Xiaohua's family has two children. Each child needs to be taken care of for 5 hours a day. How much time does Xiaohua need to spend on the children in a week?" into the first question-answering model to be trained. After receiving the question, the first question-answering model to be trained performs a reasoning operation and outputs the reasoning thinking chain data CoT corresponding to the question and the first reasoning answer Answer result, as shown below:

[0092]

[0093]

[0094] B3. Input the question to be inferred and the reasoning thinking chain data into the second question-answering model to be trained of the target network model to obtain the second reasoning answer.

[0095] In this embodiment, the second inference answer can be specifically understood as the answer predicted by the second question-answering model to be trained. The question to be inferred and the reasoning thought chain data are input into the second question-answering model to be trained of the target network model. The second question-answering model to be trained performs inference prediction based on the experience learned during the training process to obtain the second inference answer output by the model.

[0096] Exemplarily, the question to be inferred and the reasoning thinking chain data CoT output by the first question-answering model to be trained are input to the second question-answering model to be trained, and the second question-answering model to be trained performs the reasoning operation and outputs the second reasoning answer Answer, as shown below:

[0097]

[0098] B4. Calculate the similarity between the first reasoning answer and the second reasoning answer, and determine the consistency analysis result of the first reasoning answer and the second reasoning answer according to the similarity.

[0099] In this embodiment, the consistency analysis result may be high consistency, low consistency, etc. The similarity between the first reasoning answer and the second reasoning answer may be calculated by an edit distance algorithm, a cosine similarity algorithm, etc. The consistency analysis result of the first reasoning answer and the second reasoning answer is determined according to the size of the similarity. The greater the similarity, the higher the consistency of the two reasoning answers. The present application may classify the consistency in advance and divide it into corresponding consistency classifications according to the size of the similarity.

[0100] For example, the first inference answer Answer_A is "70 hours" and the second inference answer Answer_B is "70 hours" as an example to illustrate the calculation method of similarity. The method combining edit distance and cosine similarity is used to determine the consistency of Answer_A and Answer_B. Using the edit distance algorithm to analyze, it only takes one step to change from Answer_A to Answer_B, that is, 70 hours to 70 hours - delete the character "small", and the edit distance is 1. Using the cosine similarity algorithm to analyze, first convert Answer_A and Answer_B into vector representation, and use the cosine similarity algorithm dot_product(Answer_A,Answer_B) / (magnitude(Answer_A)*magnitude(Answer_B)) to calculate the cosine similarity between the answers, which is 0.938. The closer the similarity is to 1, the more similar it is. Therefore, it can be judged that Answer_A and Answer_B have high consistency; conversely, Answer_A and Answer_B have low consistency.

[0101] As an optional embodiment of this embodiment, this optional embodiment further optimizes the consistency analysis result of determining the first reasoning answer and the second reasoning answer according to the similarity into C1-C2:

[0102] C1. Evaluate the similarity according to the similarity evaluation rules and determine the score corresponding to the similarity.

[0103] In this embodiment, the similarity evaluation rule can be understood as a method of calculating scores based on similarity, for example, the scores are divided according to the numerical value and numerical range of the similarity. For example, when the similarity is in the range of 0 to 0.5, the score is 3 points; when the similarity is in the range of 0.5 to 0.7, the score is 6 points; when the similarity is in the range of 0.7 to 1, the score is 9 points. Alternatively, the similarity evaluation rule is a calculation formula or algorithm, and after the similarity is brought in, the corresponding score can be calculated.

[0104] C2. Based on the score and in combination with the predetermined consistency score area division rules, determine the target consistency area where the score is located, and determine the consistency analysis result according to the target consistency area.

[0105] In this embodiment, the consistency score region division rule can be specifically understood as the correspondence between the score and the consistency region, and the consistency region can be a high consistency region, a low consistency region, etc. For example, the score corresponding to the high consistency region is greater than 8 points. Etc. The target consistency region can be specifically understood as the consistency region corresponding to the score.

[0106] Pre-set consistency score area division rules, query based on the score, determine the consistency area where the score is located, use this consistency area as the target consistency area, and determine the consistency corresponding to the target consistency area as the consistency analysis result. For example, when the consistency of the target consistency area is high consistency, the consistency analysis result is high consistency.

[0107] It should be noted that each problem to be reasoned is processed in the same way to obtain a consistency analysis result for each problem to be reasoned. The consistency analysis result can reflect the consistency and standardization of the problem reasoning of the first model to be trained and the second model to be trained.

[0108] B5. Based on the consistency analysis results, a low-consistency problem dataset is formed.

[0109] In this embodiment, the low consistency problem data set can be specifically understood as a set of problems whose prediction results are low consistency. The statistical consistency analysis results are low consistency problems to be inferred, and these problems to be inferred are put into the same data set to obtain a low consistency problem data set.

[0110] In the embodiment of the present application, after obtaining the low consistency problem data set, the low consistency problem data set can be stored in a file format, or in a storage system such as a big data system or a vector database, a knowledge base, etc. A high consistency problem data set can also be formed based on the high consistency problems to be inferred, and when storing, the high consistency problems to be inferred and the low consistency problems to be inferred can be stored at the same time. In order to save storage space, it is also possible to choose to store only the low consistency problems to be inferred.

[0111] B6. Determine whether the amount of data in the low consistency problem data set meets the enhanced training conditions. If so, execute B7; otherwise, execute B8.

[0112] In this embodiment, the enhanced training condition can be specifically understood as a condition for performing enhanced training on the model, for example, the amount of data reaches a certain threshold, the proportion of the amount of data reaches a certain threshold, etc. The enhanced training condition is pre-set, and taking the enhanced training condition as the ratio of the low-consistency problems to be inferred to the total number of problems to be inferred is greater than 10% as an example, the amount of data in the low-consistency problem data set is counted, and the ratio of this data amount to the total number of problems to be inferred is calculated. If it is greater than 10%, it is determined that the enhanced training condition is met, and step B7 is executed for enhanced training; otherwise, it is determined that the enhanced training condition is not met, and step B8 is executed.

[0113] B7. Perform reinforcement learning training on the target network model based on the low-consistency question dataset to obtain a joint question-answering model.

[0114] Based on the questions to be inferred in the low-consistency question data set, the target network model continues to be trained to implement reinforcement learning training of the target network model and obtain a joint question-answering model that meets the requirements.

[0115] As an optional embodiment of this embodiment, this optional embodiment further performs reinforcement learning training on the target network model based on the low consistency problem data set and optimizes it to D1-D5:

[0116] D1. Select augmented training questions from the low consistency question dataset.

[0117] In this embodiment, the enhanced training problem can be specifically understood as a problem used to perform enhanced training on the model. Since the number of problems used in the enhanced training process is usually multiple, the embodiment of the present application needs to select at least one enhanced training problem from the low consistency problem data set, and select a problem to be inferred from the low consistency problem data set as the enhanced training problem in each iteration during the enhanced training process. The method of selecting enhanced training problems from the low consistency problem data set can be selected in sequence or randomly.

[0118] D2. Input the corresponding enhanced training question in the current iteration into the first question-answering model to be trained of the target network model to obtain the first enhanced training answer and enhanced training thinking chain data.

[0119] In this embodiment, the first enhanced training answer can be specifically understood as the answer obtained by the first question and answer model to be trained to predict the enhanced training question; the enhanced training thinking chain data can be specifically understood as the reasoning thinking process of the first question and answer model to be trained to infer the answer to the enhanced training question.

[0120] The enhanced training questions are input into the first question-answering model to be trained in the target network model. The first question-answering model to be trained makes inferences and predictions on the enhanced training questions based on the experience learned during the training process, and obtains the first enhanced training answers and enhanced training thinking chain data output by the model.

[0121] D3. Input the enhanced training questions and enhanced training thinking chain data into the second to-be-trained question-answering model of the second to-be-trained network model of the target network model to obtain the second enhanced training answer.

[0122] In this embodiment, the second enhanced training answer can be specifically understood as the answer obtained by the second question-answering model to be trained to predict the enhanced training question. The enhanced training question and the enhanced training thinking chain data are input into the second question-answering model to be trained of the target network model, and the second question-answering model to be trained performs inference prediction based on the experience learned during the training process to obtain the second enhanced training answer output by the model.

[0123] D4. Calculate the enhanced training loss function according to the first enhanced training answer and the second enhanced training answer.

[0124] In this embodiment, the enhanced training loss function can be specifically understood as a loss function of the difference between the prediction results of the two models during the enhanced training process. The expression of the loss function is predetermined, and the first enhanced training answer and the second enhanced training answer are substituted into the expression of the loss function to obtain the enhanced training loss function.

[0125] D5. Based on the enhanced training loss function, back-propagate the first question-answering model to be trained and the second question-answering model to be trained to obtain the target network model for the next iteration, until the second training end condition is met to obtain the joint question-answering model.

[0126] In this embodiment, the second training end condition can be specifically understood as the end condition of the model training. For example, after the value of the loss function approaches stability (i.e., cannot decrease) or is less than a certain threshold over a period of time, it is determined that the second training end condition is met. The first training end condition and the second training end condition in the embodiment of the present application can be the same or different.

[0127] During the training process of the neural network model, the model is continuously updated and adjusted through the back propagation method until the output of the model is consistent with the target. After the enhanced training loss function is determined, the first question-and-answer model to be trained and the second question-and-answer model to be trained are back propagated simultaneously through the enhanced training loss function to obtain the target network model for the next iteration. When it is determined according to the enhanced training loss function that the second training end condition is not met, a new enhanced training question is selected to continue training the target network model of the next iteration until the second training end condition is met, and a joint question-and-answer model is obtained. The embodiment of the present invention does not limit the specific back propagation process, and it can be set according to the specific situation.

[0128] During the enhanced training, since the enhanced training questions have no standard answers and thought chain data, that is, the only known data in the entire training process is the question. Therefore, during the enhanced training process, the loss function is calculated only based on the answers output by the two models for back propagation. This method does not require high training data, only the question is needed, which can reduce the workload of manual labeling, while improving the consistency and standardization of the model, thereby improving the prediction accuracy.

[0129] B8. Determine the target network model as the joint question-answering model.

[0130] When the enhanced training conditions are not met, the target network model is directly determined as the joint question-answering model.

[0131] Compared with the entire model training, the enhanced training method provided in this embodiment is more targeted. By performing enhanced training on low-consistency problems, the effect and rigor of the model are enhanced in a targeted manner, thereby improving the standardization and consistency of the model.

[0132] When performing enhanced training, you can also expand the low consistency question dataset, for example, using ChatGPT as the main large model. Taking inference_low_question.json as an example, the prompt input to ChatGPT is as follows:

[0133]

[0134] The following are examples of questions rewritten based on ChatGPT:

[0135]

[0136] After all the rewritten and expanded questions are generated, a new low-consistency question dataset inference_new.json is formed. The expanded low-consistency question dataset is used for model training, which increases data diversity and covers a larger ratio of actual scenarios in data distribution, which can effectively improve model performance.

[0137] In actual application, it is difficult to train the first question-answering model to be trained and the second question-answering model to be trained to be completely accurate and logically aligned through only one training. Therefore, the embodiment of the present application can combine and deploy the three processes of model training, consistency analysis, and enhanced learning training, and can also use the method of amplifying data to achieve automatic online optimization of the model.

[0138] S204: If the first target answer and the second target answer are consistent, the first target answer or the second target answer is output as the output result of the joint question-answering model.

[0139] If the first target answer and the second target answer are consistent, that is, the prediction results of the two models are the same, the first target answer or the second target answer is directly used as the output result of the joint question-answering model and output.

[0140] If the first target answer and the second target answer are inconsistent, the first target answer and the second target answer may be output simultaneously, or the output answers may be inconsistent, wrong, etc.

[0141] As an optional embodiment of the present embodiment, this optional embodiment is further optimized to include: if the first target answer and the second target answer are inconsistent, determining that the joint question and answer model has made a prediction error or re-inputting the question to be answered into the joint question and answer model for prediction until the first target answer and the second target answer are consistent or the number of predictions exceeds a preset threshold.

[0142] In this embodiment, the number of predictions can be specifically understood as the number of repeated predictions when predicting the answer to the question to be answered; the preset threshold can be specifically understood as a pre-set threshold used to judge the number of predictions.

[0143] If the first target answer and the second target answer are inconsistent, it is possible to directly determine that the joint question answering model has made a prediction error and output a relevant description of the prediction error; alternatively, the question to be answered can be input into the pre-trained joint question answering model for re-prediction. After re-prediction, the first target answer and the second target answer may be consistent, or they may still be inconsistent. In this case, the question to be answered can be re-predicted until the first target answer and the second target answer are consistent. Alternatively, the number of predictions can be counted each time a prediction is made. When the number of predictions exceeds a preset threshold, the prediction can be stopped, the model prediction error can be determined, and a relevant description of the prediction error can be output.

[0144] It should be noted that re-inputting the question to be answered into the joint question-answering model for prediction means re-inputting the question to be answered into the first question-answering model and the second question-answering model in the joint question-answering model for prediction, and its implementation process and principle are the same as the first time inputting the question to be answered.

[0145] S205. Determine the answer to the question to be answered based on the output result of the joint question-answering model.

[0146] When the output result of the joint question-answering model is one answer, this answer is directly determined as the answer to the question. When the output result of the joint question-answering model is two answers or a related description of the prediction error, it is determined that the answer to the question to be answered cannot be obtained, and the final result can be a null value.

[0147] The first question-answering model and the second question-answering model are formed by contrast enhancement training and reasoning, and the first question-answering model and the second question-answering model are used as sub-models of the joint question-answering model to achieve question-answering. The joint question-answering model can be deployed in a system, and the system can solve users' questions in the form of questions and answers. In this embodiment, the first question-answering model and the second question-answering model can automatically learn and reason based on the data set, and realize online optimization in actual application scenarios without manual intervention.

[0148] The embodiment of the present invention provides a question-answering method based on a large model, which solves the problem of low accuracy of answers and uncontrollable prediction process in the question-answering process, makes full use of the data autonomy characteristics of the large model itself to carry out joint model training, and carries out model training methods based on the thinking chain, records the whole process of the complete large model thinking and obtaining answers, and is conducive to the implementation of human-computer interaction and standard guidelines; the model generation method provided in this embodiment opens the model learning black box, so that the intermediate steps follow the logical specifications, realizes the measurable and controllable large model processing process, and realizes the reinforcement learning of logical consistency in the form of comparative learning. The method is simple and easy to implement, and can be conveniently applied to actual business scenarios, with stable performance and controllable process. The embodiment of the present application performs enhanced learning and reasoning on two models at the same time, and obtains the result of consistency alignment through comparative training and reasoning between models; the whole process of model training and prediction is intuitive and clear, and automatically judges whether the two models remain standardized after the model training is completed, with high efficiency and accurate results; effectively avoids the situation where the prediction results are inaccurate due to the inability of the model to align in a standardized manner, and improves the accuracy of model prediction.

[0149] Embodiment 3

[0150] Figure 3 This is a schematic diagram of the structure of a question-answering device based on a large model provided in the third embodiment of the present invention. Figure 3 As shown, the device includes: a question acquisition module 31, a model input module 32, and an answer determination module 33.

[0151] Wherein, the question acquisition module 31 is used to obtain the question to be answered;

[0152] A model input module 32 is used to input the question to be answered into a pre-trained joint question-answering model to obtain an output result of the joint question-answering model; the joint question-answering model includes a first question-answering model and a second question-answering model, the first question-answering model and the second question-answering model are large models, the first question-answering model and the second question-answering model are jointly trained based on a thinking chain, and the input data of the second question-answering model is determined according to the output data of the first question-answering model and the question to be answered;

[0153] The answer determination module 33 is used to determine the answer corresponding to the question to be answered based on the output result of the joint question-answering model.

[0154] An embodiment of the present invention provides a question-and-answer device, which solves the problems of low answer accuracy and uncontrollable prediction process in the question-and-answer process. The questions are answered by pre-training a joint question-and-answer model to obtain corresponding answers. The joint question-and-answer model is obtained by jointly training a first question-and-answer model and a second question-and-answer model. The first question-and-answer model and the second question-and-answer model are jointly trained based on a thinking chain to achieve the logic and controllability of the answer prediction process and results. In the process of predicting the answer, the input data of the second question-and-answer model is determined according to the output data of the first question-and-answer model and the question to be answered, so that the first question-and-answer model and the second question-and-answer model are associated to maintain high consistency, thereby avoiding the occurrence of inaccurate prediction results due to the inability to align the models in a standardized manner, and improving the prediction accuracy of the model.

[0155] Optionally, the model input module 32 includes:

[0156] A first prediction unit, configured to input the question to be answered into a first question-answering model in the joint question-answering model, and obtain a first target answer and predicted thinking chain data output by the first question-answering model;

[0157] A second prediction unit, used for inputting the question to be answered and the predicted thinking chain data into a second question-answering model in the joint question-answering model to obtain a second target answer output by the second question-answering model;

[0158] An output unit is used to output the first target answer or the second target answer as an output result of the joint question-answering model if the first target answer and the second target answer are consistent.

[0159] Optionally, the model input module 32 further includes:

[0160] A repeated input unit is used to determine that the joint question and answer model has made a prediction error or to re-input the question to be answered into the joint question and answer model for prediction if the first target answer and the second target answer are inconsistent, until the first target answer and the second target answer are consistent or the number of predictions exceeds a preset threshold.

[0161] Optionally, the device further comprises:

[0162] A sample acquisition module, used to acquire a training sample set including at least one training sample, wherein the training sample includes a problem to be predicted, standard thought chain data and a standard answer;

[0163] A first model training module, used for inputting the to-be-predicted question in the corresponding training sample in the current iteration into the first to-be-trained question-answering model of the current to-be-trained network model, and obtaining the first predicted answer and predicted thought chain data output by the first to-be-trained question-answering model;

[0164] The second model training module is used to input the to-be-predicted question and the standard thinking chain data in the training sample corresponding to the current iteration into the second to-be-trained question-answering model of the current to-be-trained network model, and obtain the second predicted answer output by the second to-be-trained question-answering model;

[0165] A loss function determination module, configured to determine a first loss function based on the first predicted answer and the standard answer, and the predicted thinking chain data and the standard thinking chain data, determine a second loss function based on the second predicted answer and the standard answer, and determine a contrast loss function based on the first predicted answer and the second predicted answer;

[0166] A loss function fitting module, used to determine a first fitting function according to the first loss function and the contrast loss function, and to determine a second fitting function according to the second loss function and the contrast loss function;

[0167] A back propagation module, used to perform back propagation on the first question-answering model to be trained based on the first fitting loss function, and to perform back propagation on the second question-answering model to be trained based on the second fitting loss function, to obtain a network model to be trained for the next iteration, until the first training end condition is met, and a target network model is obtained;

[0168] The joint question-answering model determination module is used to determine the joint question-answering model based on the target network model.

[0169] Optionally, a joint question-answering model determination module includes:

[0170] A question-to-be-reasoned obtaining unit, used to obtain at least one question to be reasoned;

[0171] A first reasoning unit is used for inputting each question to be reasoned into a first question-answering model to be trained of the target network model to obtain a first reasoning answer and reasoning thinking chain data;

[0172] A second reasoning unit is used to input the question to be reasoned and the reasoning thinking chain data into the second question-answering model to be trained of the target network model to obtain a second reasoning answer;

[0173] a consistency analysis unit, configured to calculate a similarity between the first reasoning answer and the second reasoning answer, and determine a consistency analysis result between the first reasoning answer and the second reasoning answer according to the similarity;

[0174] A problem data set generating unit, used for forming a low consistency problem data set based on the problem to be inferred with low consistency as a result of consistency analysis;

[0175] The question-answering model determination unit is used to determine whether the amount of data in the low-consistency question data set meets the enhanced training conditions. If so, the target network model is subjected to enhanced learning training based on the low-consistency question data set to obtain a joint question-answering model; otherwise, the target network model is determined as a joint question-answering model.

[0176] Optionally, a consistency analysis unit is specifically used to evaluate the similarity according to a similarity evaluation rule to determine a score corresponding to the similarity; based on the score, combined with a predetermined consistency score area division rule, determine a target consistency area where the score is located, and determine a consistency analysis result according to the target consistency area.

[0177] Optionally, a question-and-answer model determination unit is specifically used to select enhanced training questions from the low-consistency question data set; input the enhanced training questions corresponding to the current iteration into the first question-and-answer model to be trained of the target network model to obtain a first enhanced training answer and enhanced training thinking chain data; input the enhanced training questions and the enhanced training thinking chain data into the second question-and-answer model to be trained of the target network model to obtain a second enhanced training answer; calculate an enhanced training loss function based on the first enhanced training answer and the second enhanced training answer; back-propagate the first question-and-answer model to be trained and the second question-and-answer model to be trained based on the enhanced training loss function to obtain a target network model for the next iteration, until the second training end condition is met to obtain a joint question-and-answer model.

[0178] The question-and-answer device provided in the embodiment of the present invention can execute the question-and-answer method based on the big model provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0179] Embodiment 4

[0180] Figure 4 A schematic diagram of the structure of an electronic device 40 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0181] like Figure 4 As shown, the electronic device 40 includes at least one processor 41, and a memory connected to the at least one processor 41, such as a read-only memory (ROM) 42, a random access memory (RAM) 43, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 41 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 42 or the computer program loaded from the storage unit 48 to the random access memory (RAM) 43. In the RAM 43, various programs and data required for the operation of the electronic device 40 can also be stored. The processor 41, the ROM 42, and the RAM 43 are connected to each other through a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.

[0182] A number of components in the electronic device 40 are connected to the I / O interface 45, including: an input unit 46, such as a keyboard, a mouse, etc.; an output unit 47, such as various types of displays, speakers, etc.; a storage unit 48, such as a disk, an optical disk, etc.; and a communication unit 49, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0183] The processor 41 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 41 executes the various methods and processes described above, such as a large model-based question-answering method.

[0184] In some embodiments, the large model-based question-answering method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 48. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 40 via the ROM 42 and / or the communication unit 49. When the computer program is loaded into the RAM 43 and executed by the processor 41, one or more steps of the large model-based question-answering method described above may be performed. Alternatively, in other embodiments, the processor 41 may be configured to execute the large model-based question-answering method in any other appropriate manner (e.g., by means of firmware).

[0185] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0186] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0187] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0188] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0189] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0190] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0191] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0192] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A question-answering method based on a large model, characterized in that: include: Get questions to be answered; Input the question to be answered into a pre-trained joint question-answering model to obtain an output result of the joint question-answering model; the joint question-answering model includes a first question-answering model and a second question-answering model, the first question-answering model and the second question-answering model are large models, the first question-answering model and the second question-answering model are jointly trained based on a thinking chain, and the input data of the second question-answering model is determined according to the output data of the first question-answering model and the question to be answered; Determine the answer to the question to be answered according to the output result of the joint question-answering model; The training steps of the joint question-answering model include: Acquire a training sample set including at least one training sample, wherein the training sample includes a question to be predicted, standard thought chain data, and a standard answer; Inputting the to-be-predicted question in the corresponding training sample in the current iteration into the first to-be-trained question-answering model of the current to-be-trained network model, and obtaining the first predicted answer and predicted thought chain data output by the first to-be-trained question-answering model; Input the to-be-predicted question and the standard thinking chain data in the training sample corresponding to the current iteration into the second to-be-trained question-answering model of the current to-be-trained network model, and obtain the second predicted answer output by the second to-be-trained question-answering model; Determine a first loss function based on the first predicted answer and the standard answer, and the predicted thinking chain data and the standard thinking chain data, determine a second loss function based on the second predicted answer and the standard answer, and determine a contrast loss function based on the first predicted answer and the second predicted answer; Determine a first fitting loss function according to the first loss function and the contrast loss function, and determine a second fitting loss function according to the second loss function and the contrast loss function; Performing back propagation on the first question-answering model to be trained based on the first fitting loss function, and performing back propagation on the second question-answering model to be trained based on the second fitting loss function to obtain a network model to be trained for the next iteration, until the first training end condition is met, thereby obtaining a target network model; A joint question-answering model is determined based on the target network model.

2. The method according to claim 1, characterized in that: The step of inputting the question to be answered into a pre-trained joint question answering model to obtain an output result of the joint question answering model includes: Inputting the question to be answered into the first question-answering model in the joint question-answering model to obtain a first target answer and predicted thinking chain data output by the first question-answering model; Inputting the question to be answered and the predicted thinking chain data into a second question-answering model in the joint question-answering model to obtain a second target answer output by the second question-answering model; If the first target answer and the second target answer are consistent, the first target answer or the second target answer is output as the output result of the joint question and answer model.

3. The method according to claim 2, characterized in that Also includes: If the first target answer and the second target answer are inconsistent, it is determined that the joint question and answer model has made a prediction error or the question to be answered is re-input into the joint question and answer model for prediction until the first target answer and the second target answer are consistent or the number of predictions exceeds a preset threshold.

4. The method according to claim 1, characterized in that: The determining of the joint question-answering model based on the target network model includes: Obtain at least one question to be reasoned; For each question to be inferred, input the question to be inferred into the first question-answering model to be trained of the target network model to obtain a first inference answer and inference thinking chain data; Inputting the question to be inferred and the reasoning thinking chain data into the second question-answering model to be trained of the target network model to obtain a second reasoning answer; Calculating the similarity between the first reasoning answer and the second reasoning answer, and determining a consistency analysis result between the first reasoning answer and the second reasoning answer according to the similarity; A low consistency problem data set is formed based on the problems to be inferred with low consistency as a result of consistency analysis; Determine whether the amount of data in the low-consistency question data set meets the enhanced training conditions. If so, perform enhanced learning training on the target network model based on the low-consistency question data set to obtain a joint question-answering model; otherwise, determine the target network model as a joint question-answering model.

5. The method according to claim 4, characterized in that The determining, according to the similarity, a consistency analysis result of the first reasoning answer and the second reasoning answer includes: Evaluate the similarity according to a similarity evaluation rule to determine a score corresponding to the similarity; Based on the score and in combination with a predetermined consistency score region division rule, a target consistency region where the score is located is determined, and a consistency analysis result is determined according to the target consistency region.

6. The method according to claim 4, characterized in that The step of performing reinforcement learning training on the target network model based on the low consistency question data set to obtain a joint question answering model includes: Selecting enhanced training questions from the low-consistency question dataset; Inputting the enhanced training question corresponding to the current iteration into the first question-answering model to be trained of the target network model to obtain a first enhanced training answer and enhanced training thinking chain data; Inputting the enhanced training questions and enhanced training thinking chain data into the second question-answering model to be trained of the target network model to obtain a second enhanced training answer; Calculate a reinforcement training loss function according to the first reinforcement training answer and the second reinforcement training answer; Based on the enhanced training loss function, back-propagation is performed on the first question-answering model to be trained and the second question-answering model to be trained to obtain a target network model for the next iteration, until the second training end condition is met to obtain a joint question-answering model.

7. A question-answering device based on a large model, characterized in that: include: A question acquisition module is used to obtain questions to be answered; A model input module, used for inputting the question to be answered into a pre-trained joint question-answering model to obtain an output result of the joint question-answering model; the joint question-answering model includes a first question-answering model and a second question-answering model, the first question-answering model and the second question-answering model are large models, the first question-answering model and the second question-answering model are jointly trained based on a thinking chain, and the input data of the second question-answering model is determined according to the output data of the first question-answering model and the question to be answered; An answer determination module, used to determine the answer corresponding to the question to be answered according to the output result of the joint question-answering model; The device also includes: A sample acquisition module, used to acquire a training sample set including at least one training sample, wherein the training sample includes a problem to be predicted, standard thought chain data and a standard answer; A first model training module, used for inputting the to-be-predicted question in the corresponding training sample in the current iteration into the first to-be-trained question-answering model of the current to-be-trained network model, and obtaining the first predicted answer and predicted thought chain data output by the first to-be-trained question-answering model; The second model training module is used to input the to-be-predicted question and the standard thinking chain data in the training sample corresponding to the current iteration into the second to-be-trained question-answering model of the current to-be-trained network model, and obtain the second predicted answer output by the second to-be-trained question-answering model; A loss function determination module, configured to determine a first loss function based on the first predicted answer and the standard answer, and the predicted thinking chain data and the standard thinking chain data, determine a second loss function based on the second predicted answer and the standard answer, and determine a contrast loss function based on the first predicted answer and the second predicted answer; A loss function fitting module, used to determine a first fitting loss function according to the first loss function and the contrast loss function, and to determine a second fitting loss function according to the second loss function and the contrast loss function; A back propagation module, used to perform back propagation on the first question-answering model to be trained based on the first fitting loss function, and to perform back propagation on the second question-answering model to be trained based on the second fitting loss function, to obtain a network model to be trained for the next iteration, until the first training end condition is met, and a target network model is obtained; The joint question-answering model determination module is used to determine the joint question-answering model based on the target network model.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the large model-based question-answering method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the large model-based question-answering method according to any one of claims 1 to 6 when executed.