AIMMerging: Adaptive Iterative Model Merging Using Training Trajectories for Language Model Continual Learning

Yujie Feng, Jian Li, Xiaoyu Dong, Pengfei Xu, Xiaohui Zhou, Yujia Zhang, Zexin Lu, Yasha Wang, Alan Zhao, Xu Chu, Xiao-Ming Wu · DOI

Abstract

Continual Learning (CL) in Large Language Models (LLMs) is often hindered by the "catastrophic forgetting" phenomenon, where the acquisition of new tasks leads to the degradation of previously learned knowledge. While model merging has emerged as a promising technique to mitigate this, existing methods typically rely on static merging schedules that fail to account for the dynamic nature of the training process. This paper presents AIMMerging (Adaptive Iterative Model Merging), a framework that utilizes real-time training trajectory signals to dynamically adjust merging frequency and fusion weights. Our experiments across various benchmarks and model sizes (up to 13B parameters) demonstrate that AIMMerging significantly outperforms state-of-the-art methods, achieving an 80% relative improvement in forward knowledge transfer and a 59% improvement in backward knowledge retention.

1. Introduction

The deployment of Large Language Models (LLMs) in real-world scenarios often requires them to learn from a continuous stream of data. This process, known as Continual Learning (CL), presents a fundamental challenge: the stability-plasticity dilemma. Models must remain plastic enough to integrate new information (Forward Transfer) while maintaining stability to prevent the overwriting of historical knowledge (Backward Transfer).

Recent advancements have explored model merging—the process of combining weights from a pre-trained base model and a fine-tuned task-specific model—as a way to balance these competing objectives. However, traditional merging strategies are often rigid, employing fixed intervals or single-shot merges at the end of training. Such approaches ignore the non-linear dynamics of neural network training, where learning rates and knowledge acquisition speeds fluctuate. AIMMerging addresses this by introducing an adaptive, trajectory-guided approach to model merging.

2. Methodology

The AIMMerging framework is built upon two core innovations: the Training Trajectory-guided Merge Controller and the Rehearsal-based Knowledge Fusion Module.

2.1 Training Trajectory-guided Merge Controller

The Merge Controller acts as the decision-making engine of the framework, determining when a merge should occur based on two primary signals:

  • Learning Signal: This signal is derived from the magnitude of parameter updates during training. A high magnitude indicates a "rapid learning phase," suggesting the model is actively acquiring new task-specific features. Conversely, a downward trend suggests the model is reaching convergence.
  • Forgetting Signal: To monitor the retention of previous knowledge, the controller utilizes a small "rehearsal" buffer containing data from prior tasks. By tracking the loss on this buffer in real-time, the system can detect "forgetting spikes."

By analyzing these signals through a sliding window, the controller adaptively adjusts the merging interval. During periods of high learning or detected forgetting, the merging frequency increases to "lock in" progress and protect old knowledge.

2.2 Rehearsal-based Knowledge Fusion Module

When a merge is triggered, the Knowledge Fusion Module determines how the weights should be combined. Rather than simple parameter averaging, the module calculates dynamic fusion weights ($\alpha$). These weights are informed by the strength of the learning and forgetting signals, ensuring that the fusion process prioritizes the preservation of critical historical knowledge while allowing for the integration of new updates.

3. Experimental Setup

We evaluated AIMMerging across a range of model architectures and sizes, including T5-large (770M), Qwen3-1.7B, LLaMA2-7B, and LLaMA2-13B. The framework was tested against three distinct benchmarks:

  1. Standard CL Benchmark: Comprising five classic text classification tasks (e.g., AG News, Yelp).
  2. Long Sequence Benchmark: A challenging 15-task sequence including GLUE and SuperGLUE tasks.
  3. SuperNI Benchmark: A diverse set of 15 NLP tasks covering dialogue, summarization, and sentiment analysis to test cross-task generalization.

4. Results and Discussion

AIMMerging consistently outperformed existing baselines, such as LoRAReplay and Recurrent-KIF, across all tested scenarios.

4.1 Knowledge Retention and Transfer

On the Long Sequence benchmark, AIMMerging demonstrated exceptional stability. The performance drop on the initial task was limited to just 4%, a significant improvement over vanilla replay (32% drop) and the previous state-of-the-art merging method (10% drop). Overall, the framework achieved a relative improvement of 80% in Forward Transfer (FWT) and 59% in Backward Transfer (BWT).

4.2 Scalability and Efficiency

The benefits of AIMMerging scaled effectively with model size. For the LLaMA2-7B model, FWT improved from 78.2% to 79.3%, while BWT improved from -2.9% to -1.6% compared to previous best-in-class methods. Notably, AIMMerging achieves these results without the computational overhead of calculating complex parameter importance masks, relying instead on global trajectory signals.

4.3 The "Emergency Brake" Effect

A key insight from our analysis is the importance of the forgetting signal. By acting as an "emergency brake," this signal allows the system to trigger merges the moment forgetting is detected, rather than waiting for a pre-defined schedule. This real-time responsiveness is crucial for maintaining performance across long task sequences.

5. Conclusion and Future Work

AIMMerging provides a robust and scalable framework for continual learning in LLMs by making model merging adaptive to the training trajectory. While the current implementation relies on a rehearsal buffer for signal calculation, future research will explore "memory-free" versions of the framework. Additionally, we aim to automate the selection of hyperparameters through meta-learning and investigate the use of more granular signals to further refine the merging process.

Summary updated

BibTeX
@misc{feng2025aimmerging,
  author = {Yujie Feng and Jian Li and Xiaoyu Dong and Pengfei Xu and Xiaohui Zhou and Yujia Zhang and Zexin LU and Yasha Wang and Alan Zhao and Xu Chu and Xiao-Ming Wu},
  title = {{AIMMerging: Adaptive Iterative Model Merging Using Training Trajectories for Language Model Continual Learning}},
  year = {2025},
  eprint = {2509.17348},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.17348},
}
Figure