Papers › Training data-efficient image transformers & distillation through attention

Training data-efficient image transformers & distillation through attention

23 Dec 2020arXiv:2012.12877archive 2025-07-28

Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, Hervé Jégou

Recently, neural networks purely based on attention were shown to address image understanding tasks such as image classification. However, these visual transformers are pre-trained with hundreds of millions of images using an expensive infrastructure, thereby limiting their adoption. In this work, we produce a competitive convolution-free transformer by training on Imagenet only. We train them on a single computer in less than 3 days. Our reference vision transformer (86M parameters) achieves top-1 accuracy of 83.1% (single-crop evaluation) on ImageNet with no external data. More importantly, we introduce a teacher-student strategy specific to transformers. It relies on a distillation token ensuring that the student learns from the teacher through attention. We show the interest of this token-based distillation, especially when using a convnet as a teacher. This leads us to report results competitive with convnets for both Imagenet (where we obtain up to 85.2% accuracy) and when transferring to other tasks. We share our code and models.

PaperPDFCodeCode 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="2012.12877")

Code

Syntology Ran 12 of 19 code samples harvested from 8 repositories linked to this paper; 7 have no recorded run. Of those that ran: 1 ran · honoured contract; 2 ran · fixture could not drive it; 9 ran with no contract checked.

By repository: community (archive-listed): 18 samples from 8 repositories, 11 ran; 1 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.

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

facebookresearch/deit officialmentioned in papermentioned on GitHubpytorch report
rwightman/pytorch-image-models mentioned in papermentioned on GitHubpytorch report
IMvision12/keras-vision-models mentioned on GitHubpytorch report
TACJu/TransFG mentioned on GitHubpytorch report
affjljoo3581/deit3-jax mentioned on GitHubjax report
ahmedelmahy/myownvit mentioned on GitHubpytorch report
aiot-mlsys-lab/famba-v mentioned on GitHubpytorch report
alessiomora/unlearning_fl mentioned on GitHubtfApache-2.0 report
asrafulashiq/deit-custom mentioned on GitHubpytorch report
bshantam97/Attention_Based_Networks mentioned on GitHubpytorch report
gatech-eic/vitcod mentioned on GitHubpytorch report
holdfire/CLS mentioned on GitHubpytorch report
holdfire/FAS mentioned on GitHubpytorch report
huggingface/transformers mentioned on GitHubpytorch report
hustvl/vim mentioned on GitHubpytorch report
jacobgil/vit-explain mentioned on GitHubpytorch report
liuxingwt/CLS mentioned on GitHubpytorch report
moein-shariatnia/Pix2Seq mentioned on GitHubpytorch report
nus-hpc-ai-lab/dyvm mentioned on GitHubpytorch report
omihub777/vit-cifar mentioned on GitHubpytorch report
open-edge-platform/geti mentioned on GitHubpytorchApache-2.0 report
s-chh/patchrot mentioned on GitHubpytorchMIT report
skchen1993/TrangFG mentioned on GitHubpytorch report
smu-ivpl/DeepfakeDetection mentioned on GitHubpytorch report
tianhai123/vit-pytorch mentioned on GitHubpytorch report
ttt496/vit-pytorch mentioned on GitHubpytorch report
zhuhanqing/lightening-transformer mentioned on GitHubpytorchGPL-3.0 report
PaddlePaddle/PaddleClas 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

19 samples harvested; 12 ran; 1 honoured the contract we drafted; 7 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 · fixture could not drive it
9ran
7unverified

Licence: 3 of the 19 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 8 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.

