RECALL: REpresentation-aligned Catastrophic-forgetting ALLeviation via Hierarchical Model Merging

Bowen Wang, Haiyuan Wan, Liwen Shi, Chen Yang, Peng He, Yue Ma, Haochen Han, Wenhao Li, Tiao Tan, Yongjian Li, Fangming Liu, Yifan Gong, Sheng Zhang

Abstract

We unveil that internal representations in large language models (LLMs) serve as reliable proxies of learned knowledge, and propose RECALL, a novel representation-aware model merging framework for continual learning without access to historical data. RECALL computes inter-model similarity from layer-wise hidden representations over clustered typical samples, and performs adaptive, hierarchical parameter fusion to align knowledge across models. This design enables the preservation of domain-general features in shallow layers while allowing task-specific adaptation in deeper layers. Unlike prior methods that require task labels or incur performance trade-offs, RECALL achieves seamless multi-domain integration and strong resistance to catastrophic forgetting. Extensive experiments across five NLP tasks and multiple continual learning scenarios show that RECALL outperforms baselines in both knowledge retention and generalization, providing a scalable and data-free solution for evolving LLMs.

Introduction: The Challenge of Catastrophic Forgetting

When Large Language Models (LLMs) are fine-tuned on a new task (Task B), they frequently lose the ability to perform previously learned tasks (Task A). This phenomenon, known as catastrophic forgetting (CF), remains a significant hurdle in the development of versatile, lifelong learning agents.

Existing solutions typically fall into two categories. Data-based methods rely on replaying historical data during new training sessions to maintain performance on old tasks. However, these are often constrained by massive storage requirements and privacy concerns. Model-based methods attempt to protect old weights through regularization or architectural modifications, but they often struggle to balance diverse domains and can lead to computational bloat. RECALL addresses these issues by asking: Can we preserve and fuse knowledge across models without needing any historical data or explicit task labels?

Comparison of data-based (a) and model-based (b) methods for catastrophic forgetting alleviation.

The RECALL Framework

The core philosophy of RECALL is that a model's internal hidden states (representations) are reliable proxies for its learned knowledge. The framework operates in four distinct stages to achieve data-free model merging:

  1. Typical Dataset Selection: Instead of processing entire datasets, RECALL employs K-means clustering to identify a small set of "typical samples" (e.g., approximately 20 samples) that accurately represent the data distribution.
  2. Representation Extraction: These typical samples are passed through both the base model and the newly fine-tuned "expert" models to extract hidden states at every layer.
  3. Similarity Calculation: The framework computes the similarity between these representations using a Radial Basis Function (RBF) kernel. This metric quantifies how much the "knowledge" in a specific layer has drifted from the base model during fine-tuning.
  4. Hierarchical Model Merging: Unlike standard merging techniques that apply a uniform weight across all parameters, RECALL performs layer-wise adaptive merging. It utilizes a Softmax-normalized similarity score to determine the optimal merging weight for each individual layer, allowing for fine-grained knowledge integration.

Key Insights: Representation Alignment and Layer-wise Divergence

A critical observation driving RECALL is the "Shallow-to-Deep" divergence. The authors found that early layers in LLMs tend to remain consistent across different tasks, as they primarily encode general linguistic features. In contrast, deeper layers diverge significantly to accommodate task-specific logic and specialized knowledge.

Visualization of representation drift across layers, showing increased divergence in deeper layers.

By applying different merging weights based on depth, RECALL exploits this divergence. It preserves general knowledge in the shallow layers while allowing for task-specific adaptation in the deeper layers. This approach demonstrates that data-free alignment is possible; by observing how new data is represented across different models, the system can infer which parts of the model have specialized and which have remained general.

Experimental Evaluation

The researchers evaluated RECALL across five diverse NLP tasks: sentiment classification (SST-2), reading comprehension (SQuAD 2.0), medical entrance exams (MedMCQA), English exams (RACE), and translation (IWSLT2017). Using LLaMA-2-7B-chat and Qwen2-7B-Instruct as backbones, the results were compelling:

  • Superior Knowledge Retention: In single-model merging tests, RECALL achieved an average score of 45.00, significantly outperforming standard Supervised Fine-Tuning (40.77).
  • Enhanced Generalization: RECALL improved performance on unseen tasks by +7.86% over the best baseline, indicating that it successfully fuses capabilities rather than just memorizing task-specific weights.
  • Resilience to Sequential Forgetting: In sequential learning scenarios involving five consecutive tasks, RECALL maintained stable performance. While standard LoRA fine-tuning saw performance on initial tasks plummet as new ones were added, RECALL’s forgetting curve remained remarkably resilient.
  • Scalability: The method scales linearly with model size and can effectively merge multiple expert models simultaneously, reaching an average score of 62.83 in multi-model fusion scenarios.

Conclusion and Future Work

RECALL provides a scalable, data-free solution for evolving LLMs without the overhead of historical data storage. While currently limited to homogeneous architectures (merging models with the same tokenizer and structure), it sets a new benchmark for representation-aware model merging. Future work will explore scaling this to dozens of tasks and integrating these techniques directly into training-time regularization for even more robust lifelong learning.

Summary updated

BibTeX
@inproceedings{wang2025recall,
  author = {Bowen Wang and Haiyuan Wan and Liwen Shi and Chen Yang and Peng He and Yue Ma and Haochen Han and Wenhao Li and Tiao Tan and Yongjian Li and Fangming Liu and Yifan Gong and Sheng Zhang},
  title = {{RECALL: REpresentation-aligned Catastrophic-forgetting ALLeviation via Hierarchical Model Merging}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2025},
  url = {https://openreview.net/forum?id=mjzTJkemg1},
}
Figure