Papers › CvT: Introducing Convolutions to Vision Transformers

CvT: Introducing Convolutions to Vision Transformers

29 Mar 2021ICCV 2021 10arXiv:2103.15808archive 2025-07-28

Haiping Wu, Bin Xiao, Noel Codella, Mengchen Liu, Xiyang Dai, Lu Yuan, Lei Zhang

We present in this paper a new architecture, named Convolutional vision Transformer (CvT), that improves Vision Transformer (ViT) in performance and efficiency by introducing convolutions into ViT to yield the best of both designs. This is accomplished through two primary modifications: a hierarchy of Transformers containing a new convolutional token embedding, and a convolutional Transformer block leveraging a convolutional projection. These changes introduce desirable properties of convolutional neural networks (CNNs) to the ViT architecture (\ie shift, scale, and distortion invariance) while maintaining the merits of Transformers (\ie dynamic attention, global context, and better generalization). We validate CvT by conducting extensive experiments, showing that this approach achieves state-of-the-art performance over other Vision Transformers and ResNets on ImageNet-1k, with fewer parameters and lower FLOPs. In addition, performance gains are maintained when pretrained on larger datasets (\eg ImageNet-22k) and fine-tuned to downstream tasks. Pre-trained on ImageNet-22k, our CvT-W24 obtains a top-1 accuracy of 87.7\% on the ImageNet-1k val set. Finally, our results show that the positional encoding, a crucial component in existing Vision Transformers, can be safely removed in our model, simplifying the design for higher resolution vision tasks. Code will be released at \url{https://github.com/leoxiaobin/CvT}.

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

Code

Syntology Ran 29 of 47 code samples harvested from 7 repositories linked to this paper; 18 have no recorded run. Of those that ran: 1 ran · honoured contract; 2 ran · our draft was wrong; 1 ran · fixture could not drive it; 25 ran with no contract checked.

By repository: official repository: 14 samples from 1 repository, 3 ran; named in the paper: 2 samples from 1 repository, 2 ran; community (archive-listed): 29 samples from 5 repositories, 22 ran; 2 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

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

microsoft/CvT officialmentioned on GitHubpytorchMIT report
leoxiaobin/CvT mentioned in papermentioned on GitHubpytorchMIT report
BR-IDL/PaddleViT mentioned on GitHubpaddleApache-2.0 report
EMalagoli92/CvT-TensorFlow mentioned on GitHubtfMIT report
SforAiDl/vformer mentioned on GitHubpytorch report
ahmedelmahy/myownvit mentioned on GitHubpytorch report
conceptofmind/CvT-flax mentioned on GitHubjax report
huggingface/transformers mentioned on GitHubpytorch report
ttt496/vit-pytorch mentioned on GitHubpytorch report
PaddlePaddle/PASSL paddleApache-2.0 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

47 samples harvested; 29 ran; 1 honoured the contract we drafted; 18 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 · honoured contract
2ran · our draft was wrong
1ran · fixture could not drive it
25ran
18unverified

Licence: 4 of the 47 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 7 repositories linked to this paper, official or community; each sample names its own and says which. Some samples are identical code Syntology first harvested from another repository; for those, this paper's copy is not located and its licence is not recorded. “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.

count_parameters microsoft/CvT/lib/utils/utils.py official repository ran MIT (permissive) · 6a41f5e3194a54b1 · report
is_model microsoft/CvT/lib/models/registry.py official repository ran MIT (permissive) · 86c6e09f9f6f6637 · report
register_model microsoft/CvT/lib/models/registry.py official repository ran MIT (permissive) · be2fbb8bf98a15f7 · report
accuracy microsoft/CvT/lib/core/evaluate.py official repository unverified MIT (permissive) · 48af950e22ac823c · report
all_gather microsoft/CvT/lib/utils/comm.py official repository unverified MIT (permissive) · dbb4a0fbb6f9600c · report
build_criterion microsoft/CvT/lib/core/loss.py official repository unverified MIT (permissive) · 79e00b7e79094bff · report
build_dataloader microsoft/CvT/lib/dataset/build.py official repository unverified MIT (permissive) · 51dc0ff05a226bd7 · report
build_dataset microsoft/CvT/lib/dataset/build.py official repository unverified MIT (permissive) · d664b0a074d4c567 · report
build_lr_scheduler microsoft/CvT/lib/scheduler/build.py official repository unverified MIT (permissive) · 60eb73feb15fe78a · report
build_model microsoft/CvT/lib/models/build.py official repository unverified MIT (permissive) · 0f4931981bc034df · report
build_optimizer microsoft/CvT/lib/optim/build.py official repository unverified MIT (permissive) · cafe3a0bb0d90db6 · report
model_entrypoints microsoft/CvT/lib/models/registry.py official repository unverified MIT (permissive) · 0c3902b80e9968b5 · report
reduce_dict microsoft/CvT/lib/utils/comm.py official repository unverified MIT (permissive) · 19a8d1208f8a920f · report
set_wd microsoft/CvT/lib/optim/build.py official repository unverified MIT (permissive) · 210dd79dd3fdc950 · report
linear_combination leoxiaobin/CvT/lib/core/loss.py named in the paper ran · honoured contract fingerprinted MIT recorded; this copy not marked cleared · pointer only · ee5e85cfd16bc5dc · report
reduce_loss leoxiaobin/CvT/lib/core/loss.py named in the paper ran · fixture could not drive it MIT recorded; this copy not marked cleared · pointer only · 9f7b947fbfdaa657 · report
Attention ahmedelmahy/myownvit/vit_pytorch/cvt.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 991c37c831796a95 · report
Attention conceptofmind/CvT-flax/cvt_flax/cvt_flax.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 52559df32e30ffb2 · report
Attention microsoft/esvit/models/cvt_v4_transformer.py community (archive-listed) ran MIT (permissive) · 28bc4fb247eda528 · report
ConvAttention rishikksh20/convolution-vision-transformers/cvt.py community (archive-listed) ran · metamorphic tier: invariant MIT (permissive) · 24f6586f5de31374 · report
ConvEmbed microsoft/esvit/models/cvt_v4_transformer.py community (archive-listed) ran fingerprinted MIT (permissive) · ae1afcb4cbd9e8a8 · report
CvT ahmedelmahy/myownvit/vit_pytorch/cvt.py community (archive-listed) ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · a834f7b8ea0f91fd · report
CvT conceptofmind/CvT-flax/cvt_flax/cvt_flax.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 6fd86ebfed8c45ff · report
DepthWiseConv2d ahmedelmahy/myownvit/vit_pytorch/cvt.py community (archive-listed) ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · 28e2a060ad0a121a · report
DepthWiseConv2d conceptofmind/CvT-flax/cvt_flax/cvt_flax.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · d3ffd9a7becc875f · report
DepthWiseConv2d microsoft/esvit/models/cvt_v4_transformer.py community (archive-listed) ran fingerprinted MIT (permissive) · 1900dc0d402d75ab · report
FeedForward ahmedelmahy/myownvit/vit_pytorch/cvt.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 4c414437e8099db9 · report
FeedForward conceptofmind/CvT-flax/cvt_flax/cvt_flax.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · a4ee1f00f5b87c00 · report
FeedForward microsoft/esvit/models/cvt_v4_transformer.py community (archive-listed) ran MIT (permissive) · a4becc1ab3fb3cb3 · report
LayerNorm ahmedelmahy/myownvit/vit_pytorch/cvt.py community (archive-listed) ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · f919bd05baa8dbfe · report
LayerNorm conceptofmind/CvT-flax/cvt_flax/cvt_flax.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 9822786697807511 · report
PreNorm ahmedelmahy/myownvit/vit_pytorch/cvt.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · ada83fa4cdf0ade2 · report
PreNorm microsoft/esvit/models/cvt_v4_transformer.py community (archive-listed) ran MIT (permissive) · c296102b024e1211 · report
ResStem microsoft/esvit/models/cvt_v4_transformer.py community (archive-listed) ran fingerprinted MIT (permissive) · 72cd0feff4d8e28f · report
SepConv2d rishikksh20/convolution-vision-transformers/cvt.py community (archive-listed) ran · metamorphic tier: invariant fingerprinted MIT (permissive) · 9cc172a07a92afb4 · report
Transformer ahmedelmahy/myownvit/vit_pytorch/cvt.py community (archive-listed) ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · 85fb09fd1d03038f · report
Transformer conceptofmind/CvT-flax/cvt_flax/cvt_flax.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 0a5b9eec36824115 · report
Transformer rishikksh20/convolution-vision-transformers/cvt.py community (archive-listed) ran MIT (permissive) · d6576534c1091ccc · report
CvT microsoft/esvit/models/cvt_v4_transformer.py community (archive-listed) unverified MIT (permissive) · addb189889d498a2 · report
CvT rishikksh20/convolution-vision-transformers/cvt.py community (archive-listed) unverified MIT (permissive) · 9d4228c318890e3e · report
GlobalAvgPool conceptofmind/CvT-flax/cvt_flax/cvt_flax.py community (archive-listed) unverified MIT (permissive) · 36c58f137e9289c0 · report
Transformer microsoft/esvit/models/cvt_v4_transformer.py community (archive-listed) unverified MIT (permissive) · 00dced1853563caf · report
norm_cdf EMalagoli92/CvT-TensorFlow/cvt_tensorflow/models/layers/utils.py community (archive-listed) unverified MIT (permissive) · 1e7a21b70e475e05 · report
run_layers_list EMalagoli92/CvT-TensorFlow/cvt_tensorflow/models/utils.py community (archive-listed) unverified MIT (permissive) · 8db082cfc9d2e2cf · report
trunc_normal_ EMalagoli92/CvT-TensorFlow/cvt_tensorflow/models/layers/utils.py community (archive-listed) unverified MIT (permissive) · 1ad1d109f5a6e55b · report
group_by_key_prefix_and_remove_prefix identical code first harvested elsewhere ran · our draft was wrong licence of this copy not recorded · ca4faa49da53bd5c · report
group_dict_by_key identical code first harvested elsewhere ran · our draft was wrong licence of this copy not recorded · afcf8f2954675d55 · report

Tasks

Image Classification

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Image Classification CIFAR-10 CvT-W24 Percentage correct 99.39 #6 of 265 Archive leaderboard report
Image Classification CIFAR-100 CvT-W24 Percentage correct 94.09 #5 of 211 Archive leaderboard report
Image Classification Flowers-102 CvT-W24 Accuracy 99.72 #3 of 52 Archive leaderboard report
Image Classification ImageNet CvT-W24 (384 res, ImageNet-22k pretrain) Top 1 Accuracy 87.7% #76 of 1060 Archive leaderboard report
Image Classification ImageNet CvT-21 (384 res, ImageNet-22k pretrain) GFLOPs 25 #279 of 1060 Archive leaderboard report
Image Classification ImageNet CvT-21 (384 res, ImageNet-22k pretrain) Number of params 32M #279 of 1060 Archive leaderboard report
Image Classification ImageNet CvT-21 (384 res, ImageNet-22k pretrain) Top 1 Accuracy 84.9% #279 of 1060 Archive leaderboard report
Image Classification ImageNet CvT-21 (384 res) GFLOPs 24.9 #435 of 1060 Archive leaderboard report
Image Classification ImageNet CvT-21 (384 res) Top 1 Accuracy 83.3% #435 of 1060 Archive leaderboard report
Image Classification ImageNet CvT-13 (384 res) GFLOPs 16.3 #476 of 1060 Archive leaderboard report
Image Classification ImageNet CvT-13 (384 res) Number of params 20M #476 of 1060 Archive leaderboard report
Image Classification ImageNet CvT-13 (384 res) Top 1 Accuracy 83% #476 of 1060 Archive leaderboard report
Image Classification ImageNet CvT-21 GFLOPs 7.1 #527 of 1060 Archive leaderboard report
Image Classification ImageNet CvT-21 Top 1 Accuracy 82.5% #527 of 1060 Archive leaderboard report
Image Classification ImageNet CvT-13-NAS GFLOPs 4.1 #560 of 1060 Archive leaderboard report
Image Classification ImageNet CvT-13-NAS Number of params 18M #560 of 1060 Archive leaderboard report
Image Classification ImageNet CvT-13-NAS Top 1 Accuracy 82.2% #560 of 1060 Archive leaderboard report
Image Classification ImageNet CvT-13 GFLOPs 4.5 #620 of 1060 Archive leaderboard report
Image Classification ImageNet CvT-13 Top 1 Accuracy 81.6% #620 of 1060 Archive leaderboard report
Image Classification ImageNet ReaL CvT-W24 (384 res, ImageNet-22k pretrain) Accuracy 90.6% #14 of 57 Archive leaderboard report
Image Classification ImageNet ReaL CvT-W24 (384 res, ImageNet-22k pretrain) Number of params 277M #14 of 57 Archive leaderboard report
Image Classification ImageNet ReaL CvT-W24 (384 res, ImageNet-22k pretrain) Top 1 Accuracy 87.7% #14 of 57 Archive leaderboard report
Image Classification Oxford-IIIT Pets CvT-W24 Accuracy 94.73 #2 of 6 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: CvT

Absolute Position EncodingsAdamAttentionAverage PoolingBPEBatch NormalizationConvolutionCvTDense ConnectionsDepthwise ConvolutionDepthwise Separable ConvolutionDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPointwise ConvolutionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformerVision 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