Problem solving method and system based on fusion of chain reasoning and program reasoning

By combining chain reasoning and procedural reasoning, and using self-distillation technology to train a large language model, the problem of balancing logic and computation in mathematical problems with large language models is solved, generating a comprehensive answer that is both logically coherent and computationally accurate.

CN120146180BActive Publication Date: 2025-12-12ZHEJIANG UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510150138.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-11
Publication Date
2025-12-12
Estimated Expiration
2045-02-11

AI Technical Summary

Technical Problem

When large language models solve mathematical problems, especially in scenarios requiring precise numerical calculations, there is a balance between reasoning logic and computational accuracy. Chain reasoning is logically strong but not precise enough in numerical calculations, while procedural reasoning is accurate in numerical calculations but poor in logical deduction.

Method used

By combining chain reasoning and procedural reasoning, a large language model is trained using self-distillation technology. The system generates a comprehensive answer by utilizing the logical derivation of chain reasoning and the numerical calculation of procedural reasoning, and optimizes logical coherence and calculation accuracy through an attention mechanism.

Benefits of technology

It significantly improves the reasoning and computational capabilities of large language models in solving complex mathematical problems, generating answers that are both logically coherent and computationally accurate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120146180B_ABST
    Figure CN120146180B_ABST
Patent Text Reader

Abstract

The application discloses a problem solving method based on chain reasoning and program reasoning fusion, comprising the following steps: inputting a mathematical problem and analyzing the mathematical problem in a chain reasoning mode and a program reasoning mode to obtain a chain reasoning process and a program reasoning result; inputting the mathematical problem into a pre-constructed large language model to output a prompt word related to problem solving; composing the prompt word, the chain reasoning process and the program reasoning result into a training set; constructing an initial model based on a large language model framework; performing self-distillation training on the initial model by using the training set to obtain a problem solving model; and inputting a mathematical model to be solved into the problem solving model to output a comprehensive answer containing the chain reasoning process and the program reasoning result. The application further provides a problem solving system. The method provided by the application can effectively solve the balance problem between reasoning logic and calculation accuracy in the process of analyzing a mathematical problem by a computer.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of data processing, and particularly relates to a problem solving method and system based on fusion of chain reasoning and program reasoning. BACKGROUND

[0002] In recent years, large language models such as GPT-3 and GPT-4 have made significant progress in natural language processing (NLP) and automated reasoning. These models rely on a large number of parameters and training data, and can exhibit strong capabilities in understanding, generating, and reasoning about natural language text. However, large models often make mistakes when solving mathematical problems, especially in scenarios that require precise numerical calculations.

[0003] Chain reasoning (CoT) is a reasoning method that allows large models to show their thought process step by step, which is suitable for solving complex mathematical problems. The advantage of CoT is that it enables the model to decompose complex tasks through a series of logical deductions. However, the details of this reasoning are often not precise enough, and errors may occur when dealing with specific numerical calculations. Therefore, although CoT has advantages in reasoning logic, its accuracy may be insufficient when solving complex mathematical problems.

[0004] Process reasoning (PoT) is another problem solving approach that relies on the model to generate code (such as Python) to perform specific calculations. This method is good at numerical calculations and task execution, especially suitable for tasks that require multi-step calculations or accurate solutions. For example, the model will generate a piece of code to execute to get the accurate result. However, the limitation of PoT is that although it can complete complex numerical calculations, it is not ideal in scenarios that require comprehensive reasoning such as multiple-choice questions and logical deductions.

[0005] Patent document CN117668212A discloses a problem solving method and device, which includes determining a text to be solved; inputting the text to be solved into a problem solving model, in which the problem solving model determines the problem solving information corresponding to the text to be solved, wherein the problem solving information includes a problem solving expression and a problem solving service interface identifier; determining a problem solving service interface according to the problem solving service interface identifier, to call a problem solving service through the problem solving service interface to process the problem solving expression, and obtain the problem solving result returned by the problem solving service interface; and determining the answer text corresponding to the text to be solved according to the problem solving result and the problem solving expression.

[0006] Patent document CN117251533A discloses a mathematical question and a generation method of its solution process, comprising: 1) quantitatively analyzing the characteristics of the mathematical question to obtain a data set containing the chapter to which the mathematical question belongs and the question characteristics; 2) constructing a framework and a general mathematical model for generating mathematical questions and their solution processes based on matrix elementary transformation; 3) designing an algorithm for generating mathematical questions and their solution processes; 4) inputting the measurement content, knowledge and related characteristic parameters of the mathematical question, and outputting the mathematical question and its detailed solution process; 5) quantitatively analyzing the difficulty of the output mathematical question and related measurement indicators to evaluate the quality of the generated mathematical question. SUMMARY

