Data mixing method, system and computer device for large model fine-tuning training

By constructing a data mixing optimization function and Scaling Law, the problems of resource waste and inefficiency in fine-tuning training of large models are solved, realizing an efficient and scientific model training process, optimizing model parameters and data selection, and improving training efficiency and quality.

CN120725096BActive Publication Date: 2026-01-16INSPUR GENERSOFT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511140548.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-15
Publication Date
2026-01-16
Estimated Expiration
2045-08-15

AI Technical Summary

Technical Problem

In the fine-tuning training of large models, the lack of scientific decision-making basis for selecting model size and data volume leads to waste of resources and high time costs. Existing methods rely on trial and error experiments, making it difficult to maximize cost-effectiveness.

Method used

By constructing a data mixing optimization function, and combining the data mixing ratio, the number of fine-tuned model parameters, and the total number of labeled training data units, a Scaling Law is established to optimize the model training process and accurately determine the optimal data mixing ratio and number of parameters.

Benefits of technology

It significantly shortens the development cycle of the model from selection to deployment, avoids waste of computing resources, improves training efficiency and quality, and maximizes cost-effectiveness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120725096B_ABST
    Figure CN120725096B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of data processing. A data mixing method, system and computer equipment for large model fine-tuning training are provided. According to the data mixing ratio of different topics in the fine-tuning data set, the fine-tuning model parameter quantity and the total number of labeled units of training data, multiple rounds of training tasks are performed. After each round of training is completed, the model loss after training is tested on the target data set. According to the data mixing ratio, the fine-tuning model parameter quantity, the total number of labeled units of training data and the model loss used in each round of training, a data mixing optimization function is constructed. The minimum value of the data mixing optimization function is taken as the target to determine the optimal data mixing ratio under different fine-tuning model parameter quantities and the total number of labeled units of training data. The application avoids a large amount of waste of computing resources, significantly shortens the research and development cycle of the model from selection to deployment, and maximizes the cost performance of fine-tuning training.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, in particular to a data mixing method and system for large model fine-tuning training and a computer device. BACKGROUND

[0002] The statements in this section merely provide background technology related to the present application and do not necessarily constitute prior art.

[0003] Currently, the development of large language models (LLM) has entered a new paradigm, i.e., from building general-purpose base models through large-scale pre-training to adapting these base models to specialized scenarios in various industries through fine-tuning. Fine-tuning training has become a core technology for releasing the application potential of large models in specific fields (such as finance, medicine, and law), and determines whether the model can efficiently and accurately complete downstream tasks. However, in the practice of fine-tuning training, researchers generally face an optimization dilemma of "fine-tuning resources-performance". The specific challenges are as follows: first, for different parameter sizes of base models (such as 7B, 32B, and 70B), how to choose the most suitable base for a specific task and budget, lacking scientific decision basis; second, for a given task, how much high-quality fine-tuning data is needed to achieve ideal performance, which is often only guessed by experience. In particular, optimizing data mixing for model training is a key challenge, which usually requires extensive experiments.

[0004] The existing mainstream method to solve the above problems relies heavily on "trial and error" experiments, i.e., for different combinations of model size and data volume, multiple complete and expensive fine-tuning training is performed, and then one with relatively good performance is selected from them. This approach not only leads to a large waste of computing resources and time cost, but also makes the large model fine-tuning training task very difficult due to the huge exploration space, and the finally selected solution is often only a local optimal solution, which is difficult to guarantee the maximum cost performance. The reason is that there is currently a lack of an effective Scaling Law for the fine-tuning training phase in the field, although the Scaling Law for the pre-training phase of large models has been studied to some extent. However, the performance evolution law of model fine-tuning tasks is more complex due to their task diversity, data heterogeneity, and model base differences, and has not been effectively modeled, so the existing Scaling Law cannot be applied to the current large model fine-tuning task. SUMMARY

[0005] In order to solve the problems in the prior art, the application provides a data mixing method and system for large model fine-tuning training and a computer device, which changes the current situation of relying on multiple expensive full fine-tuning for trial and error, avoids waste of a large amount of computing resources, significantly shortens the research and development cycle of a model from selection to deployment, and maximizes the cost performance of fine-tuning training.

[0006] In order to achieve the above object, the application adopts the following technical solutions:

[0007] In the first aspect, the application provides a data mixing method for large model fine-tuning training.

[0008] A data mixing method for large model fine-tuning training comprises the following processes:

[0009] determining a fine-tuning data set containing multiple topics;

[0010] performing multiple rounds of training tasks according to the data mixing ratio of different topics in the fine-tuning data set, the fine-tuning model parameter quantity and the total number of labeled units of training data, testing the model loss of the trained model after each round of training is completed;

[0011] constructing a data mixing optimization function according to the data mixing ratio, the fine-tuning model parameter quantity, the total number of labeled units of training data and the model loss used in each round of training, and determining the optimal data mixing ratio under different fine-tuning model parameter quantities and the total number of labeled units of training data, with the minimum value of the data mixing optimization function as the target.

[0012] In the second aspect, the application provides a data mixing system for large model fine-tuning training.

[0013] A data mixing system for large model fine-tuning training comprises:

[0014] a data set acquisition unit configured to determine a fine-tuning data set containing multiple topics;

[0015] a multiple-round mixing training unit configured to perform multiple rounds of training tasks according to the data mixing ratio of different topics in the fine-tuning data set, the fine-tuning model parameter quantity and the total number of labeled units of training data, and test the model loss of the trained model after each round of training is completed;

[0016] a mixing ratio determination unit configured to construct a data mixing optimization function according to the data mixing ratio, the fine-tuning model parameter quantity, the total number of labeled units of training data and the model loss used in each round of training, and determine the optimal data mixing ratio under different fine-tuning model parameter quantities and the total number of labeled units of training data, with the minimum value of the data mixing optimization function as the target.

[0017] In a third aspect, the present application provides a computer device, comprising: a processor and a computer readable storage medium;

[0018] a processor adapted to execute the computer program;

[0019] a computer readable storage medium having stored therein a computer program, the computer program being executed by the processor to implement the data mixing method for large model fine-tuning according to the first aspect of the present application.

[0020] Compared with the prior art, the present application has the following beneficial effects:

[0021] By deeply analyzing the key elements in the large model fine-tuning process, the present application constructs a data mixing optimization function according to the data mixing ratio, the fine-tuning model parameter quantity, the total number of labeled units of training data and the model loss in each round of training. This improvement integrates the originally scattered and complex influencing factors into a unified optimization framework. With the minimum value of the data mixing optimization function as the core target, the optimal different theme mixing ratio under the condition of different fine-tuning model parameter quantity and total number of labeled units of training data is accurately determined. In this process, the hidden internal law between model size, data quantity, different field data mixing ratio and model final performance is successfully revealed. These laws are like a precise key, providing a new perspective for understanding the complex mechanism of large model fine-tuning. Based on this, researchers no longer need to spend a lot of resources on tedious experiments. Through a small amount of low-cost verification experiments, the model performance under different configurations can be accurately predicted according to these laws. This undoubtedly provides a scientific and reliable quantitative guidance basis for key decisions such as data mixing strategy planning and model parameter setting before large model fine-tuning, and effectively improves the efficiency and quality of large model fine-tuning, laying a solid foundation for the further development and application of large model technology.

