Papers › DaViT: Dual Attention Vision Transformers

DaViT: Dual Attention Vision Transformers

7 Apr 2022arXiv:2204.03645archive 2025-07-28

Mingyu Ding, Bin Xiao, Noel Codella, Ping Luo, Jingdong Wang, Lu Yuan

In this work, we introduce Dual Attention Vision Transformers (DaViT), a simple yet effective vision transformer architecture that is able to capture global context while maintaining computational efficiency. We propose approaching the problem from an orthogonal angle: exploiting self-attention mechanisms with both "spatial tokens" and "channel tokens". With spatial tokens, the spatial dimension defines the token scope, and the channel dimension defines the token feature dimension. With channel tokens, we have the inverse: the channel dimension defines the token scope, and the spatial dimension defines the token feature dimension. We further group tokens along the sequence direction for both spatial and channel tokens to maintain the linear complexity of the entire model. We show that these two self-attentions complement each other: (i) since each channel token contains an abstract representation of the entire image, the channel attention naturally captures global interactions and representations by taking all spatial positions into account when computing attention scores between channels; (ii) the spatial attention refines the local representations by performing fine-grained interactions across spatial locations, which in turn helps the global information modeling in channel attention. Extensive experiments show our DaViT achieves state-of-the-art performance on four different tasks with efficient computations. Without extra data, DaViT-Tiny, DaViT-Small, and DaViT-Base achieve 82.8%, 84.2%, and 84.6% top-1 accuracy on ImageNet-1K with 28.3M, 49.7M, and 87.9M parameters, respectively. When we further scale up DaViT with 1.5B weakly supervised image and text pairs, DaViT-Gaint reaches 90.4% top-1 accuracy on ImageNet-1K. Code is available at https://github.com/dingmyu/davit.

PaperPDFCodeCode Syntology ranMethod as code

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

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

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 15 code samples harvested from 1 repository linked to this paper: 8 ran (of which 5 constructed an object rather than computing a result; 6 with no instrument failure: 0 honoured, 0 violated, 6 with no contract checked; 2 where Syntology's instrument failed) · 7 unverified. Where Syntology's instrument failed: 1 where our contract draft was wrong; 1 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: official repository: 15 samples from 1 repository, 8 ran (6 with no instrument failure; 2 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

No sample is linked to this paper from 2 of its repositories that Syntology harvested for other papers:

Levels written between 2026-09-22 and 2026-09-24 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

dingmyu/davit officialmentioned in papermentioned on GitHubpytorchSyntology: 15 samples, 8 ran (2 instrument-failed) · 7 unverified report
leondgarse/keras_cv_attention_models tfSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to RepViT: Revisiting Mobile CNN From ViT Perspective (arXiv:2307.09283; that paper's own run record: 6 ran (of which 0 constructed an object rather than computing a result; 3 with no instrument failure: 0 honoured, 0 violated, 3 with no contract checked; 3 where Syntology's instrument failed) · 6 unverified); nothing checks that they implement this paper's method. report
rwightman/pytorch-image-models pytorchSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to AdamP: Slowing Down the Slowdown for Momentum Optimizers on Scale-invariant Weights (arXiv:2006.08217; that paper's own run record: 4 ran (of which 1 constructed an object rather than computing a result; 2 with no instrument failure: 1 honoured, 0 violated, 1 with no contract checked; 2 where Syntology's instrument failed) · 0 unverified); nothing checks that they implement this paper's method. report
gitlab.com/birder/birder pytorchSyntology: not harvested 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.

A paper named beside a repository with no sample linked to this paper is shown with that paper's own run record, not this paper's: “ran” means executed on a synthesized input, not that the code is correct, and “where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Papers are listed in arXiv-id order, at most three per repository.

Code Syntology ran Syntology

