Data ratio determination method and system, electronic equipment and storage medium

By randomly generating and training data ratio information, combined with the accuracy of the prediction of regression model, the optimal data ratio is determined, which solves the problem of data set ratio in fine-tuning of large models and improves model performance.

CN119884742APending Publication Date: 2025-04-25ZHONGDIAN DATA IND CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411951008.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

In the fine-tuning stage of large-scale models, how to determine the proportion of data sets in different fields so that the fine-tuning model achieves the expected results is a technical problem.

Method used

By randomly generating data proportional information, determine the training set corresponding to each data proportional information, and obtain the fine-tuned target model. Then, based on actual accuracy, the regression model is trained to predict the accuracy of the new data ratio information, and finally determine the data ratio corresponding to the highest prediction accuracy as the target ratio.

Benefits of technology

Through this method, the best data ratio can be selected from many data ratios, thereby improving the fine-tuned model performance and achieving the expected results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119884742A_ABST
    Figure CN119884742A_ABST
Patent Text Reader

Abstract

The invention discloses a data proportion determination method and system, electronic equipment and a storage medium, and relates to the technical field of model training, and the disclosed data proportion determination method comprises the steps: randomly generating a first number of data proportion information, and determining a training set corresponding to each piece of data proportion information; obtaining a target model obtained by fine tuning of each training set, and inputting the test set into each target model to obtain actual accuracy corresponding to each piece of data matching information; training a regression model based on each piece of data matching information and each piece of actual accuracy, and processing the randomly generated second quantity of data matching information through the trained regression model to obtain each piece of prediction accuracy; and determining the highest prediction accuracy in the prediction accuracy, and taking the data ratio information corresponding to the highest prediction accuracy as a target data ratio. The technical scheme of the invention aims to solve the technical problem of how to determine the ratio of data sets in different fields so as to enable a fine-tuned model to achieve an expected effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of model training technology, and in particular to a data ratio determination method, system, electronic device and storage medium. Background Art

[0002] Fine-tuning a large model refers to the process of further training and adjusting a pre-trained large model for a specific task or dataset to make the model better suited to new tasks or improve performance. Usually, a large amount of data in a specific field is introduced during the fine-tuning stage of the model so that the model can better adapt to downstream tasks.

[0003] However, the datasets used for fine-tuning are usually large in scale, widely sourced, and of varying quality, which will make it difficult for the fine-tuned model to achieve the expected results. Therefore, in the model fine-tuning stage, how to determine the ratio of datasets in different fields so that the fine-tuned model can achieve the expected results is a technical problem that has yet to be solved by those skilled in the art. Summary of the invention

[0004] The main purpose of this application is to provide a data ratio determination method, system, electronic device and storage medium, aiming to solve the technical problem of how to determine the ratio of data sets in different fields so that the fine-tuned model can achieve the expected effect.

[0005] To achieve the above objectives, the present application proposes a method for determining a data ratio, the method comprising:

[0006] Randomly generate a first number of data ratio information, and determine a training set corresponding to each of the data ratio information, wherein the data ratio information includes a corresponding proportion of different types of data;

[0007] Obtaining the target models fine-tuned by each of the training sets, and inputting the preset test sets into each of the target models, respectively, to obtain the actual accuracy corresponding to each of the data matching information;

[0008] Training a regression model based on each of the data ratio information and each of the actual accuracies, and processing the randomly generated second amount of data ratio information by means of the trained regression model to obtain each prediction accuracy;

[0009] The highest prediction accuracy among the prediction accuracies is determined, and the data matching information corresponding to the highest prediction accuracy is used as the target data matching.

[0010] In one embodiment, the step of determining the training sets corresponding to the respective data matching information includes:

[0011] Obtaining a total number of data, wherein the total number of data is a total number of data items in a preset training set;

[0012] Determine the number of data items of each type corresponding to each piece of data matching information according to the total number of data and the proportions corresponding to each type of data in each piece of data matching information;

[0013] Based on the number of each data item, random sampling is performed in the data set corresponding to each type to obtain a training set corresponding to each data matching information.

