Question answering method and apparatus based on large language model, electronic device, and storage medium

By adopting a joint question-and-answer model with joint training in thinking chains in the big model, the defects of the big model in the data preprocessing and output results are solved, the accuracy of answers and the controllability of the prediction process in the question-and-answer process are achieved, and the prediction accuracy and consistency of the model are improved.

WO2025066258A1PCT designated stage expired Publication Date: 2025-04-03TRANSWARP TECHNOLOGY (SHANGHAI) CO LTD

Patent Information

Application Number
PCT/CN2024/097150
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-09-25
Filing Date
2024-06-04
Publication Date
2025-04-03

AI Technical Summary

Technical Problem

The existing large models have flaws in the trustworthiness and controllability of data preprocessing and output results, resulting in the inconsistent results of different models being trained, lacking consistency, and the prediction process and results are uncontrollable.

Method used

Using a joint question-and-answer model based on joint training of thinking chains, through the joint training of the first question-and-answer model and the second question-and-answer model, we ensure that the input data of the second question-and-answer model is determined based on the output data of the first question-and-answer model and the questions to be answered, thereby establishing an association relationship and improving consistency between models.

Benefits of technology

It realizes the accuracy of answers during the question and answer process and the logic and controllability of the prediction process, avoids the inaccurate prediction results caused by the inability to normalize the model, and improves the accuracy and consistency of model predictions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024097150_03042025_PF_FP_ABST
    Figure CN2024097150_03042025_PF_FP_ABST
Patent Text Reader

Abstract

A question answering method and apparatus based on a large language model, an electronic device, and a storage medium. The method comprises: acquiring a question to be answered (S101); inputting said question into a pre-trained joint question answering model to obtain an output result of the joint question answering model (S102); and on the basis of the output result of the joint question answering model, determining an answer corresponding to said question (S103).
Need to check novelty before this filing date? Find Prior Art

Description

Question answering method, device, electronic device and storage medium based on large model

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on September 25, 2023, with application number 202311246958.4, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of artificial intelligence technology, for example, to a large-model-based question-answering method, device, electronic device, and storage medium. Background Art

[0003] 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 demonstrated excellent performance in generalization and logical thinking in the field of machine learning, making it possible to achieve general artificial intelligence.

[0004] 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 and inconsistent output results between different large models trained with the same data.

[0005] Current large-scale model prediction methods, including model training and alignment, rely heavily on manual annotation and judgment. This is not only time-consuming and labor-intensive, but also results generated by large models are subject to subjective factors, making them inaccurate. These methods also suffer from low automation and efficiency, making them unsuitable for large-scale commercial use. Furthermore, the prediction process and results are unintuitive and uncontrollable. As large models think and generate answers, their inability to automatically and efficiently perform alignment further hinders accurate data prediction and accurate answers. Therefore, in intelligent question-answering, how to accurately predict and obtain reliable answers, while ensuring an intuitive and controllable prediction process, remains an unresolved challenge.

[0006] Summary of the Invention

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

[0008] According to one aspect of the present application, a large model-based question answering method is provided, comprising:

[0009] Get questions to be answered;

[0010] 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, wherein 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 thought chain, and the input data of the second question-answering model is determined based on the output data of the first question-answering model and the question to be answered;

[0011] The answer to the question to be answered is determined based on the output result of the joint question-answering model.

[0012] According to another aspect of the present application, a large model-based question-answering device is provided, comprising:

[0013] Question acquisition module, configured to obtain questions to be answered;

[0014] a model input module configured 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 being large models, the first question-answering model and the second question-answering model being jointly trained based on a thought chain, and the input data of the second question-answering model being determined based on the output data of the first question-answering model and the question to be answered;

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

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

[0017] at least one processor; and

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

[0019] 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 application.

[0020] According to another aspect of the present application, 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 application when executed.

