Error detection model training method, error detection method, device and equipment
Patent Information
- Application Number
- CN202410599271.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-14
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2044-05-14
AI Technical Summary
[0003]现有的题目解析错误检测方案是,使用通用模型训练得到错误检测模型来检测数学题目的解析是否存在错误,由于通用模型缺乏数学相关能力,导致模型无法充分拟合题目解析错误检测训练数据的分布,存在泛化性较差的问题,从而导致训练得到的所谓检测模型对于题目解析的错误检测结果不准确
[0031]本公开实施例中提供的一个或多个技术方案,通过获取第一训练样本集和第二训练样本集,第一训练样本集用于训练模型的数学解题能力,第二训练样本集用于训练模型检测数学解题错误的能力,先基于第一训练样本集对基座模型进行训练,得到训练好的解题能力增强模型,再基于解题能力增强模型构建初始检测模型,以利用解题能力增强模型获取初始检测模型的输入数据对应的字符特征表示,基于第二训练样本集对初始检测模型进行训练,得到训练好的错误检测模型。采用本公开的方案,先利用训练样本训练基座模型的数学解题能力,得到解题能力增强模型,再基于解题能力增强模型构建初始检测模型,利用训练样本训练初始检测模型检测数学解题错误的能力,通过给基座模型增加数学解题能力,能够提升初始检测模型对错误检测训练数据的拟合效果,从而提升错误检测模型的错误识别泛化能力和检测结果的准确度。
Smart Images

