Model retraining method, device and equipment
By determining the segmentation and accuracy of the inference result set and evaluation sample set, the retraining sample set is constructed to retrain the model, solving the problem that model retraining relies on external feedback information in the existing technology, and achieving continuous optimization and improvement of the model.
Patent Information
- Application Number
- CN202411752714.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2044-12-02
AI Technical Summary
In the prior art, reinforcement learning as a model retraining method mainly relies on external feedback information as continuous input, and has specific constraints on external feedback information. It does not involve the retraining and tuning process of the model, and cannot achieve continuous 'evolution' ability.
By segmenting the inference result set based on the numerical properties of the inference result set, the inference result set and evaluation sample set are determined to determine the accuracy of the inference result in the overlapping set, the first and second retraining sample sets are determined respectively, and the model is retrained based on these two sample sets. When the accuracy of the second model is greater than the preset multiple of the first model, the second model is replaced by the first model as the online model.
Continuous retraining and iteration in the usage stage after the model is deployed. Through the combination of internal inference results and external verification results, the dependence on external input is reduced, the accuracy of the model is improved, and the effect of "use the better you use it".
Smart Images

Figure CN119670890B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of computer technology, and in particular to a model retraining method, device, and equipment. Background Art
[0002] Sample data is a collection of labeled data used to train or retrain models. The quality of sample data directly impacts the model's inference performance. Typically, model training or retraining relies on manually labeled sample data. However, as the demand for sample data continues to grow, manual labeling is increasingly unable to meet this demand. Therefore, leveraging the resulting data from model inference has become a key solution.
[0003] In existing technologies, reinforcement learning is an important method for model retraining. This method relies primarily on external feedback as continuous input, with specific constraints ("rewards" or "penalties") placed on this feedback. It also only involves the model's training and construction process, not the retraining and tuning process, and thus cannot achieve continuous "evolution" capabilities.
[0004] Based on this, a new model retraining method is needed. Summary of the Invention
[0005] The embodiments of this specification provide a model retraining method, device and equipment for solving the following technical problems: In the prior art, reinforcement learning is an important method for model retraining. The method of model retraining based on reinforcement learning mainly relies on external feedback information as continuous input, and has specific constraints on external feedback information ("reward" or "penalty"), and only involves the training and construction process of the model, not the retraining and tuning process of the model, and cannot achieve continuous "evolution" capabilities.
[0006] To solve the above technical problems, the embodiments of this specification are implemented as follows:
[0007] The present invention provides a model retraining method, including:
[0008] Segmenting the inference result set and the evaluation sample set based on a numerical attribute of the inference result set, wherein the inference result set is formed by inferring the original data set based on the first model;
[0009] For each segment of the inference result set and the evaluation sample set, determining the accuracy of the inference results in the overlapping set;
[0010] Based on the accuracy of the inference results in the overlapping set, determining the first retraining sample set and the second retraining sample set respectively;
[0011] Retraining the first model based on a retraining sample set formed by fusing the first retraining sample set and the second retraining sample set to obtain a second model;
[0012] If the accuracy of the second model is greater than the preset multiple of the accuracy of the first model, the second model replaces the first model as the online model to complete the model retraining.
[0013] The present invention also provides a model retraining device, comprising:
[0014] a segmentation module, segmenting the inference result set and the evaluation sample set based on numerical attributes of the inference result set, wherein the inference result set is formed by inferring the original data set based on the first model;
[0015] an accuracy determination module, for determining the accuracy of the inference results in the overlapping set for each segment of the inference result set and the evaluation sample set;
[0016] a retraining sample set determination module, which determines a first retraining sample set and a second retraining sample set based on the accuracy of the inference results in the overlapping set;
[0017] a retraining module, retraining the first model based on a retraining sample set formed by fusing the first retraining sample set and the second retraining sample set to obtain a second model;
[0018] In the online module, if the accuracy of the second model is greater than the preset multiple of the accuracy of the first model, the second model replaces the first model as the online model to complete the model retraining.
[0019] An embodiment of this specification further provides an electronic device, including:
[0020] at least one processor; and,
[0021] a memory communicatively connected to the at least one processor; wherein,
[0022] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
[0023] Segmenting the inference result set and the evaluation sample set based on a numerical attribute of the inference result set, wherein the inference result set is formed by inferring the original data set based on the first model;
[0024] For each segment of the inference result set and the evaluation sample set, determining the accuracy of the inference results in the overlapping set;
[0025] Based on the accuracy of the inference results in the overlapping set, determining the first retraining sample set and the second retraining sample set respectively;
[0026] Retraining the first model based on a retraining sample set formed by fusing the first retraining sample set and the second retraining sample set to obtain a second model;
[0027] If the accuracy of the second model is greater than the preset multiple of the accuracy of the first model, the second model replaces the first model as the online model to complete the model retraining.
[0028] The model retraining method provided in the embodiments of this specification segments the inference result set and the evaluation sample set based on the numerical attributes of the inference result set, wherein the inference result set is formed by inferring the original data set based on the first model; for each segment of the inference result set and the evaluation sample set, the accuracy of the inference results in the overlapping set is determined; based on the accuracy of the inference results in the overlapping set, the first retraining sample set and the second retraining sample set are respectively determined; the first model is retrained based on the retraining sample set formed by the fusion of the first retraining sample set and the second retraining sample set to obtain a second model; if the accuracy of the second model is greater than a preset multiple of the accuracy of the first model, the second model replaces the first model as the online model to complete the model retraining, which can realize retraining in the use phase after the model is deployed. Through continuous model retraining, evaluation and iteration, the model can achieve the effect of "the more it is used, the better it is used". In addition, this method mainly relies on internal inference results and external verification results, can reduce dependence on external input, and has a good model retraining effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0030] Figure 1 A schematic diagram of the system architecture of a model retraining method provided in an embodiment of this specification;
[0031] Figure 2 A flowchart of a model retraining method provided in an embodiment of this specification;
[0032] Figure 3 A flowchart of another model retraining method provided in an embodiment of this specification;
[0033] Figure 4A flowchart of another model retraining method provided in an embodiment of this specification;
[0034] Figure 5 A flowchart of another model retraining method provided in an embodiment of this specification;
[0035] Figure 6 A framework diagram of a model retraining method provided in an embodiment of this specification;
[0036] Figure 7 This is a schematic diagram of a model retraining device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0037] In order to help those skilled in the art better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0038] Reinforcement learning is an online learning method that uses a trial-and-error approach. Unlike supervised and unsupervised learning, it doesn't require any pre-defined data. Instead, it obtains learning information by receiving feedback from the environment on actions. It then adjusts and optimizes the model's parameters accordingly, achieving continuous improvement. Depending on the given conditions, reinforcement learning can be divided into model-based and model-free reinforcement learning.
[0039] Therefore, the embodiments of this specification provide a new model retraining method, which starts from the model inference results and uses the evaluation sample set to discover the distribution of high-accuracy and low-accuracy inference results. By screening the high-accuracy inference results and correcting the low-accuracy inference results by the human in the loop, a retraining sample set is constructed to retrain the model. While ensuring that the model's reasoning ability in the high-accuracy area is not degraded, the model's reasoning ability in the low-accuracy area is optimized.
[0040] Figure 1 This is a schematic diagram of the system architecture of a model retraining method provided in the embodiment of this specification. Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. Network 104 is a medium for providing communication links between terminal devices 101, 102, 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0041] The terminal devices 101, 102, and 103 interact with the server 105 via the network 104 to receive or send messages, etc. Various client applications may be installed on the terminal devices 101, 102, and 103, such as dedicated programs such as model retraining methods.
[0042] Terminal devices 101, 102, and 103 can be hardware or software. When terminal devices 101, 102, and 103 are hardware, they can be various dedicated or general-purpose electronic devices, including but not limited to smartphones, tablet computers, laptop computers, and desktop computers. When terminal devices 101, 102, and 103 are software, they can be installed in the electronic devices listed above. They can be implemented as multiple software or software modules (for example, multiple software or software modules used to provide distributed services), or they can be implemented as a single software or software module.
[0043] The server 105 may be a server that provides various services, such as a backend server that provides services for client applications installed on the terminal devices 101, 102, and 103. For example, the server may perform model retraining so that the model retraining results are displayed on the terminal devices 101, 102, and 103, or the server may perform model retraining so that the model retraining results are displayed on the terminal devices 101, 102, and 103.
[0044] The server 105 may be hardware or software. When the server 105 is hardware, it may be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the server 105 is software, it may be implemented as multiple software programs or software modules (e.g., multiple software programs or software modules for providing distributed services), or as a single software program or software module.
[0045] Figure 2 This is a flow chart of a model retraining method provided in an embodiment of this specification. From a program perspective, the execution body of the process can be a program installed on an application server or application terminal. It is understood that this method can be executed by any device, equipment, platform, or device cluster with computing and processing capabilities.
[0046] like Figure 2 As shown, the model retraining method includes:
[0047] Step S201: segmenting the inference result set and the evaluation sample set based on the numerical attributes of the inference result set, wherein the inference result set is formed by inferring the original data set based on the first model.
[0048] In the embodiments of this specification, the first model can process numerical data and / or data that can be converted into numerical data. It should be noted that in the embodiments of this specification, all data involved are numerical data and / or data that can be converted into numerical data, and no further details will be given later.
[0049] It can be understood that the method provided in the embodiments of this specification is used to process numerical data and / or data that can be converted into numerical data, and then to retrain the model corresponding to the data that processes numerical data and / or data that can be converted into numerical data.
[0050] Specifically, the data type may be image data, and / or text data, and / or video data, and / or audio data, etc.
[0051] The first model is a model that has already been trained, that is, the first model is the online model. Since the data used as training samples during the training process of the trained model may differ from the actual data of the model user, in order to ensure the accuracy of the data recognition results, the first model needs to be adjusted, that is, retrained, after the model is deployed and launched, that is, during the use phase after model deployment. It can be seen that the model retraining method provided in this embodiment is not applied before the model is deployed and launched, but is applied to the use phase after the model is deployed.
[0052] In the embodiment of the specification, the original data set D is a data set used for training to obtain the first model, and the evaluation sample set C is formed by selecting part of the data from the original data set D and annotating it. Therefore, the original data set D covers the evaluation sample set C.
[0053] In this embodiment of the present specification, the first model M performs inference on the original dataset D to form an inference result set D'. Since the original dataset D includes the evaluation sample set C, and the inference result set D' is formed after the first model M performs inference on the original dataset D, the value range of the numerical attributes in the inference result set D' includes the value range of the numerical attributes of the evaluation sample set C. Therefore, when segmenting the inference result set D' and the evaluation sample set C, the segmentation is based on the numerical attributes of the inference result set.
[0054] In the embodiment of this specification, the inference result set D' and the evaluation sample set C are both in key-value format.
[0055] The segmentation of the inference result set and the evaluation sample set based on the numerical attributes of the inference result set specifically includes:
[0056] Determine the segmentation step size according to the numerical attribute of the inference result set and the preset number of segments;
[0057] Segmenting the inference result set and the evaluation sample set respectively according to the segmentation step size;
[0058] The segmentation step length = (max(x)-min(x)) / m;
[0059] in,
[0060] m is the preset number of segments;
[0061] x is a numerical attribute of the inference result set;
[0062] max(x) is the maximum value of the numerical attribute of the inference result set;
[0063] min(x) is the minimum value of the numerical attribute of the inference result set.
[0064] In a specific embodiment, the preset number of segments m is 10, and the preset number of segments m can be adjusted according to specific business scenarios.
[0065] It should be noted that the preset number of segments m here is the initial value, and it will need to be adjusted during the model retraining process to update the preset number of segments and achieve the purpose of adjusting the segmentation of the inference result set and the evaluation sample set.
[0066] Step S203: for each segment of the inference result set and the evaluation sample set, determine the accuracy of the inference results in the overlapping set.
[0067] Continuing with the previous example, the preset number of segments m is 10. Then in step S201, the inference result set and the evaluation sample set are divided into 10 segments. For each segment, the accuracy of the inference result in the overlapping set needs to be determined.
[0068] In the embodiment of this specification, determining the accuracy of the inference results in the overlapping set for each segment of the inference result set and the evaluation sample set specifically includes:
[0069] For each segment, determining an overlapping set of the inference result set and the evaluation sample set;
[0070] The accuracy of the inference result in the overlapping set is determined as the ratio of the number of identical results in the overlapping set that come from both the inference result set and the evaluation sample set to the number of samples in the overlapping set.
[0071] For each segment, the overlapping set S of the inference result set and the evaluation sample set is determined. This set is selected based on the key values of the inference result set and the evaluation sample set. Specifically, the set consisting of the same key values in the inference result set and the evaluation sample set is selected as the overlapping set. The overlapping set ensures that the data in the overlapping join comes from both the inference result set and the evaluation sample set. Since the inference result set and the evaluation sample set are in key-value format, the overlapping set is also in key-value format.
[0072] When determining the accuracy of the inference results in the overlapping set, it is determined based on the value of the overlapping set S, that is, from the overlapping set, the result value that is both the value of the inference result set and the value of the evaluation sample set is determined. Since the evaluation sample set is a labeled sample set, the value of the evaluation result set is correct. Therefore, selecting the same results from both the inference result set and the evaluation sample set from the overlapping set can ensure that the selected results are accurate, and thus used to calculate the accuracy of the overlapping set. The accuracy Q of the inference results in the overlapping set S = the number of identical results from C and from D' in S / count(S), where count(S) is the number of samples in the overlapping set S.
[0073] Step S205: Based on the accuracy of the inference results in the overlapping set, determine the first retraining sample set and the second retraining sample set respectively.
[0074] In the embodiment of this specification, determining the first retraining sample set and the second retraining sample set based on the accuracy of the inference results in the overlapping set specifically includes:
[0075] Selecting several segments with the highest accuracy from the accuracy of the inference results in the overlapping set, excluding data belonging to the evaluation sample set, and incrementally selecting a first proportion of inference results as the first retraining samples;
[0076] Several segments with the lowest accuracy are selected from the accuracy of the inference results in the overlapping set, and after excluding the data belonging to the evaluation sample set, a second proportion of inference results are incrementally selected, and the corrected second proportion of inference results are used as the second retraining samples.
[0077] In order to ensure the accuracy of the sample, the inference results of the second ratio selected in an incremental manner need to be further corrected to obtain a modified inference result of the second ratio. When performing the correction, manual review can be used, and the specific correction method is not limited here.
[0078] In the embodiment of this specification, the preset ratio of the preset number of segments is used as the plurality of segments. Specifically, the preset number of segments is 0, the preset ratio is 10%, the initial value of the first ratio n is 30%, and the initial value of the second ratio p is 30%.
[0079] It should be noted that the first ratio n and the second ratio p are both initial values. They will need to be adjusted during the model retraining process to update the first ratio and the second ratio.
[0080] Continuing with the previous example, from the m segments of the inference result set, select the top m*10% segments with the highest accuracy, and after excluding the evaluation sample set C, incrementally select the inference results of the first proportion n as the first retraining sample set R1. The first retraining sample set R1 is the selected segments with high accuracy, so the first retraining sample set R1 is also called the high-accuracy set. From the m segments of the inference result set, select the top m*10% segments with the lowest accuracy, and after excluding the evaluation sample set C, incrementally select the inference results of the second proportion p as the second retraining sample set R2. The second retraining sample set R2 is the selected segments with low accuracy, so the second retraining sample set R2 is also called the low-accuracy set.
[0081] In this embodiment, the incremental method can choose uniform distribution selection, random selection or layered selection. Uniform distribution selection refers to selecting samples from each segment at a certain interval to ensure that the selected samples are representative of the entire data distribution. This method helps to maintain the diversity of the retraining sample set and avoids bias towards certain specific types of samples. Random selection refers to randomly selecting a certain proportion of samples from each segment. This method is simple and easy to implement, and can quickly generate a retraining sample set, but it may also cause certain important features or patterns to be ignored during the retraining process. Layered selection is to first layer the data according to the characteristics or categories of the inference results, and then select samples from each layer in proportion. This method is particularly suitable for situations where the data has a clear hierarchical structure or large category differences, and can ensure that each important subgroup is sufficiently representative. In this application, the incremental method is preferably uniform distribution selection.
[0082] Step S207: retraining the first model based on a retraining sample set formed by fusing the first retraining sample set and the second retraining sample set to obtain a second model.
[0083] In the embodiment of this specification, the second model M' is a retrained model. After obtaining the retrained model, that is, the second model, whether the second model needs to replace the first model as the online model needs to be further determined based on the accuracy of the second model and the first model.
[0084] Step S209: If the accuracy of the second model is greater than a preset multiple of the accuracy of the first model, the second model replaces the first model as the online model to complete model retraining.
[0085] In the embodiment of this specification, the accuracy rate A of the first model is obtained by evaluating the first model M using the evaluation sample set C. The accuracy rate B of the second model is obtained by evaluating the second model M' using the evaluation sample set C.
[0086] In the embodiment of this specification, the preset multiple is 105%, which can be adjusted according to the specific business scenario. That is, if B>(A*105%), the second model M' replaces the first model M as the online model, and the retraining is completed.
[0087] In this embodiment of the present specification, if the accuracy of the second model is less than or equal to a preset multiple of the accuracy of the first model, the first ratio and the second ratio are updated to re-determine the first retraining sample set and the second retraining sample set.
[0088] That is, if B ≤ (A * 105%), the first ratio and the second ratio are updated to re-determine the first retraining sample and the second retraining sample. In this process, if the first ratio is less than or equal to 70%, there is no need to re-segment, and only the first ratio and the second ratio need to be adjusted to re-determine the first retraining sample and the second retraining sample.
[0089] After adjusting the first ratio and the second ratio, an updated first ratio and an updated second ratio can be obtained. Specifically, the updated first ratio = the first ratio + 10%, that is, the first ratio n + = 10%, and the updated second ratio = the second ratio + 10%, that is, the second ratio p + = 10%.
[0090] Continuing with the previous example, if the first ratio n=30%, then the updated first ratio=30%+10%=40%, and the second ratio p=30%, then the updated second ratio=30%+10%=40%, and the subsequent updates of the first ratio and the second ratio are analogous.
[0091] In an embodiment of this specification, the method further comprises:
[0092] If the first ratio is greater than 70%, adjusting the preset number of segments;
[0093] Based on the adjusted preset number of segments and based on the numerical attributes of the inference result set, the inference result set and the evaluation sample set are re-segmented respectively.
[0094] The preset number of segments is adjusted by adding the preset number of segments according to a certain gradient. The adjusted preset number of segments = the preset number of segments m + 10, that is, m + = 10.
[0095] Continuing with the previous example, the preset number of segments m=10, then the updated preset number of segments=30+10=40, and the preset number of segments after subsequent adjustments is similar.
[0096] It should be noted that when the inference result set and the evaluation sample set are re-segmented respectively, the adjusted preset number of segments should be less than or equal to 50.
[0097] In order to ensure the efficiency of model retraining, in the implementation of this manual, the end conditions of model retraining are further determined.
[0098] In an embodiment of this specification, the method further comprises:
[0099] If the adjusted preset number of segments is greater than 50, the model retraining is terminated.
[0100] In order to further understand the model retraining method provided in the embodiments of this specification, Figure 3 A flow chart of another model retraining method provided in the embodiments of this specification is shown as follows: Figure 3 As shown, the model retraining method includes:
[0101] Step S301: segmenting the inference result set and the evaluation sample set based on the numerical attributes of the inference result set, wherein the inference result set is formed by inferring the original data set based on the first model;
[0102] Step S303: determining the accuracy of the inference results in the overlapping set for each segment of the inference result set and the evaluation sample set;
[0103] Step S305: determining a first retraining sample set and a second retraining sample set based on the accuracy of the inference results in the overlapping set;
[0104] Step S307: retraining the first model based on a retraining sample set formed by fusing the first retraining sample set and the second retraining sample set to obtain a second model;
[0105] Step S309: If the accuracy of the second model is greater than the preset multiple of the accuracy of the first model, the second model replaces the first model as the online model, completing the model retraining;
[0106] Step S311: If the accuracy of the second model is less than or equal to a preset multiple of the accuracy of the first model, the first ratio and the second ratio are updated to re-determine the first retraining sample set and the second retraining sample set, and the updated first ratio is less than or equal to 70%.
[0107] In order to further understand the model retraining method provided in the embodiments of this specification, Figure 4 A flow chart of another model retraining method provided in the embodiments of this specification is shown as follows: Figure 4 As shown, the model retraining method includes:
[0108] Step S401: segmenting the inference result set and the evaluation sample set based on the numerical attributes of the inference result set, wherein the inference result set is formed by inferring the original data set based on the first model;
[0109] Step S403: determining the accuracy of the inference results in the overlapping set for each segment of the inference result set and the evaluation sample set;
[0110] Step S405: determining a first retraining sample set and a second retraining sample set based on the accuracy of the inference results in the overlapping set;
[0111] Step S407: retraining the first model based on a retraining sample set formed by fusing the first retraining sample set and the second retraining sample set to obtain a second model;
[0112] Step S409: If the accuracy of the second model is greater than the preset multiple of the accuracy of the first model, the second model replaces the first model as the online model, completing the model retraining;
[0113] Step S411: If the accuracy of the second model is less than or equal to a preset multiple of the accuracy of the first model, updating the first ratio and the second ratio to re-determine the first retraining sample set and the second retraining sample set, and the updated first ratio is less than or equal to 70%;
[0114] Step S413: If the first ratio is greater than 70%, the preset number of segments is adjusted, and based on the adjusted preset number of segments and the numerical attributes of the inference result set, the inference result set and the evaluation sample set are re-segmented respectively, and the adjusted preset number of segments is less than or equal to 50.
[0115] In order to further understand the model retraining method provided in the embodiments of this specification, Figure 5 A flow chart of another model retraining method provided in the embodiments of this specification is shown as follows: Figure 5 As shown, the model retraining method includes:
[0116] Step S501: segmenting the inference result set and the evaluation sample set based on the numerical attributes of the inference result set, wherein the inference result set is formed by inferring the original data set based on the first model;
[0117] Step S503: determining the accuracy of the inference results in the overlapping set for each segment of the inference result set and the evaluation sample set;
[0118] Step S505: determining a first retraining sample set and a second retraining sample set based on the accuracy of the inference results in the overlapping set;
[0119] Step S507: retraining the first model based on the retraining sample set formed by fusing the first retraining sample set and the second retraining sample set to obtain a second model;
[0120] Step S509: If the accuracy of the second model is greater than the preset multiple of the accuracy of the first model, the second model replaces the first model as the online model, completing the model retraining;
[0121] Step S511: If the accuracy of the second model is less than or equal to a preset multiple of the accuracy of the first model, updating the first ratio and the second ratio to re-determine the first retraining sample set and the second retraining sample set, and the updated first ratio is less than or equal to 70%;
[0122] Step S513: If the first ratio is greater than 70%, the preset number of segments is adjusted, and based on the adjusted preset number of segments and the numerical attributes of the inference result set, the inference result set and the evaluation sample set are re-segmented, wherein the adjusted preset number of segments is less than or equal to 50.
[0123] Step S515: If the adjusted preset number of segments is greater than 50, the model retraining is terminated.
[0124] In order to further understand the model retraining method provided in the embodiments of this specification, further explanation will be given below.
[0125] Figure 6 This is a framework diagram of a model retraining method provided in the embodiments of this specification. Figure 6As shown, the accuracy of the first model M is evaluated using the evaluation sample set C to obtain the initial accuracy A of the first model M; the first model M is used to infer the original data set D to form an inference result set D' after inference; the inference result set D' is divided into m segments according to specific attributes; the result accuracy Q in each segment is calculated; n of the TOP (m*10%) segment results with the highest Q after removing the evaluation samples in the inference result set D' are selected in an incremental manner as the first retraining sample set R1; p of the TOP (m*10%) segment results with the lowest Q after removing the evaluation samples in the inference result set D' are selected in an incremental manner for manual verification as the second retraining sample set R2; the first retraining sample set R1 and the second retraining sample set R2 are used to construct a retraining sample set R=R1+R2; the retraining sample set R is used to retrain the first model M to obtain the second model M', and the accuracy B of the second model M' is evaluated; based on the relationship between the accuracy A of the first model M and the accuracy B of the second model M', it is determined whether the second model M' should be used as the online model. If B>(A*105%), the second model M' is used as the online model; if B≤(A*105%), the first ratio is updated according to n+=10%, and the second ratio is updated according to p+=10%. If n≤70%, the first retraining sample set R1 and the second retraining sample set R2 are updated to perform subsequent steps and retrain the model. If n>70%, the preset number of segments m+=10 is adjusted, and the first retraining sample set R1, the second retraining sample set R2 and the retraining sample set R are cleared at the same time; if m≤50, the inference result set D' is re-segmented; if m>50, the model retraining is terminated.
[0126] The model retraining method provided in the embodiments of this specification segments the inference result set and the evaluation sample set based on the numerical attributes of the inference result set, wherein the inference result set is formed by inferring the original data set based on the first model; for each segment of the inference result set and the evaluation sample set, the accuracy of the inference results in the overlapping set is determined; based on the accuracy of the inference results in the overlapping set, the first retraining sample set and the second retraining sample set are respectively determined; the first model is retrained based on the retraining sample set formed by the fusion of the first retraining sample set and the second retraining sample set to obtain a second model; if the accuracy of the second model is greater than a preset multiple of the accuracy of the first model, the second model replaces the first model as the online model to complete the model retraining, which can realize retraining in the use phase after the model is deployed. Through continuous model retraining, evaluation and iteration, the model can achieve the effect of "the more it is used, the better it is used". In addition, this method mainly relies on internal inference results and external verification results, can reduce dependence on external input, and has a good model retraining effect.
[0127] The above content describes in detail a model retraining method. Correspondingly, this specification also provides a model retraining device, such as Figure 7 shown. Figure 7 This is a schematic diagram of a model retraining device provided in an embodiment of this specification, the model retraining device comprising:
[0128] A segmentation module 701 segments the inference result set and the evaluation sample set based on numerical attributes of the inference result set, wherein the inference result set is formed by inferring the original data set based on the first model;
[0129] The accuracy determination module 703 determines the accuracy of the inference results in the overlapping set for each segment of the inference result set and the evaluation sample set;
[0130] A retraining sample set determination module 705 determines a first retraining sample set and a second retraining sample set based on the accuracy of the inference results in the overlapping set;
[0131] A retraining module 707 retrains the first model based on a retraining sample set formed by fusing the first retraining sample set and the second retraining sample set to obtain a second model;
[0132] In the online module 709, if the accuracy of the second model is greater than the preset multiple of the accuracy of the first model, the second model replaces the first model as the online model to complete the model retraining.
[0133] In the embodiment of this specification, the model retraining device further includes:
[0134] The ratio updating module 711 updates the first ratio and the second ratio if the accuracy of the second model is less than or equal to a preset multiple of the accuracy of the first model to re-determine the first retraining sample set and the second retraining sample set, and the updated first ratio is less than or equal to 70%.
[0135] In the embodiment of this specification, the model retraining device further includes:
[0136] The re-segmentation module 713 adjusts the preset segment number if the first ratio is greater than 70%, and re-segments the inference result set and the evaluation sample set based on the adjusted preset segment number and the numerical attributes of the inference result set, and the adjusted preset segment number is less than or equal to 50.
[0137] In the embodiment of this specification, the model retraining device further includes:
[0138] The retraining termination module 715 ends the model retraining if the adjusted preset number of segments is greater than 50.
[0139] An embodiment of this specification further provides an electronic device, including:
[0140] at least one processor; and,
[0141] a memory communicatively connected to the at least one processor; wherein,
[0142] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
[0143] Segmenting the inference result set and the evaluation sample set based on a numerical attribute of the inference result set, wherein the inference result set is formed by inferring the original data set based on the first model;
[0144] For each segment of the inference result set and the evaluation sample set, determining the accuracy of the inference results in the overlapping set;
[0145] Based on the accuracy of the inference results in the overlapping set, determining the first retraining sample set and the second retraining sample set respectively;
[0146] Retraining the first model based on a retraining sample set formed by fusing the first retraining sample set and the second retraining sample set to obtain a second model;
[0147] If the accuracy of the second model is greater than the preset multiple of the accuracy of the first model, the second model replaces the first model as the online model to complete the model retraining.
[0148] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0149] The various embodiments in this specification are described in a progressive manner. Similar portions between the various embodiments can be referenced to each other, and each embodiment focuses on the differences between the other embodiments. In particular, the device, electronic device, and non-volatile computer storage medium embodiments are generally similar to the method embodiments, so their descriptions are relatively simplified. For relevant details, refer to the descriptions of the method embodiments.
[0150] The apparatus, electronic device, and non-volatile computer storage medium provided in the embodiments of this specification correspond to the method. Therefore, the apparatus, electronic device, and non-volatile computer storage medium also have similar beneficial technical effects as the corresponding method. Since the beneficial technical effects of the method have been described in detail above, the beneficial technical effects of the corresponding apparatus, electronic device, and non-volatile computer storage medium will not be repeated here.
[0151] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD through their own programming, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.
[0152] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules that implement the method and structures within the hardware component.
[0153] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0154] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing one or more embodiments of this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0155] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, the embodiments of this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0156] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0157] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0158] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0159] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0160] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0161] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0162] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0163] This specification may be described in the general context of computer-executable instructions, such as program modules, executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media, including storage devices.
[0164] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.
[0165] The foregoing is merely an embodiment of the present invention and is not intended to limit the present application. For those skilled in the art, various modifications and variations may be made to the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included within the scope of the claims of the present application.
Claims
1. A model retraining method, characterized in that: The model retraining method includes: Segmenting the inference result set and the evaluation sample set based on a numerical attribute of the inference result set, wherein the inference result set is formed by reasoning the original data set based on a first model, and the first model is used to process image data, text data, video data, or audio data; For each segment of the inference result set and the evaluation sample set, determining the accuracy of the inference results in the overlapping set; Based on the accuracy of the inference results in the overlapping set, respectively determining a first retraining sample set and a second retraining sample set, specifically comprising: selecting several segments with the highest accuracy from the accuracy of the inference results in the overlapping set, excluding data belonging to the evaluation sample set, and incrementally selecting a first proportion of inference results as the first retraining samples; selecting several segments with the lowest accuracy from the accuracy of the inference results in the overlapping set, excluding data belonging to the evaluation sample set, and incrementally selecting a second proportion of inference results, and using the corrected second proportion of inference results as the second retraining samples; Retraining the first model based on a retraining sample set formed by fusing the first retraining sample set and the second retraining sample set to obtain a second model; If the accuracy of the second model is greater than the preset multiple of the accuracy of the first model, the second model replaces the first model as the online model to complete the model retraining.
2. The model retraining method according to claim 1, wherein: The segmentation of the inference result set and the evaluation sample set based on the numerical attributes of the inference result set specifically includes: Determine the segmentation step size according to the numerical attribute of the inference result set and the preset number of segments; Segmenting the inference result set and the evaluation sample set respectively according to the segmentation step size; The segmentation step length = (max(x)-min(x)) / m; in, m is the preset number of segments; x is a numerical attribute of the inference result set; max(x) is the maximum value of the numerical attribute of the inference result set; min(x) is the minimum value of the numerical attribute of the inference result set.
3. The model retraining method according to claim 1, wherein: Determining the accuracy of the inference results in the overlapping set for each segment of the inference result set and the evaluation sample set specifically includes: For each segment, determining an overlapping set of the inference result set and the evaluation sample set; The accuracy of the inference result in the overlapping set is determined as the ratio of the number of identical results in the overlapping set that come from both the inference result set and the evaluation sample set to the number of samples in the overlapping set.
4. The model retraining method according to claim 1, wherein: A preset ratio of the preset number of segments is used as the plurality of segments.
5. The model retraining method according to claim 1, wherein: The method further comprises: If the accuracy of the second model is less than or equal to a preset multiple of the accuracy of the first model, the first ratio and the second ratio are updated to re-determine the first retraining sample set and the second retraining sample set.
6. The model retraining method according to claim 5, wherein: The method further comprises: If the first ratio is greater than 70%, the preset number of segments is adjusted; Based on the adjusted preset number of segments and based on the numerical attributes of the inference result set, the inference result set and the evaluation sample set are re-segmented respectively.
7. The model retraining method according to claim 6, wherein: The method further comprises: If the adjusted preset number of segments is greater than 50, the model retraining is terminated.
8. A model retraining device, characterized in that: The model retraining device comprises: Segmenting the inference result set and the evaluation sample set based on a numerical attribute of the inference result set, wherein the inference result set is formed by reasoning the original data set based on a first model, and the first model is used to process image data, text data, video data, or audio data; For each segment of the inference result set and the evaluation sample set, determining the accuracy of the inference results in the overlapping set; Based on the accuracy of the inference results in the overlapping set, respectively determining a first retraining sample set and a second retraining sample set, specifically comprising: selecting several segments with the highest accuracy from the accuracy of the inference results in the overlapping set, excluding data belonging to the evaluation sample set, and incrementally selecting a first proportion of inference results as the first retraining samples; selecting several segments with the lowest accuracy from the accuracy of the inference results in the overlapping set, excluding data belonging to the evaluation sample set, and incrementally selecting a second proportion of inference results, and using the corrected second proportion of inference results as the second retraining samples; Retraining the first model based on a retraining sample set formed by fusing the first retraining sample set and the second retraining sample set to obtain a second model; If the accuracy of the second model is greater than the preset multiple of the accuracy of the first model, the second model replaces the first model as the online model to complete the model retraining.
9. An electronic device comprising: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: a segmentation module, segmenting the inference result set and the evaluation sample set based on numerical attributes of the inference result set, wherein the inference result set is formed by reasoning the original data set based on a first model, and the first model is used to process image data, text data, video data, or audio data; an accuracy determination module, for determining the accuracy of the inference results in the overlapping set for each segment of the inference result set and the evaluation sample set; The retraining sample set determination module determines the first retraining sample set and the second retraining sample set based on the accuracy of the inference results in the overlapping set, specifically comprising: selecting several segments with the highest accuracy from the accuracy of the inference results in the overlapping set, excluding data belonging to the evaluation sample set, and incrementally selecting a first proportion of inference results as the first retraining samples; selecting several segments with the lowest accuracy from the accuracy of the inference results in the overlapping set, excluding data belonging to the evaluation sample set, and incrementally selecting a second proportion of inference results, and using the corrected second proportion of inference results as the second retraining samples; a retraining module, retraining the first model based on a retraining sample set formed by fusing the first retraining sample set and the second retraining sample set to obtain a second model; In the online module, if the accuracy of the second model is greater than the preset multiple of the accuracy of the first model, the second model replaces the first model as the online model to complete the model retraining.
Citation Information
Patent Citations
Model optimization method, model optimization device and electronic equipment
CN113011473A
Spine high-precision segmentation model construction method based on CT image
CN118608557A