[0022] The present application can make researchers evaluate key parameters such as model scale selection, training data scale and mixing ratio of data in different fields precisely in a scientific and rigorous manner before actual training resources are invested, by establishing a fine-tuning stage Scaling Law, so that the model scale type selection, training data scale and mixing ratio of data in different fields can be evaluated precisely, on the basis of which, the present application fundamentally changes the backward status of relying on multiple expensive full-scale fine-tuning for trial and error in the past, which not only needs to consume huge computing resources, but also has a long research and development cycle and low efficiency; with the help of the Scaling Law established by the present application, the drawbacks can be skillfully avoided, and a large amount of waste of computing resources can be effectively avoided; at the same time, the present application significantly shortens the entire research and development cycle from model selection to deployment, so that the research and development process is more efficient and smooth; furthermore, the present application can maximize the cost performance of fine-tuning training, obtain the best training effect with the least resource investment under the premise of ensuring the performance of the model, and provide strong technical support and theoretical guarantee for the development and application of large model fine-tuning training technology.

[0023] The present application can consider the data mixing ratio of each round of training, fine-tuning model parameters, total number of training data marking units and model loss and other factors by constructing a data mixing optimization function, taking the minimum value of the data mixing optimization function as the target, which helps to accurately determine the optimal different theme mixing ratio under different fine-tuning model parameters and total number of training data marking units in the complex training process, thereby improving the training effect of the model; the Huber loss is introduced in the data mixing optimization function of the present application to measure the model loss, the Huber loss has good robustness to abnormal values, and by minimizing the optimization function in the training process, the overall loss of the model can be effectively reduced, so that the model has better test performance on the target data set, and the accuracy and stability of the model are improved; moreover, the data mixing optimization function contains various coefficients, such as an irreducible loss coefficient related to the fine-tuning model and the training task, a coefficient related to the data ratio, a coefficient related to the fine-tuning model parameter and a coefficient related to the total number of training data marking units, etc., these coefficients make the optimization function adapt to training tasks and data conditions with different characteristics, have strong universality and flexibility, and can be widely applied to various large model fine-tuning training scenes.

[0024] The advantages of the additional aspects of the present application will be partially given in the following description, partially become obvious from the following description, or be known by the practice of the present application. BRIEF DESCRIPTION OF DRAWINGS

[0025] The drawings accompanying the specification of the present application serve to provide a further understanding of the present application, the illustrative embodiments of the present application and the description thereof serve to explain the present application, and do not constitute an improper limitation on the present application.

[0026] Figure 1 A flowchart of a data mixing method for large model fine-tuning training provided for an exemplary embodiment of the present application is shown in FIG. 1.

[0027] Figure 2 A schematic diagram of a data mixing system for large model fine-tuning training provided for an exemplary embodiment of the present application is shown in FIG. 2.

[0028] Figure 3 A schematic diagram of a computer device provided for an exemplary embodiment of the present application is shown in FIG. 3. DETAILED DESCRIPTION

[0029] The present application will be further described below with reference to the accompanying drawings and examples.

[0030] It should be noted that the following detailed description is exemplary and is intended to provide further explanation of the present application. Unless otherwise indicated, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs.

[0031] As described in the background, at present, the use of large models to process downstream tasks usually uses fine-tuning training from data of different topics from multiple fields, and the proportion of each topic data in the fine-tuning data set plays a key role in the performance of model training. The current method for selecting the mixing ratio of model fine-tuning data relies on a large amount of manual experience and trial and error, which is not practical and scientific for large-scale model training tasks. In view of this, the present application proposes a data mixing method for large model fine-tuning training, and proposes a systematic method and a Scaling Law specifically for fine-tuning training to determine the optimal data mixing of any target field fine-tuning training, accurately predict the model training loss with mixed data ratio of and parameter quantity , and change the fine-tuning process from constant groping and trial and error to a predictable and quantifiable scientific optimization process, providing key theoretical guidance and engineering tools for efficient application of large models, and promoting the development of artificial intelligence technology.

[0032] More specifically, as shown in Figure 1 , the following processes are included:

[0033] S101: Determine a fine-tuning data set containing multiple topics;

[0034] S102: Perform multiple rounds of training tasks according to the data mixing ratio of different topics in the fine-tuning data set, the parameter quantity of the fine-tuning model, and the total number of labeled units of the training data (i.e., the token quantity of the training data), and test the model loss after each round of training on the target data set.

