Papers › Not All Patches are What You Need: Expediting Vision Transformers via Token Reorganizations

Not All Patches are What You Need: Expediting Vision Transformers via Token Reorganizations

16 Feb 2022arXiv:2202.07800archive 2025-07-28

Youwei Liang, Chongjian Ge, Zhan Tong, Yibing Song, Jue Wang, Pengtao Xie

Vision Transformers (ViTs) take all the image patches as tokens and construct multi-head self-attention (MHSA) among them. Complete leverage of these image tokens brings redundant computations since not all the tokens are attentive in MHSA. Examples include that tokens containing semantically meaningless or distractive image backgrounds do not positively contribute to the ViT predictions. In this work, we propose to reorganize image tokens during the feed-forward process of ViT models, which is integrated into ViT during training. For each forward inference, we identify the attentive image tokens between MHSA and FFN (i.e., feed-forward network) modules, which is guided by the corresponding class token attention. Then, we reorganize image tokens by preserving attentive image tokens and fusing inattentive ones to expedite subsequent MHSA and FFN computations. To this end, our method EViT improves ViTs from two perspectives. First, under the same amount of input image tokens, our method reduces MHSA and FFN computation for efficient inference. For instance, the inference speed of DeiT-S is increased by 50% while its recognition accuracy is decreased by only 0.3% for ImageNet classification. Second, by maintaining the same computational cost, our method empowers ViTs to take more image tokens as input for recognition accuracy improvement, where the image tokens are from higher resolution images. An example is that we improve the recognition accuracy of DeiT-S by 1% for ImageNet classification at the same computational cost of a vanilla DeiT-S. Meanwhile, our method does not introduce more parameters to ViTs. Experiments on the standard benchmarks show the effectiveness of our method. The code is available at https://github.com/youweiliang/evit

PaperPDFCodeCode Syntology ran

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 2 repositories linked to this paper: 12 ran (of which 0 constructed an object rather than computing a result; 5 with no instrument failure: 0 honoured, 0 violated, 5 with no contract checked; 7 where Syntology's instrument failed) · 3 unverified. Where Syntology's instrument failed: 5 where our contract draft was wrong; 2 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: official repository: 12 samples from 1 repository, 10 ran (5 with no instrument failure; 5 where Syntology's instrument failed); community: 3 samples from 1 repository, 2 ran (0 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 1 of its repositories that Syntology harvested for other papers:

Levels written between 2026-09-22 and 2026-09-26 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed. 2 of the 12 samples that ran have no recorded date.

youweiliang/evit officialmentioned in papermentioned on GitHubpytorchApache-2.0Syntology: 12 samples, 10 ran (5 instrument-failed) · 2 unverified report
shiming-chen/zslvit mentioned on GitHubpytorchSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to Progressive Semantic-Guided Vision Transformer for Zero-Shot Learning (arXiv:2404.07713; that paper's own run record: 8 ran (of which 0 constructed an object rather than computing a result; 5 with no instrument failure: 0 honoured, 0 violated, 5 with no contract checked; 3 where Syntology's instrument failed) · 0 unverified); nothing checks that they implement this paper's method. 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: 12 ran (of which 0 constructed an object rather than computing a result; 5 with no instrument failure: 0 honoured, 0 violated, 5 with no contract checked; 7 where Syntology's instrument failed) · 3 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page last changed ; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

5ran · our draft was wrong
2ran; the contract check could not run
5ran
3unverified

Licence: 12 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 2 repositories linked to this paper, official or community; the list below is grouped by repository, each group headed by its name and what it is to the paper. “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”. “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.

