Abstract
Continual pre-training (CPT) of foundation models is often hindered by the limitations of standard cosine learning rate schedules, which require a fixed time budget and can trigger catastrophic forgetting during re-warming for new tasks. This paper introduces the Infinite Cosine Schedule, a flexible alternative that transitions to a stable constant learning rate instead of decaying to zero. By maintaining a constant phase, the model preserves plasticity for new data while mitigating forgetting of prior knowledge. Empirical evaluations across vision (Masked Autoencoders) and language (LLMs) demonstrate that this schedule outperforms standard cosine decay and specialized continual learning baselines, offering a robust framework for training models on evolving data streams.
Introduction
Foundation models like LLMs and Vision Transformers are typically trained on static snapshots of data. However, real-world data is inherently dynamic, with new concepts, languages, and codebases emerging constantly. Ideally, practitioners should be able to perform Continual Pre-training (CPT)—integrating new knowledge into an existing model without the prohibitive cost of retraining from scratch.
The current industry standard, the Cosine Decay schedule, poses two significant challenges for CPT. First, it requires a pre-defined training budget to schedule the decay to zero at the exact end of training. Second, learning new tasks usually necessitates "re-warming" the learning rate (increasing it again), a process that often leads to a sudden loss of previously acquired knowledge, known as catastrophic forgetting.
The Infinite Cosine Schedule
To address these issues, the authors propose a systematic shift to the Infinite Cosine Schedule. Unlike the standard schedule, it is designed for indefinite training and consists of four distinct phases:
- Warmup: A brief linear increase to the maximum learning rate ($\eta_{max}$).
- Cooldown: A cosine decay that stabilizes at a predefined non-zero "constant" value ($\eta_{const}$) rather than zero.
- Constant Phase: Training continues at $\eta_{const}$ indefinitely. This is the optimal state for continual learning; new tasks can be introduced here without needing to re-warm the learning rate.
- Annealing: A final, rapid exponential decay to a minimum value ($\eta_{min}$), performed only when the model is ready for deployment.
Experimental Evaluation
The study evaluates the schedule across two major modalities. In vision, Masked Autoencoders (MAE) were trained on sequences including ImageNet (objects) $\rightarrow$ Places2 (scenes) $\rightarrow$ FireRisk (aerial imagery), as well as extreme shifts to medical brain MRI scans. In language, LLMs were trained on 100B token sequences from DCLM-Baseline (General English), The Stack (Code), and German corpora.
The Infinite Schedule was compared against repeated cosine decay and classic continual learning (CL) algorithms such as Experience Replay (ER), Learning without Forgetting (LwF), and Memory Aware Synapses (MAS).
Key Results and Insights
The Infinite Schedule demonstrated superior performance, flexibility, and retention across all benchmarks:
- Vision Performance: On the ImageNet $\rightarrow$ Places2 $ ightarrow$ FireRisk sequence, the Infinite Schedule (with replay) achieved an average accuracy of 50.18%, outperforming the standard cosine schedule (48.87%).
- Forgetting Mitigation: In CIFAR-10 experiments, the Infinite Schedule improved Backward Transfer (a measure of retention) by approximately 4% compared to standard fine-tuning.
- Language Benchmarks: For LLMs, the Infinite Schedule with 50% replay reached the highest average zero-shot accuracy (46.81%) across seven popular benchmarks (e.g., HellaSwag, ARC), beating the repeated cosine approach.
- Agile Checkpointing: A critical finding is the importance of the "pre-annealed" checkpoint. Saving models before the final annealing phase preserves adaptability for future tasks, whereas annealing "crystallizes" knowledge but reduces plasticity.
Discussion and Conclusion
The results suggest that the learning rate schedule itself is a primary factor in mitigating forgetting. By avoiding the re-warming penalty and maintaining a stable constant phase, the Infinite Schedule balances plasticity for new tasks with stability for old ones. While hyperparameter tuning for $\eta_{const}$ remains important—vision tasks generally prefer lower values for retention while language tasks benefit from higher values for adaptation—the schedule's simplicity and cross-modality effectiveness make it a compelling choice for large-scale CPT.
Future work will focus on the optimization dynamics of the constant phase and addressing architectural bottlenecks, such as fixed tokenizers in language models, which may limit adaptation to entirely new domains.
Summary updated