[0014] In one embodiment, before the step of randomly selecting from the data sets corresponding to the types based on the number of each data entry to obtain the training sets corresponding to each data matching information, the method further includes:

[0015] Obtaining the task category of the model to be fine-tuned, and filtering the data sets corresponding to each type according to the task category;

[0016] The step of randomly selecting from the data sets corresponding to the respective types based on the number of the respective data items to obtain the training sets corresponding to the respective data matching information comprises:

[0017] Based on the number of each data item, random sampling is performed in the filtered data set corresponding to each type to obtain a training set corresponding to each data ratio information.

[0018] In one embodiment, before the step of determining the number of data items of each type corresponding to each piece of data matching information according to the total number of data and the proportion corresponding to each type of data in each piece of data matching information, the method further includes:

[0019] Obtaining the number of parameters of the model to be fine-tuned, and determining a data volume threshold based on a preset volume multiple and the number of parameters;

[0020] The step of determining the number of data items of each type corresponding to each piece of data matching information according to the total number of data and the proportions corresponding to each type of data in each piece of data matching information comprises:

[0021] When it is detected that the total number of data is greater than or equal to the data volume threshold, the number of data entries of each type corresponding to each data ratio information is determined according to the total number of data and the proportion corresponding to each type of data in each data ratio information.

[0022] In one embodiment, the step of determining the number of data items of each type corresponding to each piece of data ratio information according to the total number of data and the proportions corresponding to each type of data in each piece of data ratio information further includes:

[0023] When it is detected that the total number of data is less than the data volume threshold, the data volume threshold is used as the new total number of data, and the number of data entries of each type corresponding to each data matching information is determined based on the new total number of data and the corresponding proportions of each type of data in each data matching information.

[0024] In one embodiment, the step of inputting the preset test set into each of the target models to obtain the actual accuracy corresponding to each of the data matching information includes:

[0025] Inputting the preset test sets into each of the target models respectively to obtain the predicted probability distribution output by each of the target models;

[0026] According to the actual probability distribution of the test set and each of the predicted probability distributions, the cross entropy corresponding to each of the target models is calculated, and the actual accuracy corresponding to each of the data matching information is determined based on each of the cross entropies.

[0027] In one embodiment, before the step of obtaining the target model fine-tuned by each of the training sets, the method further includes:

[0028] Obtaining the number of parameters corresponding to each preset model, and comparing each of the parameter numbers with the preset parameter number range;

[0029] Taking the number of parameters that falls within the parameter number range as the target parameter number, and taking the model corresponding to the target parameter number as the candidate model;

[0030] In response to a model selection instruction, a candidate model corresponding to the model selection instruction is used as a target model.

[0031] In addition, to achieve the above purpose, the present application also proposes a data ratio determination system, the data ratio determination system comprising:

[0032] A training set determination module, used to randomly generate a first number of data ratio information, and determine a training set corresponding to each of the data ratio information, wherein the data ratio information includes a proportion corresponding to each of different types of data;

[0033] An actual accuracy calculation module is used to obtain the target model fine-tuned by each training set, and input the preset test set into each target model to obtain the actual accuracy corresponding to each data matching information;

[0034] An accuracy prediction module, used for training a regression model based on each of the data ratio information and each of the actual accuracies, and processing the randomly generated second amount of data ratio information through the trained regression model to obtain each prediction accuracy;

[0035] The best matching ratio determination module is used to determine the highest prediction accuracy among the prediction accuracies, and use the data matching ratio information corresponding to the highest prediction accuracy as the target data matching ratio.

[0036] In addition, to achieve the above-mentioned purpose, the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the data ratio determination method as described above.

[0037] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the data ratio determination method described above are implemented.

[0038] In an embodiment of the present application, by randomly generating a first number of data ratio information and determining a training set corresponding to each piece of data ratio information, wherein the data ratio information includes the corresponding proportions of different types of data, training sets corresponding to different data ratios can be obtained; then, a target model fine-tuned by each training set is obtained, and a preset test set is input into each target model respectively to obtain the actual accuracy corresponding to each piece of data ratio information, and the accuracy corresponding to the data ratio can be obtained based on the target model; then, a regression model is trained based on each piece of data ratio information and each actual accuracy, and the randomly generated second number of data ratio information is processed by the trained regression model to obtain each prediction accuracy, and each new piece of data ratio information can be processed by the regression model that has learned the relationship between data ratio and accuracy, thereby predicting the accuracy corresponding to each piece of new data ratio information; then, the highest prediction accuracy among the prediction accuracies is determined, and the data ratio information corresponding to the highest prediction accuracy is used as the target data ratio, so that the best data ratio can be obtained.

[0039] In the present application, the accuracy of a new data ratio can be predicted by the accuracies corresponding to different data ratios, so that the best data ratio can be selected from a variety of data ratios. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0042] Figure 1 A flowchart of the first embodiment of the method for determining the data ratio of this application is provided;

[0043] Figure 2 A schematic diagram of a training set determination process provided in accordance with an embodiment of a method for determining a data ratio in this application;

[0044] Figure 3 A schematic diagram of a target model determination process provided in accordance with an embodiment of a method for determining a data ratio in this application;

[0045] Figure 4 This is a schematic diagram of the module structure of the data ratio determination system in the embodiment of the present application;

[0046] Figure 5 Schematic diagram of the device structure of the hardware operating environment involved in the data ratio determination method in the embodiment of the present application.

[0047] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0048] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0049] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0050] Fine-tuning a large model refers to the process of further training and adjusting a pre-trained large model for a specific task or dataset to make the model better suited to new tasks or improve performance. Usually, a large amount of data in a specific field is introduced during the fine-tuning stage of the model so that the model can better adapt to downstream tasks.

[0051] However, the datasets used for fine-tuning are usually large in scale, widely sourced, and of varying quality, which will make it difficult for the fine-tuned model to achieve the expected results. Therefore, in the model fine-tuning stage, how to determine the ratio of datasets in different fields so that the fine-tuned model can achieve the expected results is a technical problem that has yet to be solved by those skilled in the art.

[0052] To solve the above problems, the present application randomly generates a first number of data ratio information and determines the training sets corresponding to each piece of data ratio information, wherein the data ratio information includes the corresponding proportions of different types of data, so that training sets corresponding to different data ratios can be obtained; then, the target models fine-tuned by each training set are obtained, and the preset test sets are respectively input into each target model to obtain the actual accuracy corresponding to each piece of data ratio information, and the accuracy corresponding to the data ratio can be obtained based on the target model; then, a regression model is trained based on each piece of data ratio information and each actual accuracy, and the randomly generated second number of data ratio information is processed by the trained regression model to obtain each prediction accuracy, and each new piece of data ratio information can be processed by the regression model that has learned the relationship between data ratio and accuracy, so as to predict the accuracy corresponding to each piece of new data ratio information; then, the highest prediction accuracy among the prediction accuracies is determined, and the data ratio information corresponding to the highest prediction accuracy is used as the target data ratio, so as to obtain the best data ratio.

[0053] In the present application, the accuracy of a new data ratio can be predicted by the accuracies corresponding to different data ratios, so that the best data ratio can be selected from a variety of data ratios.

[0054] It should be noted that the execution subject of the data ratio determination method of the present application may be an electronic device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a server, etc. The following takes a server as an example to illustrate various embodiments of the data ratio determination method of the present application.

[0055] Based on this, the present application embodiment provides a method for determining a data ratio, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the data ratio determination method of the present application.

[0056] In this embodiment, the data ratio determination method includes steps S10 to S40:

[0057] Step S10, randomly generating a first number of data ratio information, and determining a training set corresponding to each of the data ratio information, wherein the data ratio information includes the corresponding proportions of different types of data;

[0058] It should be noted that data types may include: summary, question and answer, information extraction, reading comprehension, natural language reasoning, intent recognition, type classification, field classification, circulation classification, government question and answer, and knowledge base question and answer. Different data types correspond to different capabilities. For example, data with a summary data type can be used to train the model's ability to extract summaries; data with a question and answer data type can be used to train the model's ability to answer questions. In this embodiment, the data used to train the model include the above 11 data types, and the different proportions of different data types can be used to determine the training sets for each training model.

