Abstract
Many leading self-supervised methods for unsupervised representation learning, in particular those for embedding image features, are built on variants of the instance discrimination task. However, the optimization of these tasks is known to be prone to instabilities that can lead to feature collapse. Different techniques have been devised to circumvent this issue, including the use of negative pairs with different contrastive losses, external memory banks, and breaking symmetry with separate encoding networks. Our method, termed BAM, moves away from directly matching features of different views of input images. Instead, it matches their self-attention vectors—the distributions of similarities to the entire set of augmented images in a batch. We obtain rich representations and avoid feature collapse by minimizing a loss that matches these distributions to a globally balanced and entropy-regularized version, obtained through self-optimal-transport. BAM shows competitive performance with leading methods on both semi-supervised and transfer-learning benchmarks.
Introduction: The Limits of Instance Discrimination
Most leading self-supervised learning (SSL) methods rely on the paradigm of instance discrimination. In this setup, a model learns by recognizing that two different augmentations (views) of the same image are "positives," while views of different images are "negatives."
While successful, this approach has two major flaws. First, it suffers from oversimplification. Treating all "negatives" as equally different ignores the rich structural information inherent in a dataset. For example, two different images of dogs should naturally be more similar to each other than a dog is to a car. Second, these methods are prone to instability and feature collapse, where the network maps all images to a single constant vector to minimize loss. To prevent this, researchers often resort to complex architectural "hacks" like massive memory banks, momentum encoders, or asymmetric predictor heads.
The BAM Framework: Self-Attention Matching
Balanced Self-Attention Matching (BAM) introduces a more nuanced approach called Self-Attention Matching (SAM). Rather than forcing the features of two views to be identical, BAM forces their relationships to the rest of the batch to be identical.
Key Components
- Global Self-Attention: For every image in a batch, the model computes a "self-attention vector"—a distribution of its similarities to every other image in that batch. This treats the entire batch as a temporary coordinate system providing relative metric information.
- Focus on Negatives: BAM explicitly masks out "positive" pairs (the other views of the same image) during this calculation. This forces the model to learn from the subtle differences between different images rather than relying on easy matches.
- Attention Balancing (The "B" in BAM): To prevent collapse without complex architectures, BAM uses the Sinkhorn-Knopp algorithm to transform the attention matrix into a "doubly-stochastic" matrix. This ensures that every image in the batch "receives" and "gives" an equal amount of attention, forcing features to spread out uniformly across the latent space.
- Entropy Control: A "temperature gap" is maintained between the predicted attention and the balanced target, encouraging the model to become more confident and discriminative as training progresses.
Experimental Results
BAM was evaluated across standard computer vision benchmarks, demonstrating results that match or exceed established frameworks like DINO and MAE.
- ImageNet-1K Performance: BAM achieved 78.1% top-1 accuracy on linear probing (ViT-B) and 83.2% on fine-tuning.
- Semi-Supervised Learning: When trained on only 1% of ImageNet labels, BAM reached 66.8% accuracy, outperforming DINO (65.0%) and MoCoV3 (66.3%).
- Video Segmentation: On the DAVIS-2017 benchmark, BAM surpassed DINO by +0.9%, indicating that its learned features are particularly robust for dense prediction tasks like tracking objects across frames.
- Transfer Learning: The method showed significant gains on specialized datasets, such as a +1.9% improvement on Food-101 compared to previous state-of-the-art models.
Conclusion and Future Work
BAM demonstrates that mathematical balancing via optimal transport is a principled and effective alternative to architectural symmetry-breaking for preventing feature collapse. By shifting the focus from individual feature matching to global relationship matching, BAM captures richer structural information from unlabeled data.
While highly effective, the method's reliance on global attention suggests a dependency on batch size to maintain a diverse set of negatives. Future research may explore extending this balanced matching concept to multi-modal data or scaling to even larger model architectures.
Summary updated