Mathematical application question solving method and system based on data synthesis

By guiding the large language model to build an inference chain and using an external feedback mechanism to correct it, combined with a program-assisted chain, the problem of poor generalization ability of the large language model in solving mathematical word problems is solved, and the accuracy and efficiency of the solution are improved.

CN120781981APending Publication Date: 2025-10-14UNIV OF JINAN
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510923144.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-04
Publication Date
2025-10-14

AI Technical Summary

Technical Problem

In the existing technology, large language models have poor generalization capabilities in the process of solving mathematical word problems, lack external feedback mechanisms, are prone to reasoning interruptions, logical errors or calculation errors, and have difficulty in accurately capturing the deductive logic between mathematical formulas.

Method used

Zero-sample thinking chain prompts are used to guide the large language model to build a reasoning chain, which is combined with the reasoning chain to generate answers. The reasoning chain is corrected through an external feedback mechanism, and a code interpreter is used to execute the program auxiliary chain. A verification mechanism is built to improve the accuracy of the solution.

Benefits of technology

It improves the accuracy and efficiency of large language models in solving mathematical word problems, enhances the modeling ability of mathematical expression structures and derivation rules, and reduces logical errors and missing intermediate steps.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120781981A_ABST
    Figure CN120781981A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of mathematical solving, and provides a mathematical application question solving method and system based on data synthesis, and the method comprises the steps: obtaining a to-be-solved mathematical application question; constructing a reasoning chain of the mathematical application questions based on a large language model; judging whether the constructed reasoning chain is converted into a program auxiliary chain or not according to the prompt judgment word; if conversion is needed, the large language model generates an inference chain and a program auxiliary chain, the program auxiliary chain is executed by using a code interpreter, and solving of the mathematical application question is completed; otherwise, solving the mathematical application problem directly according to the reasoning chain.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of mathematical solving, and particularly relates to a mathematical application question solving method and system based on data synthesis. BACKGROUND

[0002] The statements in this section merely provide background information related to the application and do not necessarily constitute prior art.

[0003] Mathematical application question solving is to analyze semantic information and numerical relationship from the question, and to deduce the final result based on logical reasoning and numerical operation.

[0004] At present, mathematical application questions can be solved based on large language models, the understanding and generation ability of the large language model is improved through enhancement strategies, and complex mathematical problems are analyzed, modeled and solved. The thought chain prompt is an important reasoning method of the large language model, which can guide the large language model to gradually deduce the problem solving process like human beings, and introduce a self-verification mechanism in the reasoning process to evaluate the consistency of the intermediate conclusion; self-consistent reasoning is a method applied in the reasoning process of the large language model, which generates multiple reasoning paths and compares them, and finally selects the answer with the most consistency and confidence. However, these methods only rely on the step-by-step reasoning process of the large language model itself, lack external feedback mechanism, and have poor generalization ability. When solving different types of mathematical application questions, the reasoning may be interrupted, logical errors or calculation errors may occur.

[0005] To solve the problem of poor generalization ability, the existing method uses data synthesis technology to create data similar to the original data distribution through algorithm generation or model generation, and combines the created data to supervise the fine-tuning of the large language model. By introducing training samples highly related to the mathematical application question solving task, the large language model can learn the semantic structure and numerical relationship in the mathematical application question mode, and further improve the accuracy of the solving task. However, mathematical application question solving usually requires step-by-step deduction of mathematical formulas and construction of complete reasoning chain; in the complex reasoning process, the language model lacks precise modeling of the structure of mathematical expressions and deduction rules, and it is difficult to accurately capture the deduction logic between mathematical formulas, resulting in missing intermediate steps or logical errors. SUMMARY

[0006] To solve the above problems, the application provides a mathematical application question solving method and system based on data synthesis, which uses zero sample thinking chain prompt to guide a large language model to construct a reasoning chain of a mathematical application question, the large language model judges whether the reasoning chain needs to be transformed according to the prompt, generates an answer combining the reasoning chain, constantly corrects the reasoning chain by comparing the generated answer with the answer in the original data set, and synthesizes training data; the training data set is used to supervise the fine-tuning of the large language model; a large language model verification mechanism is constructed to guide the large language model to construct a reasoning chain and simultaneously generate a program auxiliary chain corresponding to the reasoning chain; a mathematical application question answer is generated based on the reasoning chain, or a mathematical application question intermediate answer is obtained in combination with the program auxiliary chain, and the obtained intermediate answer is fed back to the large language model; a mathematical application question answer is generated in combination with the corrected reasoning chain, or an intermediate answer is obtained by executing the corrected program auxiliary chain by a code interpreter; after the maximum correction times are reached, the obtained answer is the final answer.