[0059] Specifically, the sum of the proportions of each data type in each data ratio information is 100%, and the specific proportion of the data type can be determined by a random number. Therefore, for 11 data types, a first amount of data ratio information can be generated in advance, thereby obtaining a first amount of data ratio schemes. It should be noted that the specific value of the first amount is not limited in this application. Preferably, the first amount can be 20 times the number of data types.

[0060] After obtaining the first amount of data ratio information, data can be randomly extracted from the database corresponding to each data type according to the proportion of each data type in each data ratio information, and the extracted data can be combined based on the data ratio information, so as to obtain a training set corresponding to the data ratio information.

[0061] Please refer to Figure 2 In a feasible implementation manner, the above step S10 includes:

[0062] Step S101, obtaining the total number of data, wherein the total number of data is the total number of data items in a preset training set;

[0063] It is understandable that when extracting data for training the model according to the data ratio information, it is first necessary to determine the total number of data items required for the training set. In a feasible implementation, the total number of data is pre-set. For example, the total number of data can be 180,000.

[0064] Step S102, determining the number of data items of each type corresponding to each piece of data matching information according to the total number of data and the proportions corresponding to each type of data in each piece of data matching information;

[0065] It can be understood that the number of data items is the product of the total number of data and the proportion.

[0066] Step S103: randomly extracting from the data sets corresponding to the respective types based on the number of the respective data items, to obtain training sets corresponding to the respective data matching information.

[0067] It can be understood that after determining the number of data entries corresponding to each data type in each data matching information, data can be extracted from the database corresponding to each data type by random sampling, and the extracted data belonging to the same data matching information can be combined to obtain the training sets corresponding to each data matching information.

[0068] Step S20, obtaining the target models fine-tuned by each of the training sets, and inputting the preset test sets into each of the target models to obtain the actual accuracy corresponding to each of the data matching information;

[0069] It should be noted that the actual accuracy refers to the degree of match between the output of the fine-tuned target model and the label of the test set. The higher the actual accuracy, the better the effect of characterizing the target model. The target model is a pre-set model, and this application does not limit the type of the target model.

[0070] In this embodiment, the training set obtained in the above step S10 will be used to fine-tune the target model. Specifically, the number of target models is consistent with the number of data matching information. For example, when the target model is model A, if there are N data matching information, then there are N models A. Then, the target model and the training set can be fine-tuned through a one-to-one correspondence. Then, the server can obtain each target model after fine-tuning, and input the pre-set test set into each target model respectively, so as to obtain the actual accuracy corresponding to each data matching information.

[0071] In a feasible implementation manner, the above step S20 includes:

[0072] Step S201, inputting a preset test set into each of the target models respectively to obtain a prediction probability distribution output by each of the target models;

[0073] It should be noted that the predicted probability distribution refers to the output results of the model for different categories (in classification problems) or different value ranges (in generation problems, etc.) expressed in the form of probability.

[0074] Step S202, according to the actual probability distribution of the test set and each of the predicted probability distributions, calculate the cross entropy corresponding to each of the target models, and determine the actual accuracy corresponding to each of the data matching information based on each of the cross entropies.

[0075] It should be noted that in the actual probability distribution, the probability of the category corresponding to the label of the data in the test set is 1, and the probability of other categories is 0.

[0076] In this embodiment, the actual accuracy can be represented by the cross entropy, so that the effect of the model can be accurately measured by the actual accuracy.

[0077] Step S30, training a regression model based on each of the data ratio information and each of the actual accuracies, and processing the randomly generated second amount of data ratio information by the trained regression model to obtain each prediction accuracy;

[0078] It should be noted that the regression model can learn the relationship between the data ratio information and the actual accuracy. Therefore, for the randomly generated second number of new data ratio information, the regression model can output the accuracy corresponding to each new data ratio information. In this embodiment, the prediction accuracy is the accuracy output by the regression model after learning the relationship between the data ratio information and the actual accuracy. In a feasible implementation, the second number can be greater than the first number.

