Abstract
Data mixing strategies like CutMix are fundamental to training high-performance deep learning models. However, while these methods work seamlessly with spatially consistent Convolutional Neural Networks (CNNs), they introduce a hidden flaw in Vision Transformers (ViTs). This paper introduces Token-Label Alignment (TL-Align), a plug-and-play training strategy that dynamically synchronizes labels with transformed tokens by tracing information flow through self-attention layers. TL-Align improves accuracy across classification, detection, and segmentation tasks with zero additional cost at inference.
The Problem of Token Misalignment
In traditional CNNs, spatial consistency allows for a simple assumption: if a patch of an image is replaced, the global label should be adjusted proportionally to the area of the patch. For example, if 30% of a "cat" image is replaced by a "dog" patch, the label becomes a 70/30 mix.
Vision Transformers operate differently. Their core mechanism, self-attention, allows every token to interact with every other token globally. This leads to a "token fluctuation" phenomenon: as an image passes through successive transformer layers, a token that originated from the "cat" portion of the image may become heavily influenced by "dog" features from across the image. Using a static input-level label at the final layer provides a noisy training signal that limits the model's performance.
The TL-Align Methodology
To address this, the authors propose Token-Label Alignment (TL-Align). The method synchronizes labels with the actual content of tokens as they evolve through the network layers.
- Initial Labeling: Each input patch (token) is assigned a label based on its source image.
- Layer-wise Propagation: TL-Align reuses the spatial self-attention weights calculated by the model to mix the labels. If Token A attends to Token B, Token A’s label is updated to include a portion of Token B’s label.
- Residual Handling: The framework accounts for residual connections and normalization, ensuring the label "flow" perfectly mirrors the data "flow."
- Efficiency: By reusing existing attention maps, TL-Align adds negligible overhead to training. Since the label-tracking logic is only used during training, it adds zero overhead to inference.
Experimental Evaluation
The researchers evaluated TL-Align across several standard benchmarks, including ImageNet-1K for classification, COCO 2017 for object detection, and ADE20K for semantic segmentation.
TL-Align consistently improved performance across various architectures:
- Classification: On ImageNet, it boosted DeiT-S by 0.8% and PVT-T by 0.4% top-1 accuracy compared to standard CutMix.
- Downstream Tasks: It improved semantic segmentation on ADE20K by +0.7 mIoU for DeiT-S and showed consistent gains in object detection on COCO.
- Transfer Learning: The method showed superior generalization on datasets like CIFAR-10/100, Oxford Flowers, and Stanford Cars.
- Robustness: Models trained with TL-Align demonstrated better performance on out-of-distribution datasets such as ImageNet-V2 and ImageNet-A.
Conclusion
TL-Align identifies and fixes a critical misalignment in how Vision Transformers process augmented data. By treating the mixing ratio as a dynamic variable that changes layer by layer, it provides a more precise ground truth for the model to learn from. While currently focused on transformers, the underlying principle of aligning labels with spatial information flow offers a promising direction for other modern architectures like MLP-Mixer and ConvNeXt.
Summary updated