Model generation method, test question answering method and device, medium and electronic equipment

By fine-tuning and iterating the pre-trained model, generating a reward function, and optimizing the test question answering model, the problem of poor performance in solving complex questions was solved, and the accuracy of solving questions with multiple sub-problems and multiple knowledge points was improved.

CN121724070APending Publication Date: 2026-03-24NEW ORIENTAL EDUCATION & TECH GRP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-17
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Existing test-taking models are inadequate in solving complex questions and cannot effectively identify questions that contain multiple sub-questions and multiple knowledge points.

Method used

By acquiring training corpora, including sample test questions and answers, the pre-trained basic model is fine-tuned to generate a reward function. The model is then iterated based on this function to optimize it and improve its problem-solving performance.

Benefits of technology

It improves the problem-solving effectiveness and accuracy of the test-answering model for complex questions, especially for questions containing multiple sub-problems and multiple knowledge points.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121724070A_ABST
    Figure CN121724070A_ABST
Patent Text Reader

Abstract

The invention relates to a model generation method, a test question answering method and device, a medium and electronic equipment, and the method comprises the steps: obtaining a training corpus which comprises a plurality of test question sample texts and sample answers corresponding to the test question sample texts, and carrying out the model fine tuning of a pre-training basic model according to the training corpus, according to the training corpus, a first candidate answering model is obtained, a reward function is generated according to feature information of the training corpus, the feature information comprises the number of sub-questions of test questions, the number of knowledge points involved in the test questions and test question difficulty information, model iteration is conducted on the first candidate answering model on the basis of the reward function, and a test question answering model is obtained; the test question answering model is used for obtaining an answering result of the input target test question.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more specifically, to a method for model generation, a method for answering test questions, an apparatus, a medium, and an electronic device. Background Technology

[0002] With the development of computer technology, test-answering models are now commonly used to answer various test questions in the field of education.

[0003] However, current test-taking models typically use simple rule checks to judge the results, which is insufficient for solving complex questions. Summary of the Invention

[0004] To address the aforementioned problems, this disclosure provides a method for model generation, a method for answering test questions, an apparatus, a medium, and an electronic device.

[0005] According to a first aspect of the present disclosure, a method for model generation is provided, the method comprising: acquiring training corpus, the training corpus including multiple test question sample texts and sample answers corresponding to the test question sample texts; fine-tuning a pre-trained basic model based on the training corpus to obtain a first candidate answering model; generating a reward function based on feature information of the training corpus, the feature information including the number of sub-questions of a test question, the number of knowledge points involved in the test question, and test question difficulty information; and iterating the first candidate answering model based on the reward function to obtain a test question answering model, the test question answering model being used to obtain the answering result of an input target test question.

[0006] Optionally, the step of obtaining training corpus includes: obtaining initial corpus, which includes multiple initial test question texts and initial answers corresponding to the test question texts; performing text preprocessing on the initial corpus to obtain corpus to be labeled; labeling the corpus to be labeled with feature information; and sampling the labeled corpus according to preset weights of multiple feature information to obtain the training corpus.

[0007] Optionally, the step of preprocessing the initial corpus to obtain the corpus to be labeled includes: filtering the initial test question text for test question standardization; and standardizing the initial answers according to a specified format.

[0008] Optionally, the step of fine-tuning the pre-trained basic model based on the training corpus to obtain a first candidate answer model includes: using the training corpus as the training text of the pre-trained basic model for model fine-tuning to obtain a second candidate answer model; and determining the second candidate answer model as the first candidate answer model when the model output obtained by the second candidate answer model based on the test sample text is the same as the sample answer.

[0009] Optionally, generating the reward function based on the feature information of the training corpus includes: generating a first evaluation function based on the number of sub-questions and the difficulty information of the test questions, wherein the first evaluation function is used to describe the accuracy rate of answering the test questions; generating a second evaluation function based on the number of knowledge points, wherein the second evaluation function is used to describe the step accuracy rate of answering the test questions; and weighting the first evaluation function and the second evaluation function to generate the reward function.

[0010] Optionally, the step of iterating the first candidate answering model based on the reward function to obtain the test question answering model includes: determining the degree of influence of the output result of the first candidate answering model corresponding to each sample in the training corpus on the adjustment of model parameters based on the reward function; and iteratively updating the parameters of the first candidate answering model based on the degree of influence as a guide for adjusting model parameters using a policy gradient algorithm to obtain the test question answering model.

[0011] According to a second aspect of the present disclosure, a method for answering test questions is provided, comprising: receiving target test questions input by a user; The target question is input into a pre-generated question-answering model to obtain the answer result of the target question output by the question-answering model; the question-answering model is generated according to the model generation method provided in the first aspect of this disclosure.

[0012] According to a third aspect of the present disclosure, an apparatus for model generation is provided, the apparatus comprising: The acquisition module is used to acquire training corpus, which includes multiple test question sample texts and sample answers corresponding to the test question sample texts; The first training module is used to fine-tune the pre-trained basic model based on the training corpus to obtain the first candidate response model; The function generation module is used to generate a reward function based on the feature information of the training corpus. The feature information includes the number of sub-questions of the test question, the number of knowledge points involved in the test question, and the difficulty information of the test question. The second training module is used to iterate the first candidate answering model based on the reward function to obtain a question answering model, which is used to obtain the answering result of the input target question.