[0035] S103: Construct a data mixing optimization function according to the data mixing ratio for each round of training, the fine-tuning model parameter quantity, the total number of labeled units of training data, and the model loss, and determine the optimal data mixing ratio under different fine-tuning model parameter quantities and the total number of labeled units of training data, with the minimum value of the data mixing optimization function as the target.

[0036] In the present application, the fine-tuning data set for training a specific task is divided into a training set, a validation set and a test set, and the training set is further divided into a training subset and a validation subset. The weights of the fine-tuned model are derived from the pre-trained model (i.e., the fine-tuning of the model is based on the pre-trained model), and the entire fine-tuning process updates the model parameters by minimizing the loss in formula (1). However, compared with the pre-training data set, the fine-tuning data set for fine-tuning training is limited in size, and continuous optimization of the training loss is prone to overfitting, which is manifested as the model loss on the validation data set begins to rise, and the validation loss curve forms a typical U-shaped curve. Therefore, in the present application, the fine-tuning process is stopped when the validation set loss reaches the minimum point, and the model training result at this time is taken as the final fine-tuned model.

[0037] In the present application, preferably, the pre-trained large model is a "basic capability library" trained on a large amount of general data, and its weights contain language rules, world knowledge and general reasoning ability. According to the complexity of the target task, the available computing resources and the performance expectation, a pre-trained model with appropriate parameter quantity (such as 7B, 32B, 70B parameter size) is selected. For example, for a simple text classification task, a 7B parameter model may be sufficient; while for a complex legal document generation or medical diagnosis reasoning task, a 32B or 70B parameter model may be needed to ensure reasoning accuracy. The process of loading weights is not a simple file reading, but needs to map the pre-trained weights to the neural network structure of the model through the model framework (such as PyTorch, TensorFlow), to ensure that each layer parameter (such as the query matrix of the attention layer, the weight matrix of the feedforward network) is accurately matched. The key of this step is to verify the integrity and compatibility of the weights: if the weight file is missing or does not match the current model structure (such as using a different tokenizer or network layer in the pre-trained model), it needs to be corrected through a weight alignment tool (such as the from_pretrained method in the transformers library of Hugging Face) to avoid subsequent fine-tuning training failure due to parameter errors. When selecting a pre-trained model, the relevance of its pre-training data to the target task should also be considered. For example, if the target task is financial analysis, a model that has been incrementally pre-trained on financial corpus (such as Bloomberg GPT) should be preferred, as its initial weights already contain domain knowledge such as financial terminology and market rules, which can reduce the difficulty of subsequent fine-tuning.

[0038] In the present application, the fine-tuning dataset is the basis for the model to adapt to the target task, and its quality and relevance directly determine the fine-tuning effect. This step needs to collect, screen and clean data around the target task. The specific process includes: preferentially selecting high-quality and domain-focused data sources, for example, in the medical field, PubMed paper abstracts, doctor-patient dialogue records and medical guideline texts can be selected; in the legal field, judicial documents, regulations and contract templates can be selected, and low-quality data (such as containing misspelled words, logical contradictions or irrelevant content to the task) should be avoided, otherwise it will lead the model to learn incorrect information; for classification, question answering and other tasks, data needs to be manually or semi-automatically labeled. For example, medical question answering data needs to clearly define the "question-answer" pair, and the answer needs to be reviewed by a professional doctor; legal contract review data needs to be labeled with "risk clauses", "compliance clauses" and other labels. Structured processing includes unifying data formats (such as JSONL), dividing input and output fields (such as "input: patient symptom description; output: possible diagnosis result"), which is convenient for the model to read and learn; remove duplicate samples through hash algorithm (such as MD5) to avoid overfitting of the model to repeated content; remove noise data through rule filtering (such as deleting text that is too short / long), semantic filtering (such as using a pre-trained model to calculate the perplexity of the text, and deleting abnormal samples with too high perplexity). For example, if the perplexity of a sample is significantly higher than the average of the dataset, it may be an incorrect text or irrelevant content to the field, which needs to be removed.

