Mathematical problem text processing method and device

By using language big models and policy networks, combined with Monte Carlo tree search algorithm, the solution path of mathematical problems is optimized, and the problem of inaccurate text solving of mathematical problems in the existing technology is solved, achieving more efficient and accurate answers to mathematical problems.

CN119442047APending Publication Date: 2025-02-14GUANGZHOU ZHENGXUAN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411420679.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The prior art cannot accurately solve mathematical problem text, resulting in insufficient accuracy and stability of the answers.

Method used

By obtaining the real-time mathematical problem text input by the user, using pre-trained language big models and policy networks, combined with the Monte Carlo tree search algorithm, the solution path is optimized to improve the accuracy and efficiency of the solution.

Benefits of technology

It improves the speed and accuracy of answering mathematical problems, enhances the generalization and adaptability of problem-solving methods, and enables the model to deal with complex and novel mathematical problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119442047A_ABST
    Figure CN119442047A_ABST
Patent Text Reader

Abstract

The invention discloses a mathematical problem text processing method and device. The method comprises the following steps: receiving a real-time mathematical question text, extracting key mathematical concepts and relationships by utilizing a pre-training language large model and a knowledge base, inputting the key mathematical concepts and relationships into a strategy network to generate a preliminary solving path, optimizing through a Monte Carlo tree search algorithm to obtain a final path, and outputting a question answer according to the final path. According to the method and the device, the question understanding speed and accuracy are improved, and the problem that the mathematical question text cannot be accurately solved in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of processing mathematics problem texts, and in particular to a method and device for processing mathematics problem texts. Background Art

[0002] Solving math problems has always been a core task in education and research, which requires not only accuracy but also the ability to clearly explain the steps of the problem. With the development of technology, we have moved from manual problem solving to automated math problem solving techniques. These technologies try to simulate the human problem-solving process to provide fast and accurate answers and solutions. Existing math problem-solving techniques mainly rely on three methods:

[0003] Traditional question bank matching method: This method searches a large question bank to find questions that match the input question and provides pre-prepared answers. Its advantage is that once the match is successful, the quality of the answers is controllable because these answers are manually crafted. However, the disadvantages of this method are also obvious: it requires constant updating and maintenance of the question bank, which is not only costly, but also difficult to find the correct answer when the question changes slightly, such as noun replacement or quantity change.

[0004] Directly using the language model to solve the problem: This method directly inputs the problem into the trained language model and uses the model's basic common sense and reasoning ability to get the answer. Its advantage is that it is simple to implement and can cope with changes in various problems. However, due to the limitations of the language model in mathematical calculations and logical reasoning, this method often leads to insufficient accuracy and stability of the answer, and sometimes even produces wrong answers.

[0005] A hybrid solution method that combines a large language model with algebraic tools: This method first uses a large language model to understand the problem and lists a system of equations or formulas, and then inputs these mathematical expressions into a specialized mathematical solution tool for solution. Although this method can overcome some of the shortcomings of a single large model in algebraic operations and logical reasoning and improve the accuracy of the answer, its problem-solving process lacks transparency and is not conducive to teaching and understanding, because it only provides the final answer without providing a detailed problem-solving process.

[0006] These three methods for processing math problem texts result in the inability to accurately solve math problem texts in the prior art. Summary of the invention

[0007] The present invention provides a method and device for processing a mathematics problem text, so as to solve the problem that the mathematics problem text cannot be accurately solved in the prior art.

[0008] In a first aspect, the present application provides a method for processing a mathematical problem text, comprising:

[0009] Get the real-time math problem text entered by the user;

[0010] Inputting the real-time math problem text into a pre-trained language model so that the language model outputs a first math concept and a first relationship corresponding to the real-time math problem text according to a predefined knowledge base;

[0011] Inputting the first mathematical concept and the first relationship into a pre-trained strategy network so that the strategy network outputs a first solution path for the real-time mathematical problem text;

[0012] Optimizing the first solution path according to the Monte Carlo tree search algorithm to obtain a second solution path;

[0013] According to the second solution path, an answer text corresponding to the real-time math problem text is output.

[0014] The present application obtains the mathematical problem input by the user, and uses the pre-trained language model, combined with the predefined knowledge base, to accurately extract the first mathematical concept and the first relationship in the problem. This step ensures that the problem is correctly understood and lays a solid foundation for the subsequent solution. Secondly, these first mathematical concepts and the first relationship are input into the strategy network, which is specially trained to output a preliminary solution path based on this information. Then, this preliminary path is optimized by the Monte Carlo tree search algorithm, which selects the optimal path by simulating different solution strategies, thereby improving the accuracy and efficiency of the solution. Finally, the present application calculates the solution of the mathematical problem according to the optimized solution path. This process improves the speed and accuracy of problem solving, and due to the collaborative work of the strategy network and the Monte Carlo tree search algorithm, it also enhances the versatility and adaptability of the problem solving method, so that the model of the present application can handle various complex and novel mathematical problems to solve the problem that the mathematical problem text cannot be accurately solved in the prior art.

[0015] As a preferred embodiment of the first aspect, the first mathematical concept and the first relationship of the real-time mathematical problem text are input into a pre-trained strategy network so that the strategy network outputs a first solution path for the real-time mathematical problem text, specifically:

[0016] Constructing a set of mathematical equations according to the first mathematical concept and the first relationship of the real-time mathematical problem text;

[0017] Inputting the mathematical equation group into a pre-trained decision network so that the decision network continuously updates the action space and the state space according to the mathematical equation group;

[0018] If the state space no longer changes, stop updating and obtain a first solution path for the mathematical equation group;

[0019] The action space includes a solution method of substitution elimination, Gaussian elimination or unary solution, and the state space includes a solution progress of the mathematical equation group.

[0020] In this preferred embodiment, the present application first constructs a corresponding mathematical equation group according to the input mathematical problem, and this step ensures that the problem is accurately converted into a computable mathematical form. Then, these equation groups are input into a decision network, and the network continuously updates the action space and state space according to the equation group, wherein the action space covers a variety of solution methods such as substitution elimination, Gaussian elimination or unary solution, and the state space reflects the real-time progress of the solution of the equation group. Through this dynamic update mechanism, the present application can flexibly adjust the solution strategy to adapt to various changes in the problem solving process. When the state space is stable, that is, there is no new solution progress, the system stops updating, and the solution path obtained at this time represents an effective solution to the problem. The present application not only improves the accuracy and efficiency of the solution, but also enhances the transparency and interpretability of the problem-solving process by providing clear solution steps, which is particularly important for education and research fields. In addition, since the present application can automatically adapt to different types of mathematical problems, it has good versatility and extensibility, and can meet diverse solution needs.

[0021] As a preferred embodiment of the first aspect, the method further includes acquiring a first fine-tuning training set and a second fine-tuning training set;

[0022] Fine-tune the initial large language model according to the first fine-tuning training set and the second fine-tuning training set to obtain the pre-trained large language model;

[0023] The first fine-tuning training set is the basic concepts and terms of the first math problem text, and the second fine-tuning training set is the first math problem text and the solution to the first math problem text.

[0024] In this preferred embodiment, the present application obtains two types of fine-tuning training sets: the first training set contains the basic concepts and terms of mathematical problems, which helps the model understand the specific structure and meaning of mathematical language; the second training set contains specific mathematical problems and their solutions, which not only further strengthens the model's understanding of mathematical concepts, but also teaches the model how to apply these concepts to the solution of practical problems. Then, the present application uses these two sets of training sets to fine-tune the initial language model, thereby obtaining an optimized, pre-trained language model. It enables the language model to more accurately parse and understand complex mathematical problems, including key concepts, terms and their relationships in the problem. When the user enters a real-time mathematical problem text, the model of the present application can not only identify the mathematical elements in the problem, but also quickly generate an effective solution path based on the learned problem-solving strategy. In addition, since the model has been trained with actual problems and solutions, it can be closer to the actual problem-solving process when generating a problem-solving path, thereby improving the accuracy and reliability of the solution.

[0025] As a preferred embodiment of the first aspect, the first solution path is optimized according to the Monte Carlo tree search algorithm to obtain the second solution path, specifically:

[0026] According to the Monte Carlo tree search algorithm, starting from the first solution path, simulating each solution path and evaluating each solution path to obtain the optimal solution path;

[0027] According to the optimal solution path, the policy network is updated so that the policy network outputs a second solution path.

[0028] In this preferred embodiment, the present application first simulates multiple possible solution paths based on the first solution path initially generated by the Monte Carlo tree search algorithm. During the simulation process, the algorithm evaluates each path, and the present application identifies the optimal solution strategy by calculating and comparing the success rate and efficiency of various paths. This evaluation process ensures that the selected path is not only feasible in theory, but also the most effective in practice. Subsequently, the system updates the strategy network according to the identified optimal path, so that the network can learn and internalize these successful strategies. This update mechanism of the present application enables the strategy network to automatically output a more accurate and efficient second solution path when facing new or similar mathematical problems. Therefore, the present application not only improves the success rate of a single solution, but also enhances the system's adaptability and generalization capabilities to various mathematical problems.

[0029] As a preferred embodiment of the first aspect, outputting the answer text corresponding to the real-time math problem text according to the second solution path is specifically:

[0030] According to the second solution path, steps for solving the real-time math problem text are obtained;

[0031] According to the solving step, an answer text corresponding to the real-time math problem text is output.

[0032] In this preferred embodiment, the application calculates the solution of the math problem text by adopting the optimized second solution path, which significantly improves the accuracy and efficiency of the problem-solving process. The application first generates the detailed solution steps of the real-time math problem text according to the second solution path, which is obtained by optimizing the strategy network and the Monte Carlo tree search algorithm. Because this path has been carefully selected and optimized, it can ensure the logic and effectiveness of the solution steps, thereby reducing the possible errors and unnecessary complexity in the solution process. Then, the system is based on these solution steps, and the application finally obtains the solution of the math problem text through a series of calculations. The application not only improves the speed of problem solving, but also ensures the accuracy of the answer, so that the system can provide clear and accurate answers like human experts when dealing with complex mathematical problems. In addition, due to the transparency of the solution steps, the application is also convenient for users to understand and follow up, thereby playing a greater role in education and research.

[0033] In a second aspect, the present application provides a device for processing a mathematical problem text. The device for processing a mathematical problem text comprises an acquisition module, an input and output module, an optimization module, and a calculation module;

[0034] The acquisition module is used to obtain the real-time math problem text input by the user;

[0035] The input-output module is used to input the real-time math problem text into a pre-trained language model, so that the language model outputs the first math concept and the first relationship corresponding to the real-time math problem text according to a predefined knowledge base;

[0036] Inputting the first mathematical concept and the first relationship into a pre-trained strategy network so that the strategy network outputs a first solution path for the real-time mathematical problem text;

[0037] The optimization module is used to optimize the first solution path according to the Monte Carlo tree search algorithm to obtain a second solution path;

[0038] The calculation module is used to output the answer text corresponding to the real-time math problem text according to the second solution path.

[0039] This device uses four modules to divide the work and coordinate the work to solve the mathematical problem text more accurately. This application obtains the mathematical problem input by the user, and uses the pre-trained language model, combined with the predefined knowledge base, to accurately extract the first mathematical concept and the first relationship in the problem. This step ensures that the problem is correctly understood and lays a solid foundation for subsequent solution. Secondly, these first mathematical concepts and the first relationship are input into the strategy network, which is specially trained to output a preliminary solution path based on this information. Then, this preliminary path is optimized by the Monte Carlo tree search algorithm, which selects the optimal path by simulating different solution strategies, thereby improving the accuracy and efficiency of the solution. Finally, this application calculates the solution of the mathematical problem according to the optimized solution path. This process improves the speed and accuracy of problem solving, and due to the collaborative work of the strategy network and the Monte Carlo tree search algorithm, it also enhances the versatility and adaptability of the problem solving method, so that the model of this application can handle various complex and novel mathematical problems to solve the problem that the mathematical problem text cannot be accurately solved in the prior art.

[0040] As a preferred embodiment of the second aspect, the first mathematical concept and the first relationship of the real-time mathematical problem text are input into a pre-trained strategy network so that the strategy network outputs a first solution path for the real-time mathematical problem text, specifically:

[0041] Constructing a set of mathematical equations according to the first mathematical concept and the first relationship of the real-time mathematical problem text;

[0042] Inputting the mathematical equation group into a pre-trained decision network so that the decision network continuously updates the action space and the state space according to the mathematical equation group;

[0043] If the state space no longer changes, stop updating and obtain a first solution path for the mathematical equation group;

[0044] The action space includes a solution method of substitution elimination, Gaussian elimination or unary solution, and the state space includes a solution progress of the mathematical equation group.

[0045] In this preferred embodiment, the present application first constructs a corresponding mathematical equation group according to the input mathematical problem, and this step ensures that the problem is accurately converted into a computable mathematical form. Then, these equation groups are input into a decision network, and the network continuously updates the action space and state space according to the equation group, wherein the action space covers a variety of solution methods such as substitution elimination, Gaussian elimination or unary solution, and the state space reflects the real-time progress of the solution of the equation group. Through this dynamic update mechanism, the present application can flexibly adjust the solution strategy to adapt to various changes in the problem solving process. When the state space is stable, that is, there is no new solution progress, the system stops updating, and the solution path obtained at this time represents an effective solution to the problem. The present application not only improves the accuracy and efficiency of the solution, but also enhances the transparency and interpretability of the problem-solving process by providing clear solution steps, which is particularly important for education and research fields. In addition, since the present application can automatically adapt to different types of mathematical problems, it has good versatility and extensibility, and can meet diverse solution needs.

[0046] As a preferred embodiment of the second aspect, the method further includes acquiring a first fine-tuning training set and a second fine-tuning training set;