[0021] The technical solution of the embodiment of the present application is to obtain a question to be answered; input the question to be answered into a pre-trained joint question-answering model to obtain the 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 the 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, which solves the problem that the accuracy of the answer is low and the prediction accuracy is low in the question-answering process. For problems with uncontrollable processes, 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 establish an association relationship to maintain high consistency, avoid the situation where the prediction results are inaccurate due to the inability to align the models in a standardized manner, and improve the model prediction accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The following will introduce the drawings required for the description of the embodiments. The drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0023] FIG1 is a flow chart of a question-answering method based on a large model provided according to Example 1 of the present application;

[0024] FIG2 is a flow chart of a question-answering method based on a large model provided according to Example 2 of the present application;

[0025] FIG3 is a schematic diagram of the structure of a question-answering device based on a large model according to the third embodiment of the present application;

[0026] FIG4 is a schematic structural diagram of an electronic device for implementing the large model-based question-answering method according to an embodiment of the present application. DETAILED DESCRIPTION

[0027] The following describes the embodiments of the present application in conjunction with the accompanying drawings. The embodiments described are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application 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 comprising a series of steps or units is not necessarily limited to those steps or units listed, but may include other steps or units that are not listed or inherent to these processes, methods, products or devices.

[0029] Example 1

[0030] Figure 1 is a flow chart of a large model-based question-answering method provided in Example 1 of the present application. This embodiment is applicable to situations where intelligent question-answering is performed. 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. As shown in Figure 1, the method includes:

[0031] S101. Obtain questions to be answered.

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

[0033] 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?

[0034] Question 2: Xiaohua has two children. Each child requires five hours of care per day. How much time does Xiaohua need to spend on the children per week?

[0035] It should be noted that the method provided in the embodiments of the present application can be integrated as an application on a smart terminal, or presented as an application webpage on the smart terminal. For users, they can open the input interface by opening the application or logging into the application webpage, manually enter text in the input interface to input the question to be answered, or enter the question to be answered by voice. The execution entity can obtain the question to be answered by receiving the user's input operation.

[0036] S102. Input the question to be answered into the pre-trained joint question-answering model to obtain the 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 the 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.

[0037] In this embodiment, the joint question-answering model can be 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. The first question-answering model and the second question-answering model can both answer questions. The first question-answering model and the second question-answering model are large models, namely large language models (LLMs). 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.

[0038] An initial model is constructed in advance. 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 a model that meets the requirements is finally 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 thought chain data to realize the derivation of the prediction process and ensure the controllability of the prediction process. The first question-answering model and the second question-answering model are jointly trained to improve the degree of correlation between the models and ensure the alignment of model specifications. In an embodiment of the present application, the first question-answering model can predict the answer and thought chain data based on the question; the second question-answering model can predict the answer based on the question and thought 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. The output data of the first question-answering model includes the answer and thought chain data. 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. The output data of the second question-answering model includes the answer.

[0039] 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.

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

[0041] 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 the higher priority can be selected as the answer to the question to be answered based on 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 can be determined that the answer to the question to be answered cannot be predicted or does not exist. 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 in text on the interface, or the answer can be broadcasted by voice. When the answer is wrong, the text or voice prompt "Sorry, no answer found for the current question" will be given.

[0042] An embodiment of the present application 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, which realizes the logic and controllability of the answer prediction process and results and enhances 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 establish an association relationship to maintain high consistency, avoid the occurrence of inaccurate prediction results due to the inability to align the models in a standardized manner, and improve the model prediction accuracy.

[0043] Example 2

[0044] FIG2 is a flow chart of a large model-based question-answering method provided in Example 2 of this application. This embodiment is a refinement of the above embodiment. As shown in FIG2 , the method includes:

[0045] S201. Obtain questions to be answered.

[0046] 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.

[0047] In this embodiment, the first target answer can be 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 understood as the reasoning process of the trained first question-answering model when predicting the question to be answered.

[0048] 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 obtains the predicted thinking chain data at the same time to represent the reasoning process of the answer prediction.