[0039] In the present application, the model fine-tuning process loss is preferably defined as:

[0040] (1);

[0041] Wherein, represents the sample in the fine-tuning dataset , represents the parameters of the large model, is the prediction loss of the large model for the sample , represents the expected value, represents the real number set.

[0042] In order to further study the data matching problem in the fine-tuning dataset, the present application assumes that the fine-tuning dataset contains data sources of topics, that is:

[0043] (2);

[0044] The present application designs a mixed dataset from different topics, that is:

[0045] (3);

[0046] in, Representing the Data sets of various topics This represents a mixed dataset containing multiple topics. Represents the total number of data topics. Representing the The goal of this invention is to determine the mixing ratio of different topics required for fine-tuning training large models of different sizes by fine-tuning a large model with N parameters using small batches of data under different data ratios, and by using the Scaling Law to predict the model loss.

[0047] In this invention, data is directly and manually categorized by topic based on domain knowledge. For example, legal data can be divided into "Civil Law," "Criminal Law," and "Administrative Law," with each topic corresponding to a subset. Alternatively, in other implementations, for datasets with unclear topics, text clustering algorithms (such as K-Means) are used to automatically group the data. By calculating text vectors (such as using Sentence-BERT to generate sentence vectors), semantically similar samples are grouped into the same topic, and then domain experts label each cluster with a topic name. The value of needs to balance "subdivision" and "computational complexity". Too small (e.g.) Then it loses its mixed meaning. Too large (e.g.) This would increase the dimensionality of subsequent scaling optimizations, leading to a surge in computational cost. Clustering effectiveness is typically evaluated using the silhouette score, selecting a k-value that maximizes cluster cohesion and inter-cluster separation (e.g., in financial tasks). (relatively common).

[0048] In this invention, the hybrid dataset Through the Each topic subset is proportional The mixture is obtained, where, This represents a set of mixing proportions for each theme, and must satisfy two constraints:

[0049] (1) The mixing ratio is non-negative: (That is, the amount of data for each topic cannot be negative).

[0050] (2) Normalization of mixing ratio: (That is, the sum of the weights of all topics is 1, to ensure the relativity of the proportions).

[0051] For example, if , This indicates that 40% of the mixed data comes from 30% from The remaining 30% comes from The physical meaning of the blending ratio is "the proportion of tokens for each topic in the total fine-tuned data," rather than the proportion of the number of samples. This is because the token length varies significantly between samples (e.g., a paper abstract might contain 500 tokens, while a short sentence might only contain 10 tokens). Using the number of tokens as a benchmark better reflects the actual impact of the data on model training. In practice, the initial blending ratio can be based on prior knowledge. For example, if it is known that "stock trading" related scenarios account for 60% of the target task, it can be initially set... The remaining topics are allocated proportionally. However, this initial proportion is not optimal; subsequent steps will use the Scaling Law to predict its relationship with model performance, ultimately finding the optimal one. .

[0052] To avoid repeatedly storing mixed data of varying proportions (and thus saving storage space), this step requires designing a dynamic generation mechanism: that is, only storing... Each topic subdataset, before each fine-tuning training, is based on the current... The value (i.e., the mixing ratio value) is used to extract and mix tokens of a corresponding proportion in real time. For example, if the total amount of fine-tuning data tokens is... , Then from Randomly selected from token, ,from Extraction The tokens are then shuffled and combined to form a new token. The key to dynamic generation is ensuring randomness and repeatability: by fixing the random seed, it is ensured that the mixed data generated under the same data ratio are completely consistent, avoiding the impact of data order differences on the comparability of training results; at the same time, the source of the data for each mixture needs to be recorded (e.g., which samples come from...). Which ones come from This facilitates subsequent analysis of the specific impacts of different themes.