[0047] Fine-tune the initial large language model according to the first fine-tuning training set and the second fine-tuning training set to obtain the pre-trained large language model;

[0048] The first fine-tuning training set is the basic concepts and terms of the first math problem text, and the second fine-tuning training set is the first math problem text and the solution to the first math problem text.

[0049] In this preferred embodiment, the present application obtains two types of fine-tuning training sets: the first training set contains the basic concepts and terms of mathematical problems, which helps the model understand the specific structure and meaning of mathematical language; the second training set contains specific mathematical problems and their solutions, which not only further strengthens the model's understanding of mathematical concepts, but also teaches the model how to apply these concepts to the solution of practical problems. Then, the present application uses these two sets of training sets to fine-tune the initial language model, thereby obtaining an optimized, pre-trained language model. It enables the language model to more accurately parse and understand complex mathematical problems, including key concepts, terms and their relationships in the problem. When the user enters a real-time mathematical problem text, the model of the present application can not only identify the mathematical elements in the problem, but also quickly generate an effective solution path based on the learned problem-solving strategy. In addition, since the model has been trained with actual problems and solutions, it can be closer to the actual problem-solving process when generating a problem-solving path, thereby improving the accuracy and reliability of the solution.

[0050] As a preferred embodiment of the second aspect, the first solution path is optimized according to the Monte Carlo tree search algorithm to obtain the second solution path, specifically:

[0051] According to the Monte Carlo tree search algorithm, starting from the first solution path, simulating each solution path and evaluating each solution path to obtain the optimal solution path;

[0052] According to the optimal solution path, the policy network is updated so that the policy network outputs a second solution path.

[0053] In this preferred embodiment, the present application first simulates multiple possible solution paths based on the first solution path initially generated by the Monte Carlo tree search algorithm. During the simulation process, the algorithm evaluates each path, and the present application identifies the optimal solution strategy by calculating and comparing the success rate and efficiency of various paths. This evaluation process ensures that the selected path is not only feasible in theory, but also the most effective in practice. Subsequently, the system updates the strategy network according to the identified optimal path, so that the network can learn and internalize these successful strategies. This update mechanism of the present application enables the strategy network to automatically output a more accurate and efficient second solution path when facing new or similar mathematical problems. Therefore, the present application not only improves the success rate of a single solution, but also enhances the system's adaptability and generalization capabilities to various mathematical problems.

[0054] As a preferred embodiment of the second aspect, outputting the answer text corresponding to the real-time math problem text according to the second solution path is specifically:

[0055] According to the second solution path, steps for solving the real-time math problem text are obtained;

[0056] According to the solving step, an answer text corresponding to the real-time math problem text is output.

[0057] In this preferred embodiment, the application calculates the solution of the math problem text by adopting the optimized second solution path, which significantly improves the accuracy and efficiency of the problem-solving process. The application first generates the detailed solution steps of the real-time math problem text according to the second solution path, which is obtained by optimizing the strategy network and the Monte Carlo tree search algorithm. Because this path has been carefully selected and optimized, it can ensure the logic and effectiveness of the solution steps, thereby reducing the possible errors and unnecessary complexity in the solution process. Then, the system is based on these solution steps, and the application finally obtains the solution of the math problem text through a series of calculations. The application not only improves the speed of problem solving, but also ensures the accuracy of the answer, so that the system can provide clear and accurate answers like human experts when dealing with complex mathematical problems. In addition, due to the transparency of the solution steps, the application is also convenient for users to understand and follow up, thereby playing a greater role in education and research. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 : A flow chart of an embodiment of a method for processing a mathematical problem text provided by the present application;

[0059] Figure 2 : A structural diagram of an embodiment of the strategy network training process provided in this application;

[0060] Figure 3 : A structural diagram of an embodiment of the components and problem-solving process of each part provided in this application;

[0061] Figure 4 : A structural diagram of an embodiment of a device for processing mathematical problem text provided in the present application. DETAILED DESCRIPTION

[0062] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0063] Embodiment 1

[0064] Please refer to Figure 1 , which is a method for processing mathematics problem text provided by an embodiment of the present invention.

[0065] In this embodiment, the process of the method for processing the math problem text in this application is described in detail through steps S01-S05.

[0066] S01: Obtain the real-time math problem text input by the user.

[0067] S02: Inputting the real-time math problem text into a pre-trained language model, so that the language model outputs a first math concept and a first relationship corresponding to the real-time math problem text according to a predefined knowledge base.

[0068] As a preferred embodiment of the first embodiment, the pre-trained language model is obtained by fine-tuning, specifically:

[0069] Obtain a first fine-tuning training set and a second fine-tuning training set;

[0070] The first fine-tuning training set is to train the language model using the basic concepts, terms, etc. of the problem description. This training set can be given in the form of questions and answers, such as:

[0071] Question: "What are the basic methods and terms for describing and outputting mathematical problems?"

[0072] Answer: "Output the objects, attributes, relationships, values ​​and problems to be solved involved in the problem; the objects involved in the problem refer to";

[0073] The second fine-tuning training set is a batch of sample samples artificially produced for the math problem to be solved: the input of the sample is the math problem text, and the output is the knowledge representation of the problem (described using production, framework, or object-oriented methods), such as:

[0074] Question: "My brother has to take a 3.4-hour bus ride to go to college. The average speed of the bus is 70.5 kilometers per hour. How many kilometers does he travel by car?";

[0075] Output: "

[0076] Target:

[0077] Brother, sports: yes, speed: 70.5 km / h;

[0078] Starting point,Movement: No;

[0079] University,Sports: No;

[0080] My brother went to the university by car. Start: My brother set out by car. End: My brother arrived at the university by car. Time: 3.4 hours.

[0081] Solution:

[0082] Name: The journey my brother took by car;

[0083] Expression: "Coordinates of the university";

[0084] Since the number of training sets required is not large and is only used to prompt the language model for some grammatical and semantic specifications of mathematical problems, it is appropriate to freeze the parameters of the selected pre-trained language model and then add some new parameters for training.

[0085] After completing the fine-tuning training of the model, attach the corresponding prompt words to the user's math problem (such as: "Use the description method of math problems to describe the following problem: {problem}") and pass it to the model to output the corresponding question description text.

[0086] As a preferred embodiment of the first embodiment, the predefined knowledge base is specifically:

[0087] The predefined knowledge base uses a database to store the general knowledge and knowledge level labels required to solve math problems, including knowledge of general concepts such as:

[0088] Attribute: Movement, sub-attributes: position, distance, speed, movement time;

[0089] Attribute: position, sub-attributes: origin, coordinates, dimensions;

[0090] And its corresponding quantitative relationship knowledge such as:

[0091] Distance relationship: distance = speed * movement time;

[0092] Extract objects and their attributes from the title description text, match the knowledge in the knowledge base, and determine the attributes and relationships of these objects, such as:

[0093] "Brother, exercise: yes, speed: 70.5 km / h";

