Abstract
In this paper, we present Co-scale conv-attentional image Transformers (CoaT), a Transformer-based image classifier equipped with co-scale and conv-attentional mechanisms. First, the co-scale mechanism maintains the integrity of Transformers' encoder branches at individual scales, while allowing representations learned at different scales to effectively communicate with each other; we design a series of serial and parallel blocks to realize the co-scale mechanism. Second, we devise a conv-attentional mechanism by realizing a relative position embedding formulation in the factorized attention module with an efficient convolution-like implementation. CoaT empowers image Transformers with enriched multi-scale and contextual modeling capabilities. On ImageNet, relatively small CoaT models attain superior classification results compared with similar-sized convolutional neural networks and image/vision Transformers. The effectiveness of CoaT's backbone is also illustrated on object detection and instance segmentation, demonstrating its applicability to downstream computer vision tasks.
Introduction
While Vision Transformers (ViT) have significantly advanced computer vision, they face two major hurdles: computational complexity and a lack of inductive bias. Standard self-attention has a quadratic complexity $O(N^2)$ relative to the number of tokens, making high-resolution processing prohibitively expensive. Furthermore, unlike CNNs, standard Transformers treat images as sequences of patches, lacking inherent understanding of local spatial relationships and scale. Existing "pyramid" Transformers move toward multi-scale modeling but often restrict information flow to a fine-to-coarse direction. CoaT addresses these by enabling bidirectional communication across scales and introducing local inductive biases through a novel attention mechanism.
Methods
Conv-Attentional Mechanism
To address complexity, CoaT utilizes Factorized Attention, which linearizes complexity from $O(N^2)$ to $O(N)$ by reordering matrix multiplications. To restore the spatial awareness lost during factorization, the authors implement Convolutional Relative Position Encoding (CRPE).
As shown in the diagram above, relative position encoding is mathematically simplified into a depthwise convolution operation. This allows the model to capture local context efficiently within the attention layer itself, bridging the gap between Transformers and CNNs.
Co-Scale Mechanism
Unlike traditional hierarchical models that only downsample, CoaT introduces Parallel Blocks to maintain multiple scales simultaneously. This "co-scale" approach allows for bidirectional communication: information flows from high-resolution to low-resolution (fine-to-coarse) and vice versa (coarse-to-fine). Features from different resolutions are matched using bilinear interpolation before being summed and processed through a shared feed-forward network. The architecture is offered in two variants: CoaT-Lite (a simpler serial pyramid) and CoaT (the full version with parallel cross-scale blocks).
Key Results
CoaT models demonstrate exceptional parameter efficiency and accuracy on ImageNet-1K, consistently outperforming similar-sized competitors.
As illustrated in the performance plot, CoaT-Lite Tiny (5.7M parameters) achieves 77.5% Top-1 accuracy, significantly outperforming the baseline DeiT-Tiny (72.2%). CoaT Mini (10M parameters) reaches 81.0%, surpassing PVT-Tiny (75.1%) despite having fewer parameters.
Beyond classification, CoaT serves as a powerful backbone for downstream tasks. On COCO 2017, CoaT Small used with Mask R-CNN achieved 49.0 $AP^b$, outperforming Swin-T (46.0 $AP^b$) while maintaining a competitive parameter count.
Conclusion and Future Work
CoaT successfully integrates the multi-scale modeling and local inductive biases of CNNs into the Transformer architecture. By realizing relative position encoding as a convolution and enabling bidirectional cross-scale communication, it achieves state-of-the-art performance with high parameter efficiency. While the parallel blocks introduce some latency overhead compared to simpler architectures, the enriched multi-scale representations prove highly effective for complex vision tasks. Future work may focus on optimizing the inference speed of the parallel groups to further improve real-world applicability.
Summary updated