[0013] Optionally, the acquisition module is used to acquire initial corpus, which includes multiple initial test question texts and initial answers corresponding to the test question texts; perform text preprocessing on the initial corpus to obtain corpus to be labeled; label the corpus to be labeled with feature information; and sample the labeled corpus according to the preset weights of multiple feature information to obtain the training corpus.

[0014] Optionally, the acquisition module is used to perform test question standardization filtering on the initial test question text and to standardize the initial answers according to a specified format.

[0015] Optionally, the first training module is used to fine-tune the model by using the training corpus as the training text of the pre-trained base model to obtain a second candidate answer model; if the model output obtained by the second candidate answer model based on the test question sample text is the same as the sample answer, the second candidate answer model is determined as the first candidate answer model.

[0016] Optionally, the function generation module is used to generate a first evaluation function based on the number of sub-questions and the difficulty information of the test questions, the first evaluation function being used to describe the accuracy rate of answering the test questions; generate a second evaluation function based on the number of knowledge points, the second evaluation function being used to describe the accuracy rate of answering the test questions step by step; and weight the first evaluation function and the second evaluation function to generate the reward function.

[0017] Optionally, the second training module is used to determine, based on the reward function, the degree of influence of the output of the first candidate answering model corresponding to each sample in the training corpus on the adjustment of model parameters; and based on a policy gradient algorithm, to use the degree of influence as a guide for adjusting model parameters, to iteratively update the parameters of the first candidate answering model to obtain the test question answering model.

[0018] According to a fourth aspect of the present disclosure, a test question answering device is provided, comprising: The receiving module is used to receive the target test questions input by the user; The generation module is used to input the target question into a pre-generated question-answering model and obtain the answer result of the target question output by the question-answering model. The question-answering model is generated according to the model generation method provided in the first aspect of this disclosure.

[0019] According to a fifth aspect of the present disclosure, a computer-readable storage medium is provided that stores computer program instructions thereon, which, when executed by a processor, implement the steps of the methods described in the first and / or second aspects of the present disclosure.

[0020] According to a sixth aspect of the present disclosure, an electronic device is provided, comprising: A memory on which computer programs are stored; A processor for executing the computer program in the memory to implement the steps of the methods described in the first and / or second aspects of this disclosure.

[0021] According to the above technical solution, training corpus consisting of multiple sample texts of test questions and corresponding sample answers is acquired. Based on the training corpus, the pre-trained basic model is fine-tuned to obtain a first candidate answering model. A reward function is generated based on the feature information of the training corpus, including the number of sub-questions, the number of knowledge points involved, and the difficulty level of the question. Based on the generated reward function, the first candidate answering model is iterated to obtain a test question answering model used to obtain the answer to the input target test question. This improves the test question answering model's performance on complex questions and optimizes its solution steps, thereby improving the accuracy of both the answer result and the answering steps for complex questions containing multiple sub-questions, multiple knowledge points, and varying difficulty levels.

[0022] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description

[0023] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the following detailed description to explain the present disclosure, but do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart illustrating a method for model generation according to an exemplary embodiment.

[0024] Figure 2 This is a flowchart illustrating another method for generating a model according to an exemplary embodiment.

[0025] Figure 3 This is a flowchart illustrating a test question answering method according to an exemplary embodiment.

[0026] Figure 4 This is a flowchart illustrating another method for answering test questions according to an exemplary embodiment.

[0027] Figure 5This is a block diagram illustrating a model generation apparatus according to an exemplary embodiment.

[0028] Figure 6 This is a block diagram illustrating a test-taking device according to an exemplary embodiment.

[0029] Figure 7 This is a block diagram of an electronic device provided according to an exemplary embodiment of the present disclosure. Detailed Implementation

[0030] The specific embodiments of this disclosure will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit this disclosure.

[0031] In the following description, the words "first" and "second" are used only to distinguish the purpose of the description and should not be interpreted as indicating or implying relative importance or order.

[0032] In related technologies, with the development of computer technology, test-answering models are currently commonly used to answer various test questions in the education field. However, the test-answering models currently in use typically rely on simple rule-based validation to judge the answer results, which is insufficient for solving complex questions.

[0033] To address the aforementioned problems, this disclosure provides a method for model generation, a test question answering method, an apparatus, a medium, and an electronic device. This method acquires training corpus including multiple test question sample texts and corresponding sample answers. Based on the training corpus, it fine-tunes a pre-trained basic model to obtain a first candidate answering model. Then, based on feature information from the training corpus, including the number of sub-questions, the number of knowledge points involved, and the difficulty level of the question, it generates a reward function. Based on the generated reward function, iterates the first candidate answering model to obtain a test question answering model for answering the input target test question. This improves the test question answering model's performance on complex questions and optimizes its solution steps, thereby improving the accuracy of both the answering results and the answering steps for complex questions containing multiple sub-questions, multiple knowledge points, and varying difficulty levels.

[0034] The present disclosure will now be described in conjunction with specific embodiments.

