[Paper Review] Supervised Contrastive Replay: Revisiting the Nearest Class Mean Classifier in Online Class-Incremental Continual Learning
This paper proposes Supervised Contrastive Replay (SCR), a novel online class-incremental continual learning method that replaces the standard Softmax classifier with the Nearest Class Mean (NCM) classifier and uses supervised contrastive loss during replay to improve embedding clustering. SCR significantly reduces catastrophic forgetting and outperforms state-of-the-art methods by up to 15.4% accuracy gain on CIFAR-100 and Mini-ImageNet.
Online class-incremental continual learning (CL) studies the problem of learning new classes continually from an online non-stationary data stream, intending to adapt to new data while mitigating catastrophic forgetting. While memory replay has shown promising results, the recency bias in online learning caused by the commonly used Softmax classifier remains an unsolved challenge. Although the Nearest-Class-Mean (NCM) classifier is significantly undervalued in the CL community, we demonstrate that it is a simple yet effective substitute for the Softmax classifier. It addresses the recency bias and avoids structural changes in the fully-connected layer for new classes. Moreover, we observe considerable and consistent performance gains when replacing the Softmax classifier with the NCM classifier for several state-of-the-art replay methods. To leverage the NCM classifier more effectively, data embeddings belonging to the same class should be clustered and well-separated from those with a different class label. To this end, we contribute Supervised Contrastive Replay (SCR), which explicitly encourages samples from the same class to cluster tightly in embedding space while pushing those of different classes further apart during replay-based training. Overall, we observe that our proposed SCR substantially reduces catastrophic forgetting and outperforms state-of-the-art CL methods by a significant margin on a variety of datasets.
Motivation & Objective
- Address the recency bias issue in online class-incremental continual learning caused by the Softmax classifier’s sensitivity to class imbalance.
- Re-evaluate the underutilized Nearest Class Mean (NCM) classifier as a robust, structurally simple alternative to Softmax in continual learning.
- Improve embedding space clustering for better generalization and classifier performance by explicitly learning class-wise separability during replay.
- Develop a memory-efficient, computation-light method that maintains high accuracy without architectural changes when new classes are added.
Proposed method
- Replace the standard Softmax classifier with the Nearest Class Mean (NCM) classifier to eliminate structural changes in the fully-connected layer during class incremental learning.
- Apply supervised contrastive loss during replay to encourage intra-class compactness and inter-class separation in the embedding space.
- Use a shared encoder and projection head to generate representations from both incoming data batches and buffered memory samples.
- During inference, discard the projection head and compute class means from buffered samples to enable NCM-based classification.
- Employ a randomized memory replay strategy with balanced batch sampling from the data stream and memory buffer to maintain training stability.
- Optimize the contrastive loss with a temperature hyperparameter τ and evaluate different projection head designs (MLP, linear, none).

Experimental results
Research questions
- RQ1Can the Nearest Class Mean (NCM) classifier outperform the Softmax classifier in online class-incremental continual learning, particularly in mitigating recency bias?
- RQ2How does supervised contrastive learning improve the quality of learned embeddings when used in conjunction with the NCM classifier?
- RQ3What is the impact of memory buffer size and sampling strategy on the performance of the proposed SCR framework?
- RQ4Does the combination of NCM and contrastive replay lead to consistent performance gains across diverse datasets and memory settings?
- RQ5How does SCR compare in efficiency and accuracy to state-of-the-art replay-based continual learning methods?
Key findings
- SCR achieves 35.4% accuracy on Mini-ImageNet, a 13.3% improvement over the best baseline (MIR-NCM), demonstrating significant performance gains.
- On CIFAR-100, SCR reaches 65.7% accuracy, a 15.4% relative improvement over the strongest baseline, confirming its effectiveness across datasets.
- SCR reduces task-recency bias substantially, with minimal bias observed even in the presence of class imbalance, unlike standard replay methods.
- The method maintains computational efficiency, with total training and inference time shorter than ASER and only slightly longer than MIR.
- Performance gains are consistent across different memory buffer sizes, with larger buffers (e.g., M=5k) yielding up to 60.2% relative improvement.
- Ablation studies show that contrastive learning benefits from larger memory batch sizes up to 200, while performance drops with overfitting at higher sizes (e.g., 500 or 1000).

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.