[0094] According to the object "brother" has the attribute of "movement", all knowledge related to the moving object is matched to it (such as the knowledge sets mentioned in 2.2.1);

[0095] After the matching is completed, a symbolic variable corresponding to each attribute is generated for the object according to the attributes and sub-attributes of the object, such as:

[0096] "Brother, exercise: yes, speed: 70.5 km / h";

[0097] Based on the object "brother" having the attribute of "movement", define variables such as "brother's position", "brother's speed", "brother's distance" and so on. If the values ​​of these variables are provided in the title description, then record their values, and the rest of the variables are unknown.

[0098] In this preferred embodiment, the present application obtains two types of fine-tuning training sets: the first training set contains the basic concepts and terms of mathematical problems, which helps the model understand the specific structure and meaning of mathematical language; the second training set contains specific mathematical problems and their solutions, which not only further strengthens the model's understanding of mathematical concepts, but also teaches the model how to apply these concepts to the solution of practical problems. Then, the present application uses these two sets of training sets to fine-tune the initial language model, thereby obtaining an optimized, pre-trained language model. It enables the language model to more accurately parse and understand complex mathematical problems, including key concepts, terms and their relationships in the problem. When the user enters a real-time mathematical problem text, the model of the present application can not only identify the mathematical elements in the problem, but also quickly generate an effective solution path based on the learned problem-solving strategy. In addition, since the model has been trained with actual problems and solutions, it can be closer to the actual problem-solving process when generating a problem-solving path, thereby improving the accuracy and reliability of the solution.

[0099] As a preferred embodiment of the first embodiment, the first mathematical concept and the first relationship of the real-time mathematical problem text are input into a pre-trained strategy network so that the strategy network outputs a first solution path of the real-time mathematical problem text, specifically:

[0100] Constructing a set of mathematical equations according to the first mathematical concept and the first relationship of the real-time mathematical problem text;

[0101] Inputting the mathematical equation group into a pre-trained decision network so that the decision network continuously updates the action space and the state space according to the mathematical equation group;

[0102] If the state space no longer changes, stop updating and obtain a first solution path for the mathematical equation group;

[0103] The action space includes a solution method of substitution elimination, Gaussian elimination or unary solution, and the state space includes a solution progress of the mathematical equation group.

[0104] More specifically, according to the quantitative relationship in the matching knowledge base, the relationship equation between these variables is established; (if it is an inequality, such as a ≥ b, then it is converted into an equation by introducing a real number c, a = b + c * c) The input equation group is expressed as a set of polynomial equations:

[0105] f 1 (x 1 ,x 2 ,...x n )=0

[0106] f 2(x 1 ,x 2 ,...x n ) = 0 ...

[0108] By selecting a specific polynomial term order, such as:

[0109]

[0110] It can be seen that a polynomial equation can be uniquely determined by a set of coefficients. Therefore, the entire system of equations can be represented by a coefficient matrix M, while recording the set K of known variables, the set U of unknown variables, and the set Q of variables to be solved.

[0111] The output process of application problems in mathematics is a process of calculating the unknown step by step from the known. Therefore, its basic form is:

[0112] Unknown variable 1 = arithmetic expression containing known variables = value;

[0113] Unknown variable 2 = arithmetic expression containing known variables (including unknown variable 1) = value;

[0114] The process of solving the system of equations corresponds to the solution steps of the problem, and the solution of the system of equations is such a decision-making process:

[0115] Action space:

[0116] The operations (strategies) on the system of equations are defined as the following:

[0117] a. Substitution elimination: Select the nth equation, select the ith variable, transform the equation into x i = g n (x j )(j = {1, 2, 3,...} and j ≠ i), and substitute it into the mth equation to replace the ith variable in it, obtaining a new equation; this action can be encoded as (1, n, i, m)

[0118] b. Gaussian elimination: Select the nth equation and the mth equation, calculate their polynomial division, i.e.: f n (x 1 , x 2 ,...) = k(x 1 , x 2 ,...) · f m (x 1 , x 2 ,...) + r(x 1 , x 2 ,...) can deduce a new equation r(x 1 , x 2,...)=0; this action can be encoded as (2,n,m,0)

[0119] c. Univariate solution: When an equation (set as the nth) has non-zero coefficients only in the known variables and an unknown variable, and all other terms (excluding the constant term) are 0, the equation is a univariate equation. At this time, solving the equation can obtain the symbolic solution of the variable. After the solution is obtained, the variable is treated as a known variable (the variable is added to the set K and removed from the set U). This action can be encoded as (3,n,0,0).

[0120] Operations such as solving one-variable equations and dividing polynomials can be completed using common symbolic computing libraries (such as sympy).

[0121] Note that the value range of these strategies is limited (i, m, and n are all positive integers and will not exceed the upper limit of the variables and the number of equations in the equation), so the Monte Carlo tree search algorithm can be used to make decisions.

[0122] State Space:

[0123] The state space of the system of equations is its corresponding coefficient matrix M and its three variable sets K, U, Q;

[0124] All values ​​after multiple decision-making operations are all equivalent forms of the system of equations.

[0125] Termination conditions:

[0126] The state transfer is terminated in the following cases;

[0127] When all variables in the Q set are in the K set (the solution is successful);

[0128] When there is no solution to a certain univariate equation (the problem has no solution).

[0129] In this preferred embodiment, the present application first constructs a corresponding mathematical equation group according to the input mathematical problem, and this step ensures that the problem is accurately converted into a computable mathematical form. Then, these equation groups are input into a decision network, and the network continuously updates the action space and state space according to the equation group, wherein the action space covers a variety of solution methods such as substitution elimination, Gaussian elimination or unary solution, and the state space reflects the real-time progress of the solution of the equation group. Through this dynamic update mechanism, the present application can flexibly adjust the solution strategy to adapt to various changes in the problem solving process. When the state space is stable, that is, there is no new solution progress, the system stops updating, and the solution path obtained at this time represents an effective solution to the problem. The present application not only improves the accuracy and efficiency of the solution, but also enhances the transparency and interpretability of the problem-solving process by providing clear solution steps, which is particularly important for education and research fields. In addition, since the present application can automatically adapt to different types of mathematical problems, it has good versatility and extensibility, and can meet diverse solution needs.

[0130] S03: Inputting the first mathematical concept and the first relationship into a pre-trained strategy network, so that the strategy network outputs a first solution path for the real-time mathematical problem text.

[0131] As a preferred embodiment of the first embodiment, the initialization and training process of the strategy network is as follows: Figure 2 As shown, specifically:

[0132] The policy network is a convolutional neural network whose input is the current state of the problem (i.e., coefficient matrix M, variable set K, U, Q), and whose output is all possible strategies for the next step and their strategy value (probability) A.

[0133] The typical structure of the network contains the following basic components:

[0134] Input layer: Receives the current state of the problem as input.

[0135] Fully connected layers: responsible for learning decision-making patterns.

[0136] Output layer: The output layer provides the specific policy value and its probability for each policy.