youweiliang/evit official repository 12 samples, 10 ran (5 instrument-failed) · 2 unverified
adjust_keep_rate in 11 papers helpers.py ran Apache-2.0 recorded; this copy not marked cleared · pointer only · 66733f50aff69220 · report fixture: signature iters:int/0/int, epoch:int/0/int, warmup_epochs:int/0/int, total_epochs:int/0/int, ITERS_PER_EPOCH:int/0/int, base_keep_rate:float/0/float, max_keep_rate:float/0/float · returned float · level recorded 2026-09-24
build_transform in 170 papers datasets.py ran · our draft was wrong Apache-2.0 recorded; this copy not marked cleared · pointer only · 3bc74137ab36aa79 · report fixture: signature is_train:bool/0/bool, args:ArgsConfig/0/? · returned Compose · level recorded 2026-09-26
checkpoint_filter_fn in 80 papers evit.py ran · our draft was wrong Apache-2.0 recorded; this copy not marked cleared · pointer only · 6d8a1f8a0697180f · report fixture: signature state_dict:dict/0/?, model:callable/0/? · returned dict · level recorded 2026-09-25
drop_path in 325 papers
census: 27 implementations from 61 papers, 5 distinct outputs across 2 buckets, one shared input per bucket this sample: bucket 1 of 2, arg 1: rank 4, kind float, dtype float32
evit.py ran; the contract check could not run (RAISES) · metamorphic tier: invariant Apache-2.0 recorded; this copy not marked cleared · pointer only · 39eace7e2822504f · report fixture: signature x:Tensor/4/float, drop_prob:float/0/float, training:bool/0/bool · returned Tensor · level recorded 2026-09-22
get_deeper_idx visualize_mask.py ran Apache-2.0 recorded; this copy not marked cleared · pointer only · efdf8b9d60927bcd · report fixture: signature idx1:Tensor/2/int, idx2:Tensor/2/int · returned Tensor · level recorded 2026-09-24
get_real_idx visualize_mask.py ran Apache-2.0 recorded; this copy not marked cleared · pointer only · 22f1fefd3b89cf1f · report fixture: signature idxs:list/1/Tensor, fuse_token:bool/0/bool · returned list · level recorded 2026-09-24
mask in 19 papers visualize_mask.py ran Apache-2.0 recorded; this copy not marked cleared · pointer only · 5112560529a3d643 · report fixture: signature x:Tensor/4/float, idx:Tensor/2/int, patch_size:int/0/int · returned Tensor · level recorded 2026-09-24
raw_reader in 9 papers folder2lmdb.py ran · our draft was wrong Apache-2.0 recorded; this copy not marked cleared · pointer only · 51738010a21f76a1 · report fixture: signature path:str/0/str · returned bytes · level recorded 2026-09-25
resize_pos_embed in 102 papers evit.py ran; the contract check could not run (RAISES) · metamorphic tier: invariant Apache-2.0 recorded; this copy not marked cleared · pointer only · 191b2735955d18f4 · report fixture: signature posemb:Tensor/3/float, posemb_new:Tensor/3/float, num_tokens:int/0/int, gs_new:list/1/int · returned Tensor · level recorded 2026-09-22
speed_test in 5 papers helpers.py ran Apache-2.0 recorded; this copy not marked cleared · pointer only · e294b62d47bcc26f · report fixture: signature model:callable/0/?, ntest:int/0/int, batchsize:int/0/int, x:Tensor/4/float · returned float · level recorded 2026-09-24
dumps_pyarrow in 5 papers folder2lmdb.py unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 9e7bf674714e06d5 · report
loads_pyarrow in 8 papers folder2lmdb.py unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · b4c154b6f0568b6b · report
Retinal-Research/EVIT-UNET community 3 samples, 2 ran (2 instrument-failed) · 1 unverified
merge in 85 papers unet/eff_unet.py ran · our draft was wrong MIT (permissive) · 5ce6e78745861c0e · report fixture: signature in_chs:int/0/int, out_chs:int/0/int, act_layer:callable/0/? · returned Sequential · level recorded, date not recorded
stem in 11 papers unet/eff_unet.py ran · our draft was wrong MIT (permissive) · 560e3160f50add18 · report fixture: signature in_chs:int/0/int, out_chs:int/0/int, act_layer:callable/0/? · returned Sequential · level recorded, date not recorded
load_from train_unetKD.py unverified MIT (permissive) · 4ce559065d5b1b96 · report

Tasks

AllEfficient ViTs

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Efficient ViTs ImageNet-1K (With LV-ViT-S) EViT (70%) GFLOPs 4.7 #10 of 19 Archive leaderboard report
Efficient ViTs ImageNet-1K (With LV-ViT-S) EViT (70%) Top 1 Accuracy 83.0 #10 of 19 Archive leaderboard report
Efficient ViTs ImageNet-1K (With LV-ViT-S) EViT (50%) GFLOPs 3.9 #16 of 19 Archive leaderboard report
Efficient ViTs ImageNet-1K (With LV-ViT-S) EViT (50%) Top 1 Accuracy 82.5 #16 of 19 Archive leaderboard report
Efficient ViTs ImageNet-1K (with DeiT-S) EViT (80%) GFLOPs 3.5 #7 of 41 Archive leaderboard report
Efficient ViTs ImageNet-1K (with DeiT-S) EViT (80%) Top 1 Accuracy 79.8 #7 of 41 Archive leaderboard report
Efficient ViTs ImageNet-1K (with DeiT-S) EViT (90%) GFLOPs 4.0 #10 of 41 Archive leaderboard report
Efficient ViTs ImageNet-1K (with DeiT-S) EViT (90%) Top 1 Accuracy 79.8 #10 of 41 Archive leaderboard report
Efficient ViTs ImageNet-1K (with DeiT-S) EViT (70%) GFLOPs 3.0 #21 of 41 Archive leaderboard report
Efficient ViTs ImageNet-1K (with DeiT-S) EViT (70%) Top 1 Accuracy 79.5 #21 of 41 Archive leaderboard report
Efficient ViTs ImageNet-1K (with DeiT-S) EViT (60%) GFLOPs 2.6 #32 of 41 Archive leaderboard report
Efficient ViTs ImageNet-1K (with DeiT-S) EViT (60%) Top 1 Accuracy 78.9 #32 of 41 Archive leaderboard report
Efficient ViTs ImageNet-1K (with DeiT-S) EViT (50%) GFLOPs 2.3 #37 of 41 Archive leaderboard report
Efficient ViTs ImageNet-1K (with DeiT-S) EViT (50%) Top 1 Accuracy 78.5 #37 of 41 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

SPEED

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