[0007] The purpose of the present application is to provide a problem solving method and system based on the fusion of chain reasoning and program reasoning, which can effectively solve the balance problem between reasoning logic and calculation accuracy in the process of analyzing mathematical problems by computer.

[0008] In order to achieve the first purpose of the present application, the following technical solution is provided: a problem solving method based on the fusion of chain reasoning and program reasoning, comprising the following steps:

[0009] Input the mathematical question and analyze it by chain reasoning and program reasoning to obtain the chain reasoning process and the program reasoning result;

[0010] Input the mathematical question into the pre-constructed large language model to output the prompt words related to the problem solving;

[0011] The prompt words, the chain reasoning process and the program reasoning result form a training set;

[0012] An initial model is constructed based on the large language model framework, which includes a prompt word extraction module, a chain reasoning module, a program reasoning module and an answer generation module;

[0013] The prompt word extraction module is used to obtain the prompt words related to the problem solving in the input mathematical question;

[0014] The chain reasoning module performs reasoning according to the input prompt words to output the chain reasoning process;

[0015] The program reasoning module performs reasoning according to the input prompt words to output the program reasoning result;

[0016] The answer generation module adopts an attention mechanism to combine the input chain reasoning process and program reasoning result to output a comprehensive answer;

[0017] The initial model is subjected to self-distillation training using the training set to obtain a problem solving model for comprehensive solution of mathematical questions;

[0018] The mathematical model of the solution answer is input into the problem solving model to output a comprehensive answer containing a chain reasoning process and a program reasoning result.

[0019] The present application combines chain reasoning with process reasoning and trains the model using self-distillation technology, so that the model can significantly improve its reasoning and calculation ability and perform better in solving complex mathematical problems.

[0020] Specifically, the chain reasoning method refers to splitting the input mathematical problem into multiple subtasks by a large language model, analyzing each subtask to output the corresponding problem solving process, and concatenating all problem solving processes as a chain reasoning process for output.

[0021] Specifically, the process of splitting into multiple subtasks is as follows:

[0022] The mathematical problem is input into a large language model to extract prompt words related to mathematical knowledge;

[0023] The similarity of the extracted prompt words and mathematical prior knowledge is matched, and the mathematical prior knowledge with the largest similarity is output as the theme of the corresponding subtask.

[0024] Specifically, the program reasoning method refers to generating corresponding calculation code for the input mathematical problem by a large language model, and running the calculation code to output the final numerical value as the program reasoning result.

[0025] Specifically, the answer generation module takes the chain reasoning process as the head and the program reasoning result as the tail to construct a logically coherent comprehensive answer.

[0026] Specifically, the attention mechanism refers to introducing the program reasoning module in the training process with the weight of each subtask in the chain reasoning process to generate a program reasoning result that conforms to the reasoning logic in the chain reasoning process.

[0027] Specifically, the self-distillation training refers to inputting a data set into an initial model to obtain an initial comprehensive answer, then forming a new data set with the initial comprehensive answer and the data set and fine-tuning the initial model again.

[0028] In order to achieve the second object of the present application, the following technical scheme is provided: a problem solving system, which is realized by the above-mentioned problem solving method based on the fusion of chain reasoning and program reasoning, comprising an interactive unit, an analysis unit and an output unit;

[0029] The interactive unit is used to input the text content of the mathematical problem;

[0030] The analysis unit generates a comprehensive answer corresponding to the mathematical problem according to the input text content.

[0031] The output unit is configured to visually output the comprehensive answer.

[0032] Compared with the prior art, the present application has the following advantages:

[0033] By combining chain-of-thought (CoT) and process-of-thought (PoT), the mathematical problem solving ability of a large model is optimized using a self-distillation technique, the model can significantly improve its reasoning and calculation ability by merging the answers of the two different reasoning methods and using self-distillation for training, and the model performs better in solving complex mathematical problems. BRIEF DESCRIPTION OF DRAWINGS

[0034] Figure 1 A schematic diagram of the problem solving method based on the fusion of chain-of-thought and process-of-thought provided for the present embodiment;

[0035] Figure 2 A generation process of the comprehensive answer provided for the present embodiment;

[0036] Figure 3 A flowchart of the self-distillation training provided for the present embodiment. DETAILED DESCRIPTION