[0035] Figure 1 This is a flowchart illustrating a model generation method according to an exemplary embodiment, such as... Figure 1 As shown, the method may include the following steps: In step S101, training corpus is obtained, which includes multiple test question sample texts and the corresponding sample answers.

[0036] The sample test text can be a test text for a specific subject, such as mathematics. The test text can include multiple-choice, fill-in-the-blank, and short-answer questions. Multiple-choice questions can include single-choice or multiple-choice questions; fill-in-the-blank questions can include single-blank or multiple-blank questions; and short-answer questions can include single-question or multiple-question short-answer questions.

[0037] In addition, the sample text of the test question and the corresponding sample answer can be displayed in a specified format. For example, for a multiple-blank fill-in-the-blank question in mathematics, "Calculate: ① ;② ;③ The sample test text can be formatted as "Calculate: ①" ;② ;③ The format of the corresponding sample answer can be... , , It should be noted that the specified format is only an example, and the sample text of the test question and the corresponding sample answer can also be displayed in other formats. This application does not make any specific restrictions on this.

[0038] In step S102, the pre-trained basic model is fine-tuned based on the training corpus to obtain the first candidate response model.

[0039] The pre-trained base model can include open-source inference models that perform well in test-answering tasks (e.g., high accuracy, strong robustness), such as DeepSeek's open-source Qwen and Llama language models. For example, the DeepSeek-R1-Distill-Qwen-7B model can be used as the pre-trained base model. The model fine-tuning method can be SFT (Supervised Fine-tuning), and the fine-tuning framework can be Llama-factory or Unsloth. For instance, based on the SFT method, the training corpus can be injected into the pre-trained base model for model parameter fine-tuning to obtain the first candidate answering model. In model parameter fine-tuning, the batch size can be 128, the learning rate can be 5e-6, the warmup steps can be 100, and the weight decay coefficient can be 0.1.

[0040] In step S103, a reward function is generated based on the feature information of the training corpus.

[0041] The feature information can include the number of sub-questions, the number of knowledge points involved, and the difficulty level of the question. The number of sub-questions can be based on the question type in the sample text; for example, a single-question short-answer question might have 1 sub-question, while a multi-question short-answer question might have the actual number of sub-questions for that question type. The knowledge points can be tags pre-generated by educators on the sample text. These knowledge points can be hierarchically divided into grade level, question type, first-level knowledge point, and second-level knowledge point. For example, a knowledge point could be a first-year junior high school short-answer question without a diagram—square root; a third-year elementary school multiple-choice question—conversion between centimeters and meters; and a second-year junior high school fill-in-the-blank question—Pythagorean theorem—calculation of the side length of a right triangle. The difficulty level of the sample text can include multiple difficulty levels; the higher the difficulty level, the more difficult the question. For example, the difficulty information of the test question can be obtained by answering the test question sample text using a pre-trained basic model. For instance, for the test question sample text, the pre-trained basic model can generate the corresponding answer to the test question sample text, and match multiple answer results with the sample answer corresponding to the test question sample text (e.g., semantic matching combined with rule matching). If all answer results match the sample answer, the difficulty level of the test question is determined to be 1; if the answer results in the first preset range (e.g., 75%~100%, excluding 75%) match the sample answer, the difficulty level of the test question is determined to be 2; if the answer results in the second preset range (e.g., 50%~75%, excluding 50%) match the sample answer, the difficulty level of the test question is determined to be 3; if the answer results in the third preset range (e.g., 25%~50%, excluding 25%) match the sample answer, the difficulty level of the test question is determined to be 4; and if the answer results in the fourth preset range (e.g., 0~25%, excluding 0) match the sample answer, the difficulty level of the test question is determined to be 5. In addition, if no single answer matches the sample answer, the sample answer may be biased and can be manually reviewed.

[0042] In addition, the reward function is used to guide the further optimization of the first candidate answer model. In one possible implementation, a first evaluation function can be generated based on the number of sub-questions and the difficulty information of the question. The first evaluation function is used to describe the accuracy of the answer result. A second evaluation function can be generated based on the number of knowledge points. The second evaluation function is used to describe the accuracy of the steps in answering the question. The first evaluation function and the second evaluation function are weighted to generate the reward function.

[0043] For example, the first evaluation function can be expressed by the following formula:

[0044] in, Score the number of correct answers to subproblems. The number of subproblems in the question. The number of sub-questions answered correctly. To adjust the difficulty level coefficient, The value ranges from 0.5 to 1.5, dynamically changing with the difficulty level of the questions. The higher the difficulty level of the questions, the higher the value. The larger the value, for example, when the difficulty level of the test is 5, the more likely it is to be increased. The value is 1.5; when the difficulty level of the test is 4, it will be... The value is 1.2; when the difficulty level of the test is 3, it will be... The value is 0.9; when the difficulty level of the test is 2, it will be... The value is 0.7; when the difficulty level of the test is 1, it will be... The value is 0.5.

[0045] Meanwhile, this second evaluation function can be expressed by the following formula:

