Papers › All Tokens Matter: Token Labeling for Training Better Vision Transformers

All Tokens Matter: Token Labeling for Training Better Vision Transformers

22 Apr 2021NeurIPS 2021 12arXiv:2104.10858archive 2025-07-28

Zihang Jiang, Qibin Hou, Li Yuan, Daquan Zhou, Yujun Shi, Xiaojie Jin, Anran Wang, Jiashi Feng

In this paper, we present token labeling -- a new training objective for training high-performance vision transformers (ViTs). Different from the standard training objective of ViTs that computes the classification loss on an additional trainable class token, our proposed one takes advantage of all the image patch tokens to compute the training loss in a dense manner. Specifically, token labeling reformulates the image classification problem into multiple token-level recognition problems and assigns each patch token with an individual location-specific supervision generated by a machine annotator. Experiments show that token labeling can clearly and consistently improve the performance of various ViT models across a wide spectrum. For a vision transformer with 26M learnable parameters serving as an example, with token labeling, the model can achieve 84.4% Top-1 accuracy on ImageNet. The result can be further increased to 86.4% by slightly scaling the model size up to 150M, delivering the minimal-sized model among previous models (250M+) reaching 86%. We also show that token labeling can clearly improve the generalization capability of the pre-trained models on downstream tasks with dense prediction, such as semantic segmentation. Our code and all the training details will be made publicly available at https://github.com/zihangJiang/TokenLabeling.

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="2104.10858")

Code

Syntology Ran 3 of 5 code samples harvested from 2 repositories linked to this paper; 2 have no recorded run. Of those that ran: 1 ran · honoured contract; 2 ran · fixture could not drive it.

By repository: official repository: 2 samples from 1 repository, 1 ran; community (archive-listed): 2 samples from 1 repository, 2 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.

zihangJiang/TokenLabeling officialmentioned in papermentioned on GitHubpytorch report
catalpaaa/demansia mentioned on GitHubpytorch report
flytocc/TokenLabeling-paddle mentioned on GitHubpaddle report
naver-ai/vidt mentioned on GitHubpytorch report
sail-sg/dualformer mentioned on GitHubpytorch report
zhoudaquan/Refiner_ViT 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

5 samples harvested; 3 ran; 1 honoured the contract we drafted; 2 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
2unverified

Licence: 3 of the 5 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 2 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.

get_dpr zihangJiang/TokenLabeling/tlt/models/lvvit.py official repository ran · honoured contract Apache-2.0 (permissive) · b240fa8e2e8f8ec6 · report
get_block zihangJiang/TokenLabeling/tlt/models/lvvit.py official repository unverified Apache-2.0 (permissive) · 219807603e18aac6 · report
Position_embedding zhoudaquan/Refiner_ViT/models/refined_transformer.py community (archive-listed) ran · fixture could not drive it no licence file found · pointer only · 9ebf0e5695d4429d · report
get_points_single zhoudaquan/Refiner_ViT/models/refined_transformer.py community (archive-listed) ran · fixture could not drive it no licence file found · pointer only · c8df8fc3cbc72444 · report
rand_bbox identical code first harvested elsewhere unverified licence of this copy not recorded · d34a085d71b8f4b5 · report

Tasks

AllEfficient ViTsGeneral ClassificationImage ClassificationSemantic Segmentationimage-classification

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Efficient ViTs ImageNet-1K (With LV-ViT-S) Base (LV-ViT-S) GFLOPs 6.6 #3 of 19 Archive leaderboard report
Efficient ViTs ImageNet-1K (With LV-ViT-S) Base (LV-ViT-S) Top 1 Accuracy 83.3 #3 of 19 Archive leaderboard report
Image Classification ImageNet LV-ViT-L GFLOPs 214.8 #151 of 1060 Archive leaderboard report
Image Classification ImageNet LV-ViT-L Number of params 151M #151 of 1060 Archive leaderboard report
Image Classification ImageNet LV-ViT-L Top 1 Accuracy 86.4% #151 of 1060 Archive leaderboard report
Image Classification ImageNet LV-ViT-M GFLOPs 16 #356 of 1060 Archive leaderboard report
Image Classification ImageNet LV-ViT-M Number of params 56M #356 of 1060 Archive leaderboard report
Image Classification ImageNet LV-ViT-M Top 1 Accuracy 84.1% #356 of 1060 Archive leaderboard report
Image Classification ImageNet LV-ViT-S GFLOPs 6.6 #438 of 1060 Archive leaderboard report
Image Classification ImageNet LV-ViT-S Number of params 26M #438 of 1060 Archive leaderboard report
Image Classification ImageNet LV-ViT-S Top 1 Accuracy 83.3% #438 of 1060 Archive leaderboard report
Semantic Segmentation ADE20K LV-ViT-L (UperNet, MS) Params (M) 209 #91 of 235 Archive leaderboard report
Semantic Segmentation ADE20K LV-ViT-L (UperNet, MS) Validation mIoU 51.8 #91 of 235 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 ConnectionsLV-ViTLayer 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