Abstract
Foundation Models (FMs) face significant challenges with catastrophic forgetting during extended pre-training. This paper introduces Adaptive Memory Replay, a strategy that treats replay data selection as a multi-armed bandit problem. By dynamically prioritizing past samples the model is most likely to forget, the proposed method achieves up to a 10% reduction in forgetting at zero additional computational cost.
Introduction
Training Foundation Models is computationally intensive. When new data arrives, "Extended Pre-Training" (EPT) is often used to keep models current. However, FMs suffer from catastrophic forgetting, where learning new information leads to the rapid loss of previously acquired knowledge.
Traditional Continual Learning (CL) research often assumes a "limited memory" constraint. However, for billion-parameter models, storage is relatively inexpensive compared to the high cost of computation. The primary challenge is not how much data can be stored, but how to intelligently select a small fraction of past data to replay during updates to prevent forgetting.
Methodology
The core of this work is the Adaptive Memory Buffer, which replaces static "coreset" approaches with a dynamic selection process based on the model's current state.
- Bandit Formulation: Data selection is framed as a non-stationary multi-armed bandit problem, where each "arm" corresponds to a cluster of past data (e.g., a specific task).
- Forgetting Estimation: The system periodically samples small batches from past clusters to estimate the degree of forgetting. A moving average tracks these values over time.
- Boltzmann Sampling: Using these estimates, a tempered softmax (Boltzmann distribution) determines the sampling frequency for each cluster. This focuses the model on its "weakest" areas while maintaining exploration.
- Zero-Cost Protocol: To maintain training efficiency, a "swap" strategy is used. A portion of each new data batch is replaced with replayed samples, keeping the total number of gradient updates constant.
Experimental Setup
The approach was evaluated across vision and language domains:
- Vision: Evaluated on DomainNet (6 domains), Medical MNIST (5 datasets), and SyViC (synthetic visual concepts).
- Language: A 5-task sequence using LLaMA (7B), including datasets such as Banking77, WikiCat, and Wikitext.
Results and Discussion
Adaptive Memory Replay consistently outperformed standard i.i.d. (random) replay and naive fine-tuning.
- Reduced Forgetting: On DomainNet, forgetting was reduced to 4.39%, a significant improvement over standard rehearsal (22.97%) and naive fine-tuning (70.95%).
- Language Performance: For LLaMA, the adaptive method reached a Final Loss of 12.88%, compared to 44.11% for standard rehearsal.
- Pareto Efficiency: The method approaches "Oracle" performance (training on all data simultaneously) more efficiently than baseline approaches as the compute budget increases.
Key Insights
- Context-Aware Replay: Optimal replay data is not static; it depends on the similarity between new and old tasks.
- Efficiency over Compression: In the FM era, the focus should shift from data storage limits to computational throughput limits.
- Randomness as a Baseline: Uniformly random replay is a strong baseline in abundant-memory settings, yet the proposed adaptive method significantly outperforms it.
Conclusion and Future Work
Adaptive Memory Replay provides a computationally efficient way to mitigate forgetting in FMs. Future work includes exploring more granular, semantic clustering of data and developing "Adaptive Discarding" strategies to identify redundant new samples. Additionally, adapting the bandit mechanism to "blurry" task boundaries in fluid data streams remains an open research direction.
Summary updated