[0046] in, A score is awarded based on the number of knowledge points matched, which describes the accuracy rate of answering questions. The number of knowledge points covered in the test questions. The number of knowledge points involved in the answer. For explicit knowledge point coverage, This represents the text of the answer result. This represents the set of knowledge points, including those covered in the test questions. This is implicit vector similarity, and its range is... It can be calculated using a pre-trained model (such as the BGE model). and The semantic similarity between them is obtained. These are explicit and implicit weight coefficients used to balance precise matching, which includes explicit knowledge point coverage, and semantic similarity, which includes implicit vector similarity. The value can be determined according to the actual situation. In this embodiment, It can be 0.7.

[0047] After generating the first and second evaluation functions, the reward function can be defined as follows:

[0048] in, The reward function has a range of . , Score the number of knowledge points matched. Score the number of correct answers to subproblems. Preset weighting coefficients ( ), The value can be determined based on the actual situation.

[0049] In step S104, based on the reward function, the first candidate answering model is iterated to obtain the question answering model.

[0050] The question-answering model is used to obtain the answer to the input target question. A policy gradient algorithm, such as the DAPO algorithm, can be used, with the VeRL framework as the reinforcement learning fine-tuning framework. The training corpus is used as a dedicated dataset for reinforcement learning fine-tuning, and the first candidate answering model is used as the base model for reinforcement learning to obtain the question-answering model.

[0051] In one possible implementation, based on the reward function, the degree of influence of the output of the first candidate answering model corresponding to each sample in the training corpus on the adjustment of model parameters is determined; based on the policy gradient algorithm, the degree of influence is used as the guide for adjusting model parameters, and the parameters of the first candidate answering model are iteratively updated to obtain the question answering model.

[0052] For example, this degree of influence can be estimated by comparing the relative advantage of the reward value calculated by the reward function for the first candidate answer model output corresponding to each sample within the same group, where the G samples of the model output form a group, and the reward value is calculated according to the reward function. Then, each reward value can be calculated. The relative advantage estimate within the same group is shown in the following formula:

[0053] in, For this relative advantage estimate, For the first The reward value of each sample output result. Let G be the average reward value of the output results of the sampled G samples. Let G be the standard deviation of the reward values ​​of the output results of the sampled G samples.

[0054] After obtaining the relative advantage estimate, this relative advantage estimate can be... The model parameter adjustment guides the objective function of the DAPO algorithm, iteratively updating the parameters of the first candidate response model. The objective function of the DAPO algorithm is shown below:

[0055] The constraints of the objective function are:

[0056] In the formula, This is the objective function used to optimize the model parameters. , This means taking the mean of the set of variables. This indicates that sample texts q and sample answers for each test question are sampled from the training corpus. , For the first The number of sample output results is G, where G represents the number of sample output results. In this embodiment, G can be 8. The old strategy is used to represent the model parameters before the update. for , This means that, according to the old strategy, G output results are sampled given an input q. Indicates the first The length of the output result for each sample This represents the discrete-time step of the objective function. For the first The reward value of each sample output result. For the first Estimation of the relative advantage of the output results for each sample. For shearing function, This is the lower limit parameter for shearing, used to control... The minimum value, The value can be 0.2. This is the upper limit parameter for shearing, used to control... The maximum value, The value can be 0.28.

[0057] After determining the objective function of the DAPO algorithm, the model parameters can be iteratively updated by maximizing the objective function using policy gradient algorithms. This leads to the test question response model. After obtaining the model, a comprehensive evaluation can be performed to ensure its performance. This evaluation may include accuracy assessment, robustness assessment, and generalization ability assessment. It should be noted that methods for maximizing the objective function based on policy gradient algorithms can be found in related technical literature and will not be elaborated upon here.

[0058] The above method allows for the acquisition of training corpora containing multiple sample texts of test questions and their corresponding sample answers. Based on this training corpus, a pre-trained basic model is fine-tuned to obtain a first candidate answering model. A reward function is generated from the training corpus, incorporating features such as the number of sub-questions, the number of knowledge points involved, and the difficulty level of the question. This reward function is then used to iterate on the first candidate answering model, resulting in a final answering model for responding to the input target question. This approach improves the answering model's performance on complex questions and optimizes its solution steps, thereby enhancing both the accuracy of the answering results and the correctness of the solution steps for complex questions involving multiple sub-questions, multiple knowledge points, and varying difficulty levels.

[0059] In some embodiments, step S101 above may include: S1011. Obtain the initial corpus.

[0060] The initial corpus includes multiple initial test question texts and their corresponding initial answers.

[0061] For example, the initial corpus can be collected from a public dataset such as the dataset generated by the Open-R1 project, or it can be collected from a pre-built question bank.

[0062] S1012. Perform text preprocessing on the initial corpus to obtain the corpus to be annotated.

[0063] In one possible implementation, the initial test question text can be filtered for test question standardization, and the initial answer can be standardized according to a specified format.

[0064] The question standardization filtering includes both question quality filtering and question format filtering. For example, question quality filtering can be performed by calling a question quality filtering component, such as a quality filtering agent based on open large models like GPT-4o or DeepSeek. For instance, the initial question text is injected into the question quality filtering agent, and m answers generated by the agent based on the large model for the initial question text are sampled. If any of the m answers corresponds to the initial answer, the initial question text is deemed to be of acceptable quality, thus filtering out questions with incomplete information or unclear wording. The value of m can be determined based on historical experience; in this embodiment, m can be 8.