[0037] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described in detail below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all embodiments. The components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of the present application.

[0038] As shown in the drawings, the problem solving method based on the fusion of chain-of-thought and process-of-thought provided for the present embodiment includes the following steps: Figure 1

[0039] Input a mathematical problem and analyze it by chain-of-thought and process-of-thought to obtain a chain-of-thought process and a process-of-thought result;

[0040] Input the mathematical problem into a pre-constructed large language model to output prompt words related to problem solving;

[0041] The prompt words, the chain-of-thought process and the process-of-thought result form a training set;

[0042] ​An initial model is constructed based on a large language model framework, and the initial model includes a hint word extraction module, a chain reasoning module, a program reasoning module, and an answer generation module.

[0043] The hint word extraction module is configured to obtain hint words related to problem solving in an input mathematical problem.

[0044] The chain reasoning module is configured to perform reasoning according to the input hint words to output a chain reasoning process.

[0045] The program reasoning module is configured to perform reasoning according to the input hint words to output a program reasoning result.

[0046] The answer generation module is configured to merge the input chain reasoning process and the program reasoning result in an attention mechanism manner to output a comprehensive answer.

[0047] The initial model is subjected to self-distillation training using a training set to obtain a problem solving model for comprehensively solving mathematical problems.

[0048] The mathematical model for solving is input into the problem solving model to output a comprehensive answer including a chain reasoning process and a program reasoning result.

[0049] More specifically, in the present embodiment, the chain reasoning process (CoT) is a logical reasoning solution process provided by the model through step-by-step derivation, but may have deficiencies in accurate numerical calculation.

[0050] The program reasoning result (PoT) is a numerical calculation problem solved by the model through the generation of calculation code (such as Python), which guarantees the accuracy of the calculation, but is not good at logical reasoning continuity.

[0051] As shown in FIG. Figure 2 The generation process of the comprehensive answer provided by the present embodiment includes selection and merging, wherein the selection refers to a mechanism designed to determine whether the CoT and PoT answers generated are correct for a specific problem, and the merging refers to combining the logical reasoning process of the CoT and the calculation result of the PoT to form a comprehensive answer with both logical continuity and calculation accuracy.

[0052] More specifically, in the process of merging the CoT and PoT answers, the CoT answer is merged first and then the PoT answer is merged, and the data generated in this way enables the trained model to calculate the weight of the logical reasoning part generated by the CoT part when generating the PoT answer, so that the generated PoT has more logic than the original.

[0053] As shown in FIG. Figure 3As shown, the self-distillation training process provided by the embodiment includes: generating new training data: using the above-mentioned merged comprehensive answer as a new training sample to further train the model, through the self-distillation technology, the model optimizes itself using the comprehensive answer generated by itself, reduces the dependence on external large-scale data sets, and as the training process proceeds, the model can learn better reasoning and calculation ability from the merged CoT and PoT answers.

[0054] The specific process is as follows:

[0055] S1, chain reasoning (CoT) and process reasoning (PoT) generation:

[0056] First, for each mathematical question, a large model is used to generate corresponding CoT answers and PoT answers; wherein the CoT answer: the model provides a logical reasoning solution process through step-by-step deduction, but may have deficiencies in accurate numerical calculation; the PoT answer: the model generates calculation code (such as Python) to directly solve the numerical calculation problem, ensuring the accuracy of the calculation, but the logical reasoning is not good.

[0057] S2, answer selection and merging:

[0058] S21, select the correct solution method: for the generated CoT and PoT answers, a mechanism is designed to determine whether the two methods are correct in solving the specific problem;

[0059] S22, generate new answers by merging: merge the two correct answers, the specific way can be to combine the logical reasoning process of CoT and the calculation result of PoT to form a comprehensive answer that has both logical coherence and calculation accuracy;

[0060] S23, attention mechanism optimization: in the process of merging CoT and PoT answers, the way of merging CoT answer first and then PoT answer is adopted, and the data generated in this way can make the model after training calculate the weight of the logical reasoning part generated by the CoT part when generating the PoT answer, so the generated PoT is more logical than the original.

[0061] S3, self-distillation training:

[0062] S31, generate new training data: use the above-mentioned merged comprehensive answer as a new training sample to further train the model.

[0063] S32, self-distillation optimization: through the self-distillation technology, the model optimizes itself using the comprehensive answer generated by itself, reduces the dependence on external large-scale data sets, and as the training process proceeds, the model can learn better reasoning and calculation ability from the merged CoT and PoT answers.