15 samples harvested: 8 ran (of which 5 constructed an object rather than computing a result; 6 with no instrument failure: 0 honoured, 0 violated, 6 with no contract checked; 2 where Syntology's instrument failed) · 7 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page has not changed since , the first build that kept a record date for it; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

1ran · our draft was wrong
1ran; the contract check could not run
6ran
7unverified

Licence: 0 of the 15 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from dingmyu/davit. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. For 3 samples that ran, the graph records a signature this page does not show: for a class the fixture built without calling, the harness called the object with inputs it made up itself, so the recorded signature is the harness's probe, not the fixture's arguments. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of six reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

dingmyu/davit official repository 15 samples, 8 ran (2 instrument-failed) · 7 unverified
ChannelAttention in 14 papers timm/models/davit.py ran · metamorphic tier: deterministic MIT (permissive) · ae32983bf5de53c3 · report fixture: returned ChannelAttention · level recorded 2026-09-22
ChannelBlock timm/models/davit.py ran · metamorphic tier: deterministic MIT (permissive) · 98189454f1018bed · report fixture: returned ChannelBlock · level recorded 2026-09-22
ConvPosEnc timm/models/davit.py ran MIT (permissive) · c6ff164380e31b6a · report fixture: signature x:Tensor/3/float, size:tuple/1/int · returned Tensor · level recorded 2026-09-24
Mlp in 102 papers timm/models/davit.py ran · metamorphic tier: deterministic MIT (permissive) · c1395a46164d140a · report fixture: returned Mlp · level recorded 2026-09-22
PatchEmbed in 123 papers
census: 9 implementations from 9 papers, 6 distinct outputs on one shared input
timm/models/davit.py ran · metamorphic tier: deterministic MIT (permissive) · dc8f008b6667e65a · report fixture: returned PatchEmbed · level recorded 2026-09-22
WindowAttention in 50 papers timm/models/davit.py ran · metamorphic tier: deterministic MIT (permissive) · 5091ab6c514932c4 · report fixture: returned WindowAttention · level recorded 2026-09-22
window_partition in 377 papers
census: 13 implementations from 17 papers, 5 distinct outputs across 3 buckets, one shared input per bucket
timm/models/davit.py ran; the contract check could not run (RAISES) fingerprinted MIT (permissive) · 80c66c535be6f491 · report fixture: signature x:Tensor/4/float, window_size:int/0/int · returned Tensor · level recorded 2026-09-22
window_reverse in 296 papers timm/models/davit.py ran · our draft was wrong MIT (permissive) · b83f31fb8b7c976a · report fixture: signature windows:Tensor/4/float, window_size:int/0/int, H:int/0/int, W:int/0/int · returned Tensor · level recorded 2026-09-22
DaViT timm/models/davit.py unverified MIT (permissive) · ceb98806b990f4e0 · report
MySequential timm/models/davit.py unverified MIT (permissive) · 5066418c2fb3b6c8 · report
SpatialBlock timm/models/davit.py unverified MIT (permissive) · dad192f68c8848d9 · report
_init_conv_weights timm/models/davit.py unverified MIT (permissive) · 266d4f400940d7a0 · report
_init_vit_weights in 9 papers timm/models/davit.py unverified MIT (permissive) · 62d0b713fcda8506 · report
lecun_normal_ in 7 papers timm/models/davit.py unverified MIT (permissive) · ef7b648f5c9e3de2 · report
variance_scaling_ in 5 papers timm/models/davit.py unverified MIT (permissive) · 2f6bf4b4b7d2ba1c · report

Method as code Syntology

What Syntology's graph records as this paper's claimed method, lifted into code: each assembly names its bricks (functions and classes), each with its own role and its own verification level. An assembly is not a check that the code implements the method correctly or reproduces the paper's results. Levels are each brick's own verification level in Syntology's graph (level 0: no recorded run), listed brick by brick and never combined into one level; “ran” means the brick executed on a synthesized input, not that its output is correct, and the instrument figure counts failures of Syntology's instrument, not of the code. Where a model read the code against the paper's claim, each assembly's label verdict is one model's judgement, kept in this page's JSON twin; it is not calibrated, so no card prints it.

1 assembly on this paper: 1 harvested, 0 generated.

harvested Assembly for DaViT (graph method: DaViT). 20 bricks; individually on a fixture: 13 ran (of which 6 constructed an object rather than computing a result; 7 with no instrument failure: 0 honoured, 0 violated, 7 with no contract checked; 6 where Syntology's instrument failed) · 7 unverified. The assembly has not been run end-to-end.

  1. DaViT entry · level 0 · unverified · ceb98806b990f4e0
  2. ChannelBlock model · level 1 · ran · 98189454f1018bed
  3. MySequential helper · level 0 · unverified · 5066418c2fb3b6c8
  4. PatchEmbed model · level 1 · ran · dc8f008b6667e65a
  5. SpatialBlock model · level 0 · unverified · dad192f68c8848d9
  6. _init_conv_weights helper · level 0 · unverified · 266d4f400940d7a0
  7. _init_vit_weights helper · level 0 · unverified · 62d0b713fcda8506
  8. ChannelAttention helper · level 1 · ran · ae32983bf5de53c3
  9. ConvPosEnc helper · level 1 · ran · c6ff164380e31b6a
  10. DropPath helper · level 1 · ran · 691dde70dfd8362b
  11. Mlp helper · level 1 · ran · c1395a46164d140a
  12. drop_path helper · level 1 · ran; the contract check could not run · 39eace7e2822504f
  13. WindowAttention model · level 1 · ran · 5091ab6c514932c4
  14. window_partition helper · level 1 · ran; the contract check could not run (RAISES) · 80c66c535be6f491
  15. window_reverse helper · level 1 · ran · our draft was wrong · b83f31fb8b7c976a
  16. trunc_normal_ helper · level 1 · ran; the contract check could not run · 02566da69866c48c
  17. lecun_normal_ helper · level 0 · unverified · ef7b648f5c9e3de2
  18. _no_grad_trunc_normal_ helper · level 1 · ran; the contract check could not run · fa2dd3be10cf9804
  19. variance_scaling_ helper · level 0 · unverified · 2f6bf4b4b7d2ba1c
  20. _ntuple helper · level 1 · ran · our draft was wrong · 553ee0765abad219

Each brick ends with its code_sha256, Syntology's identity for that exact code; click one to copy the get_code call that returns it. For agents, on Syntology's MCP service: assembly(arxiv_id="2204.03645") returns these assemblies with each brick's role and wiring (how to connect).

Tasks

Computational EfficiencyImage ClassificationInstance SegmentationMedical Image ClassificationObject DetectionSemantic Segmentation

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Image Classification ImageNet DaViT-G GFLOPs 1038 #4 of 1060 Archive leaderboard report
Image Classification ImageNet DaViT-G Number of params 1437M #4 of 1060 Archive leaderboard report
Image Classification ImageNet DaViT-G Top 1 Accuracy 90.4% #4 of 1060 Archive leaderboard report
Image Classification ImageNet DaViT-H GFLOPs 334 #5 of 1060 Archive leaderboard report
Image Classification ImageNet DaViT-H Number of params 362M #5 of 1060 Archive leaderboard report
Image Classification ImageNet DaViT-H Top 1 Accuracy 90.2% #5 of 1060 Archive leaderboard report
Image Classification ImageNet DaViT-L (ImageNet-22k) GFLOPs 103 #85 of 1060 Archive leaderboard report
Image Classification ImageNet DaViT-L (ImageNet-22k) Number of params 196.8M #85 of 1060 Archive leaderboard report
Image Classification ImageNet DaViT-L (ImageNet-22k) Top 1 Accuracy 87.5% #85 of 1060 Archive leaderboard report
Image Classification ImageNet DaViT-B (ImageNet-22k) GFLOPs 46.4 #119 of 1060 Archive leaderboard report
Image Classification ImageNet DaViT-B (ImageNet-22k) Number of params 87.9M #119 of 1060 Archive leaderboard report
Image Classification ImageNet DaViT-B (ImageNet-22k) Top 1 Accuracy 86.9% #119 of 1060 Archive leaderboard report
Image Classification ImageNet DaViT-B GFLOPs 15.5 #306 of 1060 Archive leaderboard report
Image Classification ImageNet DaViT-B Number of params 87.9M #306 of 1060 Archive leaderboard report
Image Classification ImageNet DaViT-B Top 1 Accuracy 84.6% #306 of 1060 Archive leaderboard report
Image Classification ImageNet DaViT-T Number of params 28.3M #498 of 1060 Archive leaderboard report
Image Classification ImageNet DaViT-T Top 1 Accuracy 82.8% #498 of 1060 Archive leaderboard report
Instance Segmentation COCO minival DaViT-T (Mask R-CNN, 36 epochs) mask AP 44.3 #56 of 93 Archive leaderboard report
Medical Image Classification ImageNet DaViT-T GFLOPs 4.5 #1 of 2 Archive leaderboard report
Medical Image Classification ImageNet DaViT-S GFLOPs 8.8 #2 of 2 Archive leaderboard report
Medical Image Classification ImageNet DaViT-S Top 1 Accuracy 84.2% #2 of 2 Archive leaderboard report
Object Detection COCO minival DaViT-T (Mask R-CNN, 36 epochs) box AP 49.9 #82 of 220 Archive leaderboard report
Semantic Segmentation ADE20K DaViT-B Validation mIoU 49.4 #132 of 235 Archive leaderboard report
Semantic Segmentation ADE20K DaViT-T Validation mIoU 46.3 #178 of 235 Archive leaderboard report
Semantic Segmentation ADE20K val DaViT-S (UperNet) mIoU 48.8 #61 of 95 Archive leaderboard report
Semantic Segmentation ADE20K val DaViT-B (UperNet) mIoU 46.3 #71 of 95 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

AttentionDense ConnectionsLayer NormalizationLinear LayerMulti-Head AttentionResidual ConnectionSoftmaxVision Transformer

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