Mathematical reasoning optimization method for large language model and electronic equipment

By introducing generalized problem generation and multi-round dialogue correction mechanisms in large-scale language models, the problems of insufficient universality and high computational cost in mathematical inference tasks are solved, which significantly improves the accuracy of solving mathematical problems and efficiency.

CN119227815AInactive Publication Date: 2024-12-31BEIJING ACAD OF ARTIFICIAL INTELLLIGENCE
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411745467.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2024-12-31
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing large-scale language models lack generality, high computational cost and low resolution rates for complex mathematical problems in mathematical reasoning tasks, resulting in poor performance in dealing with mathematical reasoning tasks.

Method used

The concept of generalized problem generation is introduced, reusable functional code is generated through large-scale language models, and the accuracy and efficiency of problem solving is improved through automatic execution and multiple rounds of dialogue correction mechanisms. Specific methods include masking the numerical values ​​in the original mathematical problem, generating a general problem description with variables, generating a general problem-solving program, and forming an extended data set through multiple rounds of dialogue and data augmentation techniques.

Benefits of technology

It significantly improves the accuracy and efficiency of solving mathematical problems, reduces computational costs, and enhances the reusability and scalability of the code, which can better deal with complex mathematical data sets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119227815A_ABST
    Figure CN119227815A_ABST
Patent Text Reader

Abstract

The invention discloses a big language model mathematical reasoning optimization method and electronic equipment, and belongs to the technical field of computer big models, the method comprises the steps that an original mathematical reasoning problem is acquired, the original mathematical reasoning problem comprises a plurality of numerical values, and a plurality of corresponding variables are used for replacing the numerical values; based on the original mathematical reasoning problem and the variables, generating a first general problem solving program by using a generative model; an interpreter is used for executing the first general problem solving program to obtain an execution result, the execution result is fed back to the generation model, and the generation model determines a target general problem solving program through multiple rounds of dialogues; the target general problem solving program is scaled through a data enhancement technology, and a corresponding target instruction data set is obtained. Through automatic execution and multi-round dialogue correction mechanisms, the technical effect of remarkably improving the accuracy and efficiency of problem solving is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of large computer models, and in particular, relates to a large language model mathematical reasoning optimization method and electronic equipment. Background Art

[0002] With the rapid development of artificial intelligence and large-scale language models (LLM), using LLM to solve mathematical reasoning problems has gradually become an important research direction. In recent years, large models have gradually emerged as a method of using program of thought (PoT) technology to solve problems in the field of mathematics, which generates executable program code to derive solutions to complex mathematical problems. However, existing technical solutions still have multiple limitations, such as lack of versatility, high computational cost, and low rate of solving complex problems, which leads to poor performance of LLM in dealing with mathematical reasoning tasks.

[0003] In response to the above problems, a large language model mathematical reasoning optimization method and electronic device of the present application are proposed. Summary of the invention

[0004] In order to address the deficiencies of the prior art, the present application provides a large language model mathematical reasoning optimization method and electronic device to solve the problems of LLM in the prior art, such as lack of versatility, high computational cost, and low rate of solving complex problems.

[0005] The technical effects to be achieved by this application are achieved through the following solutions: In a first aspect, the present application provides a method for optimizing mathematical reasoning of a large language model, the method comprising: Obtaining an original mathematical reasoning problem, wherein the original mathematical reasoning problem includes a plurality of numerical values, and replacing the plurality of numerical values ​​with a corresponding plurality of variables; Based on the original mathematical reasoning problem and the plurality of variables, generating a first general problem-solving program using a generative model; Executing the first general problem-solving program using an interpreter to obtain an execution result, and feeding the execution result back to the generation model, wherein the generation model determines a target general problem-solving program through multiple rounds of dialogue; The target general problem-solving program is scaled through data enhancement technology to obtain a corresponding target instruction data set.

[0006] In some embodiments, the generating model comprises: Large language models; or Code big model.

