Abstract
Self-supervised contrastive learning relies heavily on the quality of negative samples to learn robust representations. While standard methods often rely on "easy negatives," this paper introduces SynBY, a framework that generates synthetic hard negatives on-the-fly in the feature space for Vision Transformers (ViTs). By augmenting the contrastive learning process with these challenging distractors, SynBY achieves more focused attention maps and improved classification accuracy on ImageNet benchmarks.
Introduction: The Challenge of Hard Negatives
In self-supervised contrastive learning, models learn by minimizing the distance between "positive" pairs (different views of the same image) and maximizing the distance between "negative" pairs (views of different images). A common bottleneck is the prevalence of "easy negatives"—samples that are so distinct from the query that the model stops learning once it can differentiate them. To sharpen discriminative power, models require "hard negatives" that are semantically similar to the query. While well-explored in Convolutional Neural Networks (CNNs), hard negative mining has been a neglected area for the increasingly popular Vision Transformer (ViT) architectures.
Methodology: The SynBY Framework
SynBY integrates synthetic hard negative generation into the MoBY (Momentum-based framework for ViTs) pipeline. The architecture consists of an "online" encoder updated via gradient descent and a "target" encoder updated via a moving average.
The process involves identifying the N "hardest" negatives (those most similar to the query) currently in the memory bank and applying a synthesis function (F) in the feature space to create new, even more challenging negative vectors. These synthetic negatives are then included in the InfoNCE loss calculation, effectively stretching the feature space and requiring the model to capture finer-grained details to tell the query and the synthetic distractors apart.
Key Insights and Results
Evaluation on ImageNet ILSVRC-2012 demonstrates that SynBY consistently outperforms standard baselines. For the DeiT-S architecture, SynBY reached 73.0% Top-1 accuracy, surpassing MoBY (72.8%), DINO (72.5%), and MoCo-v3 (72.5%). For Swin-T, it achieved 75.2%, a 0.2% improvement over the MoBY baseline.
Beyond raw accuracy, SynBY significantly improves the quality of learned representations. Visualizations of self-attention maps reveal that SynBY produces much more "focused" patterns compared to the MoBY baseline.
The researchers also found that synthetic negatives act as a powerful regularizer. In many ViT setups, researchers use complex "stability tricks" like fixed patch embeddings to prevent training from collapsing. SynBY provides enough inherent contrast that many of these tricks become unnecessary. Furthermore, the method is "plug-and-play," requiring minimal computational overhead because the synthesis happens in the low-dimensional feature space rather than the high-dimensional pixel space.
Conclusion
SynBY offers a computationally efficient method for enhancing ViT training by synthesizing hard negatives on-the-fly. By delivering superior discriminative performance and more semantically meaningful attention maps, it addresses a key bottleneck in self-supervised learning. Future work may extend this approach to massive web-scale datasets and cross-modal tasks like vision-language modeling (e.g., CLIP), where finding hard negatives across modalities is notoriously difficult.
Summary updated