[0065] Based on mathematical libraries such as SymPy and rule-based processing, LaTeX parsing methods can be used to filter the initial test text for question formatting, thereby ensuring the accuracy and consistency of mathematical expressions. For questions with incomplete information or unclear expressions, NLP libraries such as HanLP can be used to divide the question into multiple sentences. These sentences can then be matched against a pre-defined rule base (e.g., regular expression matching), and the question text can be standardized according to the matching rules to improve readability and comprehension, ensuring clear and standardized question expression. For example, some fill-in-the-blank questions may use multiple underscores "_____" for the answer section. Regular expressions can be used to replace multiple underscores "_____" with a specified number, such as three underscores "___". Another example is the standardization of capitalization and Roman numerals for multiple-choice questions.

[0066] At the same time, the initial answers can be standardized according to a specified format to ensure that the answer format is consistent and facilitates subsequent analysis and use. For example, the specified format for single-choice questions can be "\\boxed{A}", the specified format for multiple-choice questions can be "\\boxed{ABCD}", the specified format for single-blank fill-in-the-blank questions can be "\\boxed{answer}", the specified format for multiple-blank fill-in-the-blank questions can be "\\boxed{answer1, answer2, ...}", the specified format for single-question short-answer questions can be "\\boxed{answer}", and the specified format for multiple-question short-answer questions can be "\\boxed{answer1}, \\boxed{answer2}, \\boxed{answer3}".

[0067] S1013. Label the feature information of the corpus to be labeled.

[0068] For example, a question difficulty assessment component, such as a question difficulty assessment agent based on open large-scale models like GPT-4o or DeepSeek, can be used to annotate the corpus to be labeled with difficulty information. Alternatively, the question difficulty information can be annotated with the corpus by referencing a pre-built knowledge graph. Similarly, a knowledge point classification component, such as a knowledge point classification agent based on open large-scale models like GPT-4o or DeepSeek, can be used to annotate the corpus with knowledge point information. Alternatively, knowledge point information can be annotated with a pre-built knowledge point tree / icon in a knowledge graph.

[0069] S1014. Sample the labeled corpus according to the preset weights of multiple feature information to obtain the training corpus.

[0070] The preset weights of multiple feature information can be determined through experiments. For example, for common question types with difficulty levels of 1 or 2, the ratio of single-blank fill-in-the-blank questions, multiple-choice questions, and single-question short-answer questions can be 1:1:1, and the labeled corpus can be sampled according to this ratio. For more complex question types with difficulty levels of 3, 4, or 5, the ratio of single-blank fill-in-the-blank questions, multiple-choice questions, single-question short-answer questions, multi-question fill-in-the-blank questions, and multi-question short-answer questions can be 1:1:2:3:2, and the labeled corpus can be sampled according to this ratio.

[0071] By adopting the above technical solution, the initial corpus can be obtained and preprocessed, thereby improving the problem-solving effect of the subsequent test question answering model on complex questions. This results in improved accuracy of both the answering results and answering steps for complex questions containing multiple sub-questions, multiple knowledge points, and different levels of difficulty.

[0072] In some embodiments, step S102 may include: using the training corpus as the training text of the pre-trained base model to fine-tune the model and obtain a second candidate answer model; if the model output obtained by the second candidate answer model based on the test question sample text is the same as the sample answer, the second candidate answer model is determined as the first candidate answer model.

[0073] For example, after obtaining the second candidate answer model after fine-tuning, a quality assessment can be performed on the second candidate answer model. This involves obtaining the model output obtained by the second candidate answer model based on the sample text of the question and matching the model output with the sample answer. For instance, for a multi-question short answer type, the first sub-question is solving a quadratic equation in one variable, and the second sub-question is solving a quadratic equation in two variables. In the sample answer, the answer to the first sub-question is 5, and the answer to the second sub-question is 0.8. If the model output of the second candidate answer model shows the answer to the first question as "\\boxed{5}" and the answer to the second question as "\\boxed{0.8}", it is considered that the model output is the same as the sample answer, that is, the second candidate answer model answers correctly, and then the second candidate answer model is determined as the first candidate answer model.

[0074] In this way, by evaluating the quality of the model, we can determine the training effect of model fine-tuning, which can improve the problem-solving effect of the subsequent test question answering model on complex questions. This will improve the accuracy of both the answering results and answering steps for complex questions that contain multiple sub-problems, multiple knowledge points and different levels of difficulty.

[0075] Figure 2 This is a flowchart illustrating another method for generating a model according to an exemplary embodiment, such as... Figure 2 As shown, the method may include the following steps: S201. Obtain the initial corpus.

[0076] The initial corpus includes multiple initial test question texts and their corresponding initial answers. This initial corpus can be collected from publicly available datasets, such as those generated by the Open-R1 project, or from a pre-established question bank.

[0077] S202. Perform text preprocessing on the initial corpus to obtain the corpus to be annotated.

[0078] This feature allows for filtering the initial test question text to conform to standardized test question formats, and standardizing the initial answers according to a specified format. The standardized test question filtering includes both question quality filtering and question format filtering.

