Class-Incremental Learning with Repetition

Hamed Hemati, Andrea Cossu, Antonio Carta, Julio Hurtado, Lorenzo Pellegrini, Davide Bacciu, Vincenzo Lomonaco, Damian Borth

Abstract

Real-world data streams naturally include the repetition of previous concepts. From a Continual Learning (CL) perspective, repetition is a property of the environment and, unlike replay, cannot be controlled by the agent. Nowadays, the Class-Incremental (CI) scenario represents the leading test-bed for assessing and comparing CL strategies. This scenario type is very easy to use, but it never allows revisiting previously seen classes, thus completely neglecting the role of repetition. We focus on the family of Class-Incremental with Repetition (CIR) scenario, where repetition is embedded in the definition of the stream. We propose two stochastic stream generators that produce a wide range of CIR streams starting from a single dataset and a few interpretable control parameters. We conduct the first comprehensive evaluation of repetition in CL by studying the behavior of existing CL strategies under different CIR streams. We then present a novel replay strategy that exploits repetition and counteracts the natural imbalance present in the stream. On both CIFAR100 and TinyImageNet, our strategy outperforms other replay approaches, which are not designed for environments with repetition.

Introduction: The Gap in Continual Learning Benchmarks

In Continual Learning (CL), the Class-Incremental (CI) scenario is the most popular test-bed. It assumes a model learns new classes over time but never sees previous classes again. Conversely, Domain-Incremental (DI) scenarios assume all classes are present in every single experience. Both are extreme, unrealistic constraints.

In the real world, data streams naturally feature repetition—you might see a dog today, a cat tomorrow, and a dog again next week. This realistic setup is called Class-Incremental with Repetition (CIR). However, CIR has been under-explored because it is difficult to systematically generate streams with controlled repetition.

Comparison of CI, CIR, and DI scenarios. CIR introduces natural repetition of concepts across experiences.

Existing CL strategies, such as standard replay buffers, are heavily optimized for the strict CI setting. They assume all classes are equally likely to be forgotten, which causes them to struggle when natural repetition is unbalanced (i.e., some classes appear frequently while others are rare).

Methods: Modeling Realistic Streams and Frequency-Aware Replay

To address the lack of benchmarks, we introduce two practical tools to generate CIR streams from standard datasets like CIFAR-100 and TinyImageNet:

  1. Slot-Based Generator ($G_{slot}$): Controls class repetition using a single parameter ($K$ slots per experience). It allows researchers to smoothly transition a dataset from strict CI (no repetition) to DI (full repetition).
  2. Sampling-Based Generator ($G_{samp}$): Generates arbitrarily long or unbalanced streams using probability distributions (e.g., Zipfian, Poisson). It controls exactly when new classes first appear and how often they repeat.

Frequency-Aware Replay (ER-FA)

Standard replay buffers (like Reservoir Sampling or Class-Balanced) fail in unbalanced streams because they waste limited buffer space storing classes that naturally repeat often in the environment. We propose Frequency-Aware Replay (ER-FA), which dynamically adjusts buffer quotas online. It allocates more memory slots to infrequent classes and relies on the environment's natural repetition to maintain the model's knowledge of frequent classes.

Experimental Results and Key Insights

Our evaluation reveals that natural repetition acts as a powerful regularizer. In CIR streams, even "Naive" fine-tuning (which normally suffers complete catastrophic forgetting in CI) accumulates knowledge over time. The accuracy of temporarily missing classes initially drops but recovers and stabilizes as the stream progresses. Furthermore, the performance gap between memory-heavy Replay strategies and Naive fine-tuning significantly decreases over long lifetimes with natural repetition.

Ratio of stored instances for different storage policies. ER-FA (Ours) prioritizes infrequent classes as the stream progresses.

In highly unbalanced streams, the ER-FA strategy significantly outperforms standard Experience Replay (ER-RS, ER-CB). On CIFAR-100 configured with 10% infrequent classes, ER-FA achieved a Missing Class Accuracy (MCA) of 52.2%, compared to just 11.4% for standard Reservoir Sampling (ER-RS) and 30.9% for Class-Balanced (ER-CB) replay. Overall Average Classification Accuracy (ACA) also improved to 60.8% with ER-FA, beating standard ER-RS (57.7%). Analysis using Centered Kernel Alignment (CKA) revealed that in long CIR streams, early layers stabilize quickly, and the loss landscape between experiences remains connected by low-loss paths.

Conclusion

This work highlights that standard CI benchmarks ignore a fundamental property of real-world data: repetition. By introducing CIR generators and the ER-FA strategy, we provide a framework for developing more robust CL agents. Future work will explore open-world label spaces and the role of environmental repetition in dynamic, growing network architectures.

Summary updated

BibTeX
@inproceedings{hemati2023class,
  author = {Hamed Hemati and Andrea Cossu and Antonio Carta and Julio Hurtado and Lorenzo Pellegrini and Davide Bacciu and Vincenzo Lomonaco and Damian Borth},
  title = {{Class-Incremental Learning with Repetition}},
  booktitle = {CoLLAs},
  year = {2023},
  url = {https://openreview.net/forum?id=yabG3mvCjI},
}
Figure