[0079] Step S40, determining the highest prediction accuracy among the prediction accuracies, and using the data matching information corresponding to the highest prediction accuracy as the target data matching.

[0080] Exemplarily, the first number may be 200, and the second number may be 10,000. After obtaining the actual accuracy corresponding to each of the 200 data ratio information, the regression model may be trained according to each proportion in the 200 data ratio information, and the actual accuracy corresponding to each of the 200 data ratio information. Then, the 10,000 randomly generated data ratio information may be input into the trained regression model to obtain the prediction accuracy corresponding to each of the 10,000 data ratio information. Assuming that the prediction accuracy of the 100th data ratio information is the highest, the target data ratio is the data ratio in the 100th data ratio information.

[0081] In this embodiment, by randomly generating a first amount of data ratio information and determining a training set corresponding to each piece of data ratio information, wherein the data ratio information includes the corresponding proportions of different types of data, training sets corresponding to different data ratios can be obtained; then, the target models fine-tuned by each training set are obtained, and the preset test sets are respectively input into each target model to obtain the actual accuracy corresponding to each piece of data ratio information, and the accuracy corresponding to the data ratio can be obtained based on the target model; then, a regression model is trained based on each piece of data ratio information and each actual accuracy, and the randomly generated second amount of data ratio information is processed by the trained regression model to obtain each prediction accuracy, and each new piece of data ratio information can be processed by the regression model that has learned the relationship between data ratio and accuracy, thereby predicting the accuracy corresponding to each piece of new data ratio information; then, the highest prediction accuracy among the prediction accuracies is determined, and the data ratio information corresponding to the highest prediction accuracy is used as the target data ratio, thereby obtaining the best data ratio.

[0082] In the present application, the accuracy of a new data ratio can be predicted by the accuracies corresponding to different data ratios, so that the best data ratio can be selected from a variety of data ratios.

[0083] Furthermore, based on the above-mentioned first embodiment of the method for determining the data ratio of the present application, a second embodiment of the method for determining the data ratio of the present application is proposed.

[0084] In this embodiment, before the above step S103, the method further includes:

[0085] Step S100, obtaining the task category of the model to be fine-tuned, and screening the data sets corresponding to each type according to the task category;

[0086] It is understandable that due to the large amount of data in the dataset and the fact that the data in the dataset may not match the task category of the model to be fine-tuned, the datasets corresponding to each type can be filtered based on the task category of the model to be fine-tuned to filter out data that is not related to the task category.

[0087] For example, when the task category is sentiment analysis, data irrelevant to sentiment in each data set may be filtered out to improve the quality of the training set.

[0088] Based on this, the above step S103 also includes:

[0089] Step S1031 , randomly selecting from the filtered data sets corresponding to each of the types based on the number of each of the data items, to obtain training sets corresponding to each of the data ratio information.

[0090] In this embodiment, the method of filtering the data in the data set according to the task category can improve the quality of the training set, thereby improving the efficiency of model training.

[0091] In a feasible implementation manner, before the above step S102, the method further includes:

[0092] Step S200, obtaining the number of parameters of the model to be fine-tuned, and determining a data volume threshold based on a preset volume multiple and the number of parameters;

[0093] It should be noted that the volume multiple is a pre-set coefficient used to limit the total number of training set data. In a feasible implementation, the volume multiple is greater than 10.

[0094] In this embodiment, the product of the number of parameters of the model to be fine-tuned and the volume multiple can be used as the data volume threshold, where the data volume threshold is the minimum total number of data that the model can effectively learn. It is understandable that if the total number of data is too small, the model will not be able to learn effectively. Therefore, this application can ensure that the model can learn effectively through the data volume threshold.

[0095] Based on this, the above step S102 includes:

[0096] Step S1021, when it is detected that the total number of data is greater than or equal to the data volume threshold, the number of data entries of each type corresponding to each data ratio information is determined according to the total number of data and the proportion corresponding to each type of data in each data ratio information.

[0097] It is understandable that when it is detected that the preset total number of data is greater than or equal to the data volume threshold, it indicates that the current total number of data can meet the conditions for the model to be effectively learned. Therefore, the number of each data item can be determined based on the total number of data.