[0079] S203. Label the feature information of the corpus to be labeled.

[0080] Among them, the question difficulty assessment agent can be called to label the question difficulty information, and the knowledge point classification agent can be called to label the relevant knowledge points.

[0081] S204. According to the preset weights of multiple feature information, sample the labeled corpus to obtain the training corpus.

[0082] The preset weights of multiple feature information can be determined through experiments.

[0083] S205. Use the training corpus as the training text for the pre-trained base model to fine-tune the model and obtain the second candidate response model.

[0084] The pre-trained base model can include an open-source inference model that performs well in test-taking tasks (e.g., high accuracy, strong robustness). This model can be fine-tuned using the SFT method, and the fine-tuning framework can be Llama-factory or Unsloth. In model parameter fine-tuning, the batch size can be 128, the learning rate can be 5e-6, the warmup steps can be 100, and the weight decay coefficient can be 0.1.

[0085] S206. If the model output obtained by the second candidate answering model based on the test sample text in the training corpus is the same as the sample answer in the training corpus, then the second candidate answering model shall be determined as the first candidate answering model.

[0086] S207. Generate a reward function based on the feature information of the training corpus.

[0087] The feature information includes the number of sub-questions in the test question, the number of knowledge points involved in the test question, and the difficulty information of the test question. Based on the number of sub-questions and the difficulty information of the test question, a first evaluation function is generated to describe the accuracy rate of the test question answers. Based on the number of knowledge points, a second evaluation function is generated to describe the accuracy rate of the test question answer steps. The first evaluation function and the second evaluation function are weighted to generate the reward function.

[0088] S208. Based on the reward function, the first candidate answering model is iterated to obtain the question answering model.

[0089] The question-answering model is used to obtain the answer to the input target question. Based on the reward function, the influence of the output of the first candidate answering model corresponding to each sample in the training corpus on the adjustment of model parameters can be determined. Based on the policy gradient algorithm, this influence is used as the guide for adjusting the model parameters, and the parameters of the first candidate answering model are iteratively updated to obtain the question-answering model.

[0090] The above method allows for the acquisition of multiple initial test question texts and their corresponding initial answers. These initial texts are then preprocessed to obtain labeled corpora. Feature information is annotated onto these labeled corpora, and the annotated corpora are sampled according to preset weights for multiple feature information to obtain training corpora. Based on the training corpora, the pre-trained basic model is fine-tuned to obtain a first candidate answering model. A reward function is generated based on the feature information of the training corpora, including the number of sub-questions, the number of knowledge points involved in the question, and the question difficulty. The first candidate answering model is iterated based on the generated reward function to obtain a question-answering model used to obtain the answer to the input target question. This improves the question-answering model's performance on complex questions and optimizes its solution steps, thereby improving the accuracy of both the answer result and the solution steps for complex questions containing multiple sub-questions, multiple knowledge points, and varying difficulty levels.

[0091] It should be noted that the above Figure 2 The descriptions of each step in the illustrated embodiments can be found in the descriptions of the relevant steps in the foregoing embodiments, and will not be repeated here.

[0092] Figure 3 This is a flowchart illustrating a test question answering method according to an exemplary embodiment, such as... Figure 3 As shown, the method may include the following steps: In step S301, the target test question input by the user is received.

[0093] The target question is a specific subject question, such as a math question, input by the user and can be received by handwriting on an electronic device screen, input via an electronic device input method, or handwritten on paper.

[0094] In step S302, the target question is input into a pre-generated question-answering model to obtain the answer result of the target question output by the question-answering model.

[0095] The answering model for this test question is based on Figures 1-2 The model is generated using the aforementioned method. This test-answering model can generate preliminary solution results based on the input of a specified subject test question, such as a mathematics test question, combined with the specified subject knowledge acquired during the fine-tuning process. Subsequently, the final answer process and answer result are extracted from the model's output, and the extracted answer process and answer result are standardized, such as standardizing punctuation and unifying format, to ensure that the output results conform to the standards. The processed answer process and answer result are then fed back to the user, realizing the test-answering process.

[0096] Using the above method, questions can be answered through the optimized question-answering model, which improves the accuracy of both the answer results and the answer steps for complex questions that contain multiple sub-questions, multiple knowledge points and different levels of difficulty.

[0097] Figure 4 This is a flowchart illustrating another method for answering test questions according to an exemplary embodiment, such as... Figure 4 As shown, the method includes the following steps: S401. Obtain training corpus.

[0098] This step includes: S4011, obtaining initial corpus; S4012, performing text preprocessing on the initial corpus; S4013, annotating the corpus to be annotated with feature information; S4014, sampling the annotated corpus according to the preset weights of multiple feature information.

[0099] S402. Based on the training corpus, fine-tune the pre-trained basic model.

[0100] This step includes: S4021, using an open-source large model as the pre-trained base model; S4022, fine-tuning the model using the SFT method; and S4023, evaluating the quality of the optimized model.

[0101] S403. Based on the reward function, perform model iteration on the first candidate answering model to obtain the test question answering model.

[0102] This step includes: S4031, selecting the first candidate answer model after fine-tuning; S4032, iterating the first candidate answer model based on the reward function to obtain the test question answer model.

