Dual-model reflection learning method based on thinking chain correction and adaptive screening
Through the training method of thinking chain correction data and self-consistent screening, the student model can self-correct its answers, which solves the problem that the student model cannot self-correct in the existing technology and improves the accuracy and reliability of the prediction stage.
Patent Information
- Application Number
- CN202410733339.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-10-08
AI Technical Summary
In the existing thought chain distillation technology, the student model cannot self-correct its answers, resulting in the inability to improve the accuracy and reliability of the answers in the prediction stage.
Using the training method of thinking chain correction data, the teacher model analyzes and corrects the answers of the student model, and combines the self-consistency method to screen out the problems that need to be corrected, and trains the student model that can perform secondary reflection.
In the prediction stage, the student model can not only predict the final result, but also conduct secondary reflection to correct its answer, which improves accuracy and reliability, and the experimental verification effect is significant.
Smart Images

Figure CN118747530A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of thought chain reasoning and thought chain distillation. Background Art
[0002] Thought chain distillation is a special knowledge distillation method that uses the thought chain reasoning data generated by the teacher model to fine-tune the student model, thereby improving the thought chain reasoning ability of the student model.
[0003] Chain of Thought (CoT) reasoning: Chain of Thought (CoT) technology encourages the model to elaborate its reasoning process before generating an answer, just like a human would write a step-by-step solution. As the model solves the problem, it gradually reveals the intermediate reasoning links, forming a chain of assumptions, evidence, calculation steps, or abstract concepts that ultimately leads to the correct conclusion. The process and results are shown in the attached figure. Figure 1 (b) This step-by-step explanation not only helps improve the model's accuracy in answering these questions but also enhances the transparency and interpretability of the model's reasoning behavior. However, MindChain reasoning is only effective on models with larger parameters. In the real world, it is limited by computing resources and inference API fees, making large-scale deployment impossible. Therefore, MindChain distillation technology was developed to transfer the reasoning capabilities of large models to smaller ones.
[0004] Thought chain distillation: First, the teacher model generates answers with detailed step-by-step reasoning, which serves as training data for the student model. The student model then learns to mimic these complete reasoning examples and, in the process, learns how to solve the problem from start to finish. During training, the student model is required not only to predict the final answer but also to simulate the entire reasoning process.
[0005] In the prediction stage, the existing method is to let the student model obtained by distillation perform a reasoning, and does not let the small model reflect a second time to correct its own answer. Think of the real learning and examination scenario, after getting the first version of the answer, students will improve the accuracy of the answer by checking and correcting it again. However, the existing method proves that the model cannot self-correct, because if the model can self-correct, it means that the model has the ability to give the correct answer, but it did not give the correct answer the first time, so the self-correction itself is contradictory. The process and results are shown in the attached figure. Figure 1 As shown in (a). Summary of the Invention
[0006] In order to solve the above problems, the present invention proposes a training method that uses thought chain correction data to improve the student model's ability to reflect and correct errors, and combines it with a self-consistency method to screen out problems that need to be corrected.
[0007] In order to achieve the above object, the technical solution adopted in the present invention is:
[0008] A dual-model reflective learning method based on thought chain correction and adaptive screening is characterized by comprising the following steps:
[0009] Step 1: Train to obtain the student model A, which is the step of generating the model. In this step, the question is input into the teacher model T to obtain the reasoning path and answer. The teacher model generates a series of reasoning steps, filters out the questions with incorrect answers, constructs the correctly answered questions into the training set, and trains the student model S to obtain the student model A.
[0010] Step 2: Train to obtain the student model B, i.e., the step of correcting the model. Input the questions into the unadjusted student model S to obtain the reasoning path and answer. Input the wrongly answered questions and the corresponding paths and answers into the teacher model T to analyze and correct the wrong questions to obtain the corrected questions. The corrected questions and their corresponding paths and answers are constructed into a training set. The student model S is trained to obtain the student model B.
[0011] Step 3: Prediction phase: After training, we have obtained student models A and B. We use the given test set to evaluate the uncertainty of the answers given by student model A.
[0012] Furthermore, step 1 specifically includes: given a set of training data (q i ,a i )∈Q, where q i For each question, a i To indicate the label answer, first use the zero-shot cot prompt to convert q i Input to the teacher model T to get the inference path and answers Zero-shot cot is in q i The prompt sentence Let's think step by step is added at the end to let the teacher model generate a series of reasoning steps; then compare the label a i and prediction results Filter out the questions with incorrect answers and construct the questions with correct answers into a training set Train the student model S to obtain the student model A.
[0013] Furthermore, step 2 specifically includes: given a set of training data (q i ,a i )∈Q, where q i For each question, a i To indicate the label answer, first use the zero-shot cot prompt to convert q i Input to the untuned student model S to get the inference path and answers Compare label ai and prediction results Filter the questions that are answered incorrectly, and then answer the incorrect questions i and the corresponding And splice prompt input to the teacher model T to generate analysis i and Aims to allow the teacher model to generate analysis of wrong questions and correct them. i and The analysis and correction answers generated by the teacher model are respectively; then the label a is compared i and correct the answer Screening is corrected the right question will be corrected the right question q i and its corresponding analysis i and Construct a training set Train the student model S to obtain the student model B.
[0014] Furthermore, step three specifically includes: for the student model A and the student model B that have been trained, a set of test sets (q j ,a j ), set the temperature parameter of student model A to 0.7, and use the self-consistency method to convert q j The input is fed into student model A to generate ten reasoning paths and answers, and the uncertainty of its answers is evaluated. When the consistency of the answers is less than half, that is, when most answers cannot agree on the same answer, it is marked as an "uncertain" answer and the subsequent steps are carried out. If the consistency exceeds half, this result is retained as the output. For the "uncertain" answer, the answer with the most occurrences is selected and fed into student model B for correction. Similarly, the temperature parameter of student model B is set to 0.7, and ten reasoning paths and answers are sampled. The result with the most occurrences is selected as the final corrected output.
[0015] The technical effects of the present invention are:
[0016] This invention introduces a method of thought chain correction and adaptive screening. The teacher model analyzes and corrects the student model's answers, giving the student model the ability to reflect and correct errors. During the prediction phase, the student model not only predicts the final result but also conducts secondary reflection to correct its own answers, improving the student model's accuracy and reliability.
[0017] To verify the effectiveness of the present invention, experiments were carried out on the mathematical reasoning datasets addsub, multiarith, single-eq, svamp, and gsm8k, achieving results of 75.63%, 93.88%, 78.94%, 77.66%, and 40.63%, respectively. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 This is a schematic diagram of the output method of the thinking chain model in the existing technology.
[0019] Figure 2 This is a schematic diagram of the dual-model reflective learning method based on thought chain correction and adaptive screening of the present invention. DETAILED DESCRIPTION
[0020] The technical solution of the present invention will be further described below with reference to the accompanying drawings. Figure 2 As shown, Figure 2 (a) shows a conventional thought chain distillation method. Unlabeled questions are first fed into the teacher model to generate reasoning paths and answers. Correct reasoning paths are then screened and used as training data to fine-tune the student model A. Because the model cannot self-correct its own errors and must rely on external knowledge, this paper proposes a training method that uses thought chain correction data to obtain the student model B as a corrector. Figure 2 (b) The framework diagram represents the training method designed by the present invention. First, unlabeled questions are input into the untuned student model to obtain the generated reasoning path and answer. Then, the incorrect reasoning path is screened out. Then, the incorrect reasoning path is input into the teacher model for generation analysis and correction. The correct analysis is screened out and used as training data to fine-tune the student model B, giving it the ability to correct and reflect.
[0021] During the reasoning phase, after receiving a question, student model A generates a reasoning path and answer, and then student model B makes corrections based on the content generated by model A. To avoid erroneous corrections, a self-consistency method is used to screen out the questions that need to be revised, and then the questions are sent to student model B for revision.
[0022] like Figure 2 As shown, the implementation process of this invention is mainly divided into the following steps:
[0023] Step 1: Train and obtain the student model A (generative model). Given a set of training data (q i ,a i )∈Q, where q i For each question, a i Indicates the label answer. First, use the zero-shot cot prompt to convert q i Input to the teacher model T to get the inference path and answers Zero-shot cot is in q i The prompt sentence Let's think step by step is added at the end to let the teacher model generate a series of reasoning steps. Then compare the label ai and prediction results Filter out the questions with incorrect answers and construct the questions with correct answers into a training set The student model S is trained to obtain the student model A. The training objective used is the same as that used in the pre-training phase, namely the autoregressive language modeling objective (next token prediction).
[0024] Step 2: Train and obtain the student model B (corrected model). Given a set of training data (q i ,a i )∈Q, where q i For each question, a i Indicates the label answer. First, use the zero-shot cot prompt to convert q i Input to the untuned student model S to get the inference path and answers Compare label a i and prediction results Filter the questions that are answered incorrectly, and then answer the incorrect questions i and the corresponding And splice prompt input to the teacher model T to generate analysis i and The prompt here is "Given that the answer to the above question is incorrect, please indicate where the error lies and provide the correct answer", which is intended to allow the teacher model to generate an analysis of the incorrect question and correct it. i and The analysis and correction answers generated by the teacher model are then compared with the label a i and correct the answer Screening is corrected the right question will be corrected the right question q i and its corresponding analysis i and Construct a training set The student model S is trained to obtain the student model B. The training objective used is the same as that used in the pre-training stage, that is, the cross entropy loss in the autoregressive language model training.
[0025] Step 3: Prediction phase. Assume that the student model A (generative model) and the student model B (correction model) have been trained. Given a set of test sets (q j ,a j), set the temperature parameter of student model A to 0.7, and use the self-consistency method to convert q j Ten reasoning paths and answers are generated by Student Model A, and the uncertainty of these answers is assessed. If the consistency of the answers is less than half, meaning that the majority of responses cannot agree on the same answer, the answer is marked as "uncertain" and the subsequent steps are carried out. If the consistency exceeds half, this result is retained as the output. For the "uncertain" answers, the answer with the highest number of occurrences is selected and input into Student Model B for correction. Similarly, the temperature parameter of Student Model B is set to 0.7. Ten reasoning paths and answers are sampled, and the result with the highest number of occurrences is selected as the final corrected output.
[0026] It should be further explained that the above implementation modes are only used to understand the technical solutions of the present invention, and are not used to limit the scope of protection of the present invention. Any obvious adjustments and improvements made to the technical concepts of the present invention should fall within the scope of protection of the present invention.
Claims
1. A dual-model reflective learning method based on thought chain correction and adaptive screening, characterized by The following steps are involved: Step 1: Train to obtain the student model A, that is, the step of generating the model. In this step, the question is input into the teacher model T to obtain the reasoning path and answer, and the teacher model generates a series of reasoning steps, filters out the questions with incorrect answers, constructs the questions with correct answers into the training set, and trains the student model S to obtain the student model A; Step 2: Train to obtain the student model B, i.e., the step of correcting the model. Input the question into the unadjusted student model S to obtain the reasoning path and answer. Input the wrongly answered question and the corresponding path and answer into the teacher model T to analyze and correct the wrong question to obtain the corrected question. The corrected question and its corresponding path and answer are constructed into a training set. Train the student model S to obtain the student model B. Step 3: Prediction stage: After the student model A and student model B have been trained, the uncertainty of the student model A’s answer is evaluated using the given test set.
2. The dual-model reflective learning method based on thought chain correction and adaptive screening according to claim 1 is characterized by: Step 1 specifically includes: given a set of training data (q i , a i )∈Q, where q i For each question, a i To indicate the label answer, first use the zero-shot cot prompt to convert q i Input to the teacher model T to get the inference path and answers Zero-shot cot is in q i The prompt sentence Let's think stepby step is added to let the teacher model generate a series of reasoning steps; then compare the label a i and prediction results Filter out the questions with incorrect answers and construct the questions with correct answers into a training set Train the student model S to obtain the student model A.
3. The dual-model reflective learning method based on thought chain correction and adaptive screening according to claim 1 is characterized by: Step 2 specifically includes: given a set of training data (q i , a i )∈Q, where q i For each question, a i To indicate the label answer, first use the zero-shot cot prompt to convert q i Input to the untuned student model S to get the inference path and answers Compare label a i and prediction results Filter the questions that are answered incorrectly, and then return the incorrectly answered questions to i and the corresponding And concatenate the prompt input to the teacher model T to generate analysis i and The aim is to allow the teacher model to generate analysis of wrong questions and correct them. i and The analysis and correction answers generated by the teacher model are compared with the label a i and correct the answer Screening gets corrected the right questions will correct the right questions q i And its corresponding analysis i and Construct a training set Train the student model S to obtain the student model B.
4. The dual-model reflective learning method based on thought chain correction and adaptive screening according to claim 1 is characterized by: Step 3 specifically includes: for the trained student models A and B, a set of test sets (q j , a j ), set the temperature parameter of student model A to 0.7, and use the self-consistency method to convert q j The answers are input into student model A to generate ten reasoning paths and answers, and the uncertainty of the answers is evaluated. When the consistency of the answers is less than half, that is, most of the answers cannot agree on the same answer, it is marked as an "uncertain" answer and the subsequent steps are carried out. If the consistency exceeds half, this result is retained as the output. For the "uncertain" answers, the answer with the largest number of occurrences is selected and input into student model B for correction. Similarly, the temperature parameter of student model B is set to 0.7, and ten reasoning paths and answers are sampled, and the result with the largest number of occurrences is selected as the final corrected output.
Citation Information
Cited By
Method and system for solving thinking chain reasoning mathematical problem based on feature classifier
CN119443267A
Data processing method and device
CN119990333A
Natural language question and answer framework, method and device based on self-reflection
CN120011491A
Mathematical reasoning data synthesis method and system based on intelligent agent simulation teaching scene
CN120297407A
Vehicle defense diagnosis system and method based on knowledge distillation and long thinking chain
CN120744379A
