Model retraining method and device based on wrong case evolution
Through the model retraining method based on the evolution of wrong examples, using technologies such as user correction of wrong examples and calculating cosine similarity, the high cost problem during model retraining is solved, and the acquisition of high-quality sample data and the continuous evolution of the model are achieved.
Patent Information
- Application Number
- CN202510024422.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-07
- Publication Date
- 2025-04-04
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When retraining the model, it is too costly to obtain high-quality sample data using manual labeling, and the quality of samples generated by machine labeling cannot be guaranteed and cannot be used for retraining.
The model retraining method based on the evolution of wrong examples is adopted, and the sample data is corrected or eliminated through pre-training models, user correction of error examples and calculating cosine similarity, thereby improving the quality of the retrained sample data.
It significantly reduces manual participation and time costs, improves the quality of retraining sample data, supports the continuous evolution of the model and improves the inference effect.
Smart Images

Figure CN119761522A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of model training, and in particular relates to a model retraining method, and also relates to a model retraining device. Background Art
[0002] In the field of artificial intelligence, model training is the core link in building intelligent systems. Sample data is a collection of data that has been manually or machine-labeled and is used to train the corresponding model. The quality of sample data directly affects the reasoning effect of the model.
[0003] After model training, there is still room for improvement in inference performance. On the other hand, the data encountered after deployment may be different from the samples used during training, resulting in a decrease in the accuracy of the model in certain situations. Therefore, the model needs to be retrained so that it can continue to evolve after it goes online, achieving the effect of "getting better with use".
[0004] However, retraining the model also requires a large amount of labeled sample data. The traditional method is to use manually labeled sample data, but with the increasing demand for sample data, it is increasingly difficult to meet training needs using a completely manual labeling method. The samples generated by machine labeling cannot guarantee overall quality and cannot be used for retraining. Summary of the invention
[0005] The present invention proposes a model retraining method and device based on error example evolution, the purpose of which is to solve the problem of high cost of obtaining high-quality sample data by manual labeling during model retraining.
[0006] The technical solution of the present invention is as follows: A model retraining method based on error example evolution includes the following steps: Step 1: pre-train the model, and input the input samples in the original input data set into the pre-trained model to obtain the corresponding inference results, which constitute the original result data set; Step 2: The user uses the pre-trained model. After the user finds and corrects the wrong example, the original result data set is corrected according to the user's correction to obtain a corrected result data set, and then the original input data set and the corrected result data set are used to retrain the current model; If the retrained model meets the requirements, the retrained model is put online; if the model that meets the requirements cannot be obtained through correction, go to step 3; Step 3: According to the error examples and corrections reported by users, a portion of the corresponding input samples and inference results are removed from the original input data set and the original result data set to obtain the removed input data set and the removed result data set, and then the removed input data set and the removed result data set are used to retrain the current model; If the retrained model meets the requirements, the retrained model is launched.
[0007] As a further improvement of the model retraining method based on error example evolution: in step 1, the accuracy of the pre-trained model is evaluated using the evaluation sample set to obtain the initial accuracy of the pre-trained model.
[0008] As a further improvement of the model retraining method based on error example evolution: in step 2 and step 3, the retrained model is evaluated using an evaluation sample set. If the improvement in the obtained accuracy rate relative to the initial accuracy rate exceeds a preset threshold, the retrained model is considered to meet the requirements.
[0009] As a further improvement of the model retraining method based on the evolution of wrong examples: when the original result data set is corrected in step 2, several input samples that are closest to the input sample vector of the wrong example are selected from the original input data set by calculating the cosine similarity, and the inference results corresponding to the selected input samples in the original result data set are corrected to the correction results assigned to the wrong example by the user.
[0010] As a further improvement of the model retraining method based on error example evolution: in step 2, if the retrained model does not meet the requirements, the correction selection range of the original result data set is further expanded, and more inference results are selected for correction to obtain a new corrected result data set for retraining.
[0011] As a further improvement of the model retraining method based on error example evolution: in step 2, when the number of times the correction selection range is expanded exceeds a preset value, it is determined that a model that meets the requirements cannot be obtained through correction.
[0012] As a further improvement of the model retraining method based on error example evolution: in step 2, the input sample vector closest to the error example is selected from the original input data set by calculating the cosine similarity. input samples, ,in Represents the original result dataset The number of inference results in The initial value of is 0.01. Each time the correction selection range is expanded, Increase by 0.01, when When the value is greater than or equal to 0.05, it is determined that a model that meets the requirements cannot be obtained through correction.
[0013] As a further improvement of the model retraining method based on the evolution of wrong examples: when the original input data set and the original result data set are eliminated in step 3, several input samples whose corresponding reasoning results are the same as the wrong examples and whose input sample vectors are closest to the wrong examples are selected from the original input data set by calculating the cosine similarity for elimination, and the corresponding reasoning results in the original result data set are eliminated simultaneously.
[0014] As a further improvement of the model retraining method based on error example evolution: in step 3, if the retrained model does not meet the requirements, the elimination selection range of the original input data set and the original result data set is further expanded, and the new eliminated input data set and the eliminated result data set are used for retraining; When the number of times the elimination selection range is expanded exceeds a preset value, it is determined that a model that meets the requirements cannot be obtained through elimination and retraining.
[0015] The present invention also provides a model retraining device based on error example evolution, comprising: at least one processor; at least one memory storing computer executable instructions; wherein, when the computer executable instructions are executed by the at least one processor, the at least one processor is prompted to execute the model retraining method based on error example evolution as described in any one of claims 1 to 9.
[0016] Compared with the prior art, the present invention has the following beneficial effects: The present invention fully combines machine-labeled samples with samples manually labeled and corrected by users. By correcting or eliminating samples, the quality of retraining sample data is improved at a relatively low cost. While optimizing the quality of inference samples and supporting model retraining, it significantly reduces manual participation, thereby reducing the labor and time costs brought by model retraining. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 FIG. 4 is a flowchart of a retraining method in a specific implementation manner. DETAILED DESCRIPTION
[0018] The technical solution of the present invention is described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Embodiment 1
[0019] like Figure 1 , a model retraining method based on error example evolution, the steps include: Step 1: pre-train the model, and input the input samples in the original input data set into the pre-trained model to obtain the corresponding inference results, which constitute the original result data set.
[0020] The specific process is: Step 1-1: Pre-train the model to obtain a pre-trained model The data processed by the model includes numerical data and text data, as well as data that can be converted into numerical data and text data.
[0021] Step 1-2: Use the evaluation sample set Evaluating pre-trained models The accuracy of the pre-trained model The initial accuracy .
[0022] Step 1-3: Input the original data set Input samples in are input to the pre-trained model The corresponding inference results are obtained in .
[0023] Step 2: The user uses the pre-trained model. After the user finds and corrects the error, the original result data set is corrected according to the user's correction to obtain the corrected result data set, and then the original input data set and the corrected result data set are used to retrain the current model. If the retrained model meets the requirements, the retrained model is launched; if the correction cannot obtain a model that meets the requirements, step 3 is executed.
[0024] The specific process is: Step 2-1: After the pre-trained model is launched, the original result dataset is displayed to the user , waiting for the user to find the error (i.e., input samples and inference results that users think are wrong), record the user's correct and incorrect examples The correction result . Initialization parameters .
[0025] Step 2-2: Focus on the wrong example , from the original input dataset By calculating the cosine similarity, we select the vector closest to the wrong input sample vector input samples, ,in Represents the original result dataset Then, the above input samples in the original result dataset The corresponding inference results are uniformly corrected to , thus converting the original result dataset Convert to corrected result dataset .
[0026] Step 2-3: Use the original input dataset and the current revised result dataset Pre-trained model Retrain and get the retrained model .
[0027] Step 2-4: Use the evaluation sample set Evaluating the retrained model , get the accuracy .
[0028] Step 2-5, if the accuracy obtained Relative to the initial accuracy The increase If the retrained model is greater than the preset threshold of 5%, it is considered that the retrained model meets the requirements and the model Go online and end retraining, otherwise execute steps 2-6.
[0029] Step 2-6: Adjustment ,if Clear the correction result dataset , then jump to step 2-2, further expand the correction selection range of the original result data set and retrain based on the new corrected result data set, otherwise it is determined that the model that meets the requirements cannot be obtained through correction, end step 2, and jump to step 3.
[0030] Step 3: According to the error examples and corrections reported by users, a portion of the corresponding input samples and inference results are removed from the original input data set and the original result data set to obtain the removed input data set and the removed result data set, and then the current model is retrained using the removed input data set and the removed result data set. If the retrained model meets the requirements, the retrained model is put online.
[0031] The specific process is: Step 3-1, Initialization parameters .
[0032] Step 3-2: Focus on the wrong example , from the original input dataset By calculating the cosine similarity, we select the corresponding inference result that is the same as the wrong example and the closest to the input sample vector of the wrong example. input samples, Then, the obtained Input samples from the original input dataset Eliminate, thereby converting the original input data set into the eliminated input data set , while removing the original result data set In the above The inference results corresponding to the input samples are converted into the original result dataset Convert to the result dataset after elimination .
[0033] Step 3-3: Use the current filtered input data set And the resulting dataset after elimination Pre-trained model Retrain and get the retrained model .
[0034] Step 3-4: Use the evaluation sample set Evaluating the retrained model , get the accuracy .
[0035] Step 3-5: If the accuracy is Relative to the initial accuracy The increase If the retrained model is greater than the preset threshold of 5%, it is considered that the retrained model meets the requirements and the model Go online and end retraining, otherwise execute steps 3-6.
[0036] Step 3-6: Adjustment ,if Then clear the input data set after elimination And the resulting dataset after elimination , then jump to step 3-2 to further expand the elimination selection range. Otherwise, it is determined that a model that meets the requirements cannot be obtained through elimination and retraining, and step 3 ends. Embodiment 2
[0037] A model retraining device based on error example evolution, the device comprising: at least one processor; at least one memory storing computer executable instructions; wherein, when the computer executable instructions are executed by the at least one processor, the at least one processor is prompted to execute the model retraining method based on error example evolution as described in Example 1.
[0038] It should be noted that it is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential features of the present invention. The scope of the present invention is defined by the claims rather than the above description.
Claims
1. A model retraining method based on error example evolution, characterized in that The following steps are involved: Step 1: pre-train the model, and input the input samples in the original input data set into the pre-trained model to obtain the corresponding inference results, which constitute the original result data set; Step 2: The user uses the pre-trained model. After the user finds and corrects the wrong example, the original result data set is corrected according to the user's correction to obtain a corrected result data set, and then the original input data set and the corrected result data set are used to retrain the current model; If the retrained model meets the requirements, the retrained model is put online; If the model that meets the requirements cannot be obtained through modification, execute step 3; Step 3: According to the error examples and corrections reported by users, a portion of the corresponding input samples and inference results are removed from the original input data set and the original result data set to obtain the removed input data set and the removed result data set, and then the removed input data set and the removed result data set are used to retrain the current model; If the retrained model meets the requirements, the retrained model is launched.
2. The model retraining method based on error example evolution as claimed in claim 1, characterized in that: In step 1, the accuracy of the pre-trained model is evaluated using the evaluation sample set to obtain the initial accuracy of the pre-trained model.
3. The model retraining method based on error example evolution as claimed in claim 2, characterized in that: In step 2 and step 3, the retrained model is evaluated using the evaluation sample set. If the improvement in accuracy compared to the initial accuracy exceeds a preset threshold, the retrained model is considered to meet the requirements.
4. The model retraining method based on error example evolution as claimed in claim 1, characterized in that: When correcting the original result data set in step 2, several input samples that are closest to the input sample vector of the wrong example are selected from the original input data set by calculating the cosine similarity, and the inference results corresponding to the selected input samples in the original result data set are corrected to the correction results assigned by the user to the wrong example.
5. The model retraining method based on error example evolution as claimed in claim 4, characterized in that: In step 2, if the retrained model does not meet the requirements, the correction selection range of the original result data set is further expanded, and more inference results are selected for correction to obtain a new corrected result data set for retraining.
6. The model retraining method based on error example evolution as claimed in claim 5, characterized in that: In step 2, when the number of times the correction selection range is expanded exceeds a preset value, it is determined that a model that meets the requirements cannot be obtained through correction.
7. The model retraining method based on error example evolution as claimed in claim 6, characterized in that: In step 2, the input sample vector closest to the wrong example is selected from the original input data set by calculating the cosine similarity input samples, ,in Represents the original result dataset The number of inference results in The initial value of is 0.
01. Each time the correction selection range is expanded, Increase by 0.01, when When the value is greater than or equal to 0.05, it is determined that a model that meets the requirements cannot be obtained through correction.
8. The model retraining method based on error example evolution as claimed in claim 1, characterized in that: When the original input data set and the original result data set are eliminated in step 3, several input samples whose corresponding reasoning results are the same as the wrong examples and whose input sample vectors are closest to the wrong examples are selected from the original input data set by calculating the cosine similarity for elimination, and the corresponding reasoning results in the original result data set are eliminated simultaneously.
9. The model retraining method based on error example evolution as claimed in claim 8, characterized in that: In step 3, if the retrained model does not meet the requirements, the elimination selection range of the original input data set and the original result data set is further expanded, and the new eliminated input data set and the eliminated result data set are used for retraining; When the number of times the elimination selection range is expanded exceeds a preset value, it is determined that a model that meets the requirements cannot be obtained through elimination and retraining.
10. A model retraining device based on error example evolution, characterized in that: The device includes: at least one processor; at least one memory storing computer executable instructions; wherein, when the computer executable instructions are executed by the at least one processor, the at least one processor is prompted to execute the model retraining method based on error example evolution as described in any one of claims 1 to 9.