[Paper Review] Dilated Neighborhood Attention Transformer
DiNAT combines local Neighborhood Attention with a dilated sparse global attention (DiNA) to expand receptive fields exponentially without extra compute, achieving state-of-the-art-like results on several vision tasks and opening-source release.
Transformers are quickly becoming one of the most heavily applied deep learning architectures across modalities, domains, and tasks. In vision, on top of ongoing efforts into plain transformers, hierarchical transformers have also gained significant attention, thanks to their performance and easy integration into existing frameworks. These models typically employ localized attention mechanisms, such as the sliding-window Neighborhood Attention (NA) or Swin Transformer's Shifted Window Self Attention. While effective at reducing self attention's quadratic complexity, local attention weakens two of the most desirable properties of self attention: long range inter-dependency modeling, and global receptive field. In this paper, we introduce Dilated Neighborhood Attention (DiNA), a natural, flexible and efficient extension to NA that can capture more global context and expand receptive fields exponentially at no additional cost. NA's local attention and DiNA's sparse global attention complement each other, and therefore we introduce Dilated Neighborhood Attention Transformer (DiNAT), a new hierarchical vision transformer built upon both. DiNAT variants enjoy significant improvements over strong baselines such as NAT, Swin, and ConvNeXt. Our large model is faster and ahead of its Swin counterpart by 1.6% box AP in COCO object detection, 1.4% mask AP in COCO instance segmentation, and 1.4% mIoU in ADE20K semantic segmentation. Paired with new frameworks, our large variant is the new state of the art panoptic segmentation model on COCO (58.5 PQ) and ADE20K (49.4 PQ), and instance segmentation model on Cityscapes (45.1 AP) and ADE20K (35.4 AP) (no extra data). It also matches the state of the art specialized semantic segmentation models on ADE20K (58.1 mIoU), and ranks second on Cityscapes (84.5 mIoU) (no extra data).
Motivation & Objective
- Motivate the need to balance local attention efficiency with global context in hierarchical vision transformers.
- Propose DiNA to extend Neighborhood Attention with dilation, enabling sparse global attention.
- Build a hierarchical vision transformer (DiNAT) that leverages NA and DiNA in alternating layers.
- Evaluate DiNAT on image classification, object detection, and segmentation to compare against NAT, Swin, and ConvNeXt.
- Provide implementation and release to support research in vision transformers with sparse/global attention patterns.
Proposed method
- Define DiNA as a dilation-based extension of Neighborhood Attention (NA) that selects the i-th token’s j-th nearest neighbor under a dilation constraint.
- Formulate DiNA attention weights A_i^{(k,δ)} using Q_i and K_{ ho_j^{δ}(i)} and corresponding B(i, ρ_j^{δ}(i)).
- Compute DiNA output as DiNA_{k}^{δ}(i) = softmax(A_i^{(k,δ)}/sqrt(d)) V_i^{(k,δ)} with d the embedding dimension.
- Introduce DiNAT as a hierarchical transformer combining NA and DiNA across layers, with per-layer dilation δ and downsampling scheme.
- Analyze receptive field growth: DiNA allows receptive fields to range from NAT’s linear growth to exponential growth k^{ℓ} across ℓ layers.
- Extend NATTEN (CUDA kernels) with dilation support to enable efficient DiNA implementations.
Experimental results
Research questions
- RQ1Can a dilated, sparse global attention (DiNA) preserve locality while expanding the receptive field more than local attention alone?
- RQ2Does a hybrid architecture (DiNAT) combining NA and DiNA outperform strong baselines (NAT, Swin, ConvNeXt) on classification, detection, and segmentation?
- RQ3What is the impact of per-layer dilation values on receptive field, efficiency, and downstream task performance?
- RQ4How does DiNAT scale with data (ImageNet-1K/22K) and tasks (classification, detection, segmentation, panoptic)?
- RQ5What are the isotropic vs. hierarchical trade-offs for NA/DiNA variants compared to full self-attention?
Key findings
- DiNA extends NA with sparse global attention that expands receptive fields exponentially without additional computational cost.
- DiNAT, which stacks NA and DiNA layers, shows improvements over NAT, Swin, and ConvNeXt baselines on downstream vision tasks.
- On ImageNet-1K at 224^2, DiNAT variants match or exceed NAT and competitive ConvNeXt/Swin baselines in several configurations; Large-scale pretraining on ImageNet-22K shows competitive performance against Swin-Large and ConvNeXt-Large.
- DiNAT-L achieves 86.6% top-1 on ImageNet-1K with 200M parameters and 30.6 GFLOPs, and demonstrates competitive or superior performance in downstream segmentation tasks (Panoptic/Instance/Semantic) without extra data.
- Isotropic variants (DiNAT and NAT with ViT-like isotropic design) show competitive accuracy relative to ViT and ConvNeXt baselines when matched for FLOPs and parameters.
- The open-source release extends NA/NATTEN with dilation support and supports research across vision tasks and potentially beyond.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.