Papers › CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification

CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification

27 Mar 2021ICCV 2021 10arXiv:2103.14899archive 2025-07-28

Chun-Fu Chen, Quanfu Fan, Rameswar Panda

The recently developed vision transformer (ViT) has achieved promising results on image classification compared to convolutional neural networks. Inspired by this, in this paper, we study how to learn multi-scale feature representations in transformer models for image classification. To this end, we propose a dual-branch transformer to combine image patches (i.e., tokens in a transformer) of different sizes to produce stronger image features. Our approach processes small-patch and large-patch tokens with two separate branches of different computational complexity and these tokens are then fused purely by attention multiple times to complement each other. Furthermore, to reduce computation, we develop a simple yet effective token fusion module based on cross attention, which uses a single token for each branch as a query to exchange information with other branches. Our proposed cross-attention only requires linear time for both computational and memory complexity instead of quadratic time otherwise. Extensive experiments demonstrate that our approach performs better than or on par with several concurrent works on vision transformer, in addition to efficient CNN models. For example, on the ImageNet1K dataset, with some architectural changes, our approach outperforms the recent DeiT by a large margin of 2\% with a small to moderate increase in FLOPs and model parameters. Our source codes and models are available at \url{https://github.com/IBM/CrossViT}.

PaperPDFConference PDFCodeCode Syntology ran

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

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2103.14899")

Code

Syntology Ran 17 of 26 code samples harvested from 4 repositories linked to this paper; 9 have no recorded run. Of those that ran: 1 ran · violated contract; 16 ran with no contract checked.

By repository: official repository: 6 samples from 1 repository, 4 ran; community (archive-listed): 20 samples from 3 repositories, 13 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

15 repositories listed; official and paper-mentioned ones first.

IBM/CrossViT officialmentioned in papermentioned on GitHubpytorch report
SforAiDl/vformer mentioned on GitHubpytorch report
ahmedelmahy/myownvit mentioned on GitHubpytorch report
conceptofmind/CrossViT-flax mentioned on GitHubjax report
kit-mrt/masked-fusion-360 mentioned on GitHubpytorch report
kit-mrt/red-motion mentioned on GitHubpytorch report
kit-mrt/road-barlow-twins mentioned on GitHubpytorch report
rishikksh20/CrossViT-pytorch mentioned on GitHubpytorch report
rwightman/pytorch-image-models mentioned on GitHubpytorch report
ttt496/vit-pytorch 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

26 samples harvested; 17 ran; 0 honoured the contract we drafted; 9 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · violated contract
16ran
9unverified

Licence: 0 of the 26 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 4 repositories linked to this paper, official or community; each sample names its own and says which. “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. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (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 from a repository marked official are listed first. 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 four 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; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). 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.

CrossAttention IBM/CrossViT/models/crossvit.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 9811d06fb8557fa5 · report
CrossAttentionBlock IBM/CrossViT/models/crossvit.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 185cacf0bed5e23b · report
PatchEmbed IBM/CrossViT/models/crossvit.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 2562a86d027ed434 · report
_compute_num_patches IBM/CrossViT/models/crossvit.py official repository ran · violated contract fingerprinted Apache-2.0 (permissive) · 54f90cefd4fe4358 · report
MultiScaleBlock IBM/CrossViT/models/crossvit.py official repository unverified Apache-2.0 (permissive) · 6eb91fffc193bc8d · report
VisionTransformer IBM/CrossViT/models/crossvit.py official repository unverified Apache-2.0 (permissive) · b05cff1db97d5001 · report
Attention rishikksh20/CrossViT-pytorch/crossvit.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 411c4d270072eb2e · report
Attention ahmedelmahy/myownvit/vit_pytorch/cross_vit.py community (archive-listed) ran · metamorphic tier: invariant fingerprinted MIT (permissive) · 39b524cdd79f5d2e · report
CrossAttention rishikksh20/CrossViT-pytorch/crossvit.py community (archive-listed) ran MIT (permissive) · 8abca80f7f8a5dda · report
CrossTransformer ahmedelmahy/myownvit/vit_pytorch/cross_vit.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 7909555e0d7a8a93 · report
ImageEmbedder conceptofmind/CrossViT-flax/cross_vit_flax/cross_vit_flax.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 541e36b2edd2e342 · report
ImageEmbedder ahmedelmahy/myownvit/vit_pytorch/cross_vit.py community (archive-listed) ran · metamorphic tier: invariant MIT (permissive) · 0a16f340785793af · report
MultiScaleEncoder conceptofmind/CrossViT-flax/cross_vit_flax/cross_vit_flax.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 18ea900a9c20be8f · report
PreNorm conceptofmind/CrossViT-flax/cross_vit_flax/cross_vit_flax.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · d7aaba5132053213 · report
ProjectInOut conceptofmind/CrossViT-flax/cross_vit_flax/cross_vit_flax.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 395f410c7cd053df · report
ProjectInOut ahmedelmahy/myownvit/vit_pytorch/cross_vit.py community (archive-listed) ran · metamorphic tier: invariant fingerprinted MIT (permissive) · 5c51a399079da30b · report
Transformer rishikksh20/CrossViT-pytorch/crossvit.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 45127327251f05d5 · report
Transformer conceptofmind/CrossViT-flax/cross_vit_flax/cross_vit_flax.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 0415c013e361e191 · report
Transformer ahmedelmahy/myownvit/vit_pytorch/cross_vit.py community (archive-listed) ran · metamorphic tier: invariant MIT (permissive) · 139bcf50e1423e16 · report
Attention conceptofmind/CrossViT-flax/cross_vit_flax/cross_vit_flax.py community (archive-listed) unverified MIT (permissive) · 695e0238d8d29d65 · report
CrossTransformer conceptofmind/CrossViT-flax/cross_vit_flax/cross_vit_flax.py community (archive-listed) unverified MIT (permissive) · fcda9506e4ba0369 · report
CrossViT rishikksh20/CrossViT-pytorch/crossvit.py community (archive-listed) unverified MIT (permissive) · e9810edd3a725477 · report
CrossViT conceptofmind/CrossViT-flax/cross_vit_flax/cross_vit_flax.py community (archive-listed) unverified MIT (permissive) · 54eeb67b517aba4e · report
CrossViT ahmedelmahy/myownvit/vit_pytorch/cross_vit.py community (archive-listed) unverified MIT (permissive) · 74763df32bbe08b3 · report
MultiScaleEncoder ahmedelmahy/myownvit/vit_pytorch/cross_vit.py community (archive-listed) unverified MIT (permissive) · 6f5a3f2db3ea4ac5 · report
MultiScaleTransformerEncoder rishikksh20/CrossViT-pytorch/crossvit.py community (archive-listed) unverified MIT (permissive) · 00453bc8eaf62cc7 · report

Tasks

General ClassificationImage Classificationimage-classification

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Image Classification ImageNet CrossViT-18+ GFLOPs 9.5 #501 of 1060 Archive leaderboard report
Image Classification ImageNet CrossViT-18+ Number of params 44.3M #501 of 1060 Archive leaderboard report
Image Classification ImageNet CrossViT-18+ Top 1 Accuracy 82.8% #501 of 1060 Archive leaderboard report
Image Classification ImageNet CrossViT-18 GFLOPs 9 #532 of 1060 Archive leaderboard report
Image Classification ImageNet CrossViT-18 Number of params 43.3M #532 of 1060 Archive leaderboard report
Image Classification ImageNet CrossViT-18 Top 1 Accuracy 82.5% #532 of 1060 Archive leaderboard report
Image Classification ImageNet CrossViT-15+ GFLOPs 6.1 #553 of 1060 Archive leaderboard report
Image Classification ImageNet CrossViT-15+ Number of params 28.2M #553 of 1060 Archive leaderboard report
Image Classification ImageNet CrossViT-15+ Top 1 Accuracy 82.3% #553 of 1060 Archive leaderboard report
Image Classification ImageNet CrossViT-15 GFLOPs 5.8 #637 of 1060 Archive leaderboard report
Image Classification ImageNet CrossViT-15 Number of params 27.4M #637 of 1060 Archive leaderboard report
Image Classification ImageNet CrossViT-15 Top 1 Accuracy 81.5% #637 of 1060 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

Introduced by this paper: CrossViT

AttentionAttention DropoutConcatenated Skip ConnectionCrossViTDeiTDense ConnectionsDropoutFeedforward NetworkLayer 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