Introduction
Online Continual Learning (online CL) presents a significant challenge for modern AI: models must learn from a non-stationary, continuous stream of data in a single pass without explicit task boundaries. This setting highlights the stability-plasticity dilemma, where a model must remain plastic enough to acquire new knowledge while maintaining stability to prevent the "catastrophic forgetting" of previously learned information.
Traditional approaches often rely on ResNet-based architectures and supervised contrastive learning (SCL). However, SCL can struggle with representation drift and class imbalance in an online stream. The Contrastive Vision Transformer (CVT) addresses these issues by introducing a parameter-efficient Transformer architecture enhanced with "learnable focuses" and a novel focal contrastive loss.
Methodology
The CVT framework integrates several architectural innovations to balance stability and plasticity effectively.
Architecture Overview
As shown in Figure 1, the CVT architecture processes augmented views of input data through a Contrastive Vision Transformer. Unlike standard Vision Transformers that use computationally heavy self-attention, CVT utilizes an External Attention Mechanism. This mechanism employs learnable keys and biases to capture cross-task information implicitly, significantly reducing parameter counts while maintaining high modeling capacity.
Learnable Focuses and Focal Contrastive Loss
A core innovation is the introduction of Learnable Focuses ($o_1, o_2, ..., o_C$). These are class-wise learnable vectors that serve as persistent prototypes for every class encountered. These focuses act as anchors in the feature space, ensuring that even if a class is absent from the current data stream for an extended period, its representation remains stable.
The Focal Contrastive Loss ($L_{FC}$) leverages these focuses. By treating them as primary anchors during training, the loss function rebalances the contrast between new and old classes. This prevents the representations of new classes from overwriting or drifting into the space occupied by older classes.
Dual-Classifier Structure
To further mitigate bias toward recent data, CVT employs a dual-classifier strategy:
- Injection Classifier: Optimized to learn features from the immediate data stream.
- Accumulation Classifier: Integrates knowledge from both the current stream and a small memory buffer (rehearsal). This classifier is used for final inference, providing a balanced view of all learned classes.
Experimental Evaluation
The researchers evaluated CVT on three major benchmarks: CIFAR-100, TinyImageNet, and ImageNet100, under both task-free and task-aware protocols.
Key Results
- State-of-the-Art Accuracy: On CIFAR-100 (10-split, 500 memory), CVT achieved 24.45% accuracy in the task-free setting, significantly outperforming the previous best (ERT at 16.28%).
- Enhanced Stability: On ImageNet100, CVT showed a 4.3% improvement in task-aware accuracy over existing state-of-the-art methods.
- Parameter Efficiency: Despite being a Transformer, the CVT model uses only 8.9M to 9.4M parameters, making it more efficient than standard ResNet-18 baselines (~11.2M parameters).
- Reduced Forgetting: Qualitative analysis via forgetting curves demonstrates that CVT maintains superior performance stability as the number of tasks increases.
Conclusion and Future Work
CVT demonstrates that Transformers are not only viable but superior for online CL when appropriately adapted. By using learnable focuses as anchors, the model effectively "pins" class representations, solving the drift problem inherent in standard contrastive learning.
Future research directions include reducing the dependency on a memory buffer for rehearsal (moving toward data-free CL) and scaling the "learnable focuses" approach to handle thousands of classes in web-scale datasets.
Summary updated