C-Flat++: Towards a More Efficient and Powerful Framework for Continual Learning

Wei Li, Hangjie Yuan, Zixiang Zhao, Yifan Zhu, Aojun Lu, Tao Feng, Yanan SunarXiv 2025 · OpenReview

Abstract

Balancing sensitivity to new tasks and stability for retaining past knowledge is crucial in continual learning (CL). Recently, sharpness-aware minimization has proven effective in transfer learning and has also been adopted in continual learning (CL) to improve memory retention and learning efficiency. However, relying on zeroth-order sharpness alone may favor sharper minima over flatter ones in certain settings, leading to less robust and potentially suboptimal solutions. In this paper, we propose Continual Flatness (C-Flat), a method that promotes flatter loss landscapes tailored for CL. C-Flat offers plug-and-play compatibility, enabling easy integration with minimal modifications to the code pipeline. Besides, we present a general framework that integrates C-Flat into all major CL paradigms and conduct comprehensive comparisons with loss-minima optimizers and flat-minima-based CL methods. Our results show that C-Flat consistently improves performance across a wide range of settings. In addition, we introduce C-Flat++, an efficient yet effective framework that leverages selective flatness-driven promotion, significantly reducing the update cost required by C-Flat. Extensive experiments across multiple CL methods, datasets, and scenarios demonstrate the effectiveness and efficiency of our proposed approaches.

Introduction: The Plasticity-Stability Dilemma

In Continual Learning (CL), models learn a sequence of tasks over time. The fundamental challenge is the "plasticity-stability" trade-off: the model must be flexible enough to learn new tasks (plasticity) while retaining knowledge from previous ones (stability). Without careful management, updating weights for a new task often leads to catastrophic forgetting, where performance on earlier tasks plummets.

Recent research suggests that the geometry of the loss landscape is key. "Flat" minima—broad regions where the loss function changes slowly—are more robust to the parameter shifts required for new learning. Traditional regularization often fails to find these robust regions, as shown in Figure 2.

Conceptual comparison of continual learning strategies: (a) Direct Tuning leads to forgetting, (b) Regularization compromises performance, and (c) C-Flat finds a robust, flat region where both old and new task losses remain low.

The C-Flat Framework

The authors introduce C-Flat (Continual Flatness), a "plug-and-play" optimizer designed to steer models toward these desirable flat regions. Unlike standard Sharpness-Aware Minimization (SAM) which often relies on zeroth-order sharpness (loss values), C-Flat incorporates both zeroth- and first-order (gradient norm) flatness measures.

By regularizing the smoothness of the parameter neighborhood, C-Flat ensures the model finds a region that is not just low in error, but also geometrically stable. To maintain computational feasibility, the method employs Hessian-vector products, allowing it to capture complex curvature information with $O(n)$ complexity—essentially the cost of one extra forward and backward pass.

C-Flat++: Selective Efficiency

Recognizing that calculating flatness at every step is computationally expensive, the authors developed C-Flat++. This version uses a sharpness proxy (the squared gradient norm) and a sigmoidal threshold to monitor the training process. It only triggers the more intensive flatness-aware updates when the landscape becomes too "jagged" or sharp, typically in the later stages of learning a task.

Visualization of optimization trajectories on a 3D loss landscape. C-Flat and C-Flat++ successfully navigate toward flatter, more stable minima compared to the sharp local minima found by standard SGD.

As shown in Figure 1, this selective approach allows C-Flat++ to reach the same stable regions as C-Flat but with significantly lower overhead—requiring only about 30% of the additional computational cost compared to the full method.

Experimental Evaluation

The framework was rigorously tested across standard CL benchmarks, including CIFAR-100, ImageNet-100, and DomainNet, using various incremental learning scenarios.

Key Results

  • Performance Boost: C-Flat consistently outperformed vanilla SGD and zeroth-order SAM across seven major CL paradigms, including iCaRL, DER, and MEMO. On CIFAR-100, it provided an average accuracy boost of up to 2.08%.
  • Geometric Proof: Using Hessian eigenvalue analysis, the authors proved that their models actually settled into flatter regions. The maximal Hessian eigenvalue (a measure of sharpness) dropped from 67.48 (with SGD) to 18.50 (with C-Flat++).
  • Universal Compatibility: As a general optimizer, C-Flat can be integrated into almost any existing CL pipeline with minimal code changes.

Insights and Future Directions

The research highlights that first-order flatness is a better predictor of generalization in CL than loss values alone. The authors also identified "representation stiffness": as a model learns more tasks, the gradients in shared layers decrease, making flatness optimization even more vital for the remaining plastic parameters.

While C-Flat++ is highly efficient, it still carries a slight computational premium over standard SGD. Future work could explore scaling these techniques to massive Foundation Models, where the high-dimensional loss landscapes make the search for flat minima even more critical.

Code is available at https://github.com/WanNaa/C-Flat.

Summary updated

BibTeX
@misc{li2025c,
  author = {Wei Li and Hangjie Yuan and Zixiang Zhao and Yifan Zhu and Aojun Lu and Tao Feng and Yanan Sun},
  title = {{C-Flat++: Towards a More Efficient and Powerful Framework for Continual Learning}},
  year = {2025},
  eprint = {2508.18860},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.18860},
}
Figure