[0007] In some embodiments, the obtaining of an original mathematical reasoning problem, wherein the original mathematical reasoning problem includes a plurality of numerical values, and replacing the plurality of numerical values ​​with a corresponding plurality of variables, comprises: The original mathematical reasoning problem is obtained, and a plurality of numerical values ​​are extracted from the original mathematical reasoning problem; determining a plurality of variables adapted to the plurality of values; Substituting the plurality of variables for the plurality of numerical values ​​in the original mathematical reasoning problem; The original mathematical reasoning problem after replacement is constructed into a general mathematical problem.

[0008] In some embodiments, the generating a first general problem-solving program using a generative model based on the original mathematical reasoning problem and the plurality of variables includes: Based on common mathematical problems, use large language models or code models to generate corresponding functional codes; Solving the internal logic problem of the functional code by calling the target sub-function; Comment each line of code and each function in the functional code; The commented functional code is used as the first general problem-solving program.

[0009] In some embodiments, the functional code includes multiple codes of different versions.

[0010] In some embodiments, the generative model determines a target general problem-solving procedure through multiple rounds of dialogue, including: During the multi-round dialogue, the original mathematical reasoning question, the related program, the corresponding test input and the real answer are provided to the generative model; The generative model corrects logical errors in the related program; The generative model forms a target general problem-solving program through feedback iteration.

[0011] In some embodiments, the method of scaling the target general problem-solving program by using data enhancement technology to obtain a corresponding target instruction data set includes: Automatically replace variables and parameters in the target general problem-solving program to obtain multiple sets of problems and solutions corresponding to the problems; By changing the way of asking questions in the target general problem-solving program, a plurality of variant questions with different syntax but the same mathematical logic are obtained; Based on multiple groups of problems, the solutions corresponding to the problems and the variant problems, combined with target mathematical operations, target instruction data sets are generated in batches through regular programming.

[0012] In some embodiments, the target mathematical operations include: multivariate equations and nonlinear functions.

[0013] In a second aspect, the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any one of the methods described above when executing the computer program.

[0014] In a third aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement any of the methods described above.

[0015] The large language model mathematical reasoning optimization method and electronic device provided in the embodiments of the present application introduce the concept of general problem generation, and generate reusable functional code through a large-scale language model. At the same time, through automatic execution and multi-round dialogue correction mechanism, the technical effect of significantly improving the accuracy and efficiency of problem solving is achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the embodiments of the present application or the existing technical solutions, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0017] Figure 1 This is a flowchart of a large language model mathematical reasoning optimization method in one embodiment of the present application; Figure 2 It is a schematic block diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0019] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in one or more embodiments of the present application should be understood by people with ordinary skills in the field to which the present application belongs. The "first", "second" and similar words used in one or more embodiments of the present application do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0020] The LLM technology in related technologies mainly has the following problems: 1) Lack of versatility Traditional code generation methods generate solutions based on specific numerical values. The code generated by the model is often strongly related to the numerical values ​​involved in the problem, lacking scalability and reusability. For example, for a specific problem involving the sum of a series, the generated code may only be applicable to the current input series, and when the numerical value changes, a new set of code needs to be regenerated. This method results in low model reuse efficiency and cannot be generalized well when dealing with mathematical problems with similar structures but different parameters.

[0021] 2) High computational cost In existing technical solutions, large-scale language models need to continuously generate and verify code, which requires a lot of computing resources. Especially when dealing with complex problems, it often takes multiple generations and corrections to get the correct results, further increasing the cost of training and reasoning. For example, for a mathematical problem that requires multi-step derivation, after the model generates a part of the code, it needs to be interpreted and verified, and fed back to the model for adjustment. This process greatly consumes computing resources and is inefficient.

[0022] 3) Low rate of solving complex problems The existing technical framework still has a low rate of solving complex mathematical problems. Even if programmatic reasoning methods are used, the generated code is prone to errors when faced with complex mathematical problems, and the process of solving these errors often relies on manual intervention and cannot be fully automated. The accuracy of current mathematical reasoning models drops significantly when faced with multi-step, multi-variable reasoning, especially when more complex numerical calculations, formula derivations, and function calls are required.