[0103] S404, Answer the questions.

[0104] This step includes: S4041, receiving the target test question input by the user; S4042, inputting the target test question into the test question answering model to obtain the answer result.

[0105] It should be noted that the above Figure 4 The descriptions of each step in the illustrated embodiments can be found in the descriptions of the relevant steps in the foregoing embodiments, and will not be repeated here.

[0106] Using the above method, training corpora can be obtained, and based on these corpora, the pre-trained basic model can be fine-tuned. Then, based on the reward function, the first candidate answering model is iterated to obtain the question-answering model, which is then used to answer questions. This optimized question-answering model improves the accuracy of both the answer results and the answering steps for complex questions containing multiple sub-questions, multiple knowledge points, and varying levels of difficulty.

[0107] Figure 5 This is a block diagram illustrating a model generation apparatus 500 according to an exemplary embodiment, with reference to... Figure 5 The device includes: The acquisition module 501 is used to acquire training corpus, which includes multiple test question sample texts and the corresponding sample answers for each test question sample text. The first training module 502 is used to fine-tune the pre-trained basic model based on the training corpus to obtain the first candidate response model; The function generation module 503 is used to generate a reward function based on the feature information of the training corpus. The feature information includes the number of sub-questions of the test question, the number of knowledge points involved in the test question, and the difficulty information of the test question. The second training module 504 is used to iterate the first candidate answering model based on the reward function to obtain the question answering model, which is used to obtain the answering result of the input target question.

[0108] Optionally, the acquisition module 501 is used to acquire initial corpus, which includes multiple initial test question texts and the initial answers corresponding to the test question texts; perform text preprocessing on the initial corpus to obtain corpus to be labeled; label the corpus to be labeled with feature information; and sample the labeled corpus according to the preset weights of multiple feature information to obtain the training corpus.

[0109] Optionally, the acquisition module 501 is used to perform test question standardization filtering on the initial test question text and to standardize the initial answer according to a specified format.

[0110] Optionally, the first training module 502 is used to fine-tune the model by using the training corpus as the training text of the pre-trained base model to obtain a second candidate answer model; if the model output obtained by the second candidate answer model based on the test question sample text is the same as the sample answer, the second candidate answer model is determined as the first candidate answer model.

[0111] Optionally, the function generation module 503 is used to generate a first evaluation function based on the number of sub-problems and the difficulty information of the test question. The first evaluation function is used to describe the accuracy rate of the test question answers. Based on the number of knowledge points, a second evaluation function is generated. The second evaluation function is used to describe the accuracy rate of the test question answer steps. The first evaluation function and the second evaluation function are weighted to generate the reward function.

[0112] Optionally, the second training module 504 is used to determine the degree of influence of the output of the first candidate answering model corresponding to each sample in the training corpus on the adjustment of model parameters based on the reward function; and to use the degree of influence as a guide for adjusting model parameters based on a policy gradient algorithm to iteratively update the parameters of the first candidate answering model to obtain the test question answering model.

[0113] Using the aforementioned apparatus, multiple initial test question texts and their corresponding initial answers can be acquired. These initial texts are then preprocessed to obtain labeled data. Feature information is then labeled onto this labeled data. The labeled data is sampled according to preset weights for multiple feature information to obtain training data. Based on this training data, a pre-trained basic model is fine-tuned to obtain a first candidate answering model. A reward function is generated based on the feature information of the training data, including the number of sub-questions, the number of knowledge points involved, and the difficulty level of the question. Based on this generated reward function, the first candidate answering model is iterated to obtain a test-answering model used to obtain the answer to the input target test question. This improves the test-answering model's performance on complex questions and optimizes its solution steps. Consequently, the accuracy of both the answer and the solution steps is improved for complex questions containing multiple sub-questions, multiple knowledge points, and varying difficulty levels.

[0114] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0115] Figure 6This is a block diagram illustrating a test-taking device 600 according to an exemplary embodiment, such as... Figure 6 As shown, the device includes: The receiving module 601 is used to receive the target test questions input by the user; The generation module 602 is used to input the target question into a pre-generated question-answering model and obtain the answer result of the target question output by the question-answering model.

[0116] The answering model for this test question is based on Figures 1-2 The model was generated using the method described above.

[0117] Using the aforementioned device, questions can be answered through an optimized question-answering model, thereby improving the accuracy of both the answering results and the answering steps for complex questions that contain multiple sub-questions, multiple knowledge points, and different levels of difficulty.

[0118] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0119] Figure 7 This is a block diagram of an electronic device 700 provided according to an exemplary embodiment of the present disclosure. For example... Figure 7 As shown, the electronic device 700 may include a processor 701 and a memory 702. The electronic device 700 may also include one or more of a multimedia component 703, an input / output (I / O) interface 704, and a communication component 705.