[0049] 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 a second target answer output by the second question-answering model.

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

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

[0052] As an optional embodiment of this embodiment, the training of the joint question-answering model in this optional embodiment includes steps A1-A7:

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

[0054] In this embodiment, the training sample can be understood as the data used to train the model; the training sample set can be understood as a set consisting of one or more training samples. The question to be predicted can be understood as the question that needs to be predicted during the training process. The standard thinking chain data can be understood as the true value of the thinking chain data corresponding to the question to be predicted, and the standard thinking chain data can be manually marked in advance. The standard answer can be understood as the data used as the reference true value of the answer predicted according to the question to be predicted during the training process. The training sample includes the question to be predicted, the standard thinking chain data and the standard answer, wherein the question 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.

[0055] 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.

[0056] In this embodiment, the network model to be trained can be understood as the initially constructed model. 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 understood as the question-answering model that needs to be trained. The first question-answering model to be trained can predict thought chain data and answers based on the question. The first predicted answer can be 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 understood as the predicted thought chain data.

[0057] 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 based on the current parameters of the model to obtain the first predicted answer and predicted thinking chain data.

[0058] 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.

[0059] In this embodiment, the second question-answering model to be trained can be 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.

[0060] 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.

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

[0062] 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.

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

[0064] The loss function type 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 at the same time, and the first loss function is obtained 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 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. Substitute the first predicted answer and the second predicted answer into the calculation formula of the contrast loss function to obtain the contrast loss function.

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

[0066] A5. Determine a first fitting function based on the first loss function and the contrast loss function, and determine a second fitting function based on the second loss function and the contrast loss function.

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

[0068] 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.

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

[0070] In this embodiment, the first training end condition can be understood as the end condition of 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.

[0071] 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 back propagation process of the embodiment of the present application can be set according to actual conditions.

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

[0073] The target network model obtained in this step can be used directly as the joint question-answering model, or it can be further adjusted to obtain the joint question-answering model. For example, the target network model's accuracy is determined to meet the requirements. If not, further training is performed to obtain the joint question-answering model. If so, the target network model is directly determined as the joint question-answering model. Once the joint question-answering model is obtained, it can be used to predict the questions to be answered.

[0074] When the embodiment of the present application performs model training, a training framework can be constructed. The basic framework for model training can adopt Deepspeed, Megatron, etc. The present application adopts a twin network architecture to simultaneously learn the first question-answering model to be trained and the second question-answering model to be trained. The first question-answering model to be trained and the second question-answering model to be trained can be a large language model LLM. During the model training process, the contrast loss function is calculated according to the difference between the prediction results of the first question-answering model to be trained and the second question-answering 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 enhancement learning method of the model. The first question-answering model to be trained and the second question-answering 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.

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

[0076] 1. Prepare the original question-answering training data. Prepare a training sample set (train.json) containing the question to be predicted, the standard thought chain data CoT, and the standard answer Answer. The sample examples in the dataset are as follows:

[0077] Among them, the standard thinking chain data CoT represents the description of the steps to solve the problem, and the Index field represents the sequence number of the training sample in the training sample set.

[0078] 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 calling the framework in Multicard 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 (see the example below).

[0079] This implementation uses a twin network architecture to simultaneously learn LLM A and LLM B. During contrastive reinforcement learning, LLM A and B models use the same sample source. For example, based on the data example in step 1, LLM A's input is the Question field of the training sample with Index 1, and LLM B's input 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. An example is shown below:

[0080] The data output by LLM B does not contain CoT, and the rest of the format is the same as above. During the training process, LLM A / B need to calculate the loss value of their own output compared with the original data to measure the loss between 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 decrease to the point where they cannot decrease, it is determined that the training end condition is met and the reinforcement learning of the model is completed.