[0023] Therefore, existing mathematical reasoning technology solutions cannot effectively cope with large-scale mathematical data sets, and have significant limitations in scalability and computational efficiency. New technical solutions are urgently needed to solve these problems.

[0024] The core idea of ​​this application is to introduce the concept of general problem generation in the process of mathematical problem solving, and to generate reusable functional code through a large-scale language model. At the same time, through automatic execution and multi-round dialogue correction mechanism, the accuracy and efficiency of problem solving can be significantly improved.

[0025] Specifically, the core ideas of the technical solution of this application include the following aspects: 1) Generalization Problem and General Solution Generation By masking the specific values ​​in the original math problem, the concepts of "general problem" and "general solution" are proposed. For a math problem, instead of using specific values ​​directly, these values ​​are replaced by variables to generate a general problem description with variables. The generalized processing method allows math problems with similar structures to be solved through a unified program logic, improving the reusability of the code.

[0026] 2) Function-based program generation In response to the common problems generated, this solution proposes a code generation strategy based on function calls. Unlike traditional methods, the generated code can not only solve specific problems, but also contains common functions and comments to ensure clear code logic and good readability. Functional code generation modularizes the problem-solving process and improves the scalability of the program.

[0027] 3) Multi-round dialogue correction and automatic verification The generated program code is automatically executed through programming language interpreters such as Python to verify its correctness. When an error occurs, the model can automatically correct the code based on feedback using the conversational capabilities of large-scale language models, and ultimately output the correct solution. The entire correction process does not require human intervention, achieving efficient code generation and verification.

[0028] The core idea of ​​this technical solution can significantly reduce the dependence on large-scale language models, optimize the generation process, and enhance the reusability and accuracy of the code.

[0029] 4) Data Scaling: Achieving effective and diversified expansion of data sets Data scaling is to generate a large amount of different variant data through parameter replacement, structural changes and complexity improvement, so that the data set can cover a wide range of mathematical reasoning problems. Through this step, the current problem of insufficient mathematical reasoning data can be solved, and the model can be exposed to more diverse scenarios during training. Different from traditional data enhancement methods, this application relies on the automatic replacement of synthetic programs and variables, combined with a variety of digital and parameter combinations, to form an expandable data set. The specific amount of data in the extended data set can be set according to the actual situation, thereby achieving effective and diversified expansion of the data set.

[0030] Various non-limiting implementations of the present application are described in detail below in conjunction with the accompanying drawings.

[0031] First, refer to Figure 1 , the large language model mathematical reasoning optimization method of this application is described in detail.

[0032] The present application provides a method for optimizing mathematical reasoning of a large language model, the method comprising: S1: obtaining an original mathematical reasoning problem, wherein the original mathematical reasoning problem includes a plurality of numerical values, and replacing the plurality of numerical values ​​with a corresponding plurality of variables; S2: Based on the original mathematical reasoning problem and the multiple variables, generate a first general problem-solving program using a generation model; S3: Execute the first general problem-solving program using the interpreter to obtain an execution result, and feed the execution result back to the generation model, wherein the generation model determines a target general problem-solving program through multiple rounds of dialogue; S4: Scaling the target general problem-solving program through data enhancement technology to obtain a corresponding target instruction data set.

[0033] Through the large language model mathematical reasoning optimization method provided in the embodiment of the present application, the concept of general problem generation is introduced, and reusable functional code is generated through a large-scale language model. At the same time, through the automatic execution and multi-round dialogue correction mechanism, the technical effect of significantly improving the accuracy and efficiency of problem solving is achieved.

[0034] In some embodiments, the specific implementation of the present application mainly includes four main stages: 1) Generalization of seed mathematical problems, where seed problems refer to original mathematical reasoning problems; 2) generating a general problem-solving program in code form, wherein the general problem-solving program refers to a first general problem-solving program; 3) Code execution and iterative correction to obtain the target general problem-solving program; 4) Expand the data scale through data augmentation to obtain the target instruction data set.