[0007] According to some embodiments, the first aspect of the application provides a mathematical application question solving method based on data synthesis, which adopts the following technical scheme: A mathematical application question solving method based on data synthesis comprises: Obtaining a mathematical application question to be solved; Constructing a reasoning chain of the mathematical application question based on a large language model; Judging whether the constructed reasoning chain needs to be transformed into a program auxiliary chain according to a prompt judgment word; If transformation is needed, generating a reasoning chain and a program auxiliary chain based on a large language model, executing the program auxiliary chain by a code interpreter to complete the solving of the mathematical application question; otherwise, directly completing the solving of the mathematical application question according to the reasoning chain.

[0008] As a further technical limitation, in the process of fine-tuning the large language model based on supervised learning, the loss function of the fine-tuned large language model Comprises a reasoning chain loss function , a program auxiliary chain loss function , and a question analysis loss function ; that is ; wherein i represents n represents is a question of a mathematical application question, represents a reasoning chain of the current mathematical application question, represents a program auxiliary chain corresponding to the current mathematical application question, represents an error analysis of the current mathematical application question; T represents the actual length of the generated reasoning chain, is the predicted output of the language large model to the question, represents the question corresponding true reasoning chain; , representing the problem corresponding true program auxiliary chain; , representing the problem corresponding true error analysis.

[0009] As a further technical limitation, in the process of judging whether to transform the constructed reasoning chain into a program auxiliary chain according to the prompt word, the large language model receives the prompt word and the problem to be solved, generates a reasoning step based on the prompt word, that is, obtains a reasoning chain; the large language model judges whether to generate a program auxiliary chain according to the complexity of the problem and the prompt word; calculate the numerical difference between the generated answer and the answer in the original data set to judge whether the generated answer is correct; if the generated answer is correct, add the problem, reasoning chain and answer of the mathematical application question to the training data set; if the answer generated by the large language model is incorrect, guide the large language to reconstruct the reasoning chain and the program auxiliary chain.

[0010] As a further technical limitation, based on the answer correction mechanism of external feedback, a large language model verification mechanism is constructed to guide the large language model to construct a reasoning chain and generate a program auxiliary chain corresponding to the reasoning chain; generate an answer to a mathematical application question based on the reasoning chain, or execute the program auxiliary chain using a code interpreter to obtain an intermediate answer to the mathematical application question, and feed back the obtained intermediate answer to the large language model; generate an answer to a mathematical application question based on the corrected reasoning chain, or obtain a corrected intermediate answer to a mathematical application question based on the corrected program auxiliary chain, and again feed back to the large language model as external feedback; after reaching the maximum correction times, the generated answer is taken as the final answer.

[0011] As a further technical limitation, based on the data synthesis of the large language model, a reasoning chain is constructed using a zero-sample thinking chain prompt containing judgment information, and the problem solving steps in the obtained reasoning chain are numerical operation relationships.

[0012] As a further technical limitation, the problem solving steps in the program auxiliary chain are ; ; ; Among them, P1 represents the first step of extracting information, P2 represents the second step of reasoning as performing calculation, P n is the nth step of reasoning to continue calculation, until the last step ends.

[0013] According to some embodiments, the second aspect of the present application provides a mathematical application question solving system based on data synthesis, which adopts the following technical scheme: A mathematical application question solving system based on data synthesis comprises: An acquisition module configured to acquire a mathematical application question to be solved; A construction module configured to construct a reasoning chain of the mathematical application question based on a large language model; A judgment module configured to judge whether to transform the constructed reasoning chain into a program auxiliary chain according to a prompt judgment word; A solving module configured to, if transformation is needed, generate the reasoning chain and the program auxiliary chain based on the large language model, execute the program auxiliary chain using a code interpreter to complete solving of the mathematical application question; or directly complete solving of the mathematical application question according to the reasoning chain.

[0014] According to some embodiments, a third aspect of the present application provides a computer-readable storage medium, which adopts the following technical solution: A computer-readable storage medium, which stores a program, the program being executed by a processor to implement the steps in the mathematical application question solving method based on data synthesis according to the first aspect of the present application.