[0064] The embodiment also provides a problem solving system, which is realized by the problem solving method based on the fusion of chain reasoning and program reasoning, and includes an interaction unit, an analysis unit and an output unit;

[0065] The interaction unit is configured to input text content of a mathematical problem;

[0066] The analysis unit is configured to generate a comprehensive answer corresponding to the mathematical problem according to the input text content;

[0067] The output unit is configured to visually output the comprehensive answer.

[0068] In addition, the terms "upper", "lower", "inner", "outer", "front", "back" are only used for description purposes, and cannot be understood as indicating or implying relative importance. Unless otherwise specified, the relative steps, numerical expressions and numerical values of the components and steps set forth in the embodiments do not limit the scope of the present application.

[0069] Of course, the above only describes specific embodiments of the present application, and is not intended to limit the scope of the present application. Any equivalent changes or modifications made to the structure, features and principles described in the patent application scope of the present application shall be included in the patent application scope of the present application.

[0070] Finally, it should be noted that the above-described embodiments are only specific implementations of the present application, and are used to illustrate the technical solutions of the present application, but not to limit it. The protection scope of the present application is not limited to this. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can make modifications or easily think of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed by the present application, or make equivalent replacements to some technical features. The modifications, changes or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A problem solving method based on the fusion of chain reasoning and program reasoning, characterized in that, The method comprises the following steps: inputting a mathematical problem and analyzing it through chain reasoning and program reasoning to obtain a chain reasoning process and a program reasoning result; inputting the mathematical problem into a pre-constructed large language model to output a hint word related to the problem solving; composing the hint word, the chain reasoning process and the program reasoning result into a training set; constructing an initial model based on a large language model framework, which comprises a hint word extraction module, a chain reasoning module, a program reasoning module and an answer generation module; the hint word extraction module is used to obtain the hint word related to the problem solving in the input mathematical problem; the chain reasoning module is used to perform reasoning according to the input hint word to output a chain reasoning process; the program reasoning module is used to perform reasoning according to the input hint word to output a program reasoning result; the answer generation module is used to combine the input chain reasoning process and program reasoning result by using an attention mechanism to output a comprehensive answer, wherein the answer generation module takes the chain reasoning process as the head and the program reasoning result as the tail to construct a logically coherent comprehensive answer, and the attention mechanism refers to introducing the program reasoning module into the chain reasoning process by using the weight of each subtask in the chain reasoning process during the training process to generate a program reasoning result that conforms to the reasoning logic in the chain reasoning process; performing self-distillation training on the initial model by using the training set to obtain a problem solving model for comprehensively solving mathematical problems; inputting the solved mathematical model into the problem solving model to output a comprehensive answer comprising a chain reasoning process and a program reasoning result.

2. The problem solving method based on the fusion of chain reasoning and program reasoning according to claim 1, characterized in that, The chain reasoning method refers to splitting the input mathematical problem into multiple subtasks by using a large language model, analyzing each subtask to output a corresponding problem solving process, and concatenating all problem solving processes as a chain reasoning process for output.

3. The problem solving method based on the fusion of chain reasoning and program reasoning according to claim 2, characterized in that, The process of splitting into multiple subtasks is as follows: inputting the mathematical problem into the large language model to extract a hint word related to mathematical knowledge; performing similarity matching on the extracted hint word and mathematical prior knowledge, and outputting the mathematical prior knowledge with the largest similarity as the theme of the corresponding subtask.

4. The problem solving method based on fusion of chain reasoning and program reasoning according to claim 1, characterized in that, The program reasoning method refers to generating corresponding calculation code for the input mathematical problem by using a large language model, and running the calculation code to output the final numerical value as the program reasoning result.

5. The problem solving method based on fusion of chain reasoning and program reasoning according to claim 1, wherein, The self-distillation training refers to inputting the data set into the initial model to obtain an initial comprehensive answer, then composing the initial comprehensive answer and the data set into a new data set and performing secondary fine-tuning on the initial model.

6. A problem solving system characterized by, The problem solving method based on the fusion of chain reasoning and program reasoning according to any one of claims 1-5 comprises an interaction unit, an analysis unit and an output unit; the interaction unit is used to input the text content of the mathematical problem; the analysis unit is used to generate a comprehensive answer corresponding to the mathematical problem according to the input text content; the output unit is used to visually output the comprehensive answer.

Citation Information

Patent Citations

  • Mathematical question and answering process generation method thereof

    CN117251533A

  • Question solving method and device

    CN117668212A