[0098] In a feasible implementation manner, the above step S102 further includes:

[0099] Step S1022, when it is detected that the total number of data is less than the data volume threshold, the data volume threshold is used as the new total number of data, and based on the new total number of data and the corresponding proportions of each type of data in each data ratio information, the number of data entries of each type corresponding to each data ratio information is determined.

[0100] In this embodiment, if it is detected that the set total number of data is less than the data volume threshold, the data volume threshold can be used as the new total number of data to ensure that the model can be effectively learned.

[0101] Please refer to Figure 3 In a feasible implementation manner, before the above step S20, the method further includes:

[0102] Step S300, obtaining the number of parameters corresponding to each preset model, and comparing each of the parameter numbers with a preset parameter number range;

[0103] Step S400, taking the number of parameters that falls within the parameter number range as the target parameter number, and taking the model corresponding to the target parameter number as the candidate model;

[0104] Step S500: In response to a model selection instruction, a candidate model corresponding to the model selection instruction is used as a target model.

[0105] It is understandable that the more parameters the target model has, the longer it takes to fine-tune the target model and obtain the actual accuracy. Therefore, when determining the target model, the number of parameters of the model can be used as a criterion for screening. In this embodiment, a parameter number range can be pre-set, and then models that meet the parameter number range can be screened out as candidate models, and then the information of each candidate model can be output for user selection. Preferably, the number of parameters of the target model can be 500 million.

[0106] In this embodiment, the present application can improve the efficiency of model fine-tuning and thus improve the efficiency of determining data ratio by screening the target model from multiple models.

[0107] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the method for determining the data ratio of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0108] This application also provides a data ratio determination system, please refer to Figure 4 , the data ratio determination system comprises:

[0109] A training set determination module 10 is used to randomly generate a first number of data ratio information and determine a training set corresponding to each of the data ratio information, wherein the data ratio information includes a proportion corresponding to each of different types of data;

[0110] The actual accuracy calculation module 20 is used to obtain the target model fine-tuned by each training set, and input the preset test set into each target model to obtain the actual accuracy corresponding to each data matching information;

[0111] The accuracy prediction module 30 is used to train a regression model based on each of the data ratio information and each of the actual accuracies, and process the randomly generated second amount of data ratio information through the trained regression model to obtain each prediction accuracy;

[0112] The best matching ratio determination module 40 is used to determine the highest prediction accuracy among the prediction accuracies, and use the data matching ratio information corresponding to the highest prediction accuracy as the target data matching ratio.

[0113] In one embodiment, the training set determination module 10 is further configured to:

[0114] Obtaining a total number of data, wherein the total number of data is a total number of data items in a preset training set;

[0115] Determine the number of data items of each type corresponding to each piece of data matching information according to the total number of data and the proportions corresponding to each type of data in each piece of data matching information;

[0116] Based on the number of each data item, random sampling is performed in the data set corresponding to each type to obtain a training set corresponding to each data matching information.

[0117] In one embodiment, the data ratio determination system further includes:

[0118] A data screening module, used to obtain the task category of the model to be fine-tuned, and screen the data sets corresponding to each type according to the task category;

[0119] Based on this, the training set determination module 10 is also used for:

[0120] Based on the number of each data item, random sampling is performed in the filtered data set corresponding to each type to obtain a training set corresponding to each data ratio information.

[0121] In one embodiment, the data ratio determination system further includes:

[0122] A parameter volume determination module, used to obtain the number of parameters of the model to be fine-tuned, and determine a data volume threshold based on a preset volume multiple and the number of parameters;

[0123] Based on this, the training set determination module 10 is also used for:

[0124] When it is detected that the total number of data is greater than or equal to the data volume threshold, the number of data entries of each type corresponding to each data ratio information is determined according to the total number of data and the proportion corresponding to each type of data in each data ratio information.

[0125] In one embodiment, the training set determination module 10 is further used for:

[0126] When it is detected that the total number of data is less than the data volume threshold, the data volume threshold is used as the new total number of data, and the number of data entries of each type corresponding to each data matching information is determined based on the new total number of data and the corresponding proportions of each type of data in each data matching information.