[0015] According to some embodiments, a fourth aspect of the present application provides an electronic device, which adopts the following technical solution: An electronic device comprises a memory, a processor, and a program stored in the memory and running on the processor, and the processor implements the steps in the mathematical application question solving method based on data synthesis according to the first aspect of the present application when executing the program.

[0016] According to some embodiments, a fifth aspect of the present application provides a computer program product, which adopts the following technical solution: A computer program product comprises software code, and a program in the software code executes the steps in the mathematical application question solving method based on data synthesis according to the first aspect of the present application.

[0017] Compared with the prior art, the present application has the following beneficial effects: The present application uses zero-shot thinking chain prompts to guide a large language model to construct a reasoning chain of a mathematical application question, and the large language model judges whether the reasoning chain needs to be transformed into a corresponding program auxiliary chain according to the prompts; the large language model generates an answer according to the reasoning chain, or uses a code interpreter to execute the program auxiliary chain to generate the answer, and obtains a training data set by comparing the generated answer with an answer in an original data set; the large language model is fine-tuned using the training data set; a verification mechanism of the large language model is constructed, the large language model after fine-tuning is used to construct a reasoning chain and a program auxiliary chain of a mathematical application question, an external feedback is called using a code interpreter, the reasoning chain and the program auxiliary chain are corrected, and a final answer is obtained. BRIEF DESCRIPTION OF DRAWINGS

[0018] The drawings constituting a part of the specification of the embodiments are used to provide further understanding of the embodiments, the illustrative embodiments of the embodiments and the description thereof are used to explain the embodiments, and do not constitute improper limitation on the embodiments.

[0019] Figure 1 Flowchart of the mathematical application question solving method based on data synthesis in the first embodiment of the present application; Figure 2 Architecture diagram of the mathematical application question solving method based on data synthesis in the first embodiment of the present application; Figure 3 Schematic diagram of the data synthesis and construction instruction fine-tuning training set training large language model module based on a large language model in the first embodiment of the present application; Figure 4 Schematic diagram of the answer correction mechanism module based on external feedback in the first embodiment of the present application; Figure 5 Specific prompt word design and training sample schematic diagram in the first embodiment of the present application; Figure 6 Structure block diagram of the mathematical application question solving system based on data synthesis in the second embodiment of the present application. DETAILED DESCRIPTION

[0020] The present application will be further described below in conjunction with the drawings and embodiments.

[0021] It should be noted that the following detailed description is exemplary and is intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs.

[0022] It should be noted that the terms used herein are only for the purpose of describing the specific embodiments, and are not intended to limit the exemplary embodiments according to the present application. As used herein, the singular form is intended to include the plural form unless the context clearly indicates otherwise, and it should also be understood that when the terms "comprise" and / or "include" are used in the specification, there is a feature, step, operation, device, component and / or combination thereof.

[0023] The embodiments in the present application and the features in the embodiments can be combined with each other without conflict.

[0024] Term explanation: MWP problem, i.e. mathematical problem described by natural language, requires the solver to reason and calculate according to the text information provided by the question to obtain the answer.

[0025] A large language model is a large-scale natural language processing model based on deep learning, which uses a huge amount of corpus data and parameter scale during training.

[0026] Function calling mechanism is the process of calling a function in a program to complete a specific task.

[0027] Fine-tuning is the process of transferring the learned patterns and features of a pre-trained model to a new task, thereby improving performance and reducing training data requirements.

[0028] Example 1 Embodiment 1 of the present invention introduces a method for solving mathematical word problems based on data synthesis.

[0029] like Figure 1 A method for solving mathematical word problems based on data synthesis is shown, comprising: Obtain mathematical word problems to be solved; Constructing a reasoning chain for the mathematical word problem based on the large language model; Determine whether to transform the constructed reasoning chain into a program auxiliary chain according to the prompt judgment words; If conversion is required, an inference chain and a program auxiliary chain are generated based on the large language model, and a code interpreter is used to execute the program auxiliary chain to solve the mathematical word problem; otherwise, the mathematical word problem is solved directly based on the inference chain.

[0030] like Figure 2 The method for solving mathematical word problems based on data synthesis shown in the figure includes three stages: data synthesis, fine-tuning the large language model, and solution verification. Specifically: (1) Data synthesis stage The data synthesis stage in this embodiment is divided into data preprocessing, construction of inference chains and corresponding program auxiliary chains, and screening of inference chains and program auxiliary chains.