[0053] Traditional Scaling Law guidance is based on the total number of labeled units in the pre-training data. In this case, the number of parameters in the prediction model is The model training loss is addressed by extending the traditional pre-training scaling law to the field of model fine-tuning, proposing a method for predicting models with mixed data proportions. The number of training data tokens (i.e., the total number of labeled units) is The number of parameters is the model training loss, the model fine-tuning Scaling Law proposed by the present application is defined as:

[0054] (4);

[0055] wherein, represents the irreducible loss of the model and the training task, and it is are both model fine-tuning Scaling Law parameters, which depend on the model parameter quantity, the training task and the training data source, and in actual operation, they can be fitted and determined by the model training results under different settings, represents the coefficient related to the proportion of the first th theme data, represents the exponential coefficient of the mixing proportion of the first th theme, represents the total number of data themes, represents the coefficient related to the fine-tuning model parameters, represents the exponential coefficient of the model parameter quantity, represents the exponential coefficient of the total number of token units, is the loss function; is the mixed data set, that is, the token quantity of the training data. The scaling characteristics of large model fine-tuning training are highly dependent on the training task and data selection. Through the model fine-tuning Scaling Law proposed by the present application, researchers can determine the training loss and training data dependence of models of different sizes through a small amount of training verification, greatly reducing the model training cost and optimizing the model fine-tuning training parameter selection.

[0056] In order to fit the model fine-tuning Scaling Law, the present application uses the mixed data proportion of different themes, the model parameter quantity and the total number of token units of the training data to start multiple training tasks, and tests the model loss in the target data domain. By selecting the model parameter quantity and the total number of token units of the training data at equal intervals, we obtain times of model training records: , the model fine-tuning Scaling Law parameters are optimized by minimizing the standard Huber loss:

[0057] (5);

[0058] Combined with formula (4), we can get:

[0059] (6);

[0060] wherein, represents the first The number of parameters for fine-tuning the model during each training iteration. Representing the The model loss during training. Representing the The total number of labeled units in the training data of each training iteration. Representing the The training session of the 1st time The mixing ratio of each theme, Represents the total number of training rounds. Represents the loss function. represent loss, The result of the calculation is This invention optimizes the mixing ratio parameters based on formula (5). The loss function is minimized to fit the Scaling Law parameters, predicting the optimal mixing ratio of different topics under different model parameter counts and the total number of labeled units in the training data.

[0061] In this invention, the optimal fine-tuned model parameters are recorded in each training round for the calculation of the loss value. After determining the optimal mixing ratio of different topics, the model is retrained according to the optimal mixing ratio of different topics to obtain the final fine-tuned model parameters that can be deployed.

[0062] Optionally, in each round of training, the validation loss is continuously monitored; if in continuous... epochs (e.g.) If the validation loss does not fall below the current minimum (i.e., the loss no longer decreases) within a given epoch, early stopping is triggered. During training, if the validation loss in a certain epoch falls below the historical minimum, the model parameters at that time are saved as a "candidate optimal model." When early stopping is triggered, the model that is ultimately retained is the last "candidate optimal model." When the fine-tuning dataset is of limited size, if training continues, the model will overfit the training data (training loss decreases but validation loss increases, forming a U-shaped curve). Dynamic early stopping terminates training at the point of minimum validation loss, ensuring that the model retains its ability to generalize to unseen data. The loss value at this point (minimum validation loss) is the model's performance at the current mixing ratio. Model parameter count Data volume "Real performance metrics" under configuration.

[0063] Figure 2 A data mixing system for fine-tuning training of large models is shown, comprising:

[0064] Dataset acquisition unit 201 is configured to: determine a fine-tuning dataset containing multiple topics;

[0065] The multi-round mixed training unit 202 is configured to perform a multi-round training task according to the data mixing ratio of different topics in the fine-tuning data set, the fine-tuning model parameter quantity, and the total number of labeled units of training data, and test the loss of the trained model in the target data set after each round of training is completed.

