Multi-round iteration mathematical question generation method, system, device and storage medium
By employing a multi-round iterative method for generating math problems, combining sample problems with related knowledge points, and using reinforcement learning and large language models for evaluation, the limitations of generated content in existing technologies have been addressed. This approach achieves professionalism in generated problems and allows for multi-round iterative adjustments, meeting the personalized needs of educational scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- UNIV OF SCI & TECH OF CHINA
- Filing Date
- 2026-04-20
- Publication Date
- 2026-05-29
AI Technical Summary
Existing methods for generating math problems have limitations in terms of the diversity and depth of the generated content, making it difficult to meet the personalized needs of educators, especially in terms of adjusting difficulty and logical structure. Furthermore, current technologies cannot achieve dynamic adjustments through multiple iterations.
A multi-round iterative method for generating math problems is adopted. By combining a proposition model with sample problems and related knowledge points, rough problems are generated. The difficulty of the problems is adjusted through automatic solution verification and optimization modules. Reinforcement learning and large language models are used as the judge mechanism to ensure the professionalism and quality of the generated problems.
It has improved the professionalism and quality of generated questions, and can be iteratively adjusted in multiple rounds according to teaching objectives to meet the dynamic needs of educational scenarios and generate in-depth and inspiring mathematical questions.
Smart Images