[0035] In some embodiments, the generating model comprises: Large language models; or Code big model.

[0036] The above-mentioned model is exemplary, and other models known to those skilled in the art may also be applied here, without limitation.

[0037] In some embodiments, the obtaining of an original mathematical reasoning problem, wherein the original mathematical reasoning problem includes a plurality of numerical values, and replacing the plurality of numerical values ​​with a corresponding plurality of variables, comprises: The original mathematical reasoning problem is obtained, and a plurality of numerical values ​​are extracted from the original mathematical reasoning problem; determining a plurality of variables adapted to the plurality of values; Substituting the plurality of variables for the plurality of numerical values ​​in the original mathematical reasoning problem; The original mathematical reasoning problem after replacement is constructed into a general mathematical problem.

[0038] In some embodiments, the original mathematical reasoning problem generalization includes: First, we need to collect high-quality math problems as original math reasoning problems. For each problem, we replace the specific values ​​with variables through the value masking technology to generate a universal and variable math problem.

[0039] For example, a problem involving solving the sum of a series may contain specific numbers, but after generalization, these values ​​are replaced by variables such as x1 and x2 to form a unified mathematical problem description. This process ensures that the generated mathematical problem can be applied to more scenarios without being affected by changes in values.

[0040] For example, for the question "Wang earns $12 per hour as a babysitter. Yesterday, she worked as a babysitter for 50 minutes. How much did she earn?", 12 and 50 are the numbers in the question. By masking the values ​​and replacing them with a placeholder / variable, there are two versions of the mask: "Wang earns [param1] dollars per hour as a nanny. Yesterday, she just worked as a nanny for a few minutes; how much did she earn?"; "Wang earns [hourly wage] dollars per hour as a nanny. Yesterday, she only worked as a nanny for [nanny minutes] minutes; how much did she earn?" Since pattern recognition (numbers) is a basic structured task, it is easy for pre-trained large language models (such as GPT-4 or Qwen-72B). The specific implementation method is through LLM (Large Language Model). By giving specific instructions, LLM formally expresses mathematical problems and forms a template for general problems.

[0041] The specific instructions are: Extract numbers from the following math problems (e.g. 1.5, 2 / 3, 10, etc.).

[0042] Replace the above numbers with appropriate parameters or variables.

[0043] Formulate this as a general math problem.

[0044] In some embodiments, the generating a first general problem-solving program using a generative model based on the original mathematical reasoning problem and the plurality of variables includes: Based on common mathematical problems, use large language models or code models to generate corresponding functional codes; Solving the internal logic problem of the functional code by calling the target sub-function; Comment each line of code and each function in the functional code; The commented functional code is used as the first general problem-solving program.

[0045] In some embodiments, after a general mathematical problem is generated, the corresponding functional code is generated using a large language model / code large model. The generated code generates solutions based on the general problem and comes with detailed comments and document strings to ensure clear code logic and strong readability.

[0046] For example, the code generated by the model may contain the function solve_series(x1, x2), where x1 and x2 represent the boundary values ​​of the series, and the internal logic of the function completes the problem solving by calling other sub-functions. In addition, each line of code or the function of each function will be commented in detail to help with subsequent code maintenance and improvement.

[0047] Exemplarily, the expected model synthesizes the following version of the code description as a general problem-solving program in code form: Version 1: Solution (param1, param2): # Divide minutes by 60 to convert them to hours hours = param2 / 60 # Calculate income by multiplying the hourly rate by the number of hours Income = param1*hours Return income Version 2: Calculate income (hourly wage, minutes): hours = minutes / 60 Income = hours * hourly wage Return income Version 3: Calculate income (hourly wage, babysitting minutes): This function calculates a person's total income based on hourly wages and babysitting time.

[0048] parameter: HourlyWage(float): The individual's hourly wage.

[0049] Babysitter minutes (integer): The number of minutes spent by the babysitter.

[0050] return: Float Total: An individual's total income.

