Introduction
Vision Transformers (ViTs) have emerged as powerful alternatives to Convolutional Neural Networks (CNNs) in computer vision. However, unlike CNNs, which possess an inherent inductive bias for spatial locality, the core self-attention mechanism in Transformers is permutation-invariant. To address this, standard ViTs utilize Positional Encoding (PE) by adding coordinate-based vectors to input patches.
This paper argues that simply injecting positional information at the input stage is insufficient for the model to fully internalize the spatial structure of an image. Instead, the authors propose Positional Labels, a self-supervised task that requires the model to explicitly predict the spatial coordinates of image patches. This shift from input-based hints to supervision-based targets significantly enhances feature representation across various architectures.
Methodology
The proposed framework introduces two types of self-supervised targets: Absolute Positional Labels (APL) and Relative Positional Labels (RPL). In APL, each patch in an $N \times N$ grid is assigned a unique integer ID. The model is then tasked with identifying the correct ID for each output token. In RPL, the model predicts the spatial relationship (distance and direction) between pairs of patches.
Implementation Details
As illustrated in the figure above, image patches are processed through a standard ViT encoder. The resulting output tokens are passed to a lightweight MLP Block consisting of linear layers, GELU activation, and dropout. This block generates a "position feature vector," which a classifier then uses to predict the positional label. During inference, the MLP block and classifier are discarded, leaving a more spatially-aware encoder for downstream tasks.
Integration with Masked Autoencoders (MAE)
The method is highly compatible with modern self-supervised frameworks like Masked Autoencoders (MAE). In a standard MAE setup, the model reconstructs missing pixels from visible patches. By adding a positional label task, the encoder is forced to not only capture local textures for reconstruction but also to understand the global geometric context of the visible patches.
Experimental Results
The researchers evaluated the impact of Positional Labels across multiple architectures, including ViT, Swin, DeiT, and NesT, using datasets of varying scales.
- ImageNet-1K: The addition of positional labels provided consistent performance boosts. For instance, ViT-B achieved a 1.20% improvement in top-1 accuracy (reaching 79.11%).
- Data Efficiency: The method proved particularly effective on smaller datasets. On Mini-ImageNet, ViT-B's accuracy increased by 6.15% (from 58.28% to 64.43%), suggesting that positional supervision acts as a strong regularizer when data is scarce.
- Synergy with Encoding: Interestingly, the authors found that Positional Labels and Positional Encodings are complementary. Using both yielded the highest accuracy, indicating that the model benefits from both the initial hint (PE) and the subsequent verification (Label).
Limitations and Future Work
A primary challenge arises in hierarchical models like the Swin Transformer. These models use "patch merging" layers that reduce token resolution in deeper stages, making it difficult to maintain high-resolution positional labels. To compensate, the authors modified the Swin architecture by removing the final merging layer, which increased computational overhead. Future research will focus on more efficient ways to integrate these labels into hierarchical structures without increasing the total calculation cost.
Conclusion
By transforming positional information from a passive input into an active supervision signal, this work demonstrates that Vision Transformers can learn more robust and spatially-aware representations. The approach is architecture-agnostic and provides significant accuracy gains, especially in data-constrained environments, with minimal changes to the training pipeline.
Summary updated