Attention alibaba/EasyCV/easycv/models/backbones/vision_transformer.py community (archive-listed) ran · metamorphic tier: deterministic fingerprinted Apache-2.0 (permissive) · c0bfabc05e380222 · report
DistillationLoss hustvl/vim/vim/losses.py community (archive-listed) ran Apache-2.0 (permissive) · b42ba639d4f94082 · report
DistilledVisionTransformer holdfire/FAS/models/deit.py community (archive-listed) ran no licence file found · pointer only · fee0f891e0558ff8 · report
DropPath alibaba/EasyCV/easycv/models/backbones/vision_transformer.py community (archive-listed) ran · metamorphic tier: invariant fingerprinted Apache-2.0 (permissive) · c713760d26bf0a45 · report
Encoder moein-shariatnia/Pix2Seq/model.py community (archive-listed) ran MIT (permissive) · e089d779e4638b42 · report
Mlp alibaba/EasyCV/easycv/models/backbones/vision_transformer.py community (archive-listed) ran Apache-2.0 (permissive) · 64505a0b6aa5e3d4 · report
MultiHeadSelfAttention omihub777/vit-cifar/dw_vit.py community (archive-listed) ran · metamorphic tier: invariant MIT (permissive) · 295ab55989f9e8fe · report
TransformerEncoder omihub777/vit-cifar/dw_vit.py community (archive-listed) ran · metamorphic tier: invariant fingerprinted MIT (permissive) · 9e38671b1e2518ec · report
_no_grad_trunc_normal_ alibaba/EasyCV/easycv/models/backbones/vision_transformer.py community (archive-listed) ran · fixture could not drive it Apache-2.0 (permissive) · 5bcbd988b672cf32 · report
hydra alibaba/EasyCV/easycv/models/backbones/vision_transformer.py community (archive-listed) ran fingerprinted Apache-2.0 (permissive) · c4a17f13fadc2630 · report
trunc_normal_ alibaba/EasyCV/easycv/models/backbones/vision_transformer.py community (archive-listed) ran · fixture could not drive it Apache-2.0 (permissive) · 462cf9fa4898bc51 · report
Block alibaba/EasyCV/easycv/models/backbones/vision_transformer.py community (archive-listed) unverified Apache-2.0 (permissive) · bc7c311c2770067a · report
DeiT UdbhavPrasad072300/Transformer-Implementations/transformer_package/models/transformer.py community (archive-listed) unverified MIT (permissive) · 4eae8cfd26a7bed5 · report
DepthwiseViT omihub777/vit-cifar/dw_vit.py community (archive-listed) unverified MIT (permissive) · fa8c4e7bc2b8d354 · report
DistilledVisionTransformer asrafulashiq/deit-custom/models.py community (archive-listed) unverified Apache-2.0 (permissive) · 2de7c7e2fe313b48 · report
ValueError alibaba/EasyCV/easycv/models/backbones/vision_transformer.py community (archive-listed) unverified Apache-2.0 (permissive) · c152c68202903a9f · report
VisionTransformer alibaba/EasyCV/easycv/models/backbones/vision_transformer.py community (archive-listed) unverified Apache-2.0 (permissive) · a4ea24ce126312f8 · report
_add_distilation_arguments code-implementation1/Code1/DeiT/src/args.py community (archive-listed) unverified no licence file found · pointer only · d90ec8f4e83b1d6a · report
con_loss identical code first harvested elsewhere ran · honoured contract fingerprinted licence of this copy not recorded · c1c79ef7fd065038 · report

Tasks