[0031] In the process of constructing reasoning chains and program auxiliary chains, zero-sample thinking chain prompts are used to guide the large language model to generate reasoning chains corresponding to mathematical word problems, and the prompt words are used to determine whether the reasoning chain needs to be converted into a program auxiliary chain.

[0032] Based on the judgment result, the system chooses to directly generate the answer through the inference chain or call the code interpreter to execute the program auxiliary chain to obtain the final answer. During the screening process of the inference chain and program auxiliary chain, the generated answer is compared with the original answer to determine whether it is correct. If the generated answer is correct, it is added to the training dataset. If the answer generated by the large language model is incorrect, it is guided to self-reflect and reconstruct the inference chain and program auxiliary chain.

[0033] (2) Fine-tuning the large language model In fine-tuning a large language model, the synthesized examples after data synthesis are used as a training data set to fine-tune the large language model by using the instruction fine-tuning strategy.

[0034] (3) Solution verification stage The large language model after fine-tuning is used to solve mathematical application problems, and the reasoning chain and program auxiliary chain are modified during the solving process to obtain the final solution of the mathematical application problem.

[0035] As one or more embodiments, the original data is preprocessed to extract the problem and numerical answer of the mathematical application problem, and the numerical answer is cleaned; wherein, cleaning the numerical answer refers to automatically recognizing and converting the decimal, fraction, percentage and other formats in the result to the standard floating point number format by using a unified rule.

[0036] As one or more embodiments, the large language model as shown in Figure 3 is used, based on data synthesis of the large language model, the reasoning chain and the program auxiliary chain of the mathematical application problem are constructed by guiding the large language model using the zero-shot thinking chain prompt, and the training data set is obtained through program assistance and data filtering; specifically: (1) A zero-shot thinking chain prompt with task decision function is constructed to guide the large language model to generate the reasoning chain of the mathematical application problem; (2) According to the prompt word, it is judged whether the reasoning chain of the mathematical application problem needs to be converted into a program auxiliary chain; (3) By comparing the generated answer with the answer in the original data set, the numerical difference between the two answers is calculated to determine whether the generated answer is correct; (4) If the large language model solves the current mathematical application problem three times and the results are still incorrect, the data is filtered out.

[0037] It should be noted that the task decision in the present embodiment is realized by the prompt word engineering, when the model identifies the problem and the complex operation or reasoning, the program auxiliary chain is automatically selected to assist in solving the problem; the zero-shot thinking chain prompt is to add the "let's think step by step" prompt word after the mathematical application problem to guide the large language model to think step by step, this prompt method does not depend on a specific task, and does not need to construct input-output examples; The embodiment converts the operation relationship in the reasoning step into an executable calculation process through the program-aided chain, enhances the symbolic form expression of the reasoning process, constructs the framework of the program-aided chain, and realizes automatic solving; if the reasoning chain of the current mathematical application question needs to be converted into a program-aided chain, the large language model converts the reasoning chain into a program-aided chain, and executes the program-aided chain using a code interpreter to generate the answer of the mathematical application question; the code interpreter is executed through the program-aided chain, the accuracy of numerical calculation is improved, and the accuracy of the reasoning step in the calculation process is ensured; if the reasoning chain of the current mathematical application question does not need to be converted into a program-aided chain, the large language model generates an answer based on the reasoning chain.

[0038] It should be noted that generating an answer based on a reasoning chain means that the large language model identifies and extracts the final numerical answer in the reasoning chain as the generated answer.

[0039] It should be noted that if the current mathematical application question needs to be represented by a program-aided chain, the large language model converts the reasoning chain into a program-aided chain, and represents the problem solving steps in the reasoning chain as numerical operation relationships; The problem solving steps of the program-aided chain are represented by the following formula: ; ; ; Wherein, P1 represents the first step of extracting information, P2 represents the second step of reasoning as performing calculation, P n is the n-th step of reasoning to continue calculation, until the last step ends.