Figure CN122115169A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing, and in particular to a method, system, device, and storage medium for generating mathematical problems through multiple iterations. Background Technology
[0002] In daily teaching scenarios, teachers have a significant and rigid need for test question design. Test questions are not only the basis for assigning homework and organizing exams, but also, through targeted questioning, can help students deepen their understanding and internalization of key subject concepts, serving as an important link in teaching feedback and knowledge consolidation. Therefore, Math Word Question Generation (MWQG), as a key technological direction in the field of intelligent education, not only provides an effective path to alleviate teachers' test question creation pressure and improve test question creation efficiency, but also has great significance for promoting personalized teaching and optimizing the allocation of educational resources, and has currently become one of the most popular research hotspots in this field.
[0003] Existing methods for generating math problems can be mainly divided into the following two categories: 1. A method for generating mathematical problems using traditional language models.
[0004] Before the advent of large language models, mainstream methods for generating math problems primarily relied on models such as BERT (a bidirectional pre-trained language model based on a transformer architecture) or GPT (generative pre-trained transformer) to encode input formulas or reference problems, thereby transforming them into entirely new problems. These works typically selected formulas and keywords as input, using encoder-decoder networks to generate math problems. Other works further utilized knowledge graphs and soft templates to enrich the content of the generated problems or to control the difficulty of the output problems.
[0005] However, given the limitations of traditional language models in terms of language proficiency and generalization ability, educators find it difficult to interact with the models in practical applications. This prevents them from further adjusting the generated questions at the level of difficulty, topic, or other attributes. This not only restricts the diversity of generated content but also makes it difficult for teachers to obtain questions that match their own needs.
[0006] 2. A method for generating mathematical problems using a large language model.
[0007] Large Language Models (LLMs) have brought significant opportunities to the development of automatic math problem generation tasks due to their superior language understanding and generation capabilities. Current research on LLM-based problem generation mainly falls into two categories: one employs prompt-guided strategies, such as combining them with Chain of Thought (CoT) methods, to guide the problem design logic through refined instructions, thereby improving the accuracy and rationality of the generated content; the other utilizes parameter fine-tuning techniques, using manually annotated high-quality datasets or training data autonomously synthesized by the LLM to iteratively optimize model parameters, further enhancing its specific performance in problem generation tasks.
[0008] However, existing methods still suffer from two major limitations that restrict their effectiveness in real-world scenarios: First, the generated questions lack in-depth guidance specific to certain domains, resulting in superficial content and insufficient logical depth. When relying solely on few-sample learning coupled with basic prompts to drive generation, large language models often only make simple textual modifications to the input examples (such as replacing numbers or adjusting word order), failing to deeply capture the core logical structure behind mathematical problems (such as formula derivation logic and problem-solving connections), making it difficult to generate in-depth and thought-provoking questions. Second, current methods are generally limited to a "static generation mode," meaning that for a single generation request, the large language model only outputs a single, fixed question result. However, in real-world teaching scenarios, educators often need to iteratively modify questions multiple times based on specific teaching objectives (such as difficulty adaptation). The static generation mode cannot meet this dynamic adjustment requirement, making it difficult for existing technologies to effectively adapt to the application demands of actual educational scenarios.
[0009] In view of this, the present invention is hereby proposed. Summary of the Invention
[0010] The purpose of this invention is to provide a multi-round iterative method, system, device, and storage medium for generating mathematical problems, which can improve the quality of problem generation for large language models. Furthermore, through multi-round dynamic interaction, the professionalism of the generated problems is guaranteed, which can well serve practical test question generation tasks.
[0011] The objective of this invention is achieved through the following technical solution: A multi-round iterative method for generating mathematical problems includes: Step 1: Based on the target knowledge points input by the user, retrieve model questions from the subject-specific question bank and query related knowledge points from the knowledge graph; generate rough questions by combining model questions and related knowledge points through a propositional model; the propositional model is obtained by training a selected primary language model using reinforcement learning. During reinforcement learning, the reward function for training the propositional model is constructed based on the similarity between the rough questions output by the primary language model and the model questions, the test results of the formula format in the rough questions, and the scoring of the rough questions using the primary language model as a judge mechanism. Step 2: Automatically solve and verify the unfinished problem or the new math problem to obtain the solution. Step 3: Predict the difficulty of the question based on the answer content. If it is lower than the target difficulty input by the user, adjust the question content through the proposition model, output a new math question, and then go to step 2. Repeat steps 2 to 3 for iterative optimization until the predicted question difficulty reaches the target difficulty.
[0012] A multi-round iterative mathematical problem generation system, used to implement the aforementioned method, includes: The question generation module is used to execute step 1, including: retrieving model questions from the subject model question bank based on the target knowledge points input by the user, and querying related knowledge points in the knowledge graph; generating rough questions by combining model questions and related knowledge points through a question-setting model; wherein, the question-setting model is obtained by training a selected first large language model through reinforcement learning. During reinforcement learning, the reward function for training the question-setting model is constructed based on the similarity between the rough questions output by the first large language model and the model questions, the test results of the formula format in the rough questions, and the scoring of the rough questions using the large language model as a judge mechanism. The verification module is used to perform step 2, including: automatically solving and verifying the blank problem or the new math problem to obtain the solution content; The optimization module is used to execute step 3, including: predicting the difficulty of the question based on the solution content; if it is lower than the target difficulty input by the user, adjusting the question content through the proposition model, outputting a new math question, and then returning to step 2; wherein, through the collaboration of the proposition model, the verification module and the optimization module, and by repeatedly executing steps 2 to 3 for iterative optimization, until the predicted difficulty of the question reaches the target difficulty.
[0013] A processing device includes: one or more processors; and a memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the aforementioned method.
[0014] A readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned method.
[0015] As can be seen from the technical solution provided by this invention, the question generation process follows a sequence of question creation, verification, and optimization. The question creation stage involves adapting sample questions and knowledge points to generate rough questions. The verification stage solves these rough questions to obtain the solutions. Finally, the optimization stage analyzes the difficulty of the questions. If the difficulty does not meet the target difficulty, optimization ensures that the final output math questions meet the target difficulty. This approach guarantees the professionalism of the generated results, improves the quality of question generation, and effectively serves practical test question generation tasks. Furthermore, the question model used employs an LLM as Judge mechanism (a large language model as the judge) to ensure the performance of the trained model, thus solving the problem that general-purpose large language models cannot deeply adapt questions. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 A flowchart illustrating a multi-round iterative mathematical problem generation method provided in an embodiment of the present invention.
[0018] Figure 2 A flowchart of the question-setting stage provided in an embodiment of the present invention.
[0019] Figure 3 This is a schematic diagram illustrating the overall process of generating questions for an embodiment of the present invention.
[0020] Figure 4 This is a schematic diagram of a multi-round iterative mathematical problem generation system provided in an embodiment of the present invention.
[0021] Figure 5 This is a schematic diagram of a processing device provided in an embodiment of the present invention. Detailed Implementation
[0022] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of the present invention.
[0023] First, the following explanations are provided for the terms that may be used in this article: The terms "comprising," "including," "containing," "having," or other similar semantic descriptions should be interpreted as non-exclusive inclusion. For example, including a technical feature element (such as raw material, component, ingredient, carrier, dosage form, material, size, part, component, mechanism, device, step, process, method, reaction conditions, processing conditions, parameter, algorithm, signal, data, product or article of manufacture, etc.) should be interpreted as including not only the expressly listed technical feature element, but also other technical feature elements that are not expressly listed and are well-known in the art.
[0024] The following is a detailed description of a multi-round iterative mathematical problem generation method, system, device, and storage medium provided by the present invention. Contents not described in detail in the embodiments of the present invention are prior art known to those skilled in the art. Where specific conditions are not specified in the embodiments of the present invention, they are performed according to conventional conditions in the art or conditions recommended by the manufacturer. Reagents or instruments used in the embodiments of the present invention whose manufacturers are not specified are all conventional products that can be purchased commercially.
[0025] Example 1 like Figure 1 The diagram illustrates the main flow of a multi-round iterative mathematical problem generation method provided by an embodiment of the present invention, which mainly includes the following steps: Step 1: Question creation stage.
[0026] In this embodiment of the invention, model questions are retrieved from the subject-specific model question bank based on the target knowledge points input by the user, and related knowledge points are queried from the knowledge graph. A rough question is generated by combining the model questions and related knowledge points through a propositional model. The propositional model is obtained by training a selected first large language model using reinforcement learning. During reinforcement learning, a reward function for training the propositional model is constructed based on the similarity between the rough question and the model question output by the first large language model, the test results of the formula format in the rough question, and the scoring of the rough question using the large language model as a judge mechanism.
[0027] In this embodiment of the invention, the preferred implementation methods for each stage of the question-setting phase are as follows: (1) The step of retrieving model questions from the subject model question bank based on the target knowledge points input by the user includes: pre-establishing a subject model question bank, which contains model questions covering all knowledge points and difficulty levels in the corresponding subject curriculum standards. All model questions are uniformly standardized and processed. During the processing, an embedding model is introduced to encode the model question data to obtain the corresponding embedding vector. Based on the embedding vector of each model question data, the user-input target knowledge points are retrieved from the subject model question bank to obtain the embedding vector most relevant to the target knowledge points, and the corresponding model questions are output.
[0028] (2) The process of querying related knowledge points in the knowledge graph includes: treating each knowledge point as an entity and pre-constructing a knowledge graph based on the relationship between the knowledge points; mapping the target knowledge point to the knowledge graph, determining the corresponding entity Q, finding all entities that have a relationship with the entity Q, and the knowledge points corresponding to all entities are the related knowledge points.
[0029] (3) The reward function for constructing the training proposition model based on the similarity between the rough question and the model question output by the first large language model, the test results of the formula format in the rough question, and the scoring of the rough question using the large language model as a judge mechanism includes: Rewards are based on the similarity 's' between the unfinished question and the example question. The reward increases with the similarity until a threshold is reached. Furthermore, the reward is controlled by the question length, thereby calculating the similarity reward function. , is represented as: ; in, Let be the reward function based on the similarity between the unfinished problem and the example problem, and let min be the minimum value function. The length of the example question, The length of the blank question. This is the set multiplier value.
[0030] The formula format in the unfinished problem is checked, and the reward function for formula format check is calculated based on whether the mathematical formula symbols are wrapped by the specified symbols. , is represented as: ; Where e is the total number of mathematical formula symbols not enclosed by the set symbol, each mathematical formula symbol not enclosed by the set symbol is considered an error case, M is the set upper limit of error cases, K is the set initial score, and K1 is the set negative reward score for a single error case.
[0031] When using a large language model as the evaluator mechanism to score the unfinished questions, the scoring range includes N scores. The correctness and novelty of the unfinished questions are used as the scoring criteria to guide the selected second large language model to give a score r. Combined with the set baseline score r1, the first model's validation reward function is calculated. , is represented as: ; By combining the similarity reward function, the formula format verification reward function, and the first model validation reward function, a reward function for training the propositional model is constructed.
[0032] Step 2, Verification Phase.
[0033] In this embodiment of the invention, the unfinished problem or a new mathematical problem is automatically solved and verified to obtain the solution.
[0034] Preferably, a thought chain-based approach can be used to guide the selected second language model to automatically solve and verify the blank problem or the new mathematical problem, and output the solution.
[0035] Step 3: Optimization phase.
[0036] In this embodiment of the invention, the difficulty of the question is predicted based on the answer content. If it is lower than the target difficulty input by the user, the question content is adjusted through the proposition model, a new mathematical question is output, and then the process proceeds to step 2. Steps 2 to 3 are repeated for iterative optimization until the predicted difficulty of the question reaches the target difficulty.
[0037] In this embodiment of the invention, the difficulty of the question is predicted based on a difficulty prediction model. The difficulty prediction model is trained on a selected third language model using a supervised fine-tuning method. At the same time, the question model is optimized and trained in conjunction with the difficulty prediction model. The optimization and training adopts a reinforcement learning approach. A reward function for optimizing and training the question model is constructed based on the difference between the difficulty of the final generated math question and the target difficulty, the calling result of the difficulty prediction model, the content standardization of the final generated math question, and the scoring of the final generated math question using the large language model as a judge mechanism.
[0038] The preferred implementation method for constructing the reward function of the training difficulty prediction model is as follows: Based on the difference between the difficulty of the final generated math problem and the target difficulty, a difficulty verification reward function is calculated. , is represented as: ; in, The set reward value; For target difficulty, This indicates the difficulty level of the final generated math problem predicted by the difficulty prediction model.
[0039] Calculate the call reward function based on the call results of the difficulty prediction model. , is represented as: ; in, The set reward value, and ; This indicates the difficulty level of the unfinished question predicted by the difficulty prediction model.
[0040] Based on the standardization of the content of the final generated math problems, determine the standardization generation test reward function. , that is, if it is detected that the content contains non-standard content, then is set to a predetermined negative reward value, otherwise, is set to 0.
[0041] When using a large language model as a judge mechanism to score the finally generated math problems, the scoring range includes N scores. The content correctness and novelty of the finally generated math problems are used as the scoring criteria to guide the selected second large language model to give a score , combined with the set reference score r1, calculate the second model verification reward function , expressed as: .
[0042] Integrate the comprehensive difficulty verification reward function, call reward function, specification generation verification reward function and second model verification reward function to construct a reward function for optimizing and training the proposition model.
[0043] In the embodiments of the present invention, the first, second, and third in the first large language model, second large language model, and third large language model mainly play an identification role. The involved large language models can all select existing models according to the actual situation to implement. That is, they can be all the same, all different, or partially the same models; as an example, both the first large language model and the second large language model can select the Qwen2.5-7B model, and the third large language model can select Qwen2.5-3B, where Qwen is the model name (Qianwen), 2.5 is the version number, and 7B (7 billion) and 3B (3 billion) are the number of parameters. Similarly, the first and second in the first model verification reward function and the second model verification reward function mainly play an identification role, referring to that the calculations of the two are defined for different objects.
[0044] The above solution provided by the embodiments of the present invention generates questions according to the process of question generation - verification - optimization. The question generation stage is responsible for adapting and generating rough questions according to sample questions and knowledge points. The verification stage then solves the rough questions to obtain the answer content of the questions. Finally, the optimization stage analyzes the question difficulty. When the question difficulty does not meet the target difficulty, it is optimized to ensure that the difficulty of the finally output math questions meets the target difficulty. Through the above method, the professionalism of the generation result can be guaranteed, the quality of question generation can be improved, and it can serve the actual test question generation task well. Moreover, the training effect is ensured through various methods such as the LLM as Judge mechanism, thus solving the problem that general large language models cannot deeply adapt questions; in addition, using the same set of fine-tuning processes and combining the question data sets of different disciplines, the present invention can train proposition models applicable to different disciplines for large language model A, which has strong versatility.
[0045] To more clearly demonstrate the technical solution and its effects provided by the present invention, the method provided by the embodiments of the present invention will be described in detail below with reference to specific examples.
[0046] I. Overall Overview of the Plan
[0047] 1. The system replicates the test design logic of teachers in actual teaching scenarios, designing a "question generation, verification, and optimization" process for question generation. This process is geared towards academic proficiency test questions. First, it retrieves sample questions from a subject-specific question bank based on the input knowledge points. Then, it innovatively adapts these sample questions using a question-setting model to generate initial rough questions. Subsequently, it automatically solves and deeply analyzes these rough questions to output solutions. A difficulty prediction model then predicts the question's difficulty based on the solution content, dynamically adjusting the difficulty to ensure that the final generated questions precisely align with the target difficulty.
[0048] 2. Reinforcement learning is employed, combined with an LLM as Judge mechanism, to conduct targeted training on the basic large language model (the first large language model). A multi-dimensional, all-scenario reward function is designed to comprehensively evaluate and provide feedback on the model's question adaptation process from core dimensions such as question innovation, text similarity, and difficulty suitability, effectively preventing the generated content from being superficial and ensuring the depth and innovation of question adaptation.
[0049] 3. Relying on the second major language model, the system automatically solves and verifies the blank questions. At the same time, it calls the pre-tuned difficulty analysis model to quantitatively analyze the difficulty level of the blank questions. Finally, through multiple rounds of internal interaction optimization and tool calls, the difficulty of the questions is accurately corrected, flexibly meeting the personalized adjustment needs of users in different scenarios.
[0050] II. Detailed introduction of the plan.
[0051] 1. Task definition and formalization.
[0052] The goal of the math problem generation task is to generate problems based on the input target knowledge points and target difficulty. Generate a math problem that meets the user's requirements. First, generate a rough problem. Analyzing the difficulty of the blank problem Difficulty of the target question And make multiple adjustments until the requirements are met. Then output the math problem .
[0053] 2. Data collection and preprocessing.
[0054] (1) Data collection.
[0055] This invention uses mathematical word problems with knowledge point annotations as the training dataset. Dataset entries include the problem text, the problem difficulty level, and the knowledge points involved. This type of data can be obtained from educational resource websites such as Xueke.com. Alternatively, a training dataset can be obtained by using a large language model to annotate knowledge points on open-source datasets containing difficulty information, such as Competition Math.
[0056] The data collected in this section will be primarily used for training subsequent question models and difficulty prediction models.
[0057] (2) Data preprocessing.
[0058] Before training the model, the collected data needs to be preprocessed to ensure the model's performance. Preprocessing mainly includes the following: (a) Data filtering.
[0059] The target questions generated in this embodiment of the invention are text-based questions, therefore it is necessary to filter and remove multimodal questions such as geometry questions from the dataset.
[0060] (b) Data labeling.
[0061] Before using the dataset, it is necessary to map and label the difficulty and knowledge point information in the dataset. The difficulty level is labeled as five levels from "easy" to "difficult", and the knowledge point ID (identifier) is labeled as the actual knowledge point content, so as to facilitate the understanding of the large language model.
[0062] (c) Sampling.
[0063] Random sampling is performed in each dataset class, and a subset of the original dataset is selected to train the model.
[0064] 3. Scheme design.
[0065] Educational theory suggests that teachers often use existing model questions as references when designing test questions. These model questions are usually derived from textbook examples and authoritative exam questions. Teachers then adapt and adjust these model questions to design new test questions. This model ensures the quality of the test questions and also makes the connection between teaching and testing closer. Inspired by teachers' test question design methods, this invention generates test questions according to the process of question creation, verification, and optimization.
[0066] Specifically, for the input knowledge points, the first step is to use the subject-specific question bank. Sample questions retrieved Furthermore, related knowledge points are retrieved from the knowledge graph, and thus, model questions are analyzed using a propositional model. Adapt to generate a rough question And solve it to obtain the solution. Subsequently, the difficulty analysis model will... and Analyze the difficulty of the questions .like and target difficulty If the difficulty levels are inconsistent, the question model will adjust the initial question accordingly. The new math problem was obtained by making modifications. Afterwards, the solution and analysis are performed again, and the difficulty of the problem is determined by the difficulty analysis model. Repeat this process until the difficulty of the questions is similar to... Output the corresponding math problem only after they match. .
[0067] (1) Question setting stage.
[0068] like Figure 2 The diagram illustrates the overall process of the question-setting stage. This stage requires using sample questions as references and constraints, necessitating the use of Retrieval-Augmented Generation (RAG) technology. Therefore, this part necessitates the pre-establishment of a subject-specific sample question database. The sample question data originates from textbook examples and authoritative exams, covering all knowledge points and difficulty levels within the subject's curriculum standards. After acquiring the sample question data, standardized annotation and processing are performed, and the processed data is stored in a database. In practice, this invention uses an embedding model, such as bge-m3 (a versatile multilingual embedding model), to encode the sample questions and obtain their embedding information, which is then saved to a vector database for subsequent retrieval. To ensure retrieval speed and accuracy, efficient retrieval methods, such as the Approximate Nearest Neighbor Search (ANN) algorithm, are employed.
[0069] During the question generation phase, after obtaining the user's input of knowledge points, question types, and target difficulty, the system first searches a pre-established subject-specific question bank to obtain suitable sample questions. Then, the prompt model generates question-generating instructions based on the retrieved sample questions and related knowledge points. The question-generating model then generates the initial, rough questions based on these instructions. Although current mainstream general-purpose language models possess relatively mature language processing capabilities, their performance still has significant limitations in question generation tasks. Even with the introduction of prompt technology as an auxiliary means, the dimensions of question adaptation by large language models are mostly limited to numerical adjustments, making it difficult to achieve deeper innovation and optimization. To address this issue, this invention approaches the problem from two levels: knowledge point expansion and model optimization.
[0070] At the knowledge point level, knowledge graphs are used to expand upon the concepts. The knowledge relationships within the knowledge graph are constructed based on the "National Unified Examination Syllabus for College Admissions" and the assessment objectives and requirements for science mathematics from the Ministry of Education's Examination Authority. After being organized and deduplicated, these relationships are used for subsequent retrieval. After obtaining the knowledge points input by the user, the knowledge graph is queried for expansion and supplementation, resulting in several more in-depth related knowledge points. These query results are then used as contextual supplements in the subsequent question-generating process, increasing the innovation and depth of the questions. The following example, "derivative," demonstrates the expanded results.
[0071] Table 1: Examples of Knowledge Point Expansion
[0072] In Table 1: For function exist The derivative at point lim; lim is the limit; Indicates the increment of the independent variable Approaching 0; Representation function exist The function value at that point, Representation function exist The function value at that location.
[0073] At the model level, a reinforcement learning strategy is employed to train a pre-selected primary language model, aiming to enhance the model's deep adaptation capabilities and ultimately generate higher-quality test questions. In practice, large language models such as Qwen2.5-7B or GLM-4-9B can be selected as the primary language model for training, and can be replaced with other large language models as needed. In this example, GLM is a generalized linear model, 4 is the version number, and 9B (9 billion) represents the number of parameters.
[0074] In the reinforcement learning process, this invention selects the GRPO (Group Relative Policy Optimization) algorithm and designs the reward function from the following multiple perspectives: (1.1) Similarity test.
[0075] The similarity test calculates the similarity between the draft question and the example question using the TF-IDF (Term Frequency-Inverse Document Frequency) algorithm, and assigns a reward based on the result. The similarity test ensures that the adapted draft question does not deviate too far from the example question. Specifically, the similarity test rewards based on the calculated text similarity score *s*, and the reward increases with *s* until a threshold is reached. This avoids new questions being overly similar to original ones. Rewards are also controlled by question length to prevent excessive length discrepancies. (Note the length of the sample questions.) Length of the blank title ,like Exceeding times or less of The left-hand side of the min function will be less than 1, thus reducing the reward received by the model. (Similarity reward function) The calculation expression is: ; The min function is the minimum value function.
[0076] (1.2) Formula format verification.
[0077] The formula format check examines whether mathematical formulas in the blank problem are enclosed in specified symbols (e.g., symbols "[]" or "\\"). The total number of unenclosed formula symbols, e, is calculated using regular expressions. An initial score of K (e.g., K=0.25) is set. Each unenclosed formula symbol is considered an error, and points are deducted based on the number of errors, adding K1 (e.g., K1=0.05) to the initial score, up to a maximum of M (e.g., M=10). The formula format check reward function is then defined. The calculation expression is: .
[0078] (1.3) Large language model test.
[0079] The LLM test uses an LLM as Judge mechanism to score the adaptation process, employing a second large language model (e.g., the Qwen2.5-7B model) to score based on the scoring criteria given in the prompts, with a score range of 0 to 9. For example, the scoring criteria in the prompts can primarily include content accuracy and adaptation novelty, with fine-grained prompts instructing the second large language model to align with teachers' question preferences. For a given score r, the LLM test uses r1 (e.g., r1=6) as a benchmark; scores exceeding r1 are rewarded positively, while scores below r1 are rewarded negatively. The first model validates the reward function. The calculation expression is: .
[0080] By combining the above similarity reward function, formula format verification reward function, and first model verification reward function, a reward function for training the propositional model is constructed; the subsequent training process involved can refer to conventional techniques, and will not be elaborated upon in this invention.
[0081] (2) Verification phase.
[0082] The verification phase verifies the problem by solving the initial, undeveloped problem. After the initial problem is generated, it is typically solved for further analysis and adjustment. In this embodiment of the invention, a large language model is used to replace manual verification, thus automatically solving the problem. Since existing large language models already possess excellent problem-solving capabilities, this invention directly uses a thought chain method to guide a selected second large language model to verify the solution.
[0083] (3) Optimization stage.
[0084] Optimization is a crucial step in the question-setting process. After question design, adjustments are made to ensure that the various attributes of the questions align with actual teaching situations. To align with teachers' question-setting experience, this invention optimizes the raw questions through multiple rounds of interaction. An optimization module is designed focusing on adjusting question difficulty, the most common and important aspect of teacher optimization, and uses a model for automatic optimization. Based on the question stem and answer content of the raw questions, the optimization module precisely calibrates the question difficulty to the target level. To ensure that the final output question difficulty aligns with teachers' experience, this invention first uses the question stem, answer content, and inherent difficulty information collected by this invention as a basis to perform supervised fine-tuning (SFT) on a selected third-largest language model (e.g., Qwen2.5-3B). This ultimately constructs a difficulty prediction model with reliable predictive capabilities. This model analyzes the question difficulty based on the input question stem and answer content; for example, this invention categorizes question difficulty into five levels, from "easy" to "difficult."
[0085] In this embodiment of the invention, the question stem and the answer content are two separate parts in a question information. They can be stored in a dictionary manner. For example, the question stem ['stem'] can be obtained directly through question['stem'], and the answer content is obtained in the same way.
[0086] This difficulty prediction model will participate in the subsequent reinforcement learning training process in a dual role: "tool invocation" and "reward evaluation." During training, the system encapsulates the difficulty prediction model into a difficulty prediction tool, which predicts the difficulty of the questions based on the input question information and returns the predicted difficulty value.
[0087] To further ensure that the adjustment results align with teacher experience, a multi-round interactive design is adopted. Multi-round interactive question adjustment with tool calls is implemented through customized conversation logic and automated interactive flow control, thereby optimizing and training the question model. The optimization training employs reinforcement learning, also using the GRPO algorithm, and the reward function is designed from the following dimensions: (3.1) Large language model test.
[0088] This section follows the same approach as in section (1.3), using prompt words and the second major language model to evaluate the final generated math problems and provide a score. The reward function is calculated in the same way as before, the difference being that different prompts are used to adjust the task for the question. To distinguish it, the calculated reward function is called the second model validation reward function. .
[0089] (3.2) Difficulty test.
[0090] The difficulty of the final generated math problems is evaluated, and a corresponding reward is given based on the evaluation result. This applies to user-specified target difficulty levels. The difficulty of the final generated math problem is Then the difficulty verification reward function The calculation expression is: .
[0091] For example, a reward value can be set. .
[0092] (3.3) Tool call verification.
[0093] The purpose of the tool call count check is to encourage the question-setting model to proactively call the difficulty analysis tool to better adjust the questions. This reward section aims to encourage the question-setting model to call the difficulty analysis tool for the first time, and also to encourage the model to use the difficulty analysis tool to analyze and adjust questions in real time, thereby accurately matching the target difficulty.
[0094] Definition: Target difficulty The final generated math problems are predicted to have the highest difficulty level using a difficulty analysis tool. :1) If not adjusted to the target difficulty, i.e. If the question model does not utilize the difficulty analysis tool, no reward will be given. 2) If the question is successfully adjusted to the target difficulty level... At the same time This indicates that the difficulty of the initial question did not match the target difficulty, while the question model successfully adjusted the difficulty of the question by using difficulty analysis tools, and will receive a higher reward; 3) As for the initial question difficulty already being in line with the target difficulty... The same, and even after using difficulty analysis tools, it still hasn't been adjusted to the target difficulty. In either of these two scenarios, a smaller reward will be given. Therefore, the reward function will be called. , is represented as: .
[0095] For example, a reward value can be set. .
[0096] The difficulty analysis tool is based on a difficulty prediction model, which is packaged as an external service and participates in reinforcement training via API calls. After the proposition model issues a call request, the tool parses the question stem and two parameters from the request and uses them to predict the difficulty. The prediction results are automatically added to the model's message list as messages for subsequent adjustments.
[0097] (3.4) Standard generation verification.
[0098] The purpose of the standardized generation check is to prevent the model from generating inappropriate content during question adjustment that could interfere with the difficulty prediction model's judgment. For example, the propositional model might add extra content such as "Therefore, the difficulty of the question is..." to the output, which would interfere with the analysis results of the difficulty analysis model. The standardized generation check uses both regular expression extraction and a second language model to check the generated content. The regular expression method attempts to extract relevant phrases, while the language model check uses prompt words to require the second language model to review the output content. If either check detects inappropriate content, the standardized generation check reward function... Set to a negative reward value (e.g., -0.8), otherwise Set to 0.
[0099] like Figure 3 As shown, this diagram illustrates the problem generation process. The upper part describes the reward functions for the problem generation and optimization phases, as well as the strategy for the verification phase. The lower part provides an example of the evaluation criteria used by the LLM as Judge mechanism.
[0100] Through the above description of the embodiments, those skilled in the art can clearly understand that the above embodiments can be implemented by software, or by using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solutions of the above embodiments can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, mobile hard drive, etc.), including several instructions to cause a computer device (such as a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0101] Example 2 This invention also proposes a multi-round iterative mathematical problem generation system, which is mainly used to implement the methods provided in the foregoing embodiments, such as... Figure 4 As shown, the system mainly includes: The question generation module is used to execute step 1, including: retrieving model questions from the subject model question bank based on the target knowledge points input by the user, and querying related knowledge points in the knowledge graph; generating rough questions by combining model questions and related knowledge points through a question-setting model; wherein, the question-setting model is obtained by training a selected first large language model through reinforcement learning. During reinforcement learning, the reward function for training the question-setting model is constructed based on the similarity between the rough questions output by the first large language model and the model questions, the test results of the formula format in the rough questions, and the scoring of the rough questions using the large language model as a judge mechanism. The verification module is used to perform step 2, including: automatically solving and verifying the blank problem or the new math problem to obtain the solution content; The optimization module is used to execute step 3, including: predicting the difficulty of the question based on the solution content; if it is lower than the target difficulty input by the user, adjusting the question content through the proposition model, outputting a new math question, and then returning to step 2; wherein, through the collaboration of the proposition model, the verification module and the optimization module, and by repeatedly executing steps 2 to 3 for iterative optimization, until the predicted difficulty of the question reaches the target difficulty.
[0102] Since the main technical details of the above system have been described in detail in the previous embodiments, they will not be repeated here.
[0103] Those skilled in the art will understand that, for the sake of convenience and brevity, the above-described division of functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the system can be divided into different functional modules to complete all or part of the functions described above.
[0104] Example 3 The present invention also provides a processing device, such as Figure 5 As shown, it mainly includes: one or more processors; a memory for storing one or more programs; wherein, when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the foregoing embodiments.
[0105] Furthermore, the processing device also includes at least one input device and at least one output device; in the processing device, the processor, memory, input device, and output device are connected via a bus.
[0106] In this embodiment of the invention, the specific types of the memory, input device, and output device are not limited; for example: Input devices can be touchscreens, image acquisition devices, physical buttons, or mice, etc. The output device can be a display terminal; The memory can be random access memory (RAM) or non-volatile memory, such as disk storage.
[0107] Example 4 The present invention also provides a readable storage medium storing a computer program that, when executed by a processor, implements the method provided in the foregoing embodiments.
[0108] In this embodiment of the invention, the readable storage medium is a computer-readable storage medium and can be disposed in the aforementioned processing device, for example, as a memory in the processing device. Furthermore, the readable storage medium can also be any medium capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), magnetic disk, or optical disk.
[0109] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims. The information disclosed in the background section is intended only to enhance the understanding of the overall background technology of the present invention and should not be construed as an admission or implication in any way that such information constitutes prior art known to those skilled in the art.
Claims
1. A multi-round iterative method for generating mathematical problems, characterized in that, include: Step 1: Based on the target knowledge points input by the user, retrieve model questions from the subject-specific question bank and query related knowledge points from the knowledge graph; generate rough questions by combining model questions and related knowledge points through a propositional model; the propositional model is obtained by training a selected primary language model using reinforcement learning. During reinforcement learning, the reward function for training the propositional model is constructed based on the similarity between the rough questions output by the primary language model and the model questions, the test results of the formula format in the rough questions, and the scoring of the rough questions using the primary language model as a judge mechanism. Step 2: Automatically solve and verify the unfinished problem or the new math problem to obtain the solution. Step 3: Predict the difficulty of the question based on the answer content. If it is lower than the target difficulty input by the user, adjust the question content through the proposition model, output a new math question, and then go to step 2. Repeat steps 2 to 3 for iterative optimization until the predicted question difficulty reaches the target difficulty.
2. The method for generating mathematical problems through multiple iterations according to claim 1, characterized in that, The process of retrieving sample questions from the subject-specific sample question bank based on the user's input of target knowledge points includes: A subject-specific question bank is pre-established, which contains questions covering all knowledge points and difficulty levels in the corresponding subject curriculum standards. All questions undergo unified standardized annotation and processing. During the processing, an embedding model is introduced to encode the question data to obtain the corresponding embedding vector. Based on the target knowledge point input by the user, the system retrieves the embedding vectors of each example question from the subject-specific question bank, obtains the embedding vector most relevant to the target knowledge point, and outputs the corresponding example question.
3. The method for generating mathematical problems through multiple iterations according to claim 1, characterized in that, The process of retrieving related knowledge points from the knowledge graph includes: Each knowledge point is treated as an entity, and a knowledge graph is pre-constructed by combining the relationships between knowledge points; The target knowledge point is mapped to the knowledge graph, the corresponding entity Q is determined, and all entities that are related to the entity Q are found. The knowledge points corresponding to all entities are the associated knowledge points.
4. The method for generating mathematical problems through multiple iterations according to claim 1, characterized in that, The reward function for constructing the training proposition model based on the similarity between the rough question and the model question output by the first large language model, the test results of the formula format in the rough question, and the scoring of the rough question using the large language model as a judge mechanism includes: Rewards are based on the similarity 's' between the unfinished question and the example question. The reward increases with the similarity until a threshold is reached. Furthermore, the reward is controlled by the question length, thereby calculating the similarity reward function. , is represented as: ; in, Let be the reward function based on the similarity between the unfinished problem and the example problem, and let min be the minimum value function. The length of the example question, The length of the blank question. The set multiplier value; The formula format in the unfinished problem is checked, and the reward function for formula format check is calculated based on whether the mathematical formula symbols are wrapped by the specified symbols. , is represented as: ; Where e is the total number of mathematical formula symbols not enclosed by the set symbol, each mathematical formula symbol not enclosed by the set symbol is considered an error case, M is the set upper limit of error cases, K is the set initial score, and K1 is the set negative reward score for a single error case. When using a large language model as the evaluator mechanism to score the unfinished questions, the scoring range includes N scores. The correctness and novelty of the unfinished questions are used as the scoring criteria to guide the selected second large language model to give a score r. Combined with the set baseline score r1, the first model's validation reward function is calculated. , is represented as: ; By combining the similarity reward function, the formula format verification reward function, and the first model validation reward function, a reward function for training the propositional model is constructed.
5. The method for generating mathematical problems through multiple iterations according to claim 1, characterized in that, The automatic solution verification of the blank problem or the new mathematical problem, and the obtained solution content includes: Using a thought chain-based approach, the selected second language model is guided to automatically solve and verify the blank questions or new mathematical questions, and output the solution.
6. The method for generating mathematical problems through multiple iterations according to claim 1, characterized in that, In step 3, the difficulty of the question is predicted based on the solution content using a difficulty prediction model. This model is trained on a selected third language model using supervised fine-tuning learning. Simultaneously, the proposition model is optimized using the difficulty prediction model. This optimization training employs reinforcement learning, constructing a reward function for optimizing the proposition model based on the difference between the difficulty of the final generated math question and the target difficulty, the results of the difficulty prediction model, the standardization of the content of the final generated math question, and the scoring of the final generated math question using the large language model as a judge.
7. The method for generating mathematical problems through multiple iterations according to claim 6, characterized in that, The reward function for optimizing the proposition model, constructed based on the difference between the difficulty of the final generated math problem and the target difficulty, the results of the difficulty prediction model, the content standardization of the final generated math problem, and the scoring of the final generated math problem using a large language model as a judge mechanism, includes: Based on the difference between the difficulty of the final generated math problem and the target difficulty, a difficulty verification reward function is calculated. , is represented as: ; in, The set reward value; For target difficulty, This indicates the difficulty level of the final generated math problem predicted by the difficulty prediction model. Calculate the call reward function based on the call results of the difficulty prediction model. , is represented as: ; in, The set reward value, and ; This indicates the difficulty level of the unfinished question predicted by the difficulty prediction model. Based on the standardization of the content of the newly generated learning questions, determine the standardization generation test reward function. That is, if the detected content contains non-standard content, then... Set to a predetermined negative reward value; otherwise, Set to 0; When using a large language model as the evaluator mechanism to score the final generated math problems, the scoring range includes N scores. The scoring criteria are based on two dimensions: the correctness and novelty of the final generated math problems. This guides the selected second large language model to provide the score. Based on the set baseline score r1, the second model validation reward function is calculated. , is represented as: ; By combining the reward function for difficulty verification, calling the reward function, generating the verification reward function according to the standardization, and verifying the reward function of the second model, a reward function for optimizing and training the proposition model is constructed.
8. A multi-round iterative mathematical problem generation system, characterized in that, The method for implementing any one of claims 1 to 7 comprises: a question generation module, configured to perform step 1, including: retrieving model questions from a subject-specific question bank based on the target knowledge points input by the user, and querying related knowledge points in a knowledge graph; generating a rough question by combining the model questions and related knowledge points through a propositional model; wherein the propositional model is obtained by training a selected first large language model using reinforcement learning, and during reinforcement learning, constructing a reward function for training the propositional model based on the similarity between the rough question and the model question output by the first large language model, the test results of the formula format in the rough question, and the scoring of the rough question using the large language model as a judge mechanism; The verification module is used to perform step 2, including: automatically solving and verifying the blank problem or the new math problem to obtain the solution content; The optimization module is used to execute step 3, including: predicting the difficulty of the question based on the solution content; if it is lower than the target difficulty input by the user, adjusting the question content through the proposition model, outputting a new math question, and then returning to step 2; wherein, through the collaboration of the proposition model, the verification module and the optimization module, and by repeatedly executing steps 2 to 3 for iterative optimization, until the predicted difficulty of the question reaches the target difficulty.
9. A processing device, characterized in that, include: One or more processors; Memory, used to store one or more programs; Wherein, when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the method as described in any one of claims 1 to 7.
10. A readable storage medium storing a computer program, characterized in that, When a computer program is executed by a processor, it implements the method as described in any one of claims 1 to 7.