Document Image ClassificationDocument Layout AnalysisEfficient ViTsFine-Grained Image ClassificationImage Classificationimage-classification

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Document Image Classification RVL-CDIP DeiT-B Accuracy 90.32% #30 of 31 Archive leaderboard report
Document Image Classification RVL-CDIP DeiT-B Parameters 87M #30 of 31 Archive leaderboard report
Document Layout Analysis PubLayNet val DeiT-B Figure 0.957 #10 of 15 Archive leaderboard report
Document Layout Analysis PubLayNet val DeiT-B List 0.921 #10 of 15 Archive leaderboard report
Document Layout Analysis PubLayNet val DeiT-B Overall 0.932 #10 of 15 Archive leaderboard report
Document Layout Analysis PubLayNet val DeiT-B Table 0.972 #10 of 15 Archive leaderboard report
Document Layout Analysis PubLayNet val DeiT-B Text 0.934 #10 of 15 Archive leaderboard report
Document Layout Analysis PubLayNet val DeiT-B Title 0.874 #10 of 15 Archive leaderboard report
Efficient ViTs ImageNet-1K (with DeiT-S) Base (DeiT-S) GFLOPs 4.6 #12 of 41 Archive leaderboard report
Efficient ViTs ImageNet-1K (with DeiT-S) Base (DeiT-S) Top 1 Accuracy 79.8 #12 of 41 Archive leaderboard report
Efficient ViTs ImageNet-1K (with DeiT-T) Base (DeiT-T) GFLOPs 1.2 #7 of 22 Archive leaderboard report
Efficient ViTs ImageNet-1K (with DeiT-T) Base (DeiT-T) Top 1 Accuracy 72.2 #7 of 22 Archive leaderboard report
Fine-Grained Image Classification Oxford 102 Flowers DeiT-B Accuracy 98.8% #10 of 25 Archive leaderboard report
Fine-Grained Image Classification Oxford 102 Flowers DeiT-B PARAMS 86M #10 of 25 Archive leaderboard report
Fine-Grained Image Classification Stanford Cars DeiT-B Accuracy 93.3% #65 of 83 Archive leaderboard report
Fine-Grained Image Classification Stanford Cars DeiT-B PARAMS 86M #65 of 83 Archive leaderboard report
Image Classification CIFAR-10 DeiT-B Percentage correct 99.1 #14 of 265 Archive leaderboard report
Image Classification CIFAR-100 DeiT-B PARAMS 86M #22 of 211 Archive leaderboard report
Image Classification CIFAR-100 DeiT-B Percentage correct 90.8 #22 of 211 Archive leaderboard report
Image Classification Flowers-102 DeiT-B Accuracy 98.8% #21 of 52 Archive leaderboard report
Image Classification Flowers-102 DeiT-B PARAMS 86M #21 of 52 Archive leaderboard report
Image Classification ImageNet DeiT-B 384 Number of params 87M #251 of 1060 Archive leaderboard report
Image Classification ImageNet DeiT-B 384 Top 1 Accuracy 85.2% #251 of 1060 Archive leaderboard report
Image Classification ImageNet DeiT-B Number of params 86M #341 of 1060 Archive leaderboard report
Image Classification ImageNet DeiT-B Top 1 Accuracy 84.2% #341 of 1060 Archive leaderboard report
Image Classification ImageNet DeiT-B Number of params 22M #524 of 1060 Archive leaderboard report
Image Classification ImageNet DeiT-B Top 1 Accuracy 82.6% #524 of 1060 Archive leaderboard report
Image Classification ImageNet DeiT-B Number of params 5M #910 of 1060 Archive leaderboard report
Image Classification ImageNet DeiT-B Top 1 Accuracy 76.6% #910 of 1060 Archive leaderboard report
Image Classification ImageNet ReaL DeiT-B-384 Accuracy 89.3% #24 of 57 Archive leaderboard report
Image Classification ImageNet ReaL DeiT-B-384 Params 86M #24 of 57 Archive leaderboard report
Image Classification ImageNet ReaL DeiT-B Accuracy 88.7% #26 of 57 Archive leaderboard report
Image Classification ImageNet ReaL DeiT-B Params 86M #26 of 57 Archive leaderboard report
Image Classification ImageNet ReaL DeiT-S Accuracy 86.8% #36 of 57 Archive leaderboard report
Image Classification ImageNet ReaL DeiT-S Params 22M #36 of 57 Archive leaderboard report
Image Classification ImageNet ReaL DeiT-Ti Accuracy 82.1% #49 of 57 Archive leaderboard report
Image Classification ImageNet ReaL DeiT-Ti Params 5M #49 of 57 Archive leaderboard report
Image Classification iNaturalist 2018 DeiT-B Top-1 Accuracy 79.5% #18 of 60 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

AdamWAttentionAttention DropoutCutMixDeiTDense ConnectionsDropoutFeedforward NetworkFixResLabel SmoothingLinear LayerMixupMulti-Head AttentionRandAugmentSoftmaxStochastic DepthWeight Decay

3 archive method tags without a method page not shown.

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