[0051] #Convert minutes to hours Babysitting hours = babysitting minutes / 60 #Calculate total income Total income = hourly wage * nanny hours Returns total revenue The specific implementation method is to use the code generation capability of the code large model to achieve the program solution of the first step of general mathematical problems. The instructions used are: 1) Write a Python function to complete {problem}.

[0052] 2) Please provide detailed comments explaining each step of the procedure and include a comprehensive documentation string describing the function's purpose, parameters, and return values.

[0053] In some embodiments, the functional code includes multiple codes of different versions.

[0054] In some embodiments, the generative model determines a target general problem-solving procedure through multiple rounds of dialogue, including: During the multi-round dialogue, the original mathematical reasoning question, the related program, the corresponding test input and the real answer are provided to the generative model; The generative model corrects logical errors in the related program; The generative model forms a target general problem-solving program through feedback iteration.

[0055] In some embodiments, the above code execution and iterative correction process includes: The generated code is executed by the interpreter, and its correctness is judged based on the execution results. If the code execution fails, the system will feedback the error information to the large language model, and the large language model will generate a corrected version of the code through multiple rounds of dialogue. Through gradual iteration, the correct code solution is finally generated. This process does not require human participation and relies on an automated feedback mechanism to improve the efficiency and accuracy of code generation.

[0056] During multiple rounds of dialogue, the original mathematical reasoning questions, related programs, corresponding test inputs, and real answers are provided to the model through instructions, allowing the model to modify errors in the program logic, and then feedback and iterate to form updated code.

[0057] In some embodiments, the method of scaling the target general problem-solving program by using data enhancement technology to obtain a corresponding target instruction data set includes: Automatically replace variables and parameters in the target general problem-solving program to obtain multiple sets of problems and solutions corresponding to the problems; By changing the way of asking questions in the target general problem-solving program, a plurality of variant questions with different syntax but the same mathematical logic are obtained; Based on multiple groups of problems, solutions corresponding to the problems and the variant problems, combined with target mathematical operations, target instruction data sets are generated in batches through regular programming.

[0058] In some embodiments, the target mathematical operations include: multivariate equations and nonlinear functions.

[0059] In some embodiments, data scaling is to expand the single data in the above steps into multiple instruction data through data enhancement technology. The specific number of instruction data can be set according to the actual application situation and needs. There is no limitation here. The relevant numbers known to those skilled in the art can be applied here. Its specific implementation depends on a series of automated programs and rule settings. Based on the original mathematical reasoning problem, data scaling is achieved through the following steps: 1) Automatic replacement of variables and parameters: Through the variable replacement mechanism in the programming language, the numerical parameters in the problem (such as hourly wages, working hours) are replaced with numbers in different ranges to generate a new set of problems and corresponding solutions.

[0060] Example: If you replace hourly wage = 12 in the question "Wang works as a babysitter and earns [hourly wage] dollars per hour. Yesterday, she worked as a babysitter for 50 minutes. How much did she earn?" with 1, 2, or 3, that is, you modify the specific value of the hourly wage and generate a corresponding new problem. In the corresponding program, you only need to replace hourly wage = 12 with hourly wage = 1, hourly wage = 2, or hourly wage = 3, and the program can be used as the solution to the new problem.

[0061] 2) Diversification of expression: In addition to numerical substitution, variant questions with different grammar but the same mathematical logic can be generated by changing the way the question is expressed (such as sentence structure and question order).

[0062] Example: The original question "Wang earns $12 per hour as a nanny" can be changed to "Wang's hourly wage is $12, how much does Wang earn?" 3) Complexity introduction: On the basis of basic algebraic problems, more complex mathematical operations (such as multivariate equations and nonlinear functions) are introduced to further increase the complexity and diversity of the problems.

[0063] By gradually increasing the complexity of the problems, the model can be trained at different levels of difficulty, thereby improving its mathematical reasoning ability.

[0064] 4) Automatic generation system: By utilizing the synthetic data generation system, data can be generated in batches through rule-based programming, and the data scale can be continuously expanded according to the setting of generation rules. In theory, a variety of different mathematical reasoning problems can be generated.