[0127] In one embodiment, the actual accuracy calculation module 20 is further used for:

[0128] Inputting the preset test sets into each of the target models respectively to obtain the predicted probability distribution output by each of the target models;

[0129] According to the actual probability distribution of the test set and each of the predicted probability distributions, the cross entropy corresponding to each of the target models is calculated, and the actual accuracy corresponding to each of the data matching information is determined based on each of the cross entropies.

[0130] In one embodiment, the data ratio determination system further includes:

[0131] A numerical comparison module is used to obtain the number of parameters corresponding to each preset model, and compare each parameter number with a preset parameter number range;

[0132] A candidate model determination module, used for taking the number of parameters belonging to the parameter number range as the target parameter number, and taking the model corresponding to the target parameter number as the candidate model;

[0133] The target model determination module is used to respond to the model selection instruction and use the candidate model corresponding to the model selection instruction as the target model.

[0134] The data ratio determination system provided by the present application adopts the data ratio determination method in the above embodiment, which can solve the technical problem of how to determine the ratio of data sets in different fields so that the fine-tuned model can achieve the expected effect. Compared with the prior art, the beneficial effects of the data ratio determination system provided by the present application are the same as the beneficial effects of the data ratio determination method provided by the above embodiment, and other technical features of the data ratio determination system are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0135] The present application provides an electronic device, which includes: at least one processor; and a memory that is communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the data ratio determination method in the above-mentioned embodiment one.

[0136] Reference below Figure 5 , which shows a schematic diagram of the structure of an electronic device suitable for implementing an embodiment of the present application. Figure 5 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0137] like Figure 5 As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0138] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0139] The electronic device provided by the present application adopts the data ratio determination method in the above embodiment, which can solve the technical problem of how to determine the ratio of data sets in different fields so that the fine-tuned model can achieve the expected effect. Compared with the prior art, the beneficial effects of the electronic device provided by the present application are the same as the beneficial effects of the data ratio determination method provided by the above embodiment, and the other technical features in the electronic device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0140] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0141] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0142] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, the computer-readable program instructions being used to execute the data ratio determination method in the above-mentioned embodiment.

[0143] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0144] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.

[0145] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by an electronic device, the electronic device: randomly generates a first number of data ratio information, and determines the training sets corresponding to each data ratio information, wherein the data ratio information includes the corresponding proportions of different types of data; obtains the target models fine-tuned by each training set, and inputs the preset test sets into each target model respectively to obtain the actual accuracy corresponding to each data ratio information; trains a regression model based on each data ratio information and each actual accuracy, and processes the randomly generated second number of data ratio information through the trained regression model to obtain each prediction accuracy, wherein the second number is greater than the first number; determines the highest prediction accuracy among each prediction accuracy, and uses the data ratio information corresponding to the highest prediction accuracy as the target data ratio.

[0146] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0147] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0148] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0149] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned data ratio determination method, and can solve the technical problem of how to determine the ratio of data sets in different fields so that the fine-tuned model can achieve the expected effect. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the data ratio determination method provided in the above-mentioned embodiment, and will not be repeated here.

[0150] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned data ratio determination method when executed by a processor.

[0151] The computer program product provided by the present application can solve the technical problem of how to determine the ratio of data sets in different fields so that the fine-tuned model can achieve the expected effect. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the data ratio determination method provided by the above embodiment, which will not be repeated here.

[0152] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A method for determining a data ratio, characterized in that: The data ratio determination method comprises: Randomly generate a first number of data ratio information, and determine a training set corresponding to each of the data ratio information, wherein the data ratio information includes a corresponding proportion of different types of data; Obtaining the target models fine-tuned by each of the training sets, and inputting the preset test sets into each of the target models, respectively, to obtain the actual accuracy corresponding to each of the data matching information; Training a regression model based on each of the data ratio information and each of the actual accuracies, and processing the randomly generated second amount of data ratio information by means of the trained regression model to obtain each prediction accuracy; The highest prediction accuracy among the prediction accuracies is determined, and the data matching information corresponding to the highest prediction accuracy is used as the target data matching.

