Abstract
Self-supervised learning (SSL) with vision transformers (ViTs) has proven effective for representation learning, yet existing architectures often fail to fully exploit the patch tokens of the ViT backbone. We introduce a novel Semantic Graph Consistency (SGC) module to regularize ViT-based SSL methods. By reconceptualizing images as graphs and infusing relational inductive biases through Graph Neural Networks (GNNs), our SGC loss leverages underexploited patch tokens to enforce consistency across multiple views of an image. Extensive experiments demonstrate that our approach significantly improves representation quality, particularly in low-data regimes, yielding a 5-10% performance increase in linear evaluation.
The "Waste" Problem in ViT SSL
Self-supervised learning allows models to learn from vast amounts of unlabeled data by solving pretext tasks, such as predicting if two augmented views of the same image are identical. While Vision Transformers (ViTs) are the current state-of-the-art backbone for SSL, they suffer from a significant efficiency problem regarding token utilization.
A ViT decomposes an image into a grid of patches, producing a global [CLS] (class) token and several patch tokens. Current frameworks, such as DINO, primarily utilize the [CLS] token for contrastive loss and discard the patch tokens entirely. This practice ignores the rich, localized, and relational information present in the patches. By ignoring how these patches relate to one another, models miss out on the "relational inductive bias" that helps humans understand scenes as collections of related objects.
Semantic Graph Consistency (SGC)
To address this, we propose the Semantic Graph Consistency (SGC) module, which acts as a regularizer for existing SSL frameworks. The module operates through four key steps:
- Graph Construction: Patch tokens produced by the ViT are treated as nodes. A k-Nearest Neighbor (k-NN) graph is constructed, connecting patches that are semantically similar in the feature space.
- Message Passing: The graph is processed by a Graph Neural Network (GNN) (e.g., GraphSAGE or GCN). This allows each patch to update its representation based on its neighbors, capturing hierarchical relationships like the connection between a "wheel" and a "car body."
- Graph Pooling: The entire graph is condensed into a single global feature vector.
- Consistency Loss: The model enforces that graph-level features from two different augmentations of the same image remain similar.
The final training objective is a weighted sum of the standard SSL loss (on the [CLS] token) and the new SGC loss. This approach draws a theoretical parallel to the Weisfeiler-Lehman (WL) algorithm, training the model to recognize the underlying "semantic skeleton" of an image across different crops and distortions.
Key Results
The addition of SGC consistently improves the DINO baseline across diverse datasets, including ImageNet-1k, RESISC-45, Food-101, and Caltech-256.
Low-Data Regimes
SGC is particularly effective when labeled data is scarce. For instance, when using only 1% of the training data for linear evaluation on Food-101, SGC improved accuracy from 36.89% to 42.25%. This trend of significant absolute gains holds across multiple datasets and training percentages.
General Performance and Robustness
Even on the full ImageNet-1k dataset, SGC provides a boost, reaching 64.32% accuracy compared to DINO’s 63.49% (trained for 100 epochs). Ablation studies confirm that the structure of the relationships matters more than raw content; simply averaging patch tokens (a "bag of patches" approach) actually hurts performance compared to the graph-based regularization.
Conclusion
Semantic Graph Consistency demonstrates that the relational structure between image patches is a powerful signal for self-supervised learning. By infusing relational inductive bias back into the ViT without the rigid constraints of a CNN, SGC enables more robust and data-efficient representation learning. Future work may explore more sophisticated graph construction methods and the application of SGC to other transformer-based architectures.
Summary updated