[0040] The embodiment compares the answer generated by the large language model with the answer in the original data set to determine whether the generated answer is correct; the numerical difference between the generated answer and the answer in the original data set is calculated, and if the numerical difference is less than 1e-2, the generated answer is considered correct; if the answer generated by the large language model is correct, the question, reasoning chain, answer and other data of the mathematical application question are added to the training data set; if the answer generated by the large language model is incorrect, the large language model is guided to analyze the difference between the generated answer and the original answer, and an error example is constructed; for the error example, the large language model rechecks each reasoning step, adjusts the logical structure of the reasoning chain, and reconstructs the reasoning chain and constructs the corresponding program-aided chain; the large language model obtains an answer according to the reconstructed reasoning chain, or executes the reconstructed program-aided chain using a code interpreter to obtain a regenerated answer; if the regenerated answer is correct, the question, reasoning chain, answer, error example and other data of the mathematical application question are added to the training data set; if the regenerated answer is incorrect, the reasoning chain is reconstructed and the corresponding program-aided chain is constructed again.

[0041] The maximum number of retries of the inference chain reconstruction is set in this embodiment. If the maximum number of retries is exceeded and the correct answer is still not obtained, the example is removed from the training data set. The specific prompt word design and training sample are as shown in Figure 5 The model receives the prompt word and the problem to be solved, generates a series of reasoning steps based on the prompt word, that is, the inference chain. The model judges whether to generate a program auxiliary chain according to the complexity of the problem and the "if necessary" part of the prompt word; calculates the numerical difference between the generated answer and the answer in the original data set to judge whether the generated answer is correct. If the generated answer is correct, the problem, inference chain, answer and other data of the mathematical application problem are added to the training data set. If the answer generated by the large language model is incorrect, guide the large language to reconstruct the inference chain and the program auxiliary chain; use the obtained training data set to supervise the fine-tuning of the large language model.

[0042] As one or more implementations, the embodiment adopts a large language model as shown in Figure 3 The instruction fine-tuning training set is used to train the large language model module, and the large language model is fine-tuned through the synthesized training data set; specifically: Add solving instructions in the training data to guide the large language model to solve in a manner consistent with the task target; The large language model is fine-tuned in a supervised learning manner.

[0043] It should be noted that the fine-tuning is instruction fine-tuning, which is to further train the large language model in a supervised learning manner on a training data set composed of "instruction-response" pairs, and update all its parameters; the response refers to the standardized problem solving output generated by the model after receiving the solving instruction, including a clear thinking process, logical reasoning steps, necessary program auxiliary chain, and formatted numerical answer; when constructing the training data set, add solving instructions with task targets to guide the large language model to recognize and execute a unified problem solving format.

[0044] It should be noted that the task target first outputs a clear thinking process, then expands the reasoning steps in logical order, and calls the program auxiliary chain to assist calculation when necessary, and finally presents the numerical answer in the \boxed{} format and gives the conclusion starting with "Therefore,"; the large language model generates a logical and clear reasoning chain and an executable program auxiliary chain according to the solving instruction and the preset problem solving task target, and then obtains the problem solving answer; the large language model is fine-tuned in a supervised learning manner, and the ability of the large language model in solving mathematical application problems is transferred to a language model with a small number of parameters.

[0045] In the process of fine-tuning the large language model based on supervised learning, the loss function of the fine-tuned large language model includes the inference chain loss function , program auxiliary chain loss function And problem analysis loss function ;Right now ;in, i express; n express; For math word problems, Represents the reasoning chain of the current mathematical word problem, Indicates the program auxiliary chain corresponding to the current math word problem. Indicates the error analysis of the current math word problem; , T represents the actual length of the generated reasoning chain, is the predicted output of the language model for the question, Indicates a problem the corresponding real chain of reasoning; , Indicates a problem The corresponding real program auxiliary chain; , Indicates a problem Corresponding real error analysis.

[0046] like Figure 4 As shown, this embodiment builds an answer correction mechanism based on external feedback, builds a large language model verification mechanism, calls the correction function to correct the reasoning chain and program auxiliary chain, and obtains the final answer; specifically: Use the fine-tuned large language model to solve mathematical word problems and preliminarily generate reasoning chains and program auxiliary chains; The large language model generates an intermediate answer based on the reasoning chain, or uses a code interpreter to execute a program auxiliary chain to generate an intermediate answer; The generated intermediate answer is returned to the large language model as external feedback; Based on external feedback, a verification mechanism for large language models is built to enable verification and correction of the generated reasoning chains and program auxiliary chains; The large language model generates an answer based on the revised reasoning chain, or uses a code interpreter to execute the revised program auxiliary chain to obtain a revised answer; Set the maximum number of corrections. When the maximum number of corrections is reached, the large language model outputs the currently generated answer as the final result.

[0047] The embodiment uses zero sample thinking chain prompt to guide a large language model to construct a reasoning chain of a mathematical application question, the large language model judges whether the reasoning chain needs to be converted into a corresponding program auxiliary chain according to the prompt; the large language model generates an answer according to the reasoning chain, or executes the program auxiliary chain using a code interpreter to generate an answer, and the training data set is obtained by comparing the generated answer with the answer in the original data set; the large language model is fine-tuned using the training data set; the large language model is used to construct the reasoning chain and the program auxiliary chain of the mathematical application question after being fine-tuned, the code interpreter is called to obtain external feedback, the large language model constructs a verification mechanism, and the reasoning chain and the program auxiliary chain are corrected to obtain a final answer; and the solving efficiency and accuracy of the mathematical application question are improved.

[0048] Embodiment two The embodiment two of the present application introduces a mathematical application question solving system based on data synthesis.

[0049] As shown in Figure 6 A mathematical application question solving system based on data synthesis, comprising: An acquisition module configured to acquire a mathematical application question to be solved; A construction module configured to construct a reasoning chain of the mathematical application question based on a large language model; A judgment module configured to judge whether to convert the constructed reasoning chain into a program auxiliary chain according to a prompt judgment word; A solving module configured to, if conversion is needed, generate a reasoning chain and a program auxiliary chain based on a large language model, and use a code interpreter to execute the program auxiliary chain to complete the solving of the mathematical application question; otherwise, directly complete the solving of the mathematical application question according to the reasoning chain.

[0050] The detailed steps are the same as the mathematical application question solving method based on data synthesis provided in embodiment one, and will not be repeated here.

[0051] Embodiment three The embodiment three of the present application provides a computer readable storage medium.

[0052] A computer readable storage medium having a program stored thereon, the program being executed by a processor to implement the steps in the mathematical application question solving method based on data synthesis provided in the embodiment one of the present application.

[0053] The detailed steps are the same as the mathematical application question solving method based on data synthesis provided in embodiment one, and will not be repeated here.

[0054] Embodiment four The embodiment four of the present application provides an electronic device.

[0055] An electronic device includes a memory, a processor, and a program stored in the memory and running on the processor, and the processor implements the steps in the data synthesis based mathematical application question solving method according to the embodiment one of the present application when running the program.

[0056] The detailed steps are the same as the data synthesis based mathematical application question solving method provided in the embodiment one, and will not be repeated here.

[0057] Embodiment five The embodiment five of the present application provides a computer program product.

[0058] A computer program product includes software codes, and the program in the software codes implements the steps in the data synthesis based mathematical application question solving method according to the embodiment one of the present application.

[0059] The detailed steps are the same as the data synthesis based mathematical application question solving method provided in the embodiment one, and will not be repeated here.

[0060] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage media, etc.) containing computer-usable program code. The solutions in the embodiments of the present application can be implemented in various computer languages, such as the object-oriented programming language Java and the interpreted scripting language JavaScript.

[0061] The present application is described with reference to flowcharts and / or block diagrams of the method, device (system), and computer program product according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices produce the functions described in the flowcharts and / or block diagrams. Figure 1 An apparatus for performing the function specified in the flow or flows and / or blocks. Figure 1 An apparatus for performing the function specified in the flow or flows and / or blocks.

[0062] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the flow Figure 1 The flow or flows and / or blocks Figure 1 The flow or flows and / or blocks

[0063] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the flow Figure 1 The flow or flows and / or blocks Figure 1 The flow or flows and / or blocks

[0064] Although preferred embodiments of the application have been described herein, changes and modifications can be suggested to one skilled in the art, and it is intended that the scope of the application be limited only by the appended claims and equivalents thereof.

[0065] Obviously, numerous modifications and variations of the present application are possible in light of the above teachings. It is therefore to be understood that within the scope of the appended claims and their equivalents, the application can be practiced otherwise than as specifically described herein.

[0066] The above description is only preferred embodiments of the present application, not intended to limit the present application. The present application can be variously changed and modified by those skilled in the art without departing from the spirit and scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the present application.

Claims