[0066] The mixing ratio determination unit 203 is configured to construct a data mixing optimization function according to the data mixing ratio for each round of training, the fine-tuning model parameter quantity, the total number of labeled units of training data, and the model loss, and determine the optimal data mixing ratio under different fine-tuning model parameter quantities and the total number of labeled units of training data, taking the minimum value of the data mixing optimization function as the target.

[0067] It can be understood that the above-mentioned units can be combined into one or several other units respectively or all, or some of the units can be further split into a plurality of units with smaller functions to constitute, which can realize the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions, and the function of one unit can also be realized by multiple units, or the functions of multiple units can be realized by one unit. In other embodiments of the present application, the system can also include other units, and these functions can also be realized by other units in actual application, and can be realized by multiple units.

[0068] According to another embodiment of the present application, the system described in the embodiment can be constructed by running a computer program (including program code) capable of performing each step involved in the corresponding method of the present application on a general computing device such as a computer including processing elements and storage elements such as a Central Processing Unit (CPU), a Random Access Memory (RAM), and a Read Only Memory (ROM). The computer program can be recorded on a computer readable recording medium, loaded into the above-mentioned computing device through the computer readable recording medium, and run therein.

[0069] Figure 3 A computer device is shown, which includes a processor 301, a communication interface 302, and a computer readable storage medium 303. Wherein the processor 301, the communication interface 302 and the computer readable storage medium 303 can be connected through the bus or other ways.

[0070] The communication interface 302 is configured to receive and send data, the computer readable storage medium 303 can be stored in the memory of the electronic device, the computer readable storage medium 303 is configured to store a computer program, the computer program includes program instructions, and the processor 301 is configured to execute the program instructions stored in the computer readable storage medium 303.

[0071] The processor 301 is a computing core and a control core of the electronic device, and is adapted to implement one or more instructions, and is specifically adapted to load and execute one or more instructions to implement a corresponding method flow or a corresponding function.

[0072] The processor 301 is configured to perform the following process:

[0073] Determine a fine-tuning dataset containing multiple topics;

[0074] According to the data mixing ratio of different topics in the fine-tuning dataset, the parameter quantity of the fine-tuning model and the total number of labeled units of the training data, perform a plurality of rounds of training tasks, test the loss of the trained model on the target dataset after each round of training is completed;

[0075] According to the data mixing ratio, the parameter quantity of the fine-tuning model, the total number of labeled units of the training data and the model loss used in each round of training, construct a data mixing optimization function, and determine the optimal data mixing ratio under different parameter quantities of the fine-tuning model and the total number of labeled units of the training data, with the minimum value of the data mixing optimization function as the target.

[0076] Those of ordinary skill in the art can be aware that, in combination with the examples described in the embodiments disclosed in the present application, the units and algorithm steps of each example can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those of ordinary skill in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0077] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to the embodiments of the present application are generated. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in or transmitted by a computer readable storage medium. The computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through a wired (for example, coaxial cable, optical fiber, digital line) or wireless (for example, infrared, wireless, microwave, etc.) manner. The computer readable storage medium can be any available medium that can be accessed by a computer or a data processing device such as a server, data center, etc. integrated with one or more available media. The available media can be magnetic media (for example, floppy disk, hard disk, magnetic tape), optical media (for example, DVD), or semiconductor media (for example, solid state disk) and the like.

[0078] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. For those skilled in the art, the present application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A data mixing method for large model fine-tuning training, characterized in that, The method comprises the following steps: determining a fine-tuning data set containing multiple topics; performing multiple rounds of training tasks according to the data mixing ratio of different topics in the fine-tuning data set, the fine-tuning model parameter quantity and the total number of labeled units of training data, and testing the loss of the trained model on the target data set after each round of training is completed; constructing a data mixing optimization function according to the data mixing ratio, the fine-tuning model parameter quantity, the total number of labeled units of training data and the model loss used in each round of training, and determining the optimal data mixing ratio under different fine-tuning model parameter quantities and the total number of labeled units of training data by taking the minimum value of the data mixing optimization function as the target; The data mixing optimization function is: ; wherein, representing the model parameter quantity of the fine-tuned model of the representing the model loss of the fine-tuned model of the representing the total number of labeled units of the training data of the fine-tuned model of the representing the mixing ratio of the fine-tuned model of the representing the irreducible loss of the fine-tuned model and the training task, representing the coefficient related to the data proportion of the th topic, representing the exponential coefficient of the mixing ratio of the th topic, representing the total number of data topics, representing the coefficient related to the fine-tuned model parameter, representing the exponential coefficient of the model parameter quantity, representing the exponential coefficient of the total number of labeled units of the training data, representing the total number of training rounds, is a loss function, representing loss; Loss function including: ; wherein, represent the number of fine-tuned model parameters of the training, represent the total number of labeled units of training data of the training, represent the mixing ratio of the th topic of the training, the result of the calculation is ; When determining the fine-tuning data set containing multiple topics, a text clustering algorithm is used to calculate the text vector, and data with a semantic similarity difference less than a set threshold is classified into the same topic. The clustering effect is evaluated by the silhouette coefficient to determine the optimal total number of data topics. Alternatively, the total number of data topics and the data set corresponding to each topic are manually determined before training.

2. The data mixing method for large model fine-tuning training according to claim 1, wherein determining a fine-tuning data set containing multiple topics comprises: ; wherein, a data set representing the first a data set representing the first a data set representing the first a data set representing the total number of data topics, a data set representing the first a data set representing the mixing ratio of the first 3. The data mixing method for large model fine-tuning training according to claim 1, wherein After each round of training, the target data set is used to test the loss of the trained model, and a dynamic early stopping fine-tuning training method is used, which comprises: stopping training when the loss of the target data set reaches the minimum point, and taking the fine-tuning model training result at this time as the final fine-tuning model corresponding to the training round.

4. The data mixing method for large model fine-tuning training according to claim 1, wherein The optimal fine-tuning model parameters are recorded for loss value calculation in each round of training. After the optimal data mixing ratio of different topics is determined, the optimal data mixing ratio of different topics is used to retrain to obtain the final fine-tuning model parameters that can be deployed.

5. The data mixing method for large model fine-tuning training according to any one of claims 1-5, comprising: All data after normalization processing of the mixed proportion is added up to 1, and stored The sub-data sets of the subject are mixed in real time according to the current data mixing proportion to obtain a corresponding proportion of labeled units before each fine-tuning training, and the labeled units are mixed as a fine-tuning data set .

6. A data mixing system for large model fine-tuning training, characterized in that, The data mixing method for large model fine-tuning training according to any one of claims 1-5 comprises: a data set acquisition unit configured to determine a fine-tuning data set containing multiple topics; a multiple-round mixing training unit configured to perform multiple rounds of training tasks according to the data mixing ratio of different topics in the fine-tuning data set, the fine-tuning model parameter quantity and the total number of labeled units of training data, and test the loss of the trained model on the target data set after each round of training is completed; a mixing ratio determination unit configured to construct a data mixing optimization function according to the data mixing ratio, the fine-tuning model parameter quantity, the total number of labeled units of training data and the model loss used in each round of training, and determine the optimal data mixing ratio under different fine-tuning model parameter quantities and the total number of labeled units of training data by taking the minimum value of the data mixing optimization function as the target.

7. A computer device, comprising: comprising: a processor and a computer readable storage medium; a processor adapted to execute a computer program; A computer readable storage medium, wherein a computer program is stored in the computer readable storage medium, and the computer program, when executed by a processor, implements the data mixing method for large model fine-tuning training according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Entity extraction hybrid model training method and system, computer equipment and medium

    CN117610568A

  • Large model fine-tuning data matching method and related device

    CN119005285A