[0137] The training of the policy network can iteratively strengthen the ability of the policy network from random samples without the additional intervention of human knowledge (only with the support of external libraries related to symbolic operation rules) so that it can eventually be used in the decision-making process when solving problems.

[0138] The training process is as follows:

[0139] 1. Initialize the policy network, which behaves as a random policy;

[0140] 2. Random question generation: randomly generate a large number of questions (i.e. randomly generate M, K, U, Q);

[0141] 3. Use the Monte Carlo tree search method (using the decisions given by the policy network in the Monte Carlo tree search process) to obtain decisions on these problems and generate a large number of decision data sets;

[0142] 4. Use the generated (M, K, U, Q) and A to train the policy network;

[0143] 5. Return to step 2 and continue a new round of training;

[0144] After a large number of rounds of training, the policy network will continue to learn how to deal with problems and obtain a more accurate decision probability distribution.

[0145] After the problem is converted into M, K, U, Q representation, it is input into the policy network to obtain the next decision A for the problem. The step a with the highest probability is selected to perform state transition on the problem, and the process and results of the transition are recorded.

[0146] This process is repeated until the final state is reached. If the state is a successful solution, the results of all unary solution actions are taken from the state transition record to form the problem-solving steps. If the state is no solution or insufficient resources, the solution failure is output.

[0147] S04: Optimize the first solution path according to the Monte Carlo tree search algorithm to obtain a second solution path.

[0148] As a preferred embodiment of the first embodiment, the optimization process of the Monte Carlo tree search algorithm is specifically as follows:

[0149] Selection phase: Starting from the root node, use the UCT value of the node to select the next node (select the node with the highest UCT value).

[0150] Expansion phase: When a leaf node is reached, all possible actions are tried and a new child node is created for each action.

[0151] Simulation phase: Among all possible actions, an action is randomly selected and executed until a terminal state is reached. After reaching the terminal state, the reward is 1, and if the terminal state is not reached, no reward is allocated.

[0152] Back propagation: trace the rewards obtained during the simulation from the leaf nodes back to the root node, and update the visit count and cumulative reward of each node on the path.

[0153] Continue to the next iteration

[0154] In order to allow the policy network to play a role and participate in the algorithm process, the UCT formula is designed as follows:

[0155]

[0156] in

[0157] W i is the cumulative reward of the node (when the reward is configured as 1, it is the number of times the terminal state is reached in the simulation)

[0158] N i is the number of visits to the node (when it is 0, UCT takes infinity, so that the algorithm prioritizes exploring nodes that have not been selected)

[0159] N is the number of visits to the parent node of the node;