[0120] The processor 701 controls the overall operation of the electronic device 700 to complete all or part of the steps in the model generation method and / or question-answering method described above. The memory 702 stores various types of data to support the operation of the electronic device 700. This data may include, for example, instructions for any application or method operating on the electronic device 700, and application-related data such as contact data, sent and received messages, images, audio, video, etc. The memory 702 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. Multimedia component 703 may include a screen and an audio component. The screen may be, for example, a touchscreen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in memory 702 or transmitted via communication component 705. The audio component also includes at least one speaker for outputting audio signals. I / O interface 704 provides an interface between processor 701 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual or physical buttons. Communication component 705 is used for wired or wireless communication between the electronic device 700 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IoT, eMTC, or other 5G technologies, or combinations thereof, is not limited here. Therefore, the corresponding communication component 705 may include: a Wi-Fi module, a Bluetooth module, an NFC module, etc.

[0121] In an exemplary embodiment, the electronic device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the model generation method and / or test question answering method described above.

[0122] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, which, when executed by a processor, implement the steps of the model generation method and / or the test question answering method described above. For example, the computer-readable storage medium may be the memory 702 including the program instructions described above, which may be executed by the processor 701 of the electronic device 700 to complete the model generation method and / or the test question answering method described above.

[0123] The preferred embodiments of this disclosure have been described in detail above with reference to the accompanying drawings. However, this disclosure is not limited to the specific details of the above embodiments. Within the scope of the technical concept of this disclosure, various simple modifications can be made to the technical solutions of this disclosure, and these simple modifications all fall within the protection scope of this disclosure.

[0124] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, this disclosure will not describe the various possible combinations separately.

[0125] Furthermore, various different embodiments of this disclosure can be combined in any way, as long as they do not violate the spirit of this disclosure, they should also be regarded as the content disclosed in this disclosure.

Claims

1. A method for model generation, characterized in that, The method includes: Obtain training corpus, which includes multiple sample texts of test questions and sample answers corresponding to the sample texts of the test questions; Based on the training corpus, the pre-trained basic model is fine-tuned to obtain the first candidate response model; A reward function is generated based on the feature information of the training corpus, wherein the feature information includes the number of sub-questions of the question, the number of knowledge points involved in the question, and the question difficulty information; Based on the reward function, the first candidate answering model is iterated to obtain a question answering model, which is used to obtain the answering result of the input target question.

2. The method according to claim 1, characterized in that, The acquisition of training corpus includes: Obtain initial corpus, which includes multiple initial test question texts and corresponding initial answers to the test question texts; The initial corpus is preprocessed to obtain the corpus to be annotated; The corpus to be annotated is labeled with feature information; The labeled corpus is sampled according to the preset weights of multiple feature information to obtain the training corpus.

3. The method according to claim 2, characterized in that, The text preprocessing of the initial corpus to obtain the corpus to be labeled includes: The initial test question text is filtered for test question standardization. The initial answer is standardized according to a specified format.

4. The method according to claim 1, characterized in that, The step of fine-tuning the pre-trained basic model based on the training corpus to obtain the first candidate response model includes: The training corpus is used as the training text for the pre-trained base model to fine-tune the model and obtain the second candidate response model. If the model output obtained by the second candidate answering model based on the sample text of the test question is the same as the sample answer, the second candidate answering model is determined as the first candidate answering model.

5. The method according to claim 1, characterized in that, The step of generating a reward function based on the feature information of the training corpus includes: Based on the number of sub-problems and the difficulty information of the test questions, a first evaluation function is generated, which is used to describe the accuracy rate of the test questions. Based on the number of knowledge points, a second evaluation function is generated. The second evaluation function is used to describe the accuracy rate of answering the questions. The first evaluation function and the second evaluation function are weighted to generate the reward function.

6. The method according to claim 1, characterized in that, The step of iterating the first candidate answering model based on the reward function to obtain the question answering model includes: Based on the reward function, determine the degree of influence of the first candidate answer model output for each sample in the training corpus on the adjustment of model parameters; Based on the policy gradient algorithm, the degree of influence is used as the guide for adjusting the model parameters. The parameters of the first candidate answering model are iteratively updated to obtain the question answering model.

7. A method for answering test questions, characterized in that, include: Receive target test questions input by the user; The target question is input into a pre-generated question-answering model to obtain the answer result of the target question output by the question-answering model; The test question answering model is generated by the model generation method according to any one of claims 1 to 6.

8. A model generation apparatus, characterized in that, The device includes: The acquisition module is used to acquire training corpus, which includes multiple test question sample texts and sample answers corresponding to the test question sample texts; The first training module is used to fine-tune the pre-trained basic model based on the training corpus to obtain the first candidate response model; The function generation module is used to generate a reward function based on the feature information of the training corpus. The feature information includes the number of sub-questions of the test question, the number of knowledge points involved in the test question, and the difficulty information of the test question. The second training module is used to iterate the first candidate answering model based on the reward function to obtain a question answering model, which is used to obtain the answering result of the input target question.

9. A test-taking device, characterized in that, include: The receiving module is used to receive the target test questions input by the user; A generation module is used to input the target question into a pre-generated question-answering model and obtain the answer result of the target question output by the question-answering model, wherein the question-answering model is generated by the model generation method according to any one of claims 1 to 6.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the method described in any one of claims 1-7.

11. An electronic device, characterized in that, include: A memory on which computer programs are stored; A processor for executing the computer program in the memory to implement the steps of the method according to any one of claims 1-7.