Figure CN118410341B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, and in particular to a training method, error detection method, apparatus and device for an error detection model. Background Technology
[0002] In some applications, error detection in problem solutions is essential. For example, in smart education, detecting errors in the solution of math problems can improve the quality of the problem bank and allow for the recommendation of higher-quality math problems and correct solutions to students.
[0003] Existing solutions for detecting errors in problem parsing involve training a general model to obtain an error detection model to detect whether there are errors in the parsing of math problems. However, because the general model lacks mathematical capabilities, it cannot adequately fit the distribution of the training data for error detection in problem parsing, resulting in poor generalization. Consequently, the so-called detection model trained in this way does not accurately detect errors in problem parsing. Summary of the Invention
[0004] To address the aforementioned technical problems, or at least partially address them, this disclosure provides a training method for an error detection model, an error detection method, an apparatus, and a device.
[0005] According to one aspect of this disclosure, a method for training an error detection model is provided, comprising:
[0006] Obtain a first training sample set and a second training sample set. The first training sample set is used to train the model's mathematical problem-solving ability, and the second training sample set is used to train the model's ability to detect mathematical problem-solving errors.
[0007] The base model is trained based on the first training sample set to obtain a trained problem-solving ability enhancement model;
[0008] An initial detection model is constructed based on the problem-solving ability enhancement model, so as to obtain the character feature representation corresponding to the input data of the initial detection model using the problem-solving ability enhancement model;
[0009] The initial detection model is trained based on the second training sample set to obtain a trained error detection model.
[0010] According to another aspect of this disclosure, an error detection method based on an error detection model is provided. The error detection model is trained using the training method for the error detection model described in the foregoing aspect. The error detection method includes:
[0011] Obtain the math problem to be tested and its solution text;
[0012] The mathematical problem and its solution text are input into the error detection model, which then performs error detection on the solution text and outputs the detection results.
[0013] Obtain the detection results output by the error detection model;
[0014] In response to the detection result indicating an error in the problem's parsing text, the user is prompted that the parsing text of the math problem is incorrect.
[0015] According to another aspect of this disclosure, a training apparatus for an error detection model is provided, comprising:
[0016] The sample acquisition module is used to acquire a first training sample set and a second training sample set. The first training sample set is used to train the mathematical problem-solving ability of the model, and the second training sample set is used to train the model's ability to detect mathematical problem-solving errors.
[0017] The first training module is used to train the base model based on the first training sample set to obtain a trained problem-solving ability enhancement model.
[0018] The model building module is used to build an initial detection model based on the problem-solving ability enhancement model, so as to use the problem-solving ability enhancement model to obtain the character feature representation corresponding to the input data of the initial detection model;
[0019] The second training module is used to train the initial detection model based on the second training sample set to obtain a trained error detection model.
[0020] According to another aspect of this disclosure, an error detection device based on an error detection model is provided. The error detection model is trained using the training method described in the foregoing aspect. The error detection device includes:
[0021] The data acquisition module is used to acquire the math problems to be tested and their solution text.
[0022] An error detection module is used to input the mathematical problem and the problem analysis text into the error detection model, and the error detection model performs error detection on the problem analysis text and outputs the detection results;
[0023] The result acquisition module is used to acquire the detection results output by the error detection model;
[0024] The prompt module is used to prompt the user that the problem's parsing text is incorrect in response to the detection result indicating that there is an error in the problem's parsing text.
[0025] According to another aspect of this disclosure, an electronic device is provided, comprising:
[0026] Processor; and
[0027] Stored program memory,
[0028] The program includes instructions that, when executed by the processor, cause the processor to perform either the training method of the error detection model according to the preceding aspect or the error detection method based on the error detection model according to the preceding aspect.
[0029] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are configured to cause the computer to perform a training method for an error detection model according to the preceding aspect, or to perform an error detection method based on an error detection model according to the preceding aspect.
[0030] According to another aspect of this disclosure, a computer program product is provided, comprising a computer program, wherein, when executed by a processor, the computer program implements the training method of the error detection model described in the foregoing aspect, or executes the error detection method based on the error detection model described in the foregoing aspect.
[0031] One or more technical solutions provided in this disclosure involve acquiring a first training sample set and a second training sample set. The first training sample set is used to train the mathematical problem-solving ability of the model, and the second training sample set is used to train the model's ability to detect mathematical problem-solving errors. First, a base model is trained based on the first training sample set to obtain a trained problem-solving ability enhancement model. Then, an initial detection model is constructed based on the problem-solving ability enhancement model to obtain the character feature representation corresponding to the input data of the initial detection model. Finally, the initial detection model is trained based on the second training sample set to obtain a trained error detection model. By adopting the scheme of this disclosure, the mathematical problem-solving ability of the base model is first trained using training samples to obtain a problem-solving ability enhancement model. Then, an initial detection model is constructed based on the problem-solving ability enhancement model. The initial detection model is trained using training samples to detect mathematical problem-solving errors. By adding mathematical problem-solving ability to the base model, the fitting effect of the initial detection model on the error detection training data can be improved, thereby improving the error recognition generalization ability and the accuracy of the detection results of the error detection model. Attached Figure Description
[0032] Further details, features, and advantages of this disclosure are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:
[0033] Figure 1A flowchart illustrating a training method for an error detection model according to an exemplary embodiment of the present disclosure is shown;
[0034] Figure 2 A flowchart illustrating a training method for an error detection model according to another exemplary embodiment of the present disclosure is shown;
[0035] Figure 3 An architecture diagram of an initial detection model according to an exemplary embodiment of this disclosure is shown;
[0036] Figure 4 A flowchart illustrating an error detection method based on an error detection model according to an exemplary embodiment of the present disclosure is shown.
[0037] Figure 5 A schematic block diagram of a training apparatus for an error detection model according to an exemplary embodiment of the present disclosure is shown;
[0038] Figure 6 A schematic block diagram of an error detection apparatus based on an error detection model according to an exemplary embodiment of the present disclosure is shown;
[0039] Figure 7 A structural block diagram of an exemplary electronic device that can be used to implement embodiments of the present disclosure is shown. Detailed Implementation
[0040] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0041] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0042] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc., used in this disclosure are only used to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies.
[0043] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0044] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0045] Existing error detection schemes for parsing questions use a general base model to train an error detection model, and train it on the entire parsing text. The trained error detection model performs error detection on the complete parsing text, which has the following two problems:
[0046] (1) The general base model lacks mathematical capabilities and cannot fully fit the distribution of the training data for error detection in problem analysis. It has poor generalization and the detection results of the trained error detection model are inaccurate.
[0047] (2) The detection is performed on the complete parsed text, but it is impossible to specifically detect which steps have problems, resulting in poor interpretability.
[0048] To address the aforementioned issues, this disclosure provides a training method for an error detection model, which can be divided into two steps: First, a base model is trained using problem-solving training data, enhancing its mathematical problem-solving capabilities to obtain an enhanced problem-solving model. Then, based on this enhanced model, an initial detection model is constructed and trained using error detection training data to obtain the final error detection model. This approach enhances the initial detection model's fit to the error detection training data by adding mathematical problem-solving capabilities to the base model, thereby improving the error detection model's generalization ability and the accuracy of the detection results. In this scheme, the error detection training data can be used at the step-level, enabling the trained error detection model to detect step-level analytical errors and improving the interpretability of the detection results. This scheme can be applied in multiple scenarios, such as online education. Using this scheme, problems with analytical errors in a math question bank can be detected, improving the quality of the question bank and recommending higher-quality math problems to students.
[0049] The following description, with reference to the accompanying drawings, outlines the training method, error detection method, apparatus, and equipment for the error detection model provided in this disclosure.
[0050] Figure 1 A flowchart is shown of a training method for an error detection model according to an exemplary embodiment of the present disclosure. The method can be executed by a training device for the error detection model provided in the embodiments of the present disclosure, wherein the device can be implemented in software and / or hardware, and is generally integrated in an electronic device, including devices such as computers and servers.
[0051] like Figure 1 As shown, the training method for this error detection model may include the following steps:
[0052] Step 101: Obtain a first training sample set and a second training sample set. The first training sample set is used to train the model's mathematical problem-solving ability, and the second training sample set is used to train the model's ability to detect mathematical problem-solving errors.
[0053] The first training sample set includes problem-solving training samples used to train the model's mathematical problem-solving ability. Each problem-solving training sample in the first training sample set includes a problem and a solution, where the problem serves as the model's input and the solution serves as the model's target output.
[0054] For example, problem-solution-answer pairs in the field of mathematics can be collected, covering elementary, middle, and high school math problems. Filtering rules can be set to filter the collected math problems. The filtering rules mainly check whether the answer or solution is empty, whether the answer appears in the solution, etc. Manual filtering of math problems is also possible. Manual checking includes examining the steps to see if there are logical, reasoning, or calculation errors. After data filtering, 100,000 math problem-solution pairs are obtained, which constitute the first training sample set.
[0055] It is understandable that the solutions to the math problems in the first training sample set are correct, in order to train a model with better problem-solving ability.
[0056] The second training sample set includes error detection training samples, used to train the model's ability to detect errors in mathematical problem-solving. Each error detection training sample in the first training sample set includes the problem (problem text), the solution text, and a label indicating whether the solution text is incorrect. It is understood that the second training sample set includes both correctly solved and incorrectly solved mathematical problems, so that the trained model can detect both incorrect and correct solutions.
[0057] For example, to reduce the workload of collecting training samples, a second training sample set can be obtained based on the first training sample set. For instance, labels can be added to each problem-solving training sample in the first training sample set to obtain error detection training samples with correct parsing. Furthermore, the parsing of some problem-solving training samples in the first training sample set can be modified to produce incorrect parsing and labeled to obtain error detection training samples with incorrect parsing. Alternatively, other mathematical problems with incorrect parsing can be manually collected and labeled to obtain error detection training samples with incorrect parsing, thus obtaining the second training sample set.
[0058] Step 102: Train the base model based on the first training sample set to obtain a trained problem-solving ability enhancement model.
[0059] The base model is obtained through pre-training on massive amounts of data. It possesses certain general capabilities, essentially acting as a vast knowledge base with "unknown potential," and has the ability to continue writing (continuously predicting the next word). Based on the base model, training samples are used for model training (fine-tuning), resulting in a model capable of performing downstream tasks (such as solving mathematical problems). The base model used in this disclosure can include, but is not limited to, models such as GPT-3.5, LLaMA, GLM, and Qwen-72B. Considering that mathematical analysis detection requires a model with strong reasoning capabilities, preferably, the base model used in this disclosure is Qwen-72B. The Qwen-72B model is pre-trained using over 3 trillion corpora, including high-quality Chinese and English multilingual, code, and mathematical data, covering training corpora from both general and professional fields. In multiple Chinese-English downstream evaluation tasks, such as code, mathematics, translation, and common sense reasoning, its performance significantly surpasses existing open-source models.
[0060] In this embodiment of the disclosure, the base model can be fine-tuned using a first training sample set to obtain a trained model, which is called the problem-solving ability enhancement model.
[0061] During training, the base model takes as input the problems from the first training sample set and outputs as the parsed text of those problems. For example,
[0062] Input: Xiaoming has 2 apples, and Xiaoli has twice as many apples as Xiaoming. How many apples do they have in total?
[0063] Target output: First, we calculate the number of apples Xiao Li has. From the problem, we know that Xiao Li has twice as many apples as Xiao Ming, so Xiao Li has 2 * 2 = 4 apples. Then, we add this to the number of apples Xiao Ming has to get the total number: 2 + 4 = 6 apples.
[0064] During training, the above-mentioned "input" content is fed into the base model. The base model solves the problem based on the input and outputs the predicted analytical result. Then, the loss value is calculated based on the predicted analytical result and the above-mentioned "target output". When the loss value is not less than the preset value, the model parameters of the base model are adjusted, and training continues using the problem-solving training samples in the first training sample set until the obtained loss value is less than the preset value. The training is then completed, and the problem-solving ability enhancement model is obtained.
[0065] Step 103: Construct an initial detection model based on the problem-solving ability enhancement model, so as to obtain the character feature representation corresponding to the input data of the initial detection model using the problem-solving ability enhancement model.
[0066] In this embodiment of the disclosure, after training the problem-solving ability enhancement model, an initial detection model can be constructed based on the problem-solving ability enhancement model. The problem-solving ability enhancement model is a part of the initial detection model and is used to obtain the character feature representation corresponding to the input data of the initial detection model, so that the initial detection model can predict the detection result of whether the parsed text is incorrect based on the character feature representation.
[0067] Step 104: Train the initial detection model based on the second training sample set to obtain a trained error detection model.
[0068] In this embodiment of the disclosure, the constructed initial detection model can be trained using the acquired second training sample set to obtain a trained model, which is called an error detection model.
[0069] For example, suppose an error detection training sample in the second training sample set is as follows:
[0070] Problem text: Xiaoming has 2 apples, and Xiaoli has twice as many apples as Xiaoming. How many apples do they have in total?
[0071] Text analysis: First, calculate the number of apples Xiao Li has, which is 2*2-4; then calculate the total number, which is 4+2=7.
[0072] Label: Parsing error.
[0073] In the example above, the labels can be represented by preset identifiers, such as "0" for correct parsing and "1" for incorrect parsing.
[0074] During training, the content of the above-mentioned question text and parsing text is input into the initial detection model. The problem-solving ability enhancement model in the initial detection model represents the input content as characters. Then, the next layer of the problem-solving ability enhancement model makes a prediction of whether the parsing is correct or incorrect based on the obtained character representation and outputs the detection result (classification result). The loss value is calculated based on the detection result and the content of the above-mentioned labeled label. If the obtained loss value is not less than the preset value, the parameters of the initial model are adjusted, and the initial detection model is trained again by obtaining error detection training samples from the second training sample set until the obtained loss value is less than the preset value, thus obtaining the trained error detection model.
[0075] The training method for the error detection model in this disclosure involves acquiring a first training sample set and a second training sample set. The first training sample set is used to train the model's mathematical problem-solving ability, and the second training sample set is used to train the model's ability to detect mathematical problem-solving errors. First, a base model is trained based on the first training sample set to obtain a trained problem-solving ability enhancement model. Then, an initial detection model is constructed based on the problem-solving ability enhancement model to obtain character feature representations corresponding to the input data of the initial detection model. The initial detection model is then trained based on the second training sample set to obtain a trained error detection model. By adopting the scheme of this disclosure, the mathematical problem-solving ability of the base model is first trained using training samples to obtain a problem-solving ability enhancement model. Then, an initial detection model is constructed based on the problem-solving ability enhancement model. The initial detection model is trained using training samples to detect mathematical problem-solving errors. By adding mathematical problem-solving ability to the base model, the fitting effect of the initial detection model on the error detection training data can be improved, thereby improving the error recognition generalization ability and the accuracy of the detection results of the error detection model.
[0076] In one optional embodiment of this disclosure, when constructing the initial detection model, a preset word vector conversion network and a fully connected network can be obtained. The word vector conversion network is used to convert the input text into word vector representations, and the fully connected network is used to perform binary classification to obtain the detection result and output it. The word vector conversion network and the fully connected network can be commonly used networks, and this disclosure does not limit them. Next, the initial detection model can be constructed by using the word vector conversion network as the input layer, the fully connected network as the error detection classification layer, and the problem-solving ability enhancement model as the feature representation layer. The output of the input layer is connected to the input of the feature representation layer, and the output of the feature representation layer is connected to the input of the error detection classification layer.
[0077] Furthermore, in an optional embodiment of this disclosure, based on the foregoing embodiments, step 104 may include the following sub-steps:
[0078] Step 201: Traverse the error detection training samples in the second training sample set. The error detection training samples include the question text, the parsing text, and the annotation labels, which are used to indicate whether the parsing text is incorrect.
[0079] In this embodiment of the disclosure, the second training sample set includes multiple error detection training samples. Each error detection training sample includes a question text, a parsing text, and a label. The label is used to indicate whether the parsing text is incorrect. For example, a label "0" indicates that the parsing text is correct, and a label "1" indicates that the parsing text is incorrect. The error detection training samples in the second training sample set can be traversed one by one to train the initial detection model.
[0080] Step 202: Input the title text and parsing text of the currently traversed error detection training sample into the input layer of the initial detection model to obtain the word vector representations corresponding to the title text and the parsing text.
[0081] In this embodiment of the disclosure, for the error detection training sample being traversed, its title text and parsing text can be input into the input layer of the initial detection model, and the input layer can perform vectorization processing on the input text to obtain the corresponding word vector representation.
[0082] Step 203: Input the word vector representation into the feature representation layer of the initial detection model to obtain the character feature representation corresponding to the word vector representation using the problem-solving ability enhancement model.
[0083] In this embodiment of the disclosure, the output of the input layer of the initial detection model is connected to the input of the feature representation layer. The word vector representation obtained from the input layer is input to the feature representation layer of the initial detection model. The feature representation layer of the initial detection model performs character-by-character prediction based on the word vector representation to obtain the character feature representation of each character in the word vector representation.
[0084] Step 204: Based on the character feature representation, perform binary classification using the error detection classification layer of the initial detection model to obtain the classification result.
[0085] In this embodiment of the disclosure, the output of the feature representation layer of the initial detection model is connected to the input of the error detection classification layer. The character feature representation obtained by the feature representation layer is input to the error detection classification layer, which performs binary classification based on the character feature representation and outputs the classification result.
[0086] For example, the classification categories output by the error detection classification layer can be preset according to actual needs. For instance, the error detection classification layer can be set to output the probability corresponding to the error category or the probability corresponding to the correct category, in which case the classification result will only include the probability corresponding to one category; or, the error detection classification layer can be set to output the probabilities corresponding to the error category and the correct category respectively, in which case the classification result will include the probabilities corresponding to both the correct and error categories respectively.
[0087] Step 205: Based on the classification result and the labeled data of the currently traversed error detection training samples, calculate the loss to obtain the loss value of the initial detection model.
[0088] In this embodiment of the disclosure, after obtaining the classification result, the loss can be calculated using a preset loss function based on the classification result and the labeled labels of the currently traversed error detection training samples to obtain the loss value of the initial detection model for this training.
[0089] For example, the loss function can be a binary cross-entropy, and the formula for calculating the loss value is shown in formula (1).
[0090]
[0091] In the above formula (1), y represents the label of the error detection training sample being traversed, that is, the true label, indicating whether the parsed text of the error detection training sample being traversed is correct or incorrect. This represents the classification result output by the initial detection model, i.e., the probability of the false detection classification layer output by the initial detection model; This represents the obtained loss value.
[0092] Step 206: In response to the loss value being greater than the preset value, adjust the model parameters of the initial detection model, and obtain the next error detection training sample to continue training until the obtained loss value is not greater than the preset value, the training ends, and the trained error detection model is obtained.
[0093] In this embodiment, the calculated loss value can be compared with a preset value, which can be pre-set according to actual needs, for example, a preset value of 0.9. If the calculated loss value is greater than the preset value, the model parameters of the initial detection model are adjusted, and the error detection training samples in the second training sample set are traversed to obtain the next error detection training sample for training calculation to obtain a new loss value. The above process is repeated until the obtained loss value is no greater than the preset value, the training ends, and the trained error detection model is obtained.
[0094] The training method of the error detection model in this embodiment of the present disclosure involves traversing error detection training samples in a second training sample set. These error detection training samples include question text, parsing text, and annotation labels. The annotation labels indicate whether the parsing text is erroneous. The question text and parsing text of the currently traversed error detection training samples are input into the input layer of the initial detection model to obtain word vector representations corresponding to the question text and parsing text. Then, the word vector representations are input into the feature representation layer of the initial detection model to obtain character feature representations corresponding to the word vector representations using a problem-solving ability enhancement model. Finally, based on the character feature representations, binary classification is performed using the error detection classification layer of the initial detection model to obtain the score. Based on the classification results and the labeled tags of the currently traversed error detection training samples, the loss value of the initial detection model is calculated. If the obtained loss value is greater than the preset value, the model parameters of the initial detection model are adjusted, and the next error detection training sample is obtained to continue training until the obtained loss value is no greater than the preset value. The training ends, and a trained error detection model is obtained. Thus, by using the previously trained problem-solving ability enhancement model to obtain the character feature representation of the input data, and then performing binary classification based on the character feature representation to obtain the classification result, the fitting effect of the initial detection model on the error detection training samples can be improved, and the generalization of the model's error recognition can be improved.
[0095] To achieve step-level parsing error detection, in one optional embodiment of this disclosure, each parsing step in the parsed text of the second training sample set may be wrapped by a preset first character and a second character. The first character indicates the start of the parsing step, and the second character indicates the end of the parsing step. Correspondingly, the label includes a step label corresponding to each parsing step, which is used to indicate whether the corresponding parsing step is correct or incorrect.
[0096] For example, the first character can be <step> The second character can be< / step> An error detection training sample in the second training sample set can be:
[0097] Problem text: Xiaoming has 2 apples, and Xiaoli has twice as many apples as Xiaoming. How many apples do they have in total?
[0098] Parsing the text: <step> First, calculate the number of apples Xiao Li has, which is 2*2-4.< / step> <step> Calculate the total number: 4 + 2 = 7< / step>
[0099] Labels: 0, 1
[0100] In the example above, the labels "0, 1" indicate that the first parsing step was correct and the second parsing step was incorrect.
[0101] The division and annotation of parsing steps in the parsed text can be done manually. The parsed text is divided into steps and each step is annotated manually to check whether each step is correct. After at least one round of quality control, 100,000 step annotation data are collected to construct the second training sample set.
[0102] Furthermore, in this embodiment, the error detection classification layer of the initial detection model is used to perform binary classification to obtain the classification result. This can include: extracting the target character representation corresponding to each second character from the character feature representation based on the position information corresponding to each second character; then, inputting the target character representation corresponding to each second character into the error detection classification layer in sequence; the error detection classification layer performs binary classification based on the target character representation and outputs the classification result corresponding to each parsing step.
[0103] When obtaining the target character representation corresponding to each second character, it can be obtained based on the position of the second character in the text (question text + parsing text, with the parsing text following the question text). For example, the electronic device can be pre-configured with the second characters to be focused on (for example). Before each error detection training sample is input into the initial detection model for training, the electronic device can traverse each character of the question text and parsing text of the error detection training sample (traversing the question text first and then the parsing text) based on the second character to determine the position of each second character (indicating which character the second character is in the text). Then, the error detection training sample is input into the initial detection model, and the feature representation layer of the initial detection model is used to obtain the character feature representation of each character. After that, the electronic device searches for the character feature representation of the corresponding position in the character feature representation based on the previously determined position information of each second character as the target character representation of the second character.
[0104] It is understood that when the feature representation layer performs feature representation on a character-by-character basis, the currently predicted character feature representation will be used in the character feature representation of the next character. Thus, the character feature representation of each character contains the feature information of all previous characters. For a parsing step, the character feature representation corresponding to the second character at its end position contains the information of the parsing step and the parsing steps before it. Therefore, in this embodiment of the present disclosure, the target character representation corresponding to each second character can be obtained to predict whether the corresponding parsing step is correct or incorrect.
[0105] Furthermore, in one optional embodiment of this disclosure, for a scenario where the error detection classification layer outputs the classification result corresponding to each parsing step, when calculating the loss value of the initial detection model, the classification result corresponding to each parsing step can be traversed sequentially to obtain the step identifier of the target parsing step to which the current traversed classification result belongs. Based on the step identifier, the target step label corresponding to the step identifier can be obtained from the label of the error detection training sample being traversed. Then, based on the current traversed classification result and the target step label, the cross-entropy loss is calculated to obtain the cross-entropy loss corresponding to the target parsing step. In response to traversing the classification result corresponding to each parsing step, the average value of all cross-entropy losses is calculated as the loss value of the initial detection model.
[0106] It is understandable that the target character corresponding to the first and second characters in the parsed text indicates that it is first processed by the error detection classification layer to obtain the first classification result. This classification result is the classification result corresponding to the first parsing step. Therefore, the order of the obtained classification results can be used as the step identifier of the target parsing step to which it belongs. That is, after the question text and parsed text are input into the initial detection model, the step identifier of the parsing step to which the first classification result output by the error detection classification layer belongs is 1. And so on, each classification result corresponds to a step identifier. Thus, the corresponding step label can be obtained from the label based on the step identifier. The first step label in the label is the label corresponding to the first parsing step. Similarly, the last step label is the label corresponding to the last parsing step. For the first output classification result, it is the first to be traversed, and the first step label in the label is obtained for the calculation of the loss value.
[0107] When calculating the cross-entropy loss, it can be calculated using the following formula (2).
[0108]
[0109] In the above formula (2), y i This represents the label of the i-th step in the labeling of the error detection training sample being traversed, that is, the true label corresponding to the i-th parsing step, indicating whether the i-th parsing step of the error detection training sample being traversed is correct or incorrect. This represents the classification result of the i-th parsing step output by the initial detection model, i.e., the probability that the i-th parsing step output by the error detection classification layer of the initial detection model is correct or incorrect; This represents the cross-entropy loss corresponding to the i-th parsing step.
[0110] In this embodiment of the disclosure, after traversing the classification results corresponding to each parsing step, the average value of these cross-entropy losses can be calculated based on the cross-entropy loss corresponding to each parsing step, and the obtained average value can be determined as the loss value of the initial detection model.
[0111] Figure 3 An architecture diagram of an initial detection model according to an exemplary embodiment of this disclosure is shown, such as... Figure 3 As shown, the error detection training samples include the question text and each parsing step (including the step text and the first character). <step> The second character< / step> The input layer of the initial detection model is then passed through the feature representation layer (i.e., the problem-solving ability enhancement model) to obtain the character feature representation of each character. Finally, the error detection classification layer performs classification processing based on the target character feature representation at the second character position to obtain the classification result. This classification result includes the probability that the category of the detection parsing step is correct or incorrect.
[0112] The solution of this embodiment splits the parsing file of each error detection training sample in the second training sample set according to the parsing steps, and labels each parsing step with a step label. This enables the error detection model trained using the second training sample set to achieve step-level parsing error detection, discover specific erroneous steps in the parsed text, improve the interpretability of the detected errors, and enhance the detection effect.
[0113] Figure 4 The diagram illustrates a flowchart of an error detection method based on an error detection model according to an exemplary embodiment of the present disclosure. This method can be executed by an error detection device based on an error detection model provided in the embodiments of the present disclosure. This device can be implemented in software and / or hardware, and is generally integrated into an electronic device, including devices such as computers and servers. The error detection model is trained using the error detection model training method described in the foregoing embodiments. The trained error detection model can be integrated into the electronic device for error detection during question parsing, or it can be invoked via an interface call for error detection during question parsing, thereby realizing the error detection method based on the error detection model.
[0114] like Figure 4 As shown, this error detection method based on an error detection model may include the following steps:
[0115] Step 301: Obtain the math problem to be tested and the problem analysis text.
[0116] For example, when an error detection method based on an error detection model is applied to the detection of question parsing in a question bank, it can iterate through the math questions and their corresponding parsing texts in the question bank. The math question and its parsing text to be detected are the currently iterated math question and its corresponding parsing text. By detecting whether the parsing text of each math question in the question bank is incorrect, math questions with incorrect parsing can be filtered out, removed from the question bank, or their parsing can be corrected, thereby improving the quality of the question bank.
[0117] For example, when an error detection method based on an error detection model is applied to a scenario of grading math problems, users (such as students or teachers) can input the math problem to be detected and the corresponding problem analysis text through text input or image upload.
[0118] Step 302: Input the math problem and the problem analysis text into the error detection model, and have the error detection model perform error detection on the problem analysis text and output the detection results.
[0119] In this embodiment of the disclosure, the error detection model integrates a problem-solving ability enhancement model. After the mathematical problem and the problem analysis text are input into the error detection model, the problem-solving ability enhancement model obtains the corresponding character feature representation based on the mathematical problem and the problem analysis text, and inputs the character feature representation into the next layer of the error detection model for error detection (classification processing), and outputs the detection result.
[0120] The detection results include the probability that the question parsing text is classified into the correct category and / or the incorrect category. Whether it outputs the probability of the correct category, the probability of the incorrect category, or both, is determined by the design of the error detection model, and this disclosure does not impose any restrictions on this.
[0121] Step 303: Obtain the detection results output by the error detection model.
[0122] Step 304: In response to the detection result indicating an error in the problem parsing text, prompt the user that the problem parsing text of the math problem is incorrect.
[0123] In this embodiment of the disclosure, the electronic device can obtain the detection results output by the error detection model, and determine whether there are errors in the problem analysis text of the above-mentioned math problem based on the detection results. When it is determined that there are errors in the problem analysis text, the electronic device will prompt the user that the problem analysis text of the math problem is wrong, so that the user can take corresponding actions to deal with the error, such as correcting the problem analysis text, deleting the math problem, etc.
[0124] As an example, suppose the error detection model outputs the probability of the correct category. If the probability in the detection result is greater than the correct threshold (e.g., 0.8), then the question parsing text is determined to be correct.
[0125] As an example, suppose the error detection model outputs the probability corresponding to the error category. If the probability in the detection result is greater than the error threshold (e.g., 0.5), then it is determined that there is an error in the question parsing text.
[0126] As an example, suppose the error detection model outputs a first probability for the correct category and a second probability for the incorrect category. If the first probability in the detection result is greater than the second probability, then the question parsing text is determined to be correct; otherwise, the question parsing text is determined to be incorrect.
[0127] The error detection method based on an error detection model in this disclosure acquires the mathematical problem to be detected and its solution text. The mathematical problem and its solution text are input into an error detection model, which performs error detection on the solution text and outputs the detection result. The user is prompted that the solution text contains an error, based on the detection result. By employing the scheme of this disclosure, since the error detection model is a mathematical ability-enhanced model with mathematical problem-solving capabilities, it has a good generalization ability for identifying and resolving errors in solution text. Using the error detection model for error detection in solution text can improve the accuracy of the detection results.
[0128] In one optional embodiment of this disclosure, when an error detection model is trained using error detection training samples that have been broken down into each parsing step, the error detection model can achieve step-level error detection, that is, detect which specific parsing step in the question detection text contains an error. In this scenario, when using the error detection model to detect whether the question parsing text is incorrect, the question parsing text to be detected can be first broken down into multiple parsing steps. Each question parsing step in the question parsing text is wrapped by a preset first character and second character, where the first character indicates the start of the question parsing step and the second character indicates the end of the question parsing step. In this embodiment, the math question to be detected and the corresponding question parsing text are input into the error detection model for error detection. The detection result output by the error detection model includes the parsing step detection result corresponding to each question parsing step, and the parsing step detection result includes the probability that the corresponding question parsing step is classified as the correct category and / or the incorrect category.
[0129] Therefore, in this embodiment, responding to the detection result indicating that there is an error in the problem parsing text, prompting the user that the problem parsing text of the math problem is wrong may include: determining whether there is an error in each problem parsing step based on the parsing step detection result corresponding to each problem parsing step; in response to determining that there is an error in the problem parsing step, obtaining the target problem parsing step with the error, and prompting the user that the target problem parsing step of the math problem is wrong.
[0130] For example, suppose the solution text for a math problem includes three steps: step 1, step 2, and step 3. The different categories output by the error detection model will be explained as follows:
[0131] As an example, suppose the error detection model outputs the probability of the correct category. When the probability in the detection result is greater than the correct threshold (e.g., 0.8), the question parsing step is determined to be correct. Suppose the detection results are {0.85, 0.3, 0.91}, meaning the parsing step for step 1 has a detection result of 0.85, the parsing step for step 2 has a detection result of 0.3, and the parsing step for step 3 has a detection result of 0.91. By comparing these results with the correct threshold, it can be determined that step 2 contains an error. Step 2 is then selected as the target question parsing step, and the user is notified that step 2 contains an error.
[0132] As an example, suppose the error detection model outputs the probability corresponding to the error category. When the probability in the detection result is greater than the error threshold (e.g., 0.5), it is determined that there is an error in the question parsing text. Suppose the detection results are {0.26, 0.3, 0.91}, meaning the parsing step corresponding to step 1 has a detection result of 0.26, the parsing step corresponding to step 2 has a detection result of 0.3, and the parsing step corresponding to step 3 has a detection result of 0.91. By comparing these results with the error threshold, it can be determined that step 3 has an error. Step 3 is then selected as the target question parsing step, and the user is notified that step 3 has an error.
[0133] As an example, suppose the error detection model outputs a first probability for the correct category and a second probability for the incorrect category, denoted as (first probability, second probability). When the first probability in the detection result is greater than the second probability, the question parsing text is determined to be correct; otherwise, the question parsing text is determined to have an error. Suppose the detection results are {(0.74, 0.26), (0.7, 0.3), (0.09, 0.91)}, meaning the parsing step detection result for step 1 is (0.74, 0.26), the parsing step detection result for step 2 is (0.7, 0.3), and the parsing step detection result for step 3 is (0.09, 0.91). By comparing the first and second probabilities in the detection results of each parsing step, it can be determined that step 3 has an error. Step 3 is then selected as the target question parsing step, and the user is notified that step 3 has an error.
[0134] In this embodiment of the disclosure, an error detection model is used to detect errors in each step of the problem analysis text of a math problem and output the detection results of each step. Based on the detection results, the target problem analysis step with an error is identified, and the user is notified that the target problem analysis step has an error. Thus, step-level error detection is achieved, which can locate the specific erroneous step and provide convenience for the user to perform subsequent processing.
[0135] This exemplary embodiment also provides a training apparatus for an error detection model. Figure 5 A schematic block diagram of a training apparatus for an error detection model according to an exemplary embodiment of the present disclosure is shown, such as Figure 5 As shown, the training device 50 for the error detection model includes: a sample acquisition module 510, a first training module 520, a model building module 530, and a second training module 540.
[0136] The sample acquisition module 510 is used to acquire a first training sample set and a second training sample set. The first training sample set is used to train the mathematical problem-solving ability of the model, and the second training sample set is used to train the model's ability to detect mathematical problem-solving errors.
[0137] The first training module 520 is used to train the base model based on the first training sample set to obtain a trained problem-solving ability enhancement model.
[0138] The model building module 530 is used to build an initial detection model based on the problem-solving ability enhancement model, so as to use the problem-solving ability enhancement model to obtain the character feature representation corresponding to the input data of the initial detection model;
[0139] The second training module 540 is used to train the initial detection model based on the second training sample set to obtain a trained error detection model.
[0140] Optionally, the model building module 530 is also used for:
[0141] Obtain the preset word vector conversion network and fully connected network;
[0142] An initial detection model is constructed by using the word vector conversion network as the input layer, the fully connected network as the error detection and classification layer, and the problem-solving ability enhancement model as the feature representation layer.
[0143] The output of the input layer is connected to the input of the feature representation layer, and the output of the feature representation layer is connected to the input of the error detection and classification layer.
[0144] Optionally, the second training module 540 is also used for:
[0145] Iterate through the error detection training samples in the second training sample set. The error detection training samples include the question text, the parsing text, and the annotation labels, where the annotation labels are used to indicate whether the parsing text is incorrect.
[0146] The title text and parsing text of the error detection training sample being traversed are input into the input layer of the initial detection model to obtain the word vector representations corresponding to the title text and the parsing text.
[0147] The word vector representation is input into the feature representation layer of the initial detection model to obtain the character feature representation corresponding to the word vector representation using the problem-solving ability enhancement model;
[0148] Based on the character feature representation, binary classification is performed using the error detection classification layer of the initial detection model to obtain the classification result;
[0149] Based on the classification results and the labeled data of the currently traversed error detection training samples, the loss value of the initial detection model is calculated.
[0150] In response to the loss value being greater than a preset value, the model parameters of the initial detection model are adjusted, and the next error detection training sample is obtained to continue training until the loss value obtained is no greater than the preset value. The training ends, and a trained error detection model is obtained.
[0151] Optionally, each parsing step in the parsed text is enclosed by a preset first character and a second character, where the first character indicates the start of the parsing step and the second character indicates the end of the parsing step. The annotation labels include step annotation labels corresponding to each parsing step, and the step annotation labels are used to indicate whether the corresponding parsing step is correct or incorrect.
[0152] Furthermore, the second training module 540 is also used for:
[0153] Based on the position information corresponding to each second character, extract the target character representation corresponding to each second character from the character feature representation;
[0154] The target character representation corresponding to each second character is sequentially input into the error detection classification layer, which performs binary classification based on the target character representation and outputs the classification result corresponding to each parsing step.
[0155] Optionally, the second training module 540 is also used for:
[0156] Iterate through the classification results corresponding to each parsing step in turn, and obtain the step identifier of the target parsing step to which the current parsing result belongs;
[0157] Based on the step identifier, obtain the target step label corresponding to the step identifier from the label of the currently traversed error detection training sample;
[0158] Based on the current traversal classification result and the target step label, the cross-entropy loss is calculated to obtain the cross-entropy loss corresponding to the target parsing step;
[0159] In response to traversing the classification results corresponding to each parsing step, the average value of the cross-entropy loss is calculated as the loss value of the initial detection model.
[0160] The training apparatus for the error detection model provided in this disclosure can execute any training method for the error detection model applicable to electronic devices provided in this disclosure, and has the corresponding functional modules and beneficial effects for executing the method. Content not described in detail in the apparatus embodiments of this disclosure can be referred to the descriptions in any method embodiments of this disclosure.
[0161] An exemplary embodiment of this disclosure also provides an error detection device based on an error detection model, wherein the error detection model is trained by the error detection model training method described in the foregoing embodiments.
[0162] Figure 6 A schematic block diagram of an error detection apparatus based on an error detection model according to an exemplary embodiment of the present disclosure is shown, such as Figure 6As shown, the error detection device 60 based on the error detection model includes: a data acquisition module 610, an error detection module 620, a result acquisition module 630, and a prompting module 640.
[0163] Among them, the data acquisition module 610 is used to acquire the mathematical problem to be detected and the problem analysis text;
[0164] The error detection module 620 is used to input the mathematical problem and the problem analysis text into the error detection model, and the error detection model performs error detection on the problem analysis text and outputs the detection result;
[0165] The result acquisition module 630 is used to acquire the detection results output by the error detection model;
[0166] The prompt module 640 is used to prompt the user that the problem's parsing text is incorrect in response to the detection result indicating that there is an error in the problem's parsing text.
[0167] Optionally, each question parsing step in the question parsing text is enclosed by a preset first character and a second character, where the first character indicates the start of the question parsing step and the second character indicates the end of the question parsing step; and the detection result includes the parsing step detection result corresponding to each question parsing step;
[0168] The prompt module 640 is also used for:
[0169] Based on the detection results of the parsing steps corresponding to each question parsing step, it is determined whether there are any errors in each question parsing step;
[0170] In response to the determination that there is an error in the problem parsing steps, obtain the target problem parsing steps that contain the error;
[0171] The user is prompted that there is an error in the solution steps for the math problem.
[0172] The error detection device based on the error detection model provided in this disclosure can execute any error detection method based on the error detection model applicable to electronic devices provided in this disclosure, and has the corresponding functional modules and beneficial effects for executing the method. Content not described in detail in the device embodiments of this disclosure can be referred to the description in any method embodiment of this disclosure.
[0173] Exemplary embodiments of this disclosure also provide an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program executable by the at least one processor, the computer program, when executed by the at least one processor, causing the electronic device to perform a training method for an error detection model according to embodiments of this disclosure, or to perform an error detection method based on an error detection model according to embodiments of this disclosure.
[0174] Exemplary embodiments of this disclosure also provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a computer's processor, is used to cause the computer to perform a training method for an error detection model according to embodiments of this disclosure, or to perform an error detection method based on an error detection model according to embodiments of this disclosure.
[0175] Exemplary embodiments of this disclosure also provide a computer program product, including a computer program, wherein, when executed by a computer's processor, the computer program is used to cause the computer to perform a training method for an error detection model according to embodiments of this disclosure, or to perform an error detection method based on an error detection model according to embodiments of this disclosure.
[0176] refer to Figure 7 The present invention describes a structural block diagram of an electronic device 1100 that can serve as a server or client of the present disclosure, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0177] like Figure 7 As shown, the electronic device 1100 includes a computing unit 1101, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1102 or a computer program loaded from a storage unit 1108 into a random access memory (RAM) 1103. The RAM 1103 may also store various programs and data required for the operation of the electronic device 1100. The computing unit 1101, ROM 1102, and RAM 1103 are interconnected via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.
[0178] Multiple components in electronic device 1100 are connected to I / O interface 1105, including: input unit 1106, output unit 1107, storage unit 1108, and communication unit 1109. Input unit 1106 can be any type of device capable of inputting information to electronic device 1100. Input unit 1106 can receive input digital or character information and generate key signal inputs related to user settings and / or function control of electronic device. Output unit 1107 can be any type of device capable of presenting information and may include, but is not limited to, a display, speaker, video / audio output terminal, vibrator, and / or printer. Storage unit 1108 may include, but is not limited to, disk and optical disk. Communication unit 1109 allows electronic device 1100 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers, and / or chipsets, such as Bluetooth™ devices, WiFi devices, WiMax devices, cellular communication devices, and / or the like.
[0179] The computing unit 1101 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1101 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1101 performs the various methods and processes described above. For example, in some embodiments, a method for training an error detection model or an error detection method based on an error detection model can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1108. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 1100 via ROM 1102 and / or communication unit 1109. In some embodiments, the computing unit 1101 can be configured by any other suitable means (e.g., by means of firmware) to perform a method for training an error detection model or an error detection method based on an error detection model.
[0180] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0181] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0182] As used in this disclosure, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or apparatus (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including machine-readable media that receive machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0183] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0184] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0185] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.
Claims
1. A training method for an error detection model, wherein, The method includes: Obtain a first training sample set and a second training sample set. The first training sample set is used to train the model's mathematical problem-solving ability, and the second training sample set is used to train the model's ability to detect mathematical problem-solving errors. The base model is trained based on the first training sample set to obtain a trained problem-solving ability enhancement model; An initial detection model is constructed based on the problem-solving ability enhancement model, so as to obtain the character feature representation corresponding to the input data of the initial detection model using the problem-solving ability enhancement model; The initial detection model is trained based on the second training sample set to obtain a trained error detection model; The step of training the initial detection model based on the second training sample set to obtain a trained error detection model includes: Iterate through the error detection training samples in the second training sample set, wherein the error detection training samples include question text, parsing text, and annotation labels; The title text and parsing text of the error detection training sample being traversed are input into the input layer of the initial detection model to obtain the word vector representations corresponding to the title text and the parsing text. The word vector representation is input into the feature representation layer of the initial detection model to obtain the character feature representation corresponding to the word vector representation using the problem-solving ability enhancement model; Based on the character feature representation, binary classification is performed using the error detection classification layer of the initial detection model to obtain the classification result; Each parsing step in the parsed text is enclosed by a preset first character and a second character, where the second character indicates the end of the parsing step; The step of performing binary classification based on the character feature representation using the error detection classification layer of the initial detection model to obtain the classification result includes: Based on the position information corresponding to each second character, extract the target character representation corresponding to each second character from the character feature representation.
2. The training method for the error detection model as described in claim 1, wherein, The construction of the initial detection model based on the problem-solving ability enhancement model includes: Obtain the preset word vector conversion network and fully connected network; An initial detection model is constructed by using the word vector conversion network as the input layer, the fully connected network as the error detection and classification layer, and the problem-solving ability enhancement model as the feature representation layer. The output of the input layer is connected to the input of the feature representation layer, and the output of the feature representation layer is connected to the input of the error detection and classification layer.
3. The training method for the error detection model as described in claim 2, after performing binary classification using the error detection classification layer of the initial detection model based on the character feature representation to obtain the classification result, the method further includes: Based on the classification results and the labeled data of the currently traversed error detection training samples, the loss value of the initial detection model is calculated. In response to the loss value being greater than a preset value, the model parameters of the initial detection model are adjusted, and the next error detection training sample is obtained to continue training until the loss value obtained is no greater than the preset value. The training ends, and a trained error detection model is obtained.
4. The training method for the error detection model as described in claim 3, wherein, The first character indicates the start of the parsing step, and the label includes a step label corresponding to each parsing step, which is used to indicate whether the corresponding parsing step is correct or incorrect; After extracting the target character representation corresponding to each second character from the character feature representation based on the position information corresponding to each second character, the method further includes: The target character representation corresponding to each second character is sequentially input into the error detection classification layer, which performs binary classification based on the target character representation and outputs the classification result corresponding to each parsing step.
5. The training method for the error detection model as described in claim 4, wherein, The step of calculating the loss value of the initial detection model based on the classification result and the labeled tags includes: Iterate through the classification results corresponding to each parsing step in turn, and obtain the step identifier of the target parsing step to which the current parsing result belongs; Based on the step identifier, obtain the target step label corresponding to the step identifier from the label of the currently traversed error detection training sample; Based on the current traversal classification result and the target step label, the cross-entropy loss is calculated to obtain the cross-entropy loss corresponding to the target parsing step; In response to traversing the classification results corresponding to each parsing step, the average value of the cross-entropy loss is calculated as the loss value of the initial detection model.
6. An error detection method based on an error detection model, wherein, The error detection model is trained using the training method for the error detection model as described in any one of claims 1-5, wherein the error detection method includes: Obtain the math problem to be tested and its solution text; The mathematical problem and its solution text are input into the error detection model, which then performs error detection on the solution text and outputs the detection results. Obtain the detection results output by the error detection model; In response to the detection result indicating an error in the problem's parsing text, the user is prompted that the parsing text of the math problem is incorrect.
7. The error detection method based on the error detection model as described in claim 6, wherein, Each question parsing step in the question parsing text is enclosed by a preset first character and a second character, where the first character indicates the start of the question parsing step and the second character indicates the end of the question parsing step; Furthermore, the detection results include the detection results of the parsing steps corresponding to each question parsing step; The response to the detection result indicating an error in the problem's parsing text, prompting the user that the parsing text of the math problem is incorrect, includes: Based on the detection results of the parsing steps corresponding to each question parsing step, determine whether there are any errors in each question parsing step; In response to the determination that there is an error in the problem parsing steps, obtain the target problem parsing steps that contain the error; The user is prompted that there is an error in the solution steps for the math problem.
8. A training device for an error detection model, wherein, The device includes: The sample acquisition module is used to acquire a first training sample set and a second training sample set. The first training sample set is used to train the mathematical problem-solving ability of the model, and the second training sample set is used to train the model's ability to detect mathematical problem-solving errors. The first training module is used to train the base model based on the first training sample set to obtain a trained problem-solving ability enhancement model. The model building module is used to build an initial detection model based on the problem-solving ability enhancement model, so as to use the problem-solving ability enhancement model to obtain the character feature representation corresponding to the input data of the initial detection model; The second training module is used to train the initial detection model based on the second training sample set to obtain a trained error detection model. The step of training the initial detection model based on the second training sample set to obtain a trained error detection model includes: Iterate through the error detection training samples in the second training sample set, wherein the error detection training samples include question text, parsing text, and annotation labels; The title text and parsing text of the error detection training sample being traversed are input into the input layer of the initial detection model to obtain the word vector representations corresponding to the title text and the parsing text. The word vector representation is input into the feature representation layer of the initial detection model to obtain the character feature representation corresponding to the word vector representation using the problem-solving ability enhancement model; Based on the character feature representation, binary classification is performed using the error detection classification layer of the initial detection model to obtain the classification result; Each parsing step in the parsed text is enclosed by a preset first character and a second character, where the second character indicates the end of the parsing step; The step of performing binary classification based on the character feature representation using the error detection classification layer of the initial detection model to obtain the classification result includes: Based on the position information corresponding to each second character, extract the target character representation corresponding to each second character from the character feature representation.
9. An error detection device based on an error detection model, wherein, The error detection model is trained using the training method for the error detection model as described in any one of claims 1-5, and the error detection device comprises: The data acquisition module is used to acquire the math problems to be tested and their solution text. An error detection module is used to input the mathematical problem and the problem analysis text into the error detection model, and the error detection model performs error detection on the problem analysis text and outputs the detection results; The result acquisition module is used to acquire the detection results output by the error detection model; The prompt module is used to prompt the user that the problem's parsing text is incorrect in response to the detection result indicating that there is an error in the problem's parsing text.
10. An electronic device, comprising: processor; as well as Stored program memory, The program includes instructions that, when executed by the processor, cause the processor to perform the training method of the error detection model according to any one of claims 1-5, or to perform the error detection method based on the error detection model according to claim 6 or 7.
11. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to execute the training method of the error detection model according to any one of claims 1-5, or to execute the error detection method based on the error detection model according to claim 6 or 7.
Citation Information
Patent Citations
Question answering method and device
CN115617961A
Generation method and device of mathematical problem solving model, electronic equipment and storage medium
CN115840867A
Error detection model training method, medical image report detection method, system and equipment
CN116258136A
Question correction method and device, electronic equipment and storage medium
CN116797416A