Abstract
Vision Transformers (ViTs) often lack the inherent spatial inductive bias present in Convolutional Neural Networks (CNNs). This paper proposes "Positional Labels," a self-supervised task where the model is trained to predict the original grid locations of input patches. By treating patch positions as targets rather than just passive inputs, ViTs develop a stronger spatial understanding. Experimental results on ImageNet-1K and smaller datasets like Mini-ImageNet demonstrate significant accuracy improvements, particularly in data-constrained scenarios, with gains of up to 6% on smaller benchmarks.
Introduction
Unlike CNNs, which naturally exploit local spatial correlations through convolution operations, Vision Transformers treat image patches as a sequence or "bag of words." While positional encodings are typically added to the input to provide spatial information, this approach is passive and does not force the model to internalize the image's geometric structure. This paper addresses this limitation by introducing a supervision signal that requires the model to explicitly predict patch locations, thereby fostering a more robust spatial inductive bias.
Methodology
The authors introduce two primary forms of Positional Labels: Absolute and Relative.
Absolute Positional Label (APL)
In the APL framework, an image is divided into a fixed grid (e.g., 14x14). Each patch is assigned a unique index corresponding to its position. After the ViT encoder processes these patches, a lightweight Multi-Layer Perceptron (MLP) head is employed to predict the original index of each patch. This auxiliary task is trained alongside the primary classification objective using a joint loss function: $L = L_{classification} + \lambda L_{position}$.
Relative Positional Label (RPL)
Alternatively, the model can be tasked with predicting the spatial relationship between pairs of patches (e.g., determining if patch A is above or to the left of patch B). This approach focuses on the relative geometry within the image rather than fixed coordinates.
Integration with Self-Supervised Learning
A key contribution of this work is the integration of Positional Labels with Masked Autoencoders (MAE). In a standard MAE setup, the model learns by reconstructing masked pixels. By adding positional labels, the encoder is further challenged to identify the positions of the visible patches it receives. This dual objective provides a more powerful training signal, helping the encoder better understand the global structure of partial images.
Experimental Results
The proposed method was evaluated across several benchmarks, showing consistent improvements across different architectures:
- ImageNet-1K: Implementing APL on a ViT-B model improved top-1 accuracy from 77.91% to 79.11% (+1.20%).
- Swin Transformer: Utilizing RPL with Swin-T increased accuracy from 81.32% to 81.93%. To maintain performance, the authors modified the Swin architecture to preserve higher token resolution in the final stages.
- Small Datasets: The impact was most pronounced on Mini-ImageNet, where ViT-B performance jumped from 58.28% to 64.43% (+6.15%), suggesting that positional supervision effectively compensates for the lack of inductive bias in low-data regimes.
- MAE Synergy: Combining MAE with APL reached 80.40% accuracy, outperforming the standard MAE baseline of 79.54%.
Discussion and Limitations
While Positional Labels significantly enhance performance, there are trade-offs. For hierarchical models like the Swin Transformer, maintaining high token resolution for the positional task increases training-time computational overhead. Additionally, the balance between classification and position loss ($\lambda$) requires tuning, though $\lambda=0.5$ was found to be generally effective. Future work may explore extending these concepts to 3D data (video) or non-grid-based architectures. Importantly, the MLP head used for position prediction is discarded after training, ensuring zero additional cost during inference.
Summary updated