1. A method for solving mathematical word problems based on data synthesis, characterized in that: include: Obtain mathematical word problems to be solved; Constructing a reasoning chain for the mathematical word problem based on the large language model; Determine whether to transform the constructed reasoning chain into a program auxiliary chain according to the prompt judgment words; If conversion is required, an inference chain and a program auxiliary chain are generated based on the large language model, and a code interpreter is used to execute the program auxiliary chain to solve the mathematical word problem; otherwise, the mathematical word problem is solved directly based on the inference chain.

2. A method for solving mathematical word problems based on data synthesis as claimed in claim 1, characterized in that: In the process of fine-tuning the large language model based on supervised learning, the loss function of the fine-tuned large language model Including the inference chain loss function , program auxiliary chain loss function And problem analysis loss function ;Right now ;in, i express; n express; For math word problems, Represents the reasoning chain of the current mathematical word problem, Indicates the program auxiliary chain corresponding to the current math word problem. Indicates the error analysis of the current math word problem; , T represents the actual length of the generated reasoning chain, is the predicted output of the language model for the question, Indicates a problem the corresponding real chain of reasoning; , Indicates a problem The corresponding real program auxiliary chain; , Indicates a problem Corresponding real error analysis.

3. A method for solving mathematical word problems based on data synthesis as claimed in claim 1, characterized in that: In the process of determining whether to convert the constructed reasoning chain into a program auxiliary chain based on the prompt judgment word, the large language model receives the prompt word and the problem to be solved, and generates reasoning steps based on the prompt word, that is, obtaining the reasoning chain; The large language model determines whether to generate a program auxiliary chain based on the complexity of the question and the prompt word; Calculate the numerical difference between the generated answer and the answer in the original dataset to determine whether the generated answer is correct; if the generated answer is correct, add the math word problem, reasoning chain, and answer to the training dataset; If the answer generated by the large language model is wrong, guide the large language to reconstruct the reasoning chain and program auxiliary chain.

4. A method for solving mathematical word problems based on data synthesis as claimed in claim 1, characterized in that: Based on the answer correction mechanism of external feedback, a large language model verification mechanism is constructed to guide the large language model to construct an inference chain and generate a program auxiliary chain corresponding to the inference chain; based on the inference chain, the answer to the mathematical word problem is generated, or the code interpreter is used to execute the program auxiliary chain to obtain an intermediate answer to the mathematical word problem, and the obtained intermediate answer is fed back to the large language model; the answer to the mathematical word problem is generated in combination with the corrected inference chain, or the corrected intermediate answer to the mathematical word problem is obtained in combination with the corrected program auxiliary chain, and is again fed back to the large language model as external feedback; after reaching the maximum number of corrections, the generated answer is used as the final answer.

5. A method for solving mathematical word problems based on data synthesis as claimed in claim 1, characterized in that: Based on data synthesis of a large language model, a reasoning chain is constructed using zero-sample thinking chains containing judgment information. The problem-solving steps in the resulting reasoning chain are numerical operation relationships.

6. A method for solving mathematical word problems based on data synthesis as claimed in claim 1, characterized in that: The problem-solving steps in the program auxiliary chain are: ; ; ; Among them, P1 means the first step is to extract information, P2 means the second step is to perform calculations, and P n Continue calculating for the nth step of reasoning until the last step is completed.

7. A mathematical word problem solving system based on data synthesis, characterized in that: include: an acquisition module configured to acquire a mathematical word problem to be solved; A construction module configured to construct a reasoning chain of the mathematical word problem based on the large language model; a judgment module configured to judge whether to convert the constructed reasoning chain into a program auxiliary chain according to the prompt judgment word; The solution module is configured to generate an inference chain and a program auxiliary chain based on the large language model if conversion is required, and use the code interpreter to execute the program auxiliary chain to solve the mathematical word problem; otherwise, the mathematical word problem is solved directly according to the inference chain.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method for solving mathematical word problems based on data synthesis as described in any one of claims 1 to 6 are implemented.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the program, the steps of the method for solving mathematical word problems based on data synthesis as described in any one of claims 1 to 6 are implemented.

10. A computer program product comprising software code, characterized in that The program in the software code executes the steps of the method for solving mathematical word problems based on data synthesis as described in any one of claims 1 to 6.

Citation Information

Cited By

  • Mathematical application problem solving method and system based on multi-path search

    CN121809704A

  • Mathematical problem solving method for small parameter large language model and its application

    CN122366681A