Papers › Dilated Neighborhood Attention Transformer

Dilated Neighborhood Attention Transformer

29 Sep 2022arXiv:2209.15001archive 2025-07-28

Ali Hassani, Humphrey Shi

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).

PaperPDFCode

In Syntology View this paper on Syntology: its repositories, every harvested function with whether it ran, its licence and the call to fetch it.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

Code

SHI-Labs/Neighborhood-Attention-Transformer officialmentioned in papermentioned on GitHubpytorchMIT report
shi-labs/natten officialmentioned on GitHubpytorchMIT report
alexmehta/nac-tcn-tcns-with-causal-na mentioned on GitHubpytorchGPL-2.0 report
huggingface/transformers mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

Not run by Syntology. Nothing on this page verifies that the listed code works.

Tasks

Image ClassificationInstance SegmentationObject DetectionPanoptic SegmentationSegmentationSemantic Segmentation

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Image Classification ImageNet DiNAT-Large (11x11ks; 384res; Pretrained on IN22K@224) GFLOPs 92.4 #86 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT-Large (11x11ks; 384res; Pretrained on IN22K@224) Number of params 200M #86 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT-Large (11x11ks; 384res; Pretrained on IN22K@224) Top 1 Accuracy 87.5% #86 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT-Large (384x384; Pretrained on ImageNet-22K @ 224x224) GFLOPs 89.7 #89 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT-Large (384x384; Pretrained on ImageNet-22K @ 224x224) Top 1 Accuracy 87.4% #89 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT_s-Large (384res; Pretrained on IN22K@224) GFLOPs 101.5 #95 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT_s-Large (384res; Pretrained on IN22K@224) Number of params 197M #95 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT_s-Large (384res; Pretrained on IN22K@224) Top 1 Accuracy 87.4% #95 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT_s-Large (224x224; Pretrained on ImageNet-22K @ 224x224) GFLOPs 34.5 #136 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT_s-Large (224x224; Pretrained on ImageNet-22K @ 224x224) Top 1 Accuracy 86.5% #136 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT-Base GFLOPs 13.7 #321 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT-Base Number of params 90M #321 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT-Base Top 1 Accuracy 84.4% #321 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT-Small GFLOPs 7.8 #389 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT-Small Number of params 51M #389 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT-Small Top 1 Accuracy 83.8% #389 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT-Tiny GFLOPs 4.3 #512 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT-Tiny Number of params 28M #512 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT-Tiny Top 1 Accuracy 82.7% #512 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT-Mini GFLOPs 2.7 #609 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT-Mini Number of params 20M #609 of 1060 Archive leaderboard report
Image Classification ImageNet DiNAT-Mini Top 1 Accuracy 81.8% #609 of 1060 Archive leaderboard report
Instance Segmentation ADE20K val DiNAT-L (Mask2Former, single-scale) AP 35.4 #10 of 14 Archive leaderboard report
Instance Segmentation ADE20K val DiNAT-L (Mask2Former, single-scale) APL 55.5 #10 of 14 Archive leaderboard report
Instance Segmentation ADE20K val DiNAT-L (Mask2Former, single-scale) APM 39.0 #10 of 14 Archive leaderboard report
Instance Segmentation ADE20K val DiNAT-L (Mask2Former, single-scale) APS 16.3 #10 of 14 Archive leaderboard report
Instance Segmentation COCO minival DiNAT-L (single-scale, Mask2Former) AP50 75.0 #22 of 93 Archive leaderboard report
Instance Segmentation COCO minival DiNAT-L (single-scale, Mask2Former) mask AP 50.8 #22 of 93 Archive leaderboard report
Instance Segmentation Cityscapes val DiNAT-L (single-scale, Mask2Former) AP50 72.6 #7 of 17 Archive leaderboard report
Instance Segmentation Cityscapes val DiNAT-L (single-scale, Mask2Former) mask AP 45.1 #7 of 17 Archive leaderboard report
Panoptic Segmentation ADE20K val DiNAT-L (Mask2Former, 640x640) AP 35.0 #16 of 25 Archive leaderboard report
Panoptic Segmentation ADE20K val DiNAT-L (Mask2Former, 640x640) PQ 49.4 #16 of 25 Archive leaderboard report
Panoptic Segmentation ADE20K val DiNAT-L (Mask2Former, 640x640) mIoU 56.3 #16 of 25 Archive leaderboard report
Panoptic Segmentation COCO minival DiNAT-L (single-scale, Mask2Former) AP 49.2 #8 of 31 Archive leaderboard report
Panoptic Segmentation COCO minival DiNAT-L (single-scale, Mask2Former) PQ 58.5 #8 of 31 Archive leaderboard report
Panoptic Segmentation COCO minival DiNAT-L (single-scale, Mask2Former) PQst 48.8 #8 of 31 Archive leaderboard report
Panoptic Segmentation COCO minival DiNAT-L (single-scale, Mask2Former) PQth 64.9 #8 of 31 Archive leaderboard report
Panoptic Segmentation COCO minival DiNAT-L (single-scale, Mask2Former) mIoU 68.3 #8 of 31 Archive leaderboard report
Panoptic Segmentation Cityscapes val DiNAT-L (Mask2Former) AP 44.5 #12 of 37 Archive leaderboard report
Panoptic Segmentation Cityscapes val DiNAT-L (Mask2Former) PQ 67.2 #12 of 37 Archive leaderboard report
Panoptic Segmentation Cityscapes val DiNAT-L (Mask2Former) mIoU 83.4 #12 of 37 Archive leaderboard report
Semantic Segmentation ADE20K DiNAT-L (Mask2Former) Validation mIoU 58.1 #25 of 235 Archive leaderboard report
Semantic Segmentation ADE20K DiNAT-Large (UperNet) Validation mIoU 54.9 #53 of 235 Archive leaderboard report
Semantic Segmentation ADE20K DiNAT_s-Large (UperNet) Validation mIoU 54.6 #59 of 235 Archive leaderboard report
Semantic Segmentation ADE20K DiNAT-Base (UperNet) Validation mIoU 50.4 #113 of 235 Archive leaderboard report
Semantic Segmentation ADE20K DiNAT-Small (UperNet) Validation mIoU 49.9 #124 of 235 Archive leaderboard report
Semantic Segmentation ADE20K DiNAT-Tiny (UperNet) Validation mIoU 48.8 #143 of 235 Archive leaderboard report
Semantic Segmentation ADE20K DiNAT-Mini (UperNet) Validation mIoU 47.2 #165 of 235 Archive leaderboard report
Semantic Segmentation ADE20K val DiNAT-L (Mask2Former) mIoU 58.1 #17 of 95 Archive leaderboard report
Semantic Segmentation Cityscapes val DiNAT-L (Mask2Former) mIoU 84.5 #15 of 99 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

ConvNeXtNeighborhood AttentionTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections