Large model increment training method and system based on dynamic sparsification
By dynamically evaluating the importance of model parameters and adjusting the network structure, combining multi-objective loss function and hybrid precision quantization strategy, the problem of fixed parameter update strategy in large model training, the model compression ratio needs to be manually preset and catastrophic forgetting in incremental training scenarios is solved, and the model training effect with efficient training, low resource consumption and good performance is achieved.
Patent Information
- Application Number
- CN202510186056.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-20
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2045-02-20
AI Technical Summary
The existing large-model training optimization methods have problems such as fixed parameter update strategy, manual preset model compression ratio, easy to cause catastrophic forgetting and large model performance losses in incremental training scenarios.
By evaluating the importance of model parameters in real time, dynamically adjusting the network structure, using multi-dimensional evaluation method, adaptive structure adjustment, adjustable capacity experience replay buffer pool, multi-objective loss function and hybrid precision quantization strategy to realize incremental training management of large models and model compression optimization.
While ensuring model performance, it significantly improves the efficiency of large-scale model training, reduces computing and storage overhead, improves GPU utilization and distributed training efficiency, controls model performance losses, and eliminates catastrophic forgetting problems.
Smart Images

Figure CN119669714A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of model training, and specifically relates to a large model incremental training method and system based on dynamic sparsification. Background Art
[0002] With the rapid development of Large Language Models (LLMs), their applications in various fields are becoming more and more extensive. However, the training and fine-tuning of large models face the problem of huge computing resource consumption. Taking GPT-3 as an example, it takes thousands of GPUs and millions of dollars to fully train a model with 175 billion parameters. Even model fine-tuning often requires a large investment of computing resources.
[0003] At present, the common large model training optimization methods mainly include: 1. Full Fine-tuning: Update all parameters of the model, which consumes a lot of computing resources and is prone to overfitting; 2. LoRA (Low-Rank Adaptation): Reduces trainable parameters through low-rank matrix decomposition, but the fixed structure may limit the model's expressiveness; 3. P-tuning: Only train the embedding of continuous prompt words, although the number of parameters is small, the effect is limited; 4. Model pruning: The model is pruned statically using preset rules, which lacks flexibility.
[0004] However, the above methods have the following problems: 1. The parameter update strategy is fixed and cannot be dynamically adjusted according to the task points; 2. The model compression ratio needs to be preset manually and lacks adaptive capabilities; 3. Catastrophic forgetting is prone to occur in incremental training scenarios; 4. The performance of the model after compression is significantly lost.
[0005] Therefore, a training method is needed that can adaptively adjust the model structure and dynamically balance computing resources and model performance. Summary of the invention
[0006] The present invention aims to overcome the problems of low training efficiency, high consumption of computing resources and large model performance loss in the existing large model training optimization methods in the prior art, and provides a large model incremental training method and system based on dynamic sparsification, which can dynamically adjust the network structure by real-time evaluation of the importance of model parameters, thereby achieving efficient training while ensuring model performance.
[0007] In order to achieve the above-mentioned object of the invention, the present invention adopts the following technical solutions: The large model incremental training method based on dynamic sparsification includes the following steps: S1, uses a multi-dimensional evaluation method to evaluate the importance of parameters of the large model and reflect the contribution of parameters to the performance of the large model; S2, uses an adaptive structural adjustment method to dynamically control the sparseness of the large model structure; S3, manages incremental training of large models by building an experience replay buffer pool with adjustable capacity and proposing a multi-objective loss function; S4, adopts a mixed precision quantization strategy to perform model compression optimization on large models.
[0008] Preferably, step S1 comprises the following steps: S11, evaluates parameter sensitivity by calculating the influence of parameters on the loss function; specifically, for the loss function In the parameters The sensitivity calculation at is approximated by the second-order Taylor expansion: ; in, Indicated in the parameter The loss function value at Representation parameters Small changes in is the loss function with respect to the parameter The first derivative of ; is the loss function with respect to the parameter The second derivative of Defining parameters Sensitivity score for: ; in, Represents the absolute value of the first-order derivative, reflecting the direct impact of parameter changes on the loss function; It represents the absolute value of the second-order derivative, reflecting the impact of parameter changes on the stability of the model; is a balance factor, which is used to adjust the relative importance of the first-order term and the second-order term, and its value range is [0,1]; Use mini-batch data to further estimate the sensitivity score : ; Where B represents a mini-batch dataset; |B| represents the batch size; git and hit represent the first-order and second-order derivatives calculated on the batch V, respectively; S12, the final sensitivity score of the parameter is smoothed by exponential sliding average: ; in, Indicates Step sensitivity score; is the smoothing coefficient, the value range is [0,1]; Indicates Step sensitivity score; S13, the final sensitivity score of the parameter is smoothed by exponential sliding average, and then combined with the evaluation indicators of other dimensions to perform multi-dimensional weighted combination calculation; specifically, the parameter The comprehensive importance score Ii is calculated as follows: ; in, is the parameter sensitivity score; is the activation value of the parameter affecting the score, and the calculation formula is: ;in, is the dataset size, For parameters In the sample The activation value on ; Ti is the task-specific score, calculated according to the specific task type: For classification tasks: ; in, Representation parameters With category labels The mutual information between them is used to measure the parameters The degree of information contribution to the classification result; the greater the mutual information, the more significant the contribution of the parameter to the classification task; For the build task: ; in, Represents KL divergence, which is used to measure parameter The output distribution P is similar to the parameter-free The difference between the output distribution Q when P and Q are respectively The output probability distribution when ; the larger the KL divergence, the greater the parameter The more significant the impact on the generated results; is the weight coefficient of each dimension, and satisfies ; S14, after obtaining the comprehensive importance score Ii, the parameter classification is performed using the quantile-based adaptive threshold method, and the classification is as follows: when , then the corresponding parameters are important parameters; among them, is the upper quartile of the score distribution, i.e. the 75% quantile; when , then the corresponding parameter is a secondary parameter; is the lower quartile of the score distribution, i.e. the 25% quantile; when , then the corresponding parameter is a non-critical parameter; Introducing a dynamic adjustment mechanism: ; in, is the threshold at the current moment; is the historical threshold at time t-1; is the target threshold calculated based on current performance and resource constraints; is the smoothing factor, and its value range is [0,1.
[0009] Preferably, step S2 comprises the following steps: S21, organize the large model parameters into equal-sized computation blocks , the size of each block is k×k; the side length k of each computational block is determined by the following formula: ; Where M is the total number of model parameters; N is the number of target calculation blocks; kmax is the maximum allowed block size; Indicates rounding up operation; S22, for each calculation block The importance of: ; in, To calculate the number of parameters in the block; To calculate the parameters within the block The overall importance score of Represents the importance score of the i-th computational block.
[0010] Preferably, step S2 further comprises the following steps: S23, design a dynamic sparsity calculation method to maintain the local continuity of the large model network structure; the specific calculation process is as follows: S231, calculate the basic sparsity sb according to resource constraints: sb=1-(Ravail / Rreq); Among them, Ravail is the current available computing resources; Rreq is the resources required for complete training of the large model; the value range of sb is [0,1]; S232, considering the performance requirements of large models, adjust the basic sparsity: ; in, is the performance change; is the baseline performance level; is the performance sensitivity coefficient, with a value range of [0,1]; sp is the sparsity after considering the performance constraint; S233, in order to maintain the local continuity of the network structure, the inter-layer correlation calculation is introduced: ; in, is the current layer index; For the layer The set of directly connected layers; For Layer The topological distance with layer j; is the distance attenuation coefficient; Presentation Layer The degree of connection with adjacent layers; S234, based on the inter-layer correlation, calculate the actual sparsity of each layer and adjust the layer sparsity: ; in, For Layer The final sparsity of is the continuity protection coefficient, with a value range of [0,1]; S235, during the training process, the sparsity is dynamically updated through a sliding window: ; in, is the level sparsity at time t; is the level sparsity at the previous moment; is the target sparsity currently calculated; is the smoothing factor, with a value range of [0,1]; S236, to ensure the rationality of sparsification, set the following constraints for constraint condition checking: Global constraints: ; Local constraints: and ; in, Indicates The sparsity of the next layer adjacent to the layer, Indicates The sparsity of the previous layer adjacent to the layer; L is the total number of network layers; smax is the maximum allowed sparsity; is the sparsity difference threshold of adjacent layers; S24, based on the calculated block importance and target sparsity, performs structure pruning: S241, sorting the calculation blocks in descending order according to the importance scores; S242, before retention important blocks; m represents the total number of original computing blocks, s represents the target sparsity, and m(1-s) represents the number of important computing blocks that need to be retained; Indicates a round-down operation; S243, performing sparse processing on the remaining blocks.
[0011] Preferably, step S2 further comprises the following steps: S25, design a progressive weight inheritance mechanism to ensure the smoothness and performance stability of large model structure adjustment, which specifically includes the following steps: S251, weight importance evaluation first evaluates the importance score of each weight : ; in, is the gradient of the loss function with respect to the weight W; represents norm operation; is a small constant to prevent division by zero; Reflects the contribution of weights to the performance of large models; S252, calculate inheritance coefficient based on weight importance : ; in, is the sigmoid activation function; is the smoothing coefficient, with a value range of [0,1], which is used to control the impact of importance on inheritance strength; As the basic inheritance rate, ensure the minimum inheritance ratio; The value range of is [0,1]; S253, adopts different inheritance strategies for weights at different levels: ; in, is the current layer index; L is the total number of network layers; f(x) is the layer modulation function: ; is the level influence factor, with a value range of [0,1], which is used to control the inheritance strength of weights at different levels; S254, weight update is performed using interpolation: ; in, is the updated weight; is the original weight; is the target weight; is the calculated inheritance coefficient; S255, introduces momentum term to smooth weights and perform momentum adjustment: ; in, is the momentum value at the current moment; represents the momentum value at time t-1; is the momentum coefficient, with a value range of [0,1]; is the final weight value; S256, dynamically adjusts inherited parameters based on performance changes during training: ; in, is the performance change; and These are all initial parameter values; and All are adjustment coefficients; and All are adjusted parameters; S257, set the safety threshold of weight change for stability protection: Maximum change: ; Relative change constraint: ; in, and r are preset thresholds; S258, regularly evaluate the performance of the large model and perform structural recovery when necessary, including the following process: Calculate the performance degradation ; Among them, P0 and P1 represent the initial performance and current performance of the model respectively; when Exceeding performance threshold The recovery mechanism is triggered when Gradually restore the pruned important computing blocks; Re-evaluate and adjust sparsity; The structure is continuously updated during the training process. The specific process is as follows: Re-evaluate the importance of computational blocks every T training steps; Adjust the large model structure according to the new importance score; Update weight inheritance coefficient; Optimize computing resource allocation.
[0012] Preferably, step S3 comprises the following steps: S31, design the following multi-objective loss function to simultaneously optimize the performance of the new task and maintain the original capabilities of the model: ; in, is the total loss function; , , is the weight coefficient of each loss term, and ; for mission-specific losses; is the knowledge distillation loss; To maintain losses for the structure; The specific definitions of each loss function are as follows: Mission Specific Losses Use corresponding loss functions for different types of tasks: For classification tasks: ; CrossEntropy represents the cross entropy loss function, which is used to measure the difference between the predicted probability distribution and the true label distribution; y_pred represents the output probability distribution predicted by the model, and y_true represents the distribution of the true label; For the build task: ; NLL stands for Negative Log-Likelihood, which is used to measure the difference between the model-generated sequence and the target sequence; For regression tasks: ; MSE stands for Mean Squared Error, which is used to calculate the average square difference between the predicted value and the true value; Knowledge Distillation Loss Used to maintain the performance of the model on the original task: ; in, is the output probability distribution of the teacher model (original model); is the output probability distribution of the student model (current model); T is the temperature parameter used to soften the probability distribution, T>1; is the balance factor, with a value range of [0,1]; KL is the Kullback-Leibler divergence; Structure retention loss Used to maintain key structural features of the model: ; in, , , is the weight coefficient, and ; Each sub-item includes feature similarity loss , Attention Consistency Loss and gradient similarity loss .
[0013] S32, during the training process, the loss weights are dynamically adjusted in the following way: ; in, Represents the weight vector of each loss item at time t. The weight value is normalized to the interval (0,1) through the softmax function, and the sum of all weights is ensured to be 1; The calculation formula for weight update is: ; in, Represents the logarithmic value of the weight at time t; Represents the logarithmic value of the weight at time t-1; Represents the learning rate, which is used to control the step size of weight update, and its value range is (0,1]; Represents the gradient of the loss function calculated on the validation set with respect to the weight; Buffer pool initialization builds a dynamically sized buffer pool ERB: ; in, are memory units for different tasks; kt is the number of current tasks; the capacity of each memory unit can be adjusted dynamically; S33, calculate the corresponding importance score for each sample x : ; in, is the loss value of the sample; G(x) is the gradient magnitude score; D(x) is the diversity score based on the distance between the sample and the stored samples; , , is the weight coefficient, and ; S34, dynamically adjust the capacity of each memory unit based on task importance : ; Among them, C is the upper limit of total capacity; Assign temperature parameters to capacity to control the hardness or softness of the assignment; is an indicator of the importance of the task; S35, using stratified sampling method to select storage samples: ; in, Represents the probability of selecting sample x; Select temperature parameters for the samples to control the randomness of the selection; S36, Design a progressive update strategy: Formulate new sample entry rules, as follows: When the buffer pool is not full, the sample is directly deposited; When the buffer pool is full, samples are replaced with the following probabilities: ; in, represents the probability of replacing the stored old sample x_old with the new sample x_new; I(x_new) represents the importance score of the new sample; I(x_old) represents the importance score of the old sample; is the sigmoid function; Establish a regular cleanup mechanism as follows: Calculate sample redundancy ; Among them, R(x) represents the average similarity between sample x and the samples stored in the memory unit; sim(x, ) represents the difference between sample x and stored sample The similarity between them; n represents the number of samples involved in the calculation; when R(x) exceeds the preset threshold, it indicates that the redundancy between the corresponding sample and the stored sample is high, and it is considered to be removed to maintain sample diversity; S37, adopts stratified sampling method to train sampling strategy, including task-level sampling and sample-level sampling: Task-level sampling: ; Sample-level sampling: ; in, is the task importance weight; is the sampling temperature parameter; S38, design an adaptive learning rate adjustment strategy based on parameter importance, as follows: For parameters , the corresponding learning rate It is calculated as follows: ; in, is the basic learning rate; For parameters Importance score; is the learning rate modulation coefficient, the value range is [0,1]; is a monotonically decreasing function.
[0014] Preferably, in step S4, the mixed precision quantization strategy specifically refers to: Different parameters are given different numerical precisions, depending on their importance: Important parameters maintain FP16 precision to ensure accuracy; Secondary parameters are quantized using INT8 to save storage space; Non-critical parameters are further reduced to INT4 precision.
[0015] The present invention also provides a large model incremental training system based on dynamic sparsification, including: The parameter evaluation module is used to evaluate the importance of the parameters of the large model using a multi-dimensional evaluation method to reflect the contribution of the parameters to the performance of the large model; Dynamic sparsification control module, used to dynamically sparsify the large model structure using an adaptive structural adjustment method; The incremental training management module is used to manage the incremental training of large models by building an experience replay buffer pool with adjustable capacity and proposing a multi-objective loss function; The optimization module is used to use a mixed precision quantization strategy to perform model compression optimization on large models.
[0016] Compared with the prior art, the present invention has the following beneficial effects: (1) In terms of training efficiency, the present invention significantly improves the speed of large model training; through dynamic sparsification and parameter importance evaluation mechanism, the calculation amount of non-essential parameters is reduced, so that the training time is shortened by more than 60%. At the same time, due to the adoption of a sparsification scheme based on computing blocks, the computing density is improved, the GPU utilization rate is increased by 35%, and the overall training throughput is increased by 2.5 times; (2) In terms of resource consumption, the present invention greatly reduces the computing and storage overhead; through mixed precision quantization and dynamic structure adjustment, the GPU video memory usage in the model training process is reduced by 50%, and the storage space requirement is reduced by 55%; especially in the multi-card training scenario, through the optimized parameter update strategy, the communication overhead is significantly reduced, making the distributed training more efficient. The rate is increased by 40%; (3) In terms of model performance, the present invention well guarantees the effect of the compressed model; through a carefully designed parameter importance evaluation mechanism and a progressive weight inheritance strategy, the performance loss of the core task is controlled within 3% when the model size is reduced by 60%; at the same time, through an effective incremental training mechanism, the adaptability of new tasks is significantly improved, and the catastrophic forgetting problem is basically eliminated; (4) In terms of deployment and application, the present invention optimizes the actual use cost of the model; through adaptive model compression technology, the requirements for hardware devices are reduced, so that the model can run on more popular hardware platforms; actual measurements show that the compressed model reduces the inference delay by 45%, and the memory usage during runtime is reduced by 50%, which greatly reduces the cost of model deployment and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A flowchart of the large model incremental training method based on dynamic sparsification in the present invention in practical application; Figure 2 This is a percentage improvement effect diagram obtained by using the large model incremental training method based on dynamic sparsification in the present invention. DETAILED DESCRIPTION
[0018] In order to more clearly illustrate the embodiments of the present invention, the specific implementation methods of the present invention will be described below with reference to the accompanying drawings. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those of ordinary skill in the art, other accompanying drawings and other implementation methods can be obtained based on these accompanying drawings without creative work.
[0019] The present invention provides a large model incremental training method based on dynamic sparsification, comprising the following steps: 1. Use a multi-dimensional evaluation method to evaluate the importance of parameters of large models and reflect the contribution of parameters to the performance of large models; 2. Adopt adaptive structural adjustment method to dynamically control the sparseness of large model structure; 3. Manage incremental training of large models by building an experience replay buffer pool with adjustable capacity and proposing a multi-objective loss function; 4. Use mixed precision quantization strategy to perform model compression optimization on large models.
[0020] The specific calculation process of each step is as described in the summary of the invention, and will not be elaborated in detail in the embodiment.
[0021] In addition, the present invention also provides a large model incremental training system based on dynamic sparsification, including: The parameter evaluation module is used to evaluate the importance of the parameters of the large model using a multi-dimensional evaluation method to reflect the contribution of the parameters to the performance of the large model; Dynamic sparsification control module, used to dynamically sparsify the large model structure using an adaptive structural adjustment method; The incremental training management module is used to manage the incremental training of large models by building an experience replay buffer pool with adjustable capacity and proposing a multi-objective loss function; The optimization module is used to use a mixed precision quantization strategy to perform model compression optimization on large models.
[0022] Based on the technical solution of the present invention, the following case scenario is used to illustrate the implementation process of the present invention in practical application. The specific application implementation plan is as follows: like Figure 1 As shown, the method of the present invention takes the incremental training of the GPT-3 175B large-scale language model as an example for explanation during training. The entire training process is divided into three stages: the initial deployment stage, the incremental update stage, and the performance protection stage.
[0023] 1. Initial deployment phase (1) Basic model preparation: GPT-3 175B is selected as the base model, batch_size=32, learning_rate=1e-5 is set, and the parameter importance evaluation module is initialized.
[0024] (2) Parameter importance evaluation: For the input data batch, the sensitivity of each parameter is calculated. The actual evaluation results show: The sensitivity of the Transformer attention layer parameters is about 0.82; The sensitivity of FFN layer parameters is about 0.65; The Embedding layer parameter sensitivity is about 0.43; (3) Initial structure tailoring, based on the sensitivity score, the parameters are divided into three categories: Important parameters (sensitivity > 0.7): maintain FP16 accuracy; Minor parameters (0.3≤sensitivity≤0.7): reduced to INT8 precision; Non-critical parameters (sensitivity < 0.3): Reduce to INT4 precision or prune; The actual compression effect shows that the model size is reduced from 350GB to 140GB, the computing resource requirements are reduced by 55%, and the inference delay is reduced from 200ms to 110ms.
[0025] 2. Incremental update phase Take the newly added medical field data training as an example: (1) Data access processing: collect 1 million medical conversation data, standardize the data format, and calculate the data feature distribution.
[0026] (2) Dynamic evaluation and update: Calculate the impact of the newly added medical data batch and perform layered updates based on the impact scores: High impact layer (impact > 0.6): full update; Medium impact layer (0.3<influence≤0.6): sparse update; Low impact layer (impact ≤ 0.3): keep parameters frozen; (3) Incremental training management. The training configuration uses batch_size=16, learning_rate=5e-6, and max_steps=10000. During the training process, the performance changes are checked every 100 steps and the update strategy is adjusted dynamically.
[0027] 3. Performance protection stage (1) Performance monitoring: a comprehensive evaluation is performed every 1000 steps, including: Calculate the accuracy of medical question answers; Test general task performance; Check resource usage; (2) Structural recovery check: When the performance drops by more than 10%, the recovery mechanism is triggered, including: Calculate the contribution of each layer to performance; Recover accuracy layer by layer in order of importance; Stop when performance recovers to more than 90% of baseline; The actual recovery effect shows that the accuracy of medical question-and-answering has recovered from 82% to 93%, the performance of general tasks has remained above 95% of the baseline, and the additional resource overhead has increased by about 15%.
[0028] (3) Long-term stability protection, regular maintenance operations, including: Conduct a full assessment once a week; Dynamically adjust the sparsity threshold; Update parameter importance scores; After 6 months of actual operation verification, the system has shown good stability, including: No noticeable performance degradation; Dynamic sparsity is adaptively adjusted between 35% and 65%; Resource utilization increased by 40%; The actual application data of this embodiment shows that compared with the traditional fixed-ratio pre-trained model pruning method, the present invention has achieved significant improvements in training efficiency, storage space, inference latency, etc., including: Training efficiency increased by 2.5 times; Save 60% of storage space; Inference latency reduced by 45%; The model performance loss is controlled within 3%.
[0029] These data fully demonstrate the practical value and technical advantages of the present invention in the large-model incremental training scenario.
[0030] like Figure 2 As shown, through a large number of experimental verifications, the method of the present invention has obvious advantages in the following aspects: First, in terms of training efficiency, the speed of large model training has been significantly improved. Through dynamic sparsification and parameter importance evaluation mechanisms, the amount of calculation of non-essential parameters has been reduced, shortening the training time by more than 60%. At the same time, due to the use of a sparsification solution based on computing blocks, the computing density has been improved, the GPU utilization rate has been increased by 35%, and the overall training throughput has been increased by 2.5 times.
[0031] Secondly, in terms of resource consumption, the present invention significantly reduces computing and storage overhead. Through mixed precision quantization and dynamic structural adjustment, the GPU memory usage of the model training process is reduced by 50%, and the storage space requirement is reduced by 55%. Especially in the multi-card training scenario, the communication overhead is significantly reduced through the optimized parameter update strategy, which improves the efficiency of distributed training by 40%.
[0032] Third, in terms of model performance, the present invention well ensures the effect of the compressed model. Through a carefully designed parameter importance evaluation mechanism and a progressive weight inheritance strategy, the performance loss of the core task is controlled within 3% when the model size is reduced by 60%. At the same time, through an effective incremental training mechanism, the adaptability of new tasks has been significantly improved, and the catastrophic forgetting problem has been basically eliminated.
[0033] Finally, in terms of deployment and application, the present invention optimizes the actual use cost of the model. Through adaptive model compression technology, the requirements for hardware devices are reduced, allowing the model to run on more popular hardware platforms. Actual measurements show that the compressed model reduces inference latency by 45% and memory usage during runtime by 50%, which greatly reduces the cost of model deployment and maintenance.
[0034] The innovative features of the present invention are as follows: 1. In terms of the dynamic evaluation method of parameter importance, a multi-dimensional evaluation mechanism is proposed, including a parameter sensitivity calculation method based on the second-order Taylor expansion, an influence analysis method based on the activation value distribution, and a task-specific evaluation index system. This evaluation system can fully and accurately reflect the contribution of parameters to model performance, providing a reliable basis for subsequent structural adjustments.
[0035] 2. In terms of the implementation mechanism of adaptive sparsification, the present invention designs a unique dynamic structure adjustment scheme, including an adaptive sparsity calculation method based on resource constraints, a local sparsification strategy based on computing blocks, and a progressive weight inheritance mechanism. These technologies ensure that the model structure can be dynamically adjusted according to actual needs, while improving the stability of the training process.
[0036] 3. In terms of anti-forgetting strategies for incremental training, this paper proposes innovative solutions, including an experience replay mechanism based on adjustable capacity, a differentiated parameter update strategy, and a loss function design for multi-objective optimization. These technologies effectively solve the problem of catastrophic forgetting in incremental learning, allowing the model to continue to learn new knowledge while maintaining its original capabilities.
[0037] 4. In terms of performance protection methods for model compression, the present invention has developed a complete set of technical systems, including a mixed precision quantization scheme based on parameter importance, a multi-level structural optimization technology, and a performance recovery mechanism. These technologies optimize the model size and computational efficiency while maximizing the model performance.
[0038] The above description is only a detailed description of the preferred embodiments and principles of the present invention. For ordinary technicians in this field, according to the ideas provided by the present invention, there will be changes in the specific implementation methods, and these changes should also be regarded as the protection scope of the present invention.
Claims
1. A large model incremental training method based on dynamic sparsification, characterized in that: The method comprises the following steps: S1, uses a multi-dimensional evaluation method to evaluate the importance of parameters of the large model and reflect the contribution of parameters to the performance of the large model; S2, uses an adaptive structural adjustment method to dynamically sparsify the large model structure; S3, manages incremental training of large models by building an experience replay buffer pool with adjustable capacity and proposing a multi-objective loss function; S4, adopts a mixed precision quantization strategy to perform model compression optimization on large models.
2. The large model incremental training method based on dynamic sparsification according to claim 1 is characterized in that: Step S1 includes the following steps: S11, evaluates parameter sensitivity by calculating the influence of parameters on the loss function; specifically, for the loss function In the parameters The sensitivity calculation at is approximated by the second-order Taylor expansion: ; in, Indicated in the parameter The loss function value at Representation parameters Small changes in is the loss function with respect to the parameter The first derivative of ; is the loss function with respect to the parameter The second derivative of Defining parameters Sensitivity score for: ; in, Represents the absolute value of the first-order derivative, reflecting the direct impact of parameter changes on the loss function; It represents the absolute value of the second-order derivative, reflecting the impact of parameter changes on the stability of the model; is a balance factor, which is used to adjust the relative importance of the first-order term and the second-order term, and its value range is [0,1]; Use mini-batch data to further estimate the sensitivity score : ; Where B represents a mini-batch dataset; |B| represents the batch size; git and hit represent the first-order and second-order derivatives calculated on the batch V, respectively; S12, the final sensitivity score of the parameter is smoothed by exponential sliding average: ; in, Indicates Step sensitivity score; is the smoothing coefficient, the value range is [0,1]; Indicates Step sensitivity score; S13, the final sensitivity score of the parameter is smoothed by exponential sliding average, and then combined with the evaluation indicators of other dimensions to perform multi-dimensional weighted combination calculation; specifically, the parameter The comprehensive importance score Ii is calculated as follows: ; in, is the parameter sensitivity score; is the activation value of the parameter affecting the score, and the calculation formula is: ;in, is the dataset size, For parameters In the sample The activation value on ; Ti is the task-specific score, calculated according to the specific task type: For classification tasks: ; in, Representation parameters With category labels The mutual information between them is used to measure the parameters The degree of information contribution to the classification result; the greater the mutual information, the more significant the contribution of the parameter to the classification task; For the build task: ; in, Represents KL divergence, which is used to measure parameter The output distribution P is similar to the parameter-free The difference between the output distribution Q when P and Q are respectively The output probability distribution when ; the larger the KL divergence, the greater the parameter The more significant the impact on the generated results; is the weight coefficient of each dimension, and satisfies ; S14, after obtaining the comprehensive importance score Ii, the parameter classification is performed using the quantile-based adaptive threshold method, and the classification is as follows: when , then the corresponding parameters are important parameters; among them, is the upper quartile of the score distribution, i.e. the 75% quantile; when , then the corresponding parameter is a secondary parameter; is the lower quartile of the score distribution, i.e. the 25% quantile; when , then the corresponding parameter is a non-critical parameter; Introducing a dynamic adjustment mechanism: ; in, is the threshold at the current moment; is the historical threshold at time t-1; is the target threshold calculated based on current performance and resource constraints; is the smoothing factor, and its value range is [0,1].
3. The large model incremental training method based on dynamic sparsification according to claim 2 is characterized in that: Step S2 includes the following steps: S21, organize the large model parameters into equal-sized computation blocks , the size of each block is k×k; the side length k of each computational block is determined by the following formula: ; Where M is the total number of model parameters; N is the number of target calculation blocks; kmax is the maximum allowed block size; Indicates rounding up operation; S22, for each calculation block The importance of: ; in, To calculate the number of parameters in the block; To calculate the parameters within the block The overall importance score of Represents the importance score of the i-th computational block.
4. The large model incremental training method based on dynamic sparsification according to claim 3 is characterized in that: Step S2 also includes the following steps: S23, design a dynamic sparsity calculation method to maintain the local continuity of the large model network structure; the specific calculation process is as follows: S231, calculate the basic sparsity sb according to resource constraints: sb=1-(Ravail / Rreq); Among them, Ravail is the current available computing resources; Rreq is the resources required for complete training of the large model; the value range of sb is [0,1]; S232, considering the performance requirements of large models, adjust the basic sparsity: ; in, is the performance change; is the baseline performance level; is the performance sensitivity coefficient, with a value range of [0,1]; sp is the sparsity after considering the performance constraint; S233, in order to maintain the local continuity of the network structure, the inter-layer correlation calculation is introduced: ; in, is the current layer index; For the layer The set of directly connected layers; For Layer The topological distance with layer j; is the distance attenuation coefficient; Presentation Layer The degree of connection with adjacent layers; S234, based on the inter-layer correlation, calculate the actual sparsity of each layer and adjust the layer sparsity: ; in, For Layer The final sparsity of is the continuity protection coefficient, with a value range of [0,1]; S235, during the training process, the sparsity is dynamically updated through a sliding window: ; in, is the level sparsity at time t; is the level sparsity at the previous moment; is the target sparsity currently calculated; is the smoothing factor, with a value range of [0,1]; S236, to ensure the rationality of sparsification, set the following constraints for constraint condition checking: Global constraints: ; Local constraints: and ; in, Indicates The sparsity of the next layer adjacent to the layer, Indicates The sparsity of the previous layer adjacent to the layer; L is the total number of network layers; smax is the maximum allowed sparsity; is the sparsity difference threshold of adjacent layers; S24, based on the calculated block importance and target sparsity, performs structure pruning: S241, sorting the calculation blocks in descending order according to the importance scores; S242, before retention important blocks; m represents the total number of original computing blocks, s represents the target sparsity, and m(1-s) represents the number of important computing blocks that need to be retained; Indicates a round-down operation; S243, performing sparse processing on the remaining blocks.
5. The large model incremental training method based on dynamic sparsification according to claim 4 is characterized in that: Step S2 also includes the following steps: S25, design a progressive weight inheritance mechanism to ensure the smoothness and performance stability of large model structure adjustment, which specifically includes the following steps: S251, weight importance evaluation first evaluates the importance score of each weight : ; in, is the gradient of the loss function with respect to the weight W; represents norm operation; is a small constant to prevent division by zero; Reflects the contribution of weights to the performance of large models; S252, calculate inheritance coefficient based on weight importance : ; in, is the sigmoid activation function; is the smoothing coefficient, with a value range of [0,1], which is used to control the impact of importance on inheritance strength; As the basic inheritance rate, ensure the minimum inheritance ratio; The value range of is [0,1]; S253, adopts different inheritance strategies for weights at different levels: ; in, is the current layer index; L is the total number of network layers; f(x) is the layer modulation function: ; is the level influence factor, with a value range of [0,1], which is used to control the inheritance strength of weights at different levels; S254, weight update is performed using interpolation: ; in, is the updated weight; is the original weight; is the target weight; is the calculated inheritance coefficient; S255, introduces momentum term to smooth weights and perform momentum adjustment: ; in, is the momentum value at the current moment; represents the momentum value at time t-1; is the momentum coefficient, with a value range of [0,1]; is the final weight value; S256, dynamically adjusts inherited parameters based on performance changes during training: ; in, is the performance change; and These are all initial parameter values; and All are adjustment coefficients; and All are adjusted parameters; S257, set the safety threshold of weight change for stability protection: Maximum change: ; Relative change constraint: ; in, and r are preset thresholds; S258, regularly evaluate the performance of the large model and perform structural recovery when necessary, including the following process: Calculate the performance degradation ; Among them, P0 and P1 represent the initial performance and current performance of the model respectively; when Exceeding performance threshold The recovery mechanism is triggered when Gradually restore the pruned important computing blocks; Re-evaluate and adjust sparsity; The structure is continuously updated during the training process. The specific process is as follows: Re-evaluate the importance of computational blocks every T training steps; Adjust the large model structure according to the new importance score; Update weight inheritance coefficient; Optimize computing resource allocation.
6. The large model incremental training method based on dynamic sparsification according to claim 5 is characterized in that: Step S3 includes the following steps: S31, design the following multi-objective loss function to simultaneously optimize the performance of the new task and maintain the original capabilities of the model: ; in, is the total loss function; , , is the weight coefficient of each loss term, and ; for mission-specific losses; is the knowledge distillation loss; To maintain losses for the structure; S32, during the training process, the loss weights are dynamically adjusted in the following way: ; in, Represents the weight vector of each loss item at time t. The weight value is normalized to the interval (0,1) through the softmax function, and the sum of all weights is ensured to be 1; The calculation formula for weight update is: ; in, Represents the logarithmic value of the weight at time t; Represents the logarithmic value of the weight at time t-1; Represents the learning rate, which is used to control the step size of weight update, and its value range is (0,1]; Represents the gradient of the loss function calculated on the validation set with respect to the weight; Buffer pool initialization builds a dynamically sized buffer pool ERB: ; in, are memory units for different tasks; kt is the number of current tasks; the capacity of each memory unit can be adjusted dynamically; S33, calculate the corresponding importance score for each sample x : ; in, is the loss value of the sample; G(x) is the gradient magnitude score; D(x) is the diversity score based on the distance between the sample and the stored samples; , , is the weight coefficient, and ; S34, dynamically adjust the capacity of each memory unit based on task importance : ; Among them, C is the upper limit of total capacity; Assign temperature parameters to capacity to control the hardness or softness of the assignment; is an indicator of the importance of the task; S35, using stratified sampling method to select storage samples: ; in, Represents the probability of selecting sample x; Select temperature parameters for the samples to control the randomness of the selection; S36, Design a progressive update strategy: Formulate new sample entry rules, as follows: When the buffer pool is not full, the sample is directly deposited; When the buffer pool is full, samples are replaced with the following probabilities: ; in, represents the probability of replacing the stored old sample x_old with the new sample x_new; I(x_new) represents the importance score of the new sample; I(x_old) represents the importance score of the old sample; is the sigmoid function; Establish a regular cleanup mechanism as follows: Calculate sample redundancy ; Among them, R(x) represents the average similarity between sample x and the samples stored in the memory unit; sim(x, ) represents the difference between sample x and stored sample The similarity between them; n represents the number of samples involved in the calculation; when R(x) exceeds the preset threshold, it indicates that the redundancy between the corresponding sample and the stored sample is high, and it is considered to be removed to maintain sample diversity; S37, adopts stratified sampling method to train sampling strategy, including task-level sampling and sample-level sampling: S38, design an adaptive learning rate adjustment strategy based on parameter importance, as follows: For parameters , the corresponding learning rate It is calculated as follows: ; in, is the basic learning rate; For parameters Importance score; is the learning rate modulation coefficient, the value range is [0,1]; is a monotonically decreasing function.
7. The large model incremental training method based on dynamic sparsification according to claim 6 is characterized in that: In step S4, the mixed precision quantization strategy specifically refers to: Different parameters are given different numerical precisions, depending on their importance: Important parameters maintain FP16 precision to ensure accuracy; Secondary parameters are quantized using INT8 to save storage space; Non-critical parameters are further reduced to INT4 precision.
8. A large model incremental training system based on dynamic sparsification, used to implement the large model incremental training method based on dynamic sparsification according to any one of claims 1 to 7, characterized in that: The large model incremental training system based on dynamic sparsification includes: The parameter evaluation module is used to evaluate the importance of the parameters of the large model using a multi-dimensional evaluation method to reflect the contribution of the parameters to the performance of the large model; Dynamic sparsification control module, used to dynamically sparsify the large model structure using an adaptive structural adjustment method; The incremental training management module is used to manage the incremental training of large models by building an experience replay buffer pool with adjustable capacity and proposing a multi-objective loss function; The optimization module is used to use a mixed precision quantization strategy to perform model compression optimization on large models.
Citation Information
Patent Citations
Automatic pruning method based on dynamic sparse training
CN117273111A
Cigarette appearance detection method and system
CN118212214A
Track prediction method and system based on global geographic information coding PlusCode and Transformer
CN118585961A
Three-dimensional target detection method and system based on cross-modal decoupling knowledge transfer
CN118799665A
News interpretation method and system based on natural language processing
CN119025670A
Cited By
Lightweight natural language processing large model training method
CN119862925A
Lightweight Natural Language Processing Large Model Training Method
CN119862925B
Adaptive reasoning system and method for agricultural data and server
CN119962690A
Parking lot emergency early warning method and system based on multi-point edge calculation
CN119964345A
Model security protection method and system
CN120012141A