arXiv Science⌕ Search

arXiv · 2610.04664

FLASHSWIN: Unlocking Large Windows and Dense Tokens in Swin Vision Transformers with Memory Efficient Attention

Abstract

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 $M^2\times M^2$ score matrix per window, incurring $O(M^4)$ 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\times4$ ($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(M^4)$ to $O(M^2)$. This enables higher token density and larger receptive fields without inflating memory overhead. Training memory is flat across window sizes: at a $32\times32$ window, FLASHSWIN-T requires only $12.4$\,GB, unchanged from $8\times8$, 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\times$ larger gains in boundary quality than in mIoU.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Tushar Kataria, Gerald Sabin, Ponnuswamy Sadayappan, Shireen Y. Elhabian. 2026-10-03. FLASHSWIN: Unlocking Large Windows and Dense Tokens in Swin Vision Transformers with Memory Efficient Attention. https://arxiv.org/abs/2610.04664

Cite the original work for its findings. Save a collection to share your selection of sources.

KEEP EXPLORING

Related papers

CMFDFormer: Transformer-based Copy-Move Forgery Detection with Continual Learning

Copy-move forgery detection aims at detecting duplicated regions in a suspected forged image, and deep learning based copy-move forgery detection methods are in the ascendant. These deep learning based methods heavily rely on synthetic training data, and the performance will degrade when facing new tasks. In this paper, we propose a Transformer-style copy-move forgery detection network named as CMFDFormer, and provide a novel PCSD (Pooled Cube and Strip Distillation) continual learning framework to help CMFDFormer handle new tasks. CMFDFormer consists of a MiT (Mix Transformer) backbone network and a PHD (Pluggable Hybrid Decoder) mask prediction network. The MiT backbone network is a Transformer-style network which is adopted on the basis of comprehensive analyses with CNN-style and MLP-style backbones. The PHD network is constructed based on self-correlation computation, hierarchical feature integration, a multi-scale cycle fully-connected block and a mask reconstruction block. The PHD network is applicable to feature extractors of different styles for hierarchical multi-scale information extraction, achieving comparable performance. Last but not least, we propose a PCSD continual learning framework to improve the forgery detectability and avoid catastrophic forgetting when handling new tasks. Our continual learning framework restricts intermediate features from the PHD network, and takes advantage of both cube pooling and strip pooling. Extensive experiments on publicly available datasets demonstrate the good performance of CMFDFormer and the effectiveness of the PCSD continual learning framework.

cs.CV↗

PDB: Not All Drivers Are the Same -- A Personalized Dataset for Understanding Driving Behavior

Driving behavior varies across individuals, yet most existing driving datasets do not preserve driver identity or control for factors that may affect driving style. We introduce the Personalized Driving Behavior (PDB) dataset, a multimodal dataset collected from 9 drivers using the same vehicle and route under comparable conditions. PDB includes data from a 128-line LiDAR, external and driver-facing cameras, GNSS, IMU, CAN-bus signals, and heart-rate measurements, with 111,060 frames of LiDAR point cloud data and more than 1.33 million images. Based on these recordings, we construct PDB-Traj, a personalized trajectory prediction benchmark with 1,309 10-second trajectory segments sampled at 10 Hz. Each segment includes the ego trajectory, surrounding-agent trajectories, and driver identity. We further introduce Gated Selective Personalization (Gate-SP), a driver-aware baseline that selectively incorporates driver identity into trajectory prediction. Experiments on PDB-Traj provide reference results for personalized motion forecasting and show that driver information can improve prediction when applied selectively. PDB and PDB-Traj provide a benchmark for studying driver-specific behavior and personalized trajectory prediction.

cs.CV↗

TestDG: Test-time Domain Generalization for Continual Test-time Adaptation

This paper studies continual test-time adaptation (CTTA), the task of adapting a model to constantly changing unseen domains in testing while preserving previously learned knowledge. Existing CTTA methods mostly focus on adaptation to the current test domain only, overlooking generalization to arbitrary test domains a model may face in the future. To tackle this limitation, we present a novel online test-time domain generalization framework for CTTA, dubbed TestDG. TestDG aims to learn features invariant to both current and previous test domains on the fly during testing, improving the potential for effective generalization to future domains. To this end, we propose a new model architecture and a test-time adaptation strategy dedicated to learning domain-invariant features, along with prototype selection and update mechanisms for effectively managing information from previous test domains. TestDG achieved state of the art on three of four public CTTA benchmarks and performed on par with the best prior method on ImageNet-C. Moreover, it showed superior generalization to unseen test domains.

cs.CV↗