FLASHSWIN: Unlocking Large Windows and Dense Tokens in Swin Vision Transformers with Memory Efficient Attention
Not on the map. Why?
Abstract (arXiv)
High-resolution vision backbones have long been forced to trade away local token density to afford larger receptive fields. Hierarchical Swin transformers impose this compromise because standard windowed attention materializes an M2× M2 score matrix per window, incurring O(M4) memory as windows or token grids grow. Furthermore, Swin adds a learned relative-position bias elementwise to attention scores, requiring full materialization of the score matrix and its gradient. This keeps Swin and SwinV2 trapped in a small-window(M=8,16), coarse-token regime with patch size 4×4 (p=4), limiting performance for fine-grained tasks. We introduce FLASHSWIN, which replaces standard windowed attention with a FlashAttention implementation that computes exact softmax attention without materializing the score matrix, reducing per-window memory from O(M4) to O(M2). This enables higher token density and larger receptive fields without inflating memory overhead. Training memory is flat across window sizes: at a 32×32 window, FLASHSWIN-T requires only 12.4,GB, unchanged from 8×8, compared to 70/90,GB for SwinV2/V1-T. However, applying FlashAttention directly to Swin creates a trade-off: bypassing the score matrix precludes Swin's additive relative-position bias, forfeiting spatial information in exchange for memory efficiency. FLASHSWIN restores position information as window-local learnable 2D RoPE, making large windows and dense token grids both affordable and accurate. At matched scale, FLASHSWIN-T outperforms Swin variants. With dense tokens and wide windows (p=2,M=32), the same Tiny model reaches 84.1% ImageNet-1K, 44.1 COCO box AP, and 47.28 ADE20K mIoU---gains of +1.3, +5.1, and +1.82 over SwinV2-T at M=16, respectively. At fixed M=32, halving the patch size yields roughly 3× larger gains in boundary quality than in mIoU.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 40 of its 46 references that are in the map. First posted on arXiv 3 Oct 2026.
Builds on
40 of 46 references.
References · 40
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 30,186
- 2014Microsoft COCO: Common Objects in Contextcited by 17,608
- 2021Swin Transformer: Hierarchical Vision Transformer using Shifted Windowscited by 12,139
- 2014ImageNet Large Scale Visual Recognition Challengecited by 8,498
- 2017Mask R-CNNcited by 7,277
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,703
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,673
- 2019Benchmarking Neural Network Robustness to Common Corruptions and Perturbationscited by 2,877
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
- 2021Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutionscited by 1,962
- 2020The Many Faces of Robustness: A Critical Analysis of Out-of-Distribution Generalizationcited by 1,850
- 2025DINOv3cited by 1,414
28 more
- 2019Natural Adversarial Examplescited by 1,408
- 2019MMDetection: Open MMLab Detection Toolbox and Benchmarkcited by 1,385
- 2018Unified Perceptual Parsing for Scene Understandingcited by 1,271
- 2021Swin Transformer V2: Scaling Up Capacity and Resolutioncited by 1,228
- 2016Semantic Understanding of Scenes through the ADE20K Datasetcited by 1,069
- 2022Token Merging: Your ViT But Fastercited by 1,021
- 2019Learning Robust Global Representations by Penalizing Local Predictive Powercited by 1,013
- 2016Training Deep Nets with Sublinear Memory Costcited by 848
- 2021PVT v2: Improved Baselines with Pyramid Vision Transformercited by 751
- 2022Exploring Plain Vision Transformer Backbones for Object Detectioncited by 724
- 2021ImageNet-21K Pretraining for the Massescited by 613
- 2022Vision Transformer Adapter for Dense Predictionscited by 565
- 2017Understanding the Effective Receptive Field in Deep Convolutional Neural Networkscited by 553
- 2021CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windowscited by 527
- 2023Hiera: A Hierarchical Vision Transformer without the Bells-and-Whistlescited by 290
- 2021Focal Self-attention for Local-Global Interactions in Vision Transformerscited by 288
- 2022Neighborhood Attention Transformercited by 239
- 2024Rotary Position Embedding for Vision Transformercited by 236
- 2021Boundary IoU: Improving Object-Centric Image Segmentation Evaluationcited by 188
- 2022SegViT: Semantic Segmentation with Plain Vision Transformerscited by 106
- 2024VoCo: A Simple-yet-Effective Volume Contrastive Learning Framework for 3D Medical Image Analysiscited by 75
- 2024Benchmarking foundation models as feature extractors for weakly-supervised computational pathologycited by 49
- 2023Vision Grid Transformer for Document Layout Analysiscited by 47
- 2025A generalizable 3D framework and model for self-supervised learning in medical imagingcited by 31
- 2023SegViTv2: Exploring Efficient and Continual Semantic Segmentation with Plain Vision Transformerscited by 25
- 2025PanTS: The Pancreatic Tumor Segmentation Datasetcited by 16
- 2025FlashBias: Fast Computation of Attention with Biascited by 11
- 2024EfficientMorph: Parameter-Efficient Transformer-Based Architecture for 3D Image Registrationcited by 3
Built on by
Not cited yet.