[0081] After model training is complete, LLM A, when working independently, can input a problem and provide solution steps and answers. When LLM A and LLM B work together, they can measure the reliability of the answers. In practical applications, LLM A or LLM B can also be deployed independently to reduce costs and improve inference efficiency.

[0082] As an optional embodiment of this embodiment, this optional embodiment determines a joint question-answering model based on a target network model, including B1-B6:

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

[0084] In this embodiment, the questions to be inferred can be understood as questions that require inference answers. The questions to be inferred can be collected in advance, either by manually raising questions and collecting them in a unified manner, or by extracting them from books, web pages, etc. using data extraction technology.

[0085] B2. 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 the first inference answer and inference thinking chain data.

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

[0087] 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 inference prediction on the question to be inferred based on the experience learned during the training process, and obtains the first inference answer and inference thinking chain data output by the model.

[0088] For example, a user inputs the question to be inferred, "Xiaohua has two children. Each child requires five hours of care every day. How much time does Xiaohua need to spend on the children each week?" into the first question-answering model to be trained. After receiving the question, the first question-answering model to be trained performs an inference operation and outputs the corresponding inference thought chain data CoT and the first inference answer Answer, as shown below:

[0089] 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.

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

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

[0092] 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 based on the similarity.

[0093] In this embodiment, the consistency analysis result can be high consistency, low consistency, etc. The similarity between the first reasoning answer and the second reasoning answer can 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 based on the magnitude of the similarity. The greater the similarity, the higher the consistency of the two reasoning answers. This application can pre-classify the consistency and classify it into corresponding consistency levels based on the magnitude of the similarity.

[0094] Exemplarily, taking the first inference answer Answer_A as "70 hours" and the second inference answer Answer_B as "70 shi" as an example, the calculation method of similarity is illustrated. A method combining edit distance and cosine similarity is adopted to determine the consistency between Answer_A and Answer_B. Analyzed using the edit distance algorithm, changing from Answer_A to Answer_B, that is, from 70 hours to 70 shi, only requires 1 step - deleting the character "xiao", and the edit distance is 1. Analyzed using the cosine similarity algorithm, first convert Answer_A and Answer_B into vector representations, 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 as 0.938. The closer the similarity is to 1, the more similar it represents. Therefore, it can be judged that Answer_A and Answer_B have high consistency; conversely, Answer_A and Answer_B have low consistency.

[0095] As an optional embodiment of this embodiment, this optional embodiment determines the consistency analysis result of the first inference answer and the second inference answer according to the similarity, including C1 - C2:

[0096] C1. Evaluate the similarity according to the similarity evaluation rule to determine the score corresponding to the similarity.

[0097] In this embodiment, the similarity evaluation rule can be understood as a method for calculating scores based on similarity. For example, according to the value and value range of similarity, score division is performed. Exemplarily, when the similarity is within the range of 0 to 0.5, the score is 3 points; when the similarity is within the range of 0.5 to 0.7, the score is 6 points; when the similarity is within the range of 0.7 to 1, the score is 9 points. Or, the similarity evaluation rule is a calculation formula or algorithm. After substituting the similarity, the corresponding score can be calculated.

[0098] C2. Based on the score, combined with the pre - determined consistency score region division rule, determine the target consistency region where the score is located, and determine the consistency analysis result according to the target consistency region.

[0099] In this embodiment, the consistency score region division rule can be understood as the corresponding relationship between scores and consistency regions. 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. The target consistency region can be understood as the consistency region corresponding to the score.

[0100] 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.

[0101] It is important to note that each problem to be reasoned is processed in the same manner 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 and second models to be trained.

[0102] B5. Based on the consistency analysis results of the inference problems with low consistency, a low consistency problem dataset is formed.

[0103] In this embodiment, the low consistency problem dataset can be understood as a set of problems with low consistency prediction results. The statistical consistency analysis results indicate that the problems to be inferred have low consistency. These problems to be inferred are placed in the same dataset to obtain the low consistency problem dataset.

