Abstract
Large language models (LLMs) fine-tuning shows excellent implications. However, vanilla fine-tuning methods often require intricate data mixture and repeated experiments for optimal generalization. To address these challenges and streamline the training process, we propose an efficient and universal solution, Dynamic Boosted Annealing (DBA). We obtain a global gradient through zero-learning-rate training on general data, which is subsequently employed for gradient boosting and dynamic training step correction during domain training. In conjunction with annealing learning, we end up establishing a fine-tuning pipeline that relies solely on domain data without collapse. By evaluating both general and domain-specific performance across multiple tasks on several popular base models, DBA achieves an average improvement of 5.8% in joint performance over vanilla fine-tuning. Furthermore, since general data is no longer involved in annealing, repeated experiments led by data mixture are also eliminated. According to our tests, the DBA method can reduce GPU hours by 91.0% compared to the vanilla method.
Introduction: The Challenge of Catastrophic Forgetting
When fine-tuning Large Language Models (LLMs) for specialized domains—such as law, medicine, or finance—researchers frequently encounter catastrophic forgetting. While the model gains expertise in the target domain, it often loses its general reasoning capabilities and linguistic "common sense."
The conventional industry solution is Data Mixture (DM), which involves blending general-domain data with domain-specific data. However, determining the optimal mixing ratio is a laborious "trial-and-error" process. This requirement for repeated, computationally expensive experiments creates a significant bottleneck, especially as the number of target domains increases.
The Dynamic Boosted Annealing (DBA) Framework
To overcome these limitations, we introduce Dynamic Boosted Annealing (DBA). This framework decouples general knowledge retention from domain-specific learning through three primary mechanisms:
- Global Gradient Boosted Learning (GGB): Instead of mixing general data during active training, DBA performs a one-time "zero-learning-rate" pass on general data to compute a "Global Gradient." This serves as a stable mathematical anchor that guides the model throughout domain fine-tuning.
- Dynamic Correction (DC): Recognizing that different domains vary in their similarity to the base model's pre-existing knowledge, DC adaptively modulates update steps. By calculating the similarity between the current domain gradient and the global gradient, the system prevents the model from deviating too far in unfamiliar territory.
- Annealing Learning (AL): Utilizing a low initial learning rate and a decay strategy, AL ensures a controlled "cool down" of the training process, allowing for the absorption of new domain knowledge without disrupting internal representations.
Experimental Setup and Datasets
The DBA framework was validated across several high-stakes vertical domains:
- Finance: Evaluated using FinGPT for sentiment analysis.
- Medicine: Benchmarked via the CMB-Exam (Chinese medicine).
- Law: Tested on LawBench for legal reasoning.
- General Capabilities: Assessed using MMLU, GSM8K, and MATH.
- News QA: A new "temporal out-of-distribution" benchmark featuring over 30,000 QA pairs from news published after December 2024, ensuring the data was unseen during base model pre-training.
Key Results and Efficiency
DBA demonstrates significant improvements in both performance and operational efficiency:
- Performance Gains: The method achieved an average 5.8% improvement in joint performance (the harmonic mean of general and domain scores) compared to vanilla fine-tuning.
- Stability: Unlike direct fine-tuning, which can lead to a total collapse of general capabilities, DBA maintained high scores across general benchmarks like MMLU.
- Computational Efficiency: By eliminating the need for repeated data mixture experiments, DBA reduced GPU hours by 91.0% (e.g., from ~76 hours to ~7 hours in specific tests).
Conclusion and Future Directions
DBA offers a "finetune once" paradigm that effectively addresses catastrophic forgetting without the overhead of complex data mixing. While currently tested on dense models like Llama 3 and Qwen, future research will explore its application to Mixture-of-Experts (MoE) architectures and multi-modal models. Additionally, while optimized for AdamW, the underlying principles of gradient anchoring provide a robust foundation for broader optimization research.
Summary updated