2. The data ratio determination method according to claim 1, characterized in that: The step of determining the training sets corresponding to the respective data matching information comprises: Obtaining a total number of data, wherein the total number of data is a total number of data items in a preset training set; Determine the number of data items of each type corresponding to each piece of data matching information according to the total number of data and the proportions corresponding to each type of data in each piece of data matching information; Based on the number of each data item, random sampling is performed in the data set corresponding to each type to obtain a training set corresponding to each data ratio information.

3. The data ratio determination method according to claim 2, characterized in that: Before the step of randomly selecting from the data sets corresponding to the types based on the number of each data item to obtain the training sets corresponding to each data matching information, the method further includes: Obtaining the task category of the model to be fine-tuned, and filtering the data sets corresponding to each type according to the task category; The step of randomly selecting from the data sets corresponding to the respective types based on the number of the respective data items to obtain the training sets corresponding to the respective data matching information comprises: Based on the number of each data item, random sampling is performed in the filtered data set corresponding to each type to obtain a training set corresponding to each data ratio information.

4. The data ratio determination method according to claim 2, characterized in that: Before the step of determining the number of data items of each type corresponding to each piece of data matching information according to the total number of data and the proportions corresponding to each type of data in each piece of data matching information, the method further includes: Obtaining the number of parameters of the model to be fine-tuned, and determining a data volume threshold based on a preset volume multiple and the number of parameters; The step of determining the number of data items of each type corresponding to each piece of data matching information according to the total number of data and the proportions corresponding to each type of data in each piece of data matching information comprises: When it is detected that the total number of data is greater than or equal to the data volume threshold, the number of data entries of each type corresponding to each data ratio information is determined according to the total number of data and the proportion corresponding to each type of data in each data ratio information.

5. The data ratio determination method according to claim 4, characterized in that: The step of determining the number of data items of each type corresponding to each piece of data matching information according to the total number of data and the proportions corresponding to each type of data in each piece of data matching information further includes: When it is detected that the total number of data is less than the data volume threshold, the data volume threshold is used as the new total number of data, and the number of data entries of each type corresponding to each data matching information is determined based on the new total number of data and the corresponding proportions of each type of data in each data matching information.

6. The data ratio determination method according to claim 1, characterized in that: The step of inputting the preset test set into each of the target models to obtain the actual accuracy corresponding to each of the data matching information comprises: Inputting the preset test sets into each of the target models respectively to obtain the predicted probability distribution output by each of the target models; According to the actual probability distribution of the test set and each of the predicted probability distributions, the cross entropy corresponding to each of the target models is calculated, and the actual accuracy corresponding to each of the data matching information is determined based on each of the cross entropies.

7. The data ratio determination method according to claim 1, characterized in that: Before the step of obtaining the target model fine-tuned by each of the training sets, the method further includes: Obtaining the number of parameters corresponding to each preset model, and comparing each of the parameter numbers with a preset parameter number range; Taking the number of parameters that falls within the parameter number range as the target parameter number, and taking the model corresponding to the target parameter number as the candidate model; In response to a model selection instruction, a candidate model corresponding to the model selection instruction is used as a target model.

8. A data ratio determination system, characterized in that: The data ratio determination system comprises: A training set determination module, used to randomly generate a first number of data ratio information, and determine a training set corresponding to each of the data ratio information, wherein the data ratio information includes a proportion corresponding to each of different types of data; An actual accuracy calculation module is used to obtain the target model fine-tuned by each training set, and input the preset test set into each target model to obtain the actual accuracy corresponding to each data matching information; An accuracy prediction module, used for training a regression model based on each of the data ratio information and each of the actual accuracies, and processing the randomly generated second amount of data ratio information through the trained regression model to obtain each prediction accuracy; The best matching ratio determination module is used to determine the highest prediction accuracy among the prediction accuracies, and use the data matching ratio information corresponding to the highest prediction accuracy as the target data matching ratio.

9. An electronic device, characterized in that: The electronic device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the data ratio determination method according to any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the data ratio determination method according to any one of claims 1 to 7 are implemented.