[0104] In the embodiment of the present application, after obtaining the low-consistency problem dataset, the low-consistency problem dataset can be stored in a file format, or in a storage system such as a big data system, a vector database, or a knowledge base. A high-consistency problem dataset can also be formed based on the high-consistency problems to be inferred. When storing, both the high-consistency problems to be inferred and the low-consistency problems to be inferred can be stored simultaneously. To save storage space, only the low-consistency problems to be inferred can be stored.

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

[0106] In this embodiment, the enhanced training condition can be understood as a condition for performing enhanced training on the model, such as the data volume reaching a certain threshold, the data volume ratio reaching a certain threshold, etc. The enhanced training condition is pre-set. For example, if the enhanced training condition is that the ratio of low-consistency problems to be inferred to the total number of problems to be inferred is greater than 10%, the amount of data in the low-consistency problem data set is counted, and the ratio of this data volume 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 to perform enhanced training; otherwise, it is determined that the enhanced training condition is not met, and step B8 is executed.

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

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

[0109] As an optional embodiment of this embodiment, this optional embodiment performs reinforcement learning training on the target network model based on the low consistency problem dataset, including D1-D5:

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

[0111] In this embodiment, the enhanced training problem can be 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 the enhanced training problem from the low consistency problem data set can be to select in sequence or randomly.

[0112] 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.

[0113] In this embodiment, the first enhanced training answer can be understood as the answer obtained by the first question-answering model to be trained to predict the enhanced training question; the enhanced training thinking chain data can be understood as the reasoning thinking process of the first question-answering model to be trained to obtain the answer to the enhanced training question.

[0114] The enhanced training question is 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 question based on the experience learned during the training process, and obtains the first enhanced training answer and enhanced training thinking chain data output by the model.

[0115] D3. Input the enhanced training questions and the 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 a second enhanced training answer.

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

[0117] D4. Calculate the enhanced training loss function based on the first enhanced training answer and the second enhanced training answer.

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

[0119] D5. Backpropagate the first question-answering model to be trained and the second question-answering model to be trained based on the enhanced training loss function 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.

[0120] In this embodiment, the second training end condition can be understood as the end condition of 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.

[0121] During the training process of the neural network model, the model is continuously updated and adjusted through the backpropagation method until the output of the model is consistent with the target. After determining the enhanced training loss function, the first question-answering model to be trained and the second question-answering model to be trained are backpropagated 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, thereby obtaining a joint question-answering model. The backpropagation process of the embodiment of the present application can be set according to actual conditions.

[0122] During boosting training, since the training questions lack standard answers and thought chain data, meaning the only known data during the entire training process is the question itself, backpropagation is performed by calculating the loss function based solely on the answers output by the two models. This approach requires minimal training data, requiring only the question itself. This reduces the workload of manual labeling, improves model consistency and standardization, and ultimately enhances prediction accuracy.

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

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

[0125] 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 targeted, and the standardization and consistency of the model are improved.

[0126] 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:

[0127] The following is a sample question rewritten based on ChatGPT:

[0128] After all 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 wider range of actual scenarios, effectively improving model performance.

[0129] In actual applications, it is difficult to train both the first and second question-answering models to be trained to complete accuracy and logical alignment through just one training. Therefore, the embodiments of the present application can combine the three processes of model training, consistency analysis, and reinforcement learning training, and can also use the method of augmenting data to achieve automatic online optimization of the model.

[0130] 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.

[0131] 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.

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

[0133] As an optional embodiment of this embodiment, this optional embodiment includes: 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.

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

[0135] 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 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 is stopped, the model prediction is determined to be incorrect, and a description of the prediction error is output.

[0136] 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. The implementation process and principle are the same as the first time inputting the question to be answered.

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

[0138] When the joint question-answering model outputs a single answer, this answer is directly determined as the answer to the question. If the joint question-answering model outputs two answers or a description of an incorrect prediction, it is determined that no answer to the question can be obtained, and the final result can be a null value.

