SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2108.01390 · 2021

Evo-ViT: Slow-Fast Token Evolution for Dynamic Vision Transformer

arXiv · PDF · Open in the Atlas

Code that ran

7 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 3 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 3 failures of our instrument; 2 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2108.01390.json · badge: /api/ran/2108.01390.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
YifanXu74/Evo-ViT canonical (classifier label)
classifier basis: census
7 ran · 2 no recorded run
FunctionStatusWhere it lives
count_params Ran
ran, honoured the contract we drafted
YifanXu74/Evo-ViT/benchmark.py
code served (permissive licence) · get_code("410bffb8a07b52e3")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-04T23:28:41Z). If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Build a small model with parameters
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

model = SimpleModel()

ARGS = {
    "model": model
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
build_transform Ran
ran; our contract draft was wrong, not the code
YifanXu74/Evo-ViT/datasets.py
code served (permissive licence) · get_code("3bc74137ab36aa79")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Compose. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from torchvision import transforms

torch.manual_seed(0)

class ArgsConfig:
    def __init__(self):
        self.input_size = 224
        self.color_jitter = 0.4
        self.aa = "rand-m9-mstd0.5"
        self.train_interpolation = "bicubic"
        self.reprob = 0.25
        self.remode = "pixel"
        self.recount = 2

ARGS = {
    "is_train": True,
    "args": ArgsConfig()
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, timm, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Compose — a Compose output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Compose output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
checkpoint_filter_fn Ran
ran; our contract draft was wrong, not the code
YifanXu74/Evo-ViT/deit/evo_deit.py
code served (permissive licence) · get_code("0b3795f9775ce118")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import math

torch.manual_seed(0)

# Build a minimal model that has the attributes accessed in checkpoint_filter_fn
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        # patch_embed.proj needs to be a Conv2d with weight shape (O, I, H, W)
        self.patch_embed = nn.Module()
        self.patch_embed.proj = nn.Conv2d(3, 16, kernel_size=4, stride=4)
        
        # pos_embed needs to match the shape that will be checked
        # For a model with 64x64 input, 4x4 patches, we get 16x16 = 256 patches
        # Plus 1 for class token = 257 tokens, embed_dim=8
        self.pos_embed = torch.randn(1, 257, 8)

model = MinimalModel()

# Create a state_dict that will be processed
# Include a pos_embed with different shape to trigger resize_pos_embed
# Old pos_embed: 1 cls token + 100 grid tokens (10x10 grid) = 101 tokens, dim 8
old_pos_embed = torch.randn(1, 101, 8)

state_dict = {
    'pos_embed': old_pos_embed,
    'patch_embed.proj.weight': torch.randn(16, 3, 4, 4),
    'some_other_param': torch.randn(10, 10),
}

ARGS = {
    'state_dict': state_dict,
    'model': model,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
cuda_timestamp Ran
ran, honoured the contract we drafted
YifanXu74/Evo-ViT/benchmark.py
code served (permissive licence) · get_code("50d653ee6a59955c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import time
import torch
import torch.nn.parallel

torch.manual_seed(0)

ARGS = {
    "sync": False,
    "device": None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
easy_gather Ran
ran on a synthesized input
YifanXu74/Evo-ViT/deit/evo_deit.py
code served (permissive licence) · get_code("a402be7c553f216c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 3, dtype family float, shape (2, 2, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Construct arguments for easy_gather
# The function expects:
# - x: tensor of shape (B, N, C)
# - indices: tensor of shape (B, N_new) with values in range [0, N)

B = 2  # batch size
N = 4  # original sequence length
C = 3  # channel/feature dimension
N_new = 2  # new sequence length after gathering

# Create input tensor x with shape (B, N, C)
x = torch.randn(B, N, C)

# Create indices tensor with shape (B, N_new)
# Values should be in range [0, N) to validly index into the N dimension
indices = torch.tensor([[0, 2], [1, 3]], dtype=torch.long)

ARGS = {
    "x": x,
    "indices": indices,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 2, 3) — shape (2, 2, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
resize_pos_embed Ran
ran; our contract draft was wrong, not the code
YifanXu74/Evo-ViT/deit/evo_deit.py
code served (permissive licence) · get_code("109c74bc1997c975")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 3, dtype family float, shape (1, 10, 8) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import math
import logging
import torch
import torch.nn.functional as F

torch.manual_seed(0)

# Setup logging
logging.basicConfig(level=logging.INFO)

# Create position embeddings
# posemb: [batch, num_tokens, embed_dim]
# The function expects:
# - posemb[:, :1] to be the token embedding (CLS token)
# - posemb[0, 1:] to be the grid embeddings
# For a 4x4 grid, we need 1 + 16 = 17 tokens
# Let's use a smaller grid: 2x2 = 4 grid tokens + 1 cls token = 5 total tokens

embed_dim = 8
old_grid_size = 2  # 2x2 grid
num_old_tokens = 1 + old_grid_size * old_grid_size  # 1 cls + 4 grid = 5
posemb = torch.randn(1, num_old_tokens, embed_dim)

# Create new position embedding with different grid size
# Let's resize to a 3x3 grid: 1 + 9 = 10 tokens
new_grid_size = 3  # 3x3 grid
num_new_tokens = 1 + new_grid_size * new_grid_size  # 1 cls + 9 grid = 10
posemb_new = torch.randn(1, num_new_tokens, embed_dim)

ARGS = {
    'posemb': posemb,
    'posemb_new': posemb_new,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (1, 10, 8) — shape (1, 10, 8) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
timestamp Ran
ran, honoured the contract we drafted
YifanXu74/Evo-ViT/benchmark.py
code served (permissive licence) · get_code("475160c5a1a1225a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import time

def timestamp(sync=False):
    return time.perf_counter()

ARGS = {
    "sync": False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
build_dataset Not yet run
unverified (harvested, no recorded run)
YifanXu74/Evo-ViT/datasets.py
code served (permissive licence) · get_code("9153241c4331eb1a")
How it ran

no invocation recorded.

build_dataset2 Not yet run
unverified (harvested, no recorded run)
YifanXu74/Evo-ViT/datasets.py
pointer only (licence: MIT); the stored copy get_code serves, from edgeai1/lf-vit, is pointer only (licence: NONE) · get_code("b6679d5755485cf9")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from edgeai1/lf-vit, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 8 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 8 later) and 1 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
build_transform 37 other papers
5 dated earlier, 32 later
2104.05707 (2021-04)
LocalViT: Analyzing Locality in Vision Transformers
2104.13840 (2021-04)
Twins: Revisiting the Design of Spatial Attention in Vision Transformers
2106.00515 (2021-06)
KVT: k-NN Attention for Boosting Vision Transformers
and 34 more not named here
build_dataset 25 other papers
3 dated earlier, 22 later
2104.05707 (2021-04)
LocalViT: Analyzing Locality in Vision Transformers
2106.00515 (2021-06)
KVT: k-NN Attention for Boosting Vision Transformers
2106.01401 (2021-06)
Container: Context Aggregation Network
and 22 more not named here
count_params 10 other papers
10 later
2201.09792 (2022-01)
Patches Are All You Need?
ijcai2023_0106 (2023 (year only))
SWAT: Spatial Structure Within and Among Tokens
2303.16900 (2023-03)
InceptionNeXt: When Inception Meets ConvNeXt
and 7 more not named here
cuda_timestamp 10 other papers
10 later
2201.09792 (2022-01)
Patches Are All You Need?
ijcai2023_0106 (2023 (year only))
SWAT: Spatial Structure Within and Among Tokens
2303.16900 (2023-03)
InceptionNeXt: When Inception Meets ConvNeXt
and 7 more not named here
timestamp 10 other papers
10 later
2201.09792 (2022-01)
Patches Are All You Need?
ijcai2023_0106 (2023 (year only))
SWAT: Spatial Structure Within and Among Tokens
2303.16900 (2023-03)
InceptionNeXt: When Inception Meets ConvNeXt
and 7 more not named here
resize_pos_embed 8 other papers
2 dated earlier, 6 later
2106.00515 (2021-06)
KVT: k-NN Attention for Boosting Vision Transformers
2107.00645 (2021-07)
Global Filter Networks for Image Classification
2112.05230 (2021-12)
Injecting Semantic Concepts into End-to-End Image Captioning
and 5 more not named here
checkpoint_filter_fn 7 other papers
2 dated earlier, 5 later
2106.00515 (2021-06)
KVT: k-NN Attention for Boosting Vision Transformers
2107.00645 (2021-07)
Global Filter Networks for Image Classification
2112.05230 (2021-12)
Injecting Semantic Concepts into End-to-End Image Captioning
and 4 more not named here
build_dataset2 1 other paper
1 later
2402.00033 (2024-02)
LF-ViT: Reducing Spatial Redundancy in Vision Transformer for Efficient Image Recognition

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Vision transformers (ViTs) have recently received explosive popularity, but the huge computational cost is still a severe issue. Since the computation complexity of ViT is quadratic with respect to the input sequence length, a mainstream paradigm for computation reduction is to reduce the number of tokens. Existing designs include structured spatial compression that uses a progressive shrinking pyramid to reduce the computations of large feature maps, and unstructured token pruning that dynamically drops redundant tokens. However, the limitation of existing token pruning lies in two folds: 1) the incomplete spatial structure caused by pruning is not compatible with structured spatial compression that is commonly used in modern deep-narrow transformers; 2) it usually requires a time-consuming pre-training procedure. To tackle the limitations and expand the applicable scenario of token pruning, we present Evo-ViT, a self-motivated slow-fast token evolution approach for vision transformers. Specifically, we conduct unstructured instance-wise token selection by taking advantage of the simple and effective global class attention that is native to vision transformers. Then, we propose to update the selected informative tokens and uninformative tokens with different computation paths, namely, slow-fast updating. Since slow-fast updating mechanism maintains the spatial structure and information flow, Evo-ViT can accelerate vanilla transformers of both flat and deep-narrow structures from the very beginning of the training process. Experimental results demonstrate that our method significantly reduces the computational cost of vision transformers while maintaining comparable performance on image classification.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2108.01390")
get_code_for_paper("2108.01390")
have("2108.01390")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2108.01390.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2108.01390.svg)](https://syntology.ai/paper/2108.01390)

Connect an agent — have() is free.