[0065] This ensures that a large amount of data can be generated through programming, making the data sources rich and diverse during model training, and having strong generalization ability and flexibility.

[0066] This application also provides the following options: 1) Data expansion strategy optimization In the process of generating general problems, more complex variable replacement rules can be introduced to further improve the generation diversity of general problems and the code generalization ability.

[0067] 2) Multi-model collaboration This application can also be combined with other types of large-scale language models, such as multilingual models or models focusing on mathematical reasoning, to improve the accuracy of code generation and the problem-solving rate.

[0068] 3) Automated error classification During the multi-round dialogue correction process, the introduction of an automatic error classification module can make more targeted corrections for different error types, thereby further improving code generation efficiency and accuracy.

[0069] The above solutions provide multiple possible implementation directions for further optimization of the technical solution.

[0070] Compared with the existing technical solutions, the technical solution of the present application has the following obvious beneficial effects: 1) Code reusability is significantly improved Through the generalized problem generation technology, the solution of this application can generate generalized code for a large number of problems with similar structures, significantly improving the reusability of the code. The code generated by the traditional method can only be applied to specific problems, while the generalized code can be used to solve a wide range of mathematical problems, greatly enhancing the scalability of the code.

[0071] 2) Reduced computational costs By generalizing problems and generating functional code, this technical solution reduces the need for multiple calls to large-scale language models and reduces computing costs. In addition, automated code verification and correction reduces manual intervention and further improves the operating efficiency of the system.

[0072] 3) Improved complex problem solving rate Through multiple rounds of dialogue and automated correction mechanisms, this solution significantly improves the solution rate of complex mathematical problems. In traditional technologies, solving complex problems often requires multiple iterations and manual corrections, but this technical solution can automatically generate and correct the code and finally output the correct result.

[0073] 4) Improve code readability The generated functional code is not only versatile, but also contains detailed comments and documentation strings, which makes the code easier to understand and maintain. Especially in the process of generating large-scale data sets, readable code can effectively reduce subsequent development costs.

[0074] It should be noted that the method of one or more embodiments of the present application can be performed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of one or more embodiments of the present application, and the multiple devices will interact with each other to complete the described method.

[0075] It should be noted that the above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0076] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also discloses an electronic device.

[0077] Specifically, Figure 2 A schematic diagram of the hardware structure of an electronic device for a large language model mathematical reasoning optimization method provided in this embodiment is shown, and the device may include: a processor 410, a memory 420, an input / output interface 430, a communication interface 440, and a bus 450. The processor 410, the memory 420, the input / output interface 430, and the communication interface 440 are connected to each other in communication within the device through the bus 450.

[0078] The processor 410 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.

[0079] The memory 420 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 420 may store an operating system and other application programs. When the technical solution provided in the embodiment of the present application is implemented by software or firmware, the relevant program code is stored in the memory 420 and is called and executed by the processor 410.

[0080] The input / output interface 430 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.

[0081] The communication interface 440 is used to connect a communication module (not shown in the figure) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (for example, USB, network cable, etc.) or a wireless mode (for example, mobile network, WIFI, Bluetooth, etc.).

[0082] The bus 450 includes a path that transmits information between the various components of the device (eg, the processor 410 , the memory 420 , the input / output interface 430 , and the communication interface 440 ).

[0083] It should be noted that, although the above device only shows the processor 410, the memory 420, the input / output interface 430, the communication interface 440 and the bus 450, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiment of the present application, and does not necessarily include all the components shown in the figure.

[0084] The electronic device of the above embodiment is used to implement the corresponding large language model mathematical reasoning optimization method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.

[0085] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, one or more embodiments of the present application also provide a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the large language model mathematical reasoning optimization method as described in any of the above embodiments.

[0086] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0087] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the large language model mathematical reasoning optimization method as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0088] A person skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. In line with the concept of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of different aspects of one or more embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.