[0139] Through comparative enhancement training and reasoning, a first question-answering model and a second question-answering model are formed, and the first question-answering model and the second question-answering model are used as submodels 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 answer user 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 achieve online optimization in actual application scenarios without manual intervention.

[0140] The embodiment of the present application provides a question-answering method based on a large model, which solves the problems 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 complete process of the large model thinking and obtaining answers, which is conducive to the implementation of human-computer interaction and standard guidelines; the model generation method provided by this embodiment opens the black box of model learning, makes the intermediate steps follow the logical specifications, realizes the measurable and controllable large model processing process, and realizes reinforcement learning of logical consistency in the form of comparative learning. The method is simple and easy to implement, can be conveniently applied to actual business scenarios, has stable performance, and is controllable in the 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 the models; the entire process of model training and prediction is intuitive and clear, and automatically determines whether the two models remain standardized after the model training is completed, with high efficiency and accurate results; effectively avoids the occurrence of inaccurate prediction results caused by the inability of models to align in a standardized manner, and improves the accuracy of model prediction.

[0141] Example 3

[0142] FIG3 is a schematic diagram of the structure of a large model-based question-answering device provided in Example 3 of the present application. As shown in FIG3 , the device includes: a question acquisition module 31 , a model input module 32 , and an answer determination module 33 .

[0143] Wherein, the question acquisition module 31 is configured to acquire questions to be answered;

[0144] A model input module 32 is configured 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, wherein 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 thought chain, and the input data of the second question-answering model is determined based on the output data of the first question-answering model and the question to be answered;

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

[0146] An embodiment of the present application provides a question-and-answer device that solves the problems of low answer accuracy and uncontrollable prediction process in the question-and-answer process. The device answers the questions 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 establish an association relationship 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.

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

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

[0149] A second prediction unit is configured to input the question to be answered and the predicted thought 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;

[0150] The output unit is configured to output the first target answer or the second target answer as the output result of the joint question-answering model if the first target answer and the second target answer are consistent.

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

[0152] A repeated input unit is configured to determine that the joint question-answering model has made a prediction error or to re-input the question to be answered into the joint question-answering 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.

[0153] Optionally, the device further includes:

[0154] A sample acquisition module is configured to 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;

[0155] A first model training module is configured to input the to-be-predicted question in the training sample corresponding to the current iteration into the first to-be-trained question-answering model of the current to-be-trained network model, and obtain the first predicted answer and predicted thought chain data output by the first to-be-trained question-answering model;

[0156] The second model training module is configured to 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 a second predicted answer output by the second question-answering model to be trained;

[0157] 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 comparative loss function based on the first predicted answer and the second predicted answer;

[0158] a loss function fitting module, configured to determine a first fitting function based on the first loss function and the contrast loss function, and to determine a second fitting function based on the second loss function and the contrast loss function;

[0159] a backpropagation module configured to perform backpropagation on the first question-answering model to be trained based on the first fitting loss function, and to perform backpropagation 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 a first training end condition is met, thereby obtaining a target network model;

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

[0161] Optional, joint question-answering model determination module, including:

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

[0163] A first reasoning unit is configured to input 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 thought chain data;

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

[0165] 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;

[0166] A question data set generating unit is configured to generate a low consistency question data set based on the to-be-reasoned question whose consistency analysis result is low consistency;

[0167] The question-answering model determination unit is configured 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 to be a joint question-answering model.

[0168] Optionally, the consistency analysis unit is configured 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 the target consistency area where the score is located, and determine the consistency analysis result according to the target consistency area.

[0169] Optionally, the question-answering model determination unit is configured 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-answering 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 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 the enhanced training loss function based on the first enhanced training answer and the second enhanced training answer; perform backpropagation on the first question-answering model to be trained and the second question-answering model to be trained based on the enhanced training loss function to obtain the target network model for the next iteration, until the second training end condition is met, and a joint question-answering model is obtained.