[0160] c is a balance parameter (which can adjust the algorithm's tendency toward exploitation and exploration);

[0161] a is the probability estimate of the node given by the strategy network (i.e., the prior probability);

[0162] k is the confidence level of the prior probability given to the policy network, which can be set to the number of iterative training of the policy network plus a constant.

[0163] When the algorithm is not fully explored, the a value given by the decision network can guide the algorithm to search. When the algorithm is fully searched, the search results will dominate.

[0164] When the number of iterations reaches the upper limit, the child nodes under the root node of the search tree (that is, all possible strategies for the next step) are assigned probabilities of these strategies according to their cumulative rewards (a simple normalized allocation can be used, that is, let n be the number of child nodes, then ) to output the probability distribution A of the next strategy.

[0165] In this preferred embodiment, the present application first simulates multiple possible solution paths based on the first solution path initially generated by the Monte Carlo tree search algorithm. During the simulation process, the algorithm evaluates each path, and the present application identifies the optimal solution strategy by calculating and comparing the success rate and efficiency of various paths. This evaluation process ensures that the selected path is not only feasible in theory, but also the most effective in practice. Subsequently, the system updates the strategy network according to the identified optimal path, so that the network can learn and internalize these successful strategies. This update mechanism of the present application enables the strategy network to automatically output a more accurate and efficient second solution path when facing new or similar mathematical problems. Therefore, the present application not only improves the success rate of a single solution, but also enhances the system's adaptability and generalization capabilities to various mathematical problems.

[0166] S05: According to the second solution path, output the answer text corresponding to the real-time math problem text.

[0167] In this preferred embodiment, the application calculates the solution of the math problem text by adopting the optimized second solution path, which significantly improves the accuracy and efficiency of the problem-solving process. The application first generates the detailed solution steps of the real-time math problem text according to the second solution path, which is obtained by optimizing the strategy network and the Monte Carlo tree search algorithm. Because this path has been carefully selected and optimized, it can ensure the logic and effectiveness of the solution steps, thereby reducing the possible errors and unnecessary complexity in the solution process. Then, the system is based on these solution steps, and the application finally obtains the solution of the math problem text through a series of calculations. The application not only improves the speed of problem solving, but also ensures the accuracy of the answer, so that the system can provide clear and accurate answers like human experts when dealing with complex mathematical problems. In addition, due to the transparency of the solution steps, the application is also convenient for users to understand and follow up, thereby playing a greater role in education and research.

[0168] If the solution part outputs the solution steps, according to the display and student reading requirements, the formulas in the steps should be sorted out (for example, the negative sign should not appear at the beginning of the formula as much as possible, and radicals or higher powers should be simplified, etc., which can be achieved by calling the sympy library), and the known values ​​given in the question should be substituted into the symbolic expression to obtain the value of the variable.

[0169] The entire technical solution of this application is as follows Figure 3 As shown. The present application obtains the mathematical problem input by the user, and uses the pre-trained language model, combined with the predefined knowledge base, to accurately extract the first mathematical concept and the first relationship in the problem. This step ensures that the problem is correctly understood and lays a solid foundation for the subsequent solution. Secondly, these first mathematical concepts and the first relationship are input into the policy network, which is specially trained to output a preliminary solution path based on this information. Then, this preliminary path is optimized by the Monte Carlo tree search algorithm, which selects the optimal path by simulating different solution strategies, thereby improving the accuracy and efficiency of the solution. Finally, the present application calculates the solution of the mathematical problem according to the optimized solution path. This process improves the speed and accuracy of problem solving, and due to the collaborative work of the policy network and the Monte Carlo tree search algorithm, it also enhances the versatility and adaptability of the problem solving method, so that the model of the present application can handle various complex and novel mathematical problems to solve the problem that the mathematical problem text cannot be accurately solved in the prior art.

[0170] Embodiment 2

[0171] Please refer to Figure 4, which is a device for processing mathematical problem text provided in an embodiment of the present application.

[0172] In this embodiment, the apparatus for processing math problem text includes an acquisition module 10 , an input-output module 20 , an optimization module 30 and a calculation module 40 .

[0173] The acquisition module 10 is used to acquire the real-time math problem text input by the user.

[0174] The input-output module 20 is used to input the real-time math problem text into a pre-trained language model, so that the language model outputs the first math concept and the first relationship corresponding to the real-time math problem text according to a predefined knowledge base.

[0175] As a preferred embodiment of the second embodiment, the pre-trained language model is obtained by fine-tuning, specifically:

[0176] Obtain a first fine-tuning training set and a second fine-tuning training set;

[0177] The first fine-tuning training set is to train the language model using the basic concepts, terms, etc. of the problem description. This training set can be given in the form of questions and answers, such as:

[0178] Question: "What are the basic methods and terms for describing and outputting mathematical problems?";

[0179] Answer: "Output the objects, attributes, relationships, values ​​and problems to be solved involved in the problem; the objects involved in the problem refer to";

[0180] The second fine-tuning training set is a batch of sample samples artificially produced for the math problem to be solved: the input of the sample is the math problem text, and the output is the knowledge representation of the problem (described using production, framework, or object-oriented methods), such as:

[0181] Question: "My brother has to take a 3.4-hour bus ride to go to college. The average speed of the bus is 70.5 kilometers per hour. How many kilometers does he travel by car?";

[0182] Output: "

[0183] Target:

[0184] Brother, sports: yes, speed: 70.5 km / h;

[0185] Starting point,Movement: No;

[0186] University,Sports: No;

[0187] My brother went to the university by car. Start: My brother set out by car. End: My brother arrived at the university by car. Time: 3.4 hours.

[0188] Solution:

[0189] Name: The journey my brother took by car;

[0190] Expression: "Coordinates of the university";

[0191] Since the number of training sets required is not large and is only used to prompt the language model for some grammatical and semantic specifications of mathematical problems, it is appropriate to freeze the parameters of the selected pre-trained language model and then add some new parameters for training.

[0192] After completing the fine-tuning training of the model, attach the corresponding prompt words to the user's math problem (such as: "Use the description method of math problems to describe the following problem: {problem}") and pass it to the model to output the corresponding question description text.

[0193] As a preferred embodiment of the second embodiment, the predefined knowledge base is specifically:

[0194] The predefined knowledge base uses a database to store the general knowledge and knowledge level labels required to solve math problems, including knowledge of general concepts such as:

[0195] Attribute: Movement, sub-attributes: position, distance, speed, movement time;

[0196] Attribute: position, sub-attributes: origin, coordinates, dimensions;

[0197] And its corresponding quantitative relationship knowledge such as:

[0198] Distance relationship: distance = speed * movement time;

[0199] Extract objects and their attributes from the title description text, match the knowledge in the knowledge base, and determine the attributes and relationships of these objects, such as:

[0200] "Brother, exercise: yes, speed: 70.5 km / h";

[0201] According to the object "brother" has the attribute of "movement", all knowledge related to the moving object is matched to it (such as the knowledge sets mentioned in 2.2.1);

[0202] After the matching is completed, a symbolic variable corresponding to each attribute is generated for the object according to the attributes and sub-attributes of the object, such as:

[0203] "Brother, exercise: yes, speed: 70.5 km / h";

[0204] Based on the object "brother" having the attribute of "movement", define variables such as "brother's position", "brother's speed", "brother's distance" and so on. If the values ​​of these variables are provided in the title description, then record their values, and the rest of the variables are unknown.

[0205] In this preferred embodiment, the present application obtains two types of fine-tuning training sets: the first training set contains the basic concepts and terms of mathematical problems, which helps the model understand the specific structure and meaning of mathematical language; the second training set contains specific mathematical problems and their solutions, which not only further strengthens the model's understanding of mathematical concepts, but also teaches the model how to apply these concepts to the solution of practical problems. Then, the present application uses these two sets of training sets to fine-tune the initial language model, thereby obtaining an optimized, pre-trained language model. It enables the language model to more accurately parse and understand complex mathematical problems, including key concepts, terms and their relationships in the problem. When the user enters a real-time mathematical problem text, the model of the present application can not only identify the mathematical elements in the problem, but also quickly generate an effective solution path based on the learned problem-solving strategy. In addition, since the model has been trained with actual problems and solutions, it can be closer to the actual problem-solving process when generating a problem-solving path, thereby improving the accuracy and reliability of the solution.

[0206] As a preferred embodiment of the second embodiment, the first mathematical concept and the first relationship of the real-time mathematical problem text are input into a pre-trained strategy network so that the strategy network outputs a first solution path for the real-time mathematical problem text, specifically:

[0207] Constructing a set of mathematical equations according to the first mathematical concept and the first relationship of the real-time mathematical problem text;

[0208] Inputting the mathematical equation group into a pre-trained decision network so that the decision network continuously updates the action space and the state space according to the mathematical equation group;

[0209] If the state space no longer changes, stop updating and obtain a first solution path for the mathematical equation group;

[0210] The action space includes a solution method of substitution elimination, Gaussian elimination or unary solution, and the state space includes a solution progress of the mathematical equation group.

[0211] More specifically, according to the quantitative relationship in the matching knowledge base, the relationship equation between these variables is established (if it is an inequality, such as a ≥ b, then it is converted into an equation by introducing a real number c, a = b + c * c);

[0212] Represent the input system of equations as a system of polynomial equations:

[0213] f 1 (x 1 ,x 2 ,...x n ) = 0

[0214] f 2 (x 1 ,x 2 ,...x n ) = 0 ...

[0216] By selecting a specific polynomial term order, such as:

[0217]

[0218] It can be seen that a polynomial equation can be uniquely determined by a set of coefficients. Therefore, the entire system of equations can be represented by a coefficient matrix M, while recording the set K of known variables, the set U of unknown variables, and the set Q of variables to be solved.

[0219] The output process of application problems in mathematics is a process of calculating the unknown step by step from the known. Therefore, its basic form is:

[0220] Unknown variable 1 = arithmetic expression containing known variables = value;

[0221] Unknown variable 2 = arithmetic expression containing known variables (including unknown variable 1) = value;

[0222] The process of solving the system of equations corresponds to the steps of solving the problem, and the solution of the system of equations is such a decision-making process:

[0223] Action space:

[0224] The operations (strategies) on the system of equations are defined as the following:

[0225] a. Substitution and elimination: Select the nth equation and the ith variable, transform the equation into x i = g n (x j )(j = {1, 2, 3,...} and j ≠ i), and substitute it into the mth equation to replace the ith variable, obtaining a new equation; this action can be encoded as (1, n, i, m)

[0226] b. Gaussian elimination: Select the nth equation and the mth equation, calculate their polynomial division, i.e.: f n (x 1 ,x 2 ,...) = k(x 1 ,x2 ,...)·f m (x 1 ,x 2 ,...)+r(x 1 ,x 2 ,...) can derive a new equation r(x 1 ,x 2 ,...)=0; this action can be encoded as (2,n,m,0)

[0227] c. Univariate solution: When an equation (set as the nth) has non-zero coefficients only in the known variables and an unknown variable, and all other terms (excluding the constant term) are 0, the equation is a univariate equation. At this time, solving the equation can obtain the symbolic solution of the variable. After the solution is obtained, the variable is treated as a known variable (the variable is added to the set K and removed from the set U). This action can be encoded as (3,n,0,0).

[0228] Operations such as solving one-variable equations and dividing polynomials can be completed using common symbolic computing libraries (such as sympy).

[0229] Note that the value range of these strategies is limited (i, m, and n are all positive integers and will not exceed the upper limit of the variables and the number of equations in the equation), so the Monte Carlo tree search algorithm can be used to make decisions.

[0230] State Space:

[0231] The state space of the system of equations is its corresponding coefficient matrix M and its three variable sets K, U, Q;

[0232] All values ​​after multiple decision-making operations are all equivalent forms of the system of equations.

[0233] Termination conditions:

[0234] The state transfer is terminated in the following cases;

[0235] When all variables in the Q set are in the K set (the solution is successful);

[0236] When there is no solution to a certain univariate equation (the problem has no solution).

[0237] In this preferred embodiment, the present application first constructs a corresponding mathematical equation group according to the input mathematical problem, and this step ensures that the problem is accurately converted into a computable mathematical form. Then, these equation groups are input into a decision network, and the network continuously updates the action space and state space according to the equation group, wherein the action space covers a variety of solution methods such as substitution elimination, Gaussian elimination or unary solution, and the state space reflects the real-time progress of the solution of the equation group. Through this dynamic update mechanism, the present application can flexibly adjust the solution strategy to adapt to various changes in the problem solving process. When the state space is stable, that is, there is no new solution progress, the system stops updating, and the solution path obtained at this time represents an effective solution to the problem. The present application not only improves the accuracy and efficiency of the solution, but also enhances the transparency and interpretability of the problem-solving process by providing clear solution steps, which is particularly important for education and research fields. In addition, since the present application can automatically adapt to different types of mathematical problems, it has good versatility and extensibility, and can meet diverse solution needs.

[0238] The input-output module 20 is used to input the first mathematical concept and the first relationship into a pre-trained strategy network, so that the strategy network outputs a first solution path for the real-time mathematical problem text.

[0239] As a preferred embodiment of the second embodiment, the initialization and training process of the strategy network is as follows: Figure 2 As shown, specifically:

[0240] The policy network is a convolutional neural network whose input is the current state of the problem (i.e., coefficient matrix M, variable set K, U, Q), and whose output is all possible strategies for the next step and their strategy value (probability) A.

[0241] The typical structure of the network contains the following basic components:

[0242] Input layer: Receives the current state of the problem as input.

[0243] Fully connected layers: responsible for learning decision-making patterns.

[0244] Output layer: The output layer provides the specific policy value and its probability for each policy.

[0245] The training of the policy network can iteratively strengthen the ability of the policy network from random samples without the additional intervention of human knowledge (only with the support of external libraries related to symbolic operation rules) so that it can eventually be used in the decision-making process when solving problems.

[0246] The training process is as follows:

[0247] 1. Initialize the policy network, which behaves as a random policy;

[0248] 2. Random question generation: randomly generate a large number of questions (i.e. randomly generate M, K, U, Q);

[0249] 3. Use the Monte Carlo tree search method (using the decisions given by the policy network in the Monte Carlo tree search process) to obtain decisions on these problems and generate a large number of decision data sets;

[0250] 4. Use the generated (M, K, U, Q) and A to train the policy network;

[0251] 5. Return to step 2 and continue a new round of training;

[0252] After a large number of rounds of training, the policy network will continue to learn how to deal with problems and obtain a more accurate decision probability distribution.

[0253] After the problem is converted into M, K, U, Q representation, it is input into the policy network to obtain the next decision A for the problem. The step a with the highest probability is selected to perform state transition on the problem, and the process and results of the transition are recorded.

[0254] This process is repeated until the final state is reached. If the state is a successful solution, the results of all unary solution actions are taken from the state transition record to form the problem-solving steps. If the state is no solution or insufficient resources, the solution failure is output.

[0255] The optimization module 30 is used to optimize the first solution path according to the Monte Carlo tree search algorithm to obtain a second solution path.

[0256] As a preferred embodiment of the second embodiment, the optimization process of the Monte Carlo tree search algorithm is specifically as follows:

[0257] Selection phase: Starting from the root node, use the UCT value of the node to select the next node (select the node with the highest UCT value).

[0258] Expansion phase: When a leaf node is reached, all possible actions are tried and a new child node is created for each action.

[0259] Simulation phase: Among all possible actions, an action is randomly selected and executed until a terminal state is reached. After reaching the terminal state, the reward is 1, and if the terminal state is not reached, no reward is allocated.

[0260] Back propagation: trace the rewards obtained during the simulation from the leaf nodes back to the root node, and update the visit count and cumulative reward of each node on the path.

[0261] Continue to the next iteration

[0262] In order to allow the policy network to play a role and participate in the algorithm process, the UCT formula is designed as follows:

[0263]

[0264] in

[0265] W i is the cumulative reward of the node (when the reward is configured as 1, it is the number of times the terminal state is reached in the simulation)

[0266] N i is the number of visits to the node (when it is 0, UCT takes infinity, so that the algorithm prioritizes exploring nodes that have not been selected)

[0267] N is the number of visits to the parent node of the node;

[0268] c is a balance parameter (which can adjust the algorithm's tendency toward exploitation and exploration);

[0269] a is the probability estimate of the node given by the strategy network (i.e., the prior probability);

[0270] k is the confidence level of the prior probability given to the policy network, which can be set to the number of iterative training of the policy network plus a constant.

[0271] When the algorithm is not fully explored, the a value given by the decision network can guide the algorithm to search. When the algorithm is fully searched, the search results will dominate.

[0272] When the number of iterations reaches the upper limit, the child nodes under the root node of the search tree (that is, all possible strategies for the next step) are assigned probabilities of these strategies according to their cumulative rewards (a simple normalized allocation can be used, that is, let n be the number of child nodes, then ) to output the probability distribution A of the next strategy.

[0273] In this preferred embodiment, the present application first simulates multiple possible solution paths based on the first solution path initially generated by the Monte Carlo tree search algorithm. During the simulation process, the algorithm evaluates each path, and the present application identifies the optimal solution strategy by calculating and comparing the success rate and efficiency of various paths. This evaluation process ensures that the selected path is not only feasible in theory, but also the most effective in practice. Subsequently, the system updates the strategy network according to the identified optimal path, so that the network can learn and internalize these successful strategies. This update mechanism of the present application enables the strategy network to automatically output a more accurate and efficient second solution path when facing new or similar mathematical problems. Therefore, the present application not only improves the success rate of a single solution, but also enhances the system's adaptability and generalization capabilities to various mathematical problems.

[0274] The calculation module 40 is used to output the answer text corresponding to the real-time math problem text according to the second solution path.

[0275] In this preferred embodiment, the application calculates the solution of the math problem text by adopting the optimized second solution path, which significantly improves the accuracy and efficiency of the problem-solving process. The application first generates the detailed solution steps of the real-time math problem text according to the second solution path, which is obtained by optimizing the strategy network and the Monte Carlo tree search algorithm. Because this path has been carefully selected and optimized, it can ensure the logic and effectiveness of the solution steps, thereby reducing the possible errors and unnecessary complexity in the solution process. Then, the system is based on these solution steps, and the application finally obtains the solution of the math problem text through a series of calculations. The application not only improves the speed of problem solving, but also ensures the accuracy of the answer, so that the system can provide clear and accurate answers like human experts when dealing with complex mathematical problems. In addition, due to the transparency of the solution steps, the application is also convenient for users to understand and follow up, thereby playing a greater role in education and research.

[0276] If the solution part outputs the solution steps, according to the display and student reading requirements, the formulas in the steps should be sorted out (for example, the negative sign should not appear at the beginning of the formula as much as possible, and radicals or higher powers should be simplified, etc., which can be achieved by calling the sympy library), and the known values ​​given in the question should be substituted into the symbolic expression to obtain the value of the variable.

[0277] The entire technical solution of this application is as follows Figure 3 As shown. The device uses four modules to divide the work and coordinate the work to more accurately solve the mathematical problem text. The present application obtains the mathematical problem input by the user, and uses the pre-trained language model, combined with the pre-defined knowledge base, to accurately extract the first mathematical concept and the first relationship in the problem. This step ensures that the problem is correctly understood and lays a solid foundation for the subsequent solution. Secondly, these first mathematical concepts and the first relationship are input into the strategy network, which is specially trained to output a preliminary solution path based on this information. Then, this preliminary path is optimized by the Monte Carlo tree search algorithm, which selects the optimal path by simulating different solution strategies, thereby improving the accuracy and efficiency of the solution. Finally, the present application calculates the solution of the mathematical problem according to the optimized solution path. This process improves the speed and accuracy of problem solving, and due to the collaborative work of the strategy network and the Monte Carlo tree search algorithm, it also enhances the versatility and adaptability of the problem solving method, so that the model of the present application can handle various complex and novel mathematical problems to solve the problem that the mathematical problem text cannot be accurately solved in the prior art.

[0278] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for processing a mathematical problem text, characterized in that: include: Get the real-time math problem text entered by the user; Inputting the real-time math problem text into a pre-trained language model so that the language model outputs a first mathematical concept and a first relationship corresponding to the real-time math problem text according to a predefined knowledge base; Inputting the first mathematical concept and the first relationship into a pre-trained strategy network so that the strategy network outputs a first solution path for the real-time mathematical problem text; Optimizing the first solution path according to the Monte Carlo tree search algorithm to obtain a second solution path; According to the second solution path, an answer text corresponding to the real-time math problem text is output.

2. The method for processing a mathematical problem text according to claim 1, characterized in that: The step of inputting the first mathematical concept and the first relationship of the real-time mathematical problem text into a pre-trained strategy network so that the strategy network outputs a first solution path for the real-time mathematical problem text is specifically as follows: Constructing a set of mathematical equations according to the first mathematical concept and the first relationship of the real-time mathematical problem text; Inputting the mathematical equation group into a pre-trained decision network so that the decision network continuously updates the action space and the state space according to the mathematical equation group; If the state space no longer changes, stop updating and obtain a first solution path for the mathematical equation group; The action space includes a solution method of substitution elimination, Gaussian elimination or unary solution, and the state space includes a solution progress of the mathematical equation group.

3. The method for processing a mathematical problem text according to claim 1, characterized in that: Also includes: Obtain a first fine-tuning training set and a second fine-tuning training set; Fine-tune the initial large language model according to the first fine-tuning training set and the second fine-tuning training set to obtain the pre-trained large language model; The first fine-tuning training set is the basic concepts and terms of the first math problem text, and the second fine-tuning training set is the first math problem text and the solution to the first math problem text.

4. The method for processing a mathematical problem text according to claim 1, characterized in that: The first solution path is optimized according to the Monte Carlo tree search algorithm to obtain the second solution path, specifically: According to the Monte Carlo tree search algorithm, taking the first solution path as the starting point, simulating each solution path and evaluating each solution path to obtain the optimal solution path; According to the optimal solution path, the policy network is updated so that the policy network outputs a second solution path.

5. The method for processing a mathematical problem text according to claim 1, characterized in that: The outputting of the answer text corresponding to the real-time math problem text according to the second solution path is specifically: According to the second solution path, steps for solving the real-time math problem text are obtained; According to the solving step, an answer text corresponding to the real-time math problem text is output.

6. A device for processing mathematical problem text, characterized in that: It includes an acquisition module, an input and output module, an optimization module and a calculation module; The acquisition module is used to obtain the real-time math problem text input by the user; The input-output module is used to input the real-time math problem text into a pre-trained language model, so that the language model outputs the first math concept and the first relationship corresponding to the real-time math problem text according to a predefined knowledge base; Inputting the first mathematical concept and the first relationship into a pre-trained strategy network so that the strategy network outputs a first solution path for the real-time mathematical problem text; The optimization module is used to optimize the first solution path according to the Monte Carlo tree search algorithm to obtain a second solution path; The calculation module is used to output the answer text corresponding to the real-time math problem text according to the second solution path.

7. The apparatus for processing mathematical problem text according to claim 6, characterized in that: The step of inputting the first mathematical concept and the first relationship of the real-time mathematical problem text into a pre-trained strategy network so that the strategy network outputs a first solution path for the real-time mathematical problem text is specifically as follows: Constructing a set of mathematical equations according to the first mathematical concept and the first relationship of the real-time mathematical problem text; Inputting the mathematical equation group into a pre-trained decision network so that the decision network continuously updates the action space and the state space according to the mathematical equation group; If the state space no longer changes, stop updating and obtain a first solution path for the mathematical equation group; The action space includes a solution method of substitution elimination, Gaussian elimination or unary solution, and the state space includes a solution progress of the mathematical equation group.

8. The apparatus for processing mathematical problem text according to claim 6, characterized in that: Also includes: Obtain a first fine-tuning training set and a second fine-tuning training set; Fine-tune the initial large language model according to the first fine-tuning training set and the second fine-tuning training set to obtain the pre-trained large language model; The first fine-tuning training set is the basic concepts and terms of the first math problem text, and the second fine-tuning training set is the first math problem text and the solution to the first math problem text.

9. The apparatus for processing mathematical problem text according to claim 6, characterized in that: The first solution path is optimized according to the Monte Carlo tree search algorithm to obtain the second solution path, specifically: According to the Monte Carlo tree search algorithm, taking the first solution path as the starting point, simulating each solution path and evaluating each solution path to obtain the optimal solution path; According to the optimal solution path, the policy network is updated so that the policy network outputs a second solution path.

10. The apparatus for processing mathematical problem text according to claim 6, characterized in that: The outputting of the answer text corresponding to the real-time math problem text according to the second solution path is specifically: According to the second solution path, steps for solving the real-time math problem text are obtained; According to the solving step, an answer text corresponding to the real-time math problem text is output.