[0089] In addition, to simplify the description and discussion, and in order not to make one or more embodiments of the present application difficult to understand, the well-known power / ground connections to the integrated circuit (IC) chip and other components may or may not be shown in the provided figures. In addition, the device may be shown in the form of a block diagram to avoid making one or more embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which one or more embodiments of the present application will be implemented (that is, these details should be fully within the scope of understanding of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present application, it is obvious to those skilled in the art that one or more embodiments of the present application can be implemented without these specific details or with changes in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.

[0090] Although the present application has been described in conjunction with specific embodiments of the present application, many alternatives, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the discussed embodiments.

[0091] One or more embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present application should be included in the scope of protection of the present application.

Claims

1. A method for optimizing mathematical reasoning of a large language model, characterized in that: The method comprises: Obtaining an original mathematical reasoning problem, wherein the original mathematical reasoning problem includes a plurality of numerical values, and replacing the plurality of numerical values ​​with a corresponding plurality of variables; Based on the original mathematical reasoning problem and the plurality of variables, generating a first general problem-solving program using a generative model; Executing the first general problem-solving program using an interpreter to obtain an execution result, and feeding the execution result back to the generation model, wherein the generation model determines a target general problem-solving program through multiple rounds of dialogue; The target general problem-solving program is scaled through data enhancement technology to obtain a corresponding target instruction data set.

2. The large language model mathematical reasoning optimization method according to claim 1, characterized in that: The generation model includes: Large language models; or Code big model.

3. The large language model mathematical reasoning optimization method according to claim 1 or 2, characterized in that: The obtaining of an original mathematical reasoning problem, wherein the original mathematical reasoning problem includes a plurality of numerical values, and replacing the plurality of numerical values ​​with a corresponding plurality of variables, comprises: The original mathematical reasoning problem is obtained, and a plurality of numerical values ​​are extracted from the original mathematical reasoning problem; determining a plurality of variables adapted to the plurality of values; Substituting the plurality of variables for the plurality of numerical values ​​in the original mathematical reasoning problem; The original mathematical reasoning problem after replacement is constructed into a general mathematical problem.

4. The large language model mathematical reasoning optimization method according to claim 3, characterized in that: The step of generating a first general problem-solving program based on the original mathematical reasoning problem and the plurality of variables using a generative model comprises: Based on common mathematical problems, use large language models or large code models to generate corresponding functional codes; Solving the internal logic problem of the functional code by calling the target sub-function; Comment each line of code and each function in the functional code; The commented functional code is used as the first general problem-solving program.

5. The large language model mathematical reasoning optimization method according to claim 4, characterized in that: The functional code includes a plurality of codes of different versions.

6. The large language model mathematical reasoning optimization method according to claim 1, characterized in that: The generative model determines the target general problem-solving procedure through multiple rounds of dialogue, including: During the multi-round dialogue, the original mathematical reasoning question, the related program, the corresponding test input and the real answer are provided to the generative model; The generative model corrects logical errors in the related program; The generative model forms a target general problem-solving program through feedback iteration.

7. The large language model mathematical reasoning optimization method according to claim 6, characterized in that: The method of scaling the target general problem-solving program by using data enhancement technology to obtain a corresponding target instruction data set includes: Automatically replace variables and parameters in the target general problem-solving program to obtain multiple sets of problems and solutions corresponding to the problems; By changing the way of asking questions in the target general problem-solving program, a plurality of variant questions with different syntax but the same mathematical logic are obtained; Based on multiple groups of problems, the solutions corresponding to the problems and the variant problems, combined with target mathematical operations, target instruction data sets are generated in batches through regular programming.

8. The large language model mathematical reasoning optimization method according to claim 7, characterized in that: The target mathematical operations include: multivariate equations and nonlinear functions.

9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 8 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Training method and device and reasoning method and device for mathematical problem solving model

    CN104933158A

  • Answer set logic program-based LPMLN reasoning method and system

    CN107092515A

  • Method, apparatus and computer program product for processing questions

    CN117911730A

  • Big language model-based reasoning calculation method, apparatus and device, and storage medium

    CN117973530A

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

    CN118094221A