[0170] The question-and-answer device provided in the embodiments of the present application can execute the large model-based question-and-answer method provided in any embodiment of the present application, and has the corresponding functional modules and beneficial effects of the execution method.

[0171] Example 4

[0172] FIG4 shows a block diagram of an electronic device 40 that can be used to implement an embodiment of the present application. The electronic device can 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 only examples.

[0173] As shown in Figure 4, 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 the 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 into the random access memory (RAM) 43. Various programs and data required for the operation of the electronic device 40 can also be stored in the RAM 43. The processor 41, ROM 42 and RAM 43 are connected to each other via a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.

[0174] Multiple 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 magnetic 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 via a computer network such as the Internet and / or various telecommunication networks.

[0175] Processor 41 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of processor 41 include a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. Processor 41 executes the various methods and processes described above, such as the large model-based question-answering method.

[0176] In some embodiments, the large model-based question-answering method may be implemented as a computer program that 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).

[0177] Various embodiments 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), system-on-chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system comprising 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.

[0178] Computer programs for implementing the methods of the present application 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, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0179] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. A computer-readable storage medium can include an electronic, magnetic, optical, electromagnetic, infrared or semiconductor system, device or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. Examples of machine-readable storage media include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAMs), read-only memories (ROMs), erasable programmable read-only memories (EPROMs or flash memories), optical fibers, portable compact disk read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0180] To provide interaction with a user, the systems and techniques described herein can 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 pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0181] The systems and techniques described herein can be implemented in a computing system that includes back-end 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 front-end components (e.g., a user computer with a graphical user interface or 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 back-end components, middleware components, or front-end components. The components of the system can 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.

[0182] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0183] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this application can be performed in parallel, sequentially, or in a different order, as long as the desired results of this application can be achieved.

Claims

1. A question answering method based on a large model, comprising: Get questions to be answered; 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, wherein 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 input data of the second question-answering model is determined according to output data of the first question-answering model and the question to be answered; The answer to the question to be answered is determined according to the output result of the joint question-answering model.

2. The method according to claim 1, wherein: 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-answering model.

3. The method according to claim 2, further comprising: 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 any one of claims 1 to 3, wherein: 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; Based on the first predicted answer and the standard answer, and the predicted thinking chain data and the standard thinking chain data, a first loss function is determined, and based on the second predicted answer and the standard answer, Determine a second loss function, and determine a contrast loss function based on the first predicted answer and the second predicted answer; 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; 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.

5. The method according to claim 4, wherein: 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.

6. The method according to claim 5, wherein: 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.

7. The method according to claim 5, wherein: 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.

8. A question-answering device based on a large model, comprising: A question acquisition module, configured to acquire questions to be answered; A model input module is configured 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; The answer determination module is configured to determine the answer corresponding to the question to be answered based on the output result of the joint question-answering model.

9. An electronic device, comprising: at least one processor; as well as 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 perform the large model-based question-answering method according to any one of claims 1 to 7.

10. A computer-readable storage medium storing computer instructions, wherein 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 7 when executed.

Citation Information

Patent Citations

  • Entity relation joint extraction method based on automatic question and answer

    CN113836281A

  • Man-machine conversation method and system, electronic equipment and storage medium

    CN116431780A

  • Knowledge question and answer method, device and equipment and storage medium

    CN116561278A

  • Data generation method and device, electronic equipment and storage medium

    CN116663530A

  • Question and answer method and device based on large model, electronic equipment and storage medium

    CN117312512A

Cited By

  • Question and answer model cluster collaborative question and answer method, system and device based on dual reinforcement learning and medium

    CN120338123A

  • Question and answer model training method and question and answer task processing method

    CN120744074A

  • Video question and answer model training method, video question and answer method and electronic equipment

    CN120781989A

  • Power dispatching scene-oriented thinking chain question and answer data synthesis method and device

    CN121303370A