SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · aaai_25860 · AAAI · 2023

CF-ViT: A General Coarse-to-Fine Method for Vision Transformer

Rongrong Ji, Ke Li, Mingbao Lin, Fei Chao, Yongjian Wu, Yunhang Shen, Mengzhao Chen

Open in the Atlas

Code that ran

7 of 13 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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 6 failures of our instrument; 6 no recorded run), measured 2026-11-22; 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/aaai_25860.json · badge: /api/ran/aaai_25860.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
ChenMnZ/CF-ViT canonical (classifier label)
classifier basis: census
7 ran · 6 no recorded run
FunctionStatusWhere it lives
accuracy Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ChenMnZ/CF-ViT/utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from edgeai1/lf-vit, is pointer only (licence: NONE) · get_code("11a9344aa6b3aaf2")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), 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. A run is recorded.

batch_index_select Ran
ran; our contract draft was wrong, not the code
ChenMnZ/CF-ViT/utils.py
code served (permissive licence) · get_code("908619be92da9903")
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)

# Test case 1: 3D tensor
x_3d = torch.randn(2, 4, 3)  # B=2, N=4, C=3
idx_3d = torch.tensor([[0, 2], [1, 3]])  # B=2, N_new=2

# Test case 2: 2D tensor
x_2d = torch.randn(2, 4)  # B=2, N=4
idx_2d = torch.tensor([[0, 2], [1, 3]])  # B=2, N_new=2

# Use the 3D case for ARGS
ARGS = {
    "x": x_3d,
    "idx": idx_3d,
}
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
build_transform Ran
ran; our contract draft was wrong, not the code
ChenMnZ/CF-ViT/deit/datasets.py
pointer only (licence: Apache-2.0) · get_code("3bc74137ab36aa79")
How it ran

The body of this sample is withheld: Apache-2.0, as GitHub detects it on this paper's repository, ChenMnZ/CF-ViT, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. 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. A run is recorded.

dynamic_evaluate Ran
ran; our contract draft was wrong, not the code
ChenMnZ/CF-ViT/dynamic_inference.py
code served (permissive licence) · get_code("8f49cc1ffec8b4b7")
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 tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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)

# logits: shape (n_stage, n_sample, c)
# - n_stage: number of stages
# - n_sample: number of samples
# - c: number of classes
logits = torch.randn(3, 2, 4)  # 3 stages, 2 samples, 4 classes

# targets: shape (n_sample,) with class indices
targets = torch.tensor([1, 2])  # 2 samples with class labels

# flops: shape (n_stage,) with flop counts per stage
flops = torch.tensor([100.0, 200.0, 300.0])  # 3 stages

# T: shape (n_stage,) with confidence thresholds per stage
T = torch.tensor([0.3, 0.5, 0.7])  # 3 stages with different thresholds

ARGS = {
    "logits": logits,
    "targets": targets,
    "flops": flops,
    "T": T,
}
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 tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
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
get_index Ran
ran; our contract draft was wrong, not the code
ChenMnZ/CF-ViT/utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from edgeai1/lf-vit, is pointer only (licence: NONE) · get_code("92d94f28ebc2079a")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), 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. A run is recorded.

get_keep_indices Ran
ran, honoured the contract we drafted
ChenMnZ/CF-ViT/visualize.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from edgeai1/lf-vit, is pointer only (licence: NONE) · get_code("37f5e48a5790ef05")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), 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. A run is recorded.

get_transform Ran
ran; our contract draft was wrong, not the code
ChenMnZ/CF-ViT/visualize.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from edgeai1/lf-vit, is pointer only (licence: NONE) · get_code("7d65fb83e43743c6")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), 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. A run is recorded.

build_dataset Not yet run
unverified (harvested, no recorded run)
ChenMnZ/CF-ViT/deit/datasets.py
pointer only (licence: Apache-2.0) · get_code("9153241c4331eb1a")
How it ran

The body of this sample is withheld: Apache-2.0, as GitHub detects it on this paper's repository, ChenMnZ/CF-ViT, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. 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.

evaluate_throughput Not yet run
unverified (harvested, no recorded run)
ChenMnZ/CF-ViT/dynamic_inference.py
pointer only (licence: Apache-2.0) · get_code("dac8b95d52d9d274")
How it ran

The body of this sample is withheld: Apache-2.0, as GitHub detects it on this paper's repository, ChenMnZ/CF-ViT, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. 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.

gen_masked_tokens Not yet run
unverified (harvested, no recorded run)
ChenMnZ/CF-ViT/visualize.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from edgeai1/lf-vit, is pointer only (licence: NONE) · get_code("b0434ead3a6e4aea")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), 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.

generate_logits Not yet run
unverified (harvested, no recorded run)
ChenMnZ/CF-ViT/dynamic_inference.py
code served (permissive licence) · get_code("1a428b74a66cbcf3")
How it ran

no invocation recorded.

validate Not yet run
unverified (harvested, no recorded run)
ChenMnZ/CF-ViT/main_lvvit.py
pointer only (licence: Apache-2.0) · get_code("b99bcda9a4bdf4b7")
How it ran

The body of this sample is withheld: Apache-2.0, as GitHub detects it on this paper's repository, ChenMnZ/CF-ViT, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. 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.

validate_throughput Not yet run
unverified (harvested, no recorded run)
ChenMnZ/CF-ViT/main_lvvit.py
pointer only (licence: Apache-2.0) · get_code("90e2fbbb2436eed9")
How it ran

The body of this sample is withheld: Apache-2.0, as GitHub detects it on this paper's repository, ChenMnZ/CF-ViT, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. 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 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 10 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 9 later) and 3 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
21 dated earlier, 8 later, 8 same year, order not determinable
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
11 dated earlier, 7 later, 7 same year, order not determinable
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
batch_index_select 10 other papers
2 dated earlier, 4 later, 4 same year, order not determinable · 1 only as an assembly brick
2106.02034 (2021-06)
DynamicViT: Efficient Vision Transformers with Dynamic Token Sparsification
2202.06258 (2022-02)
Flowformer: Linearizing Transformers with Conservation Flows
2304.10716 (2023-04)
Joint Token Pruning and Squeezing Towards More Aggressive Compression of Vision Transformers
and 7 more not named here
dynamic_evaluate 5 other papers
4 dated earlier, 1 later
2010.05300 (2020-10)
Glance and Focus: a Dynamic Approach to Reducing Spatial Redundancy in Image Classification
2105.15075 (2021-05)
Not All Images are Worth 16x16 Words: Dynamic Transformers for Efficient Image Recognition
2201.03014 (2022-01)
Glance and Focus Networks for Dynamic Visual Recognition
and 2 more not named here
accuracy 1 other paper
1 later
2402.00033 (2024-02)
LF-ViT: Reducing Spatial Redundancy in Vision Transformer for Efficient Image Recognition
gen_masked_tokens 1 other paper
1 later
2402.00033 (2024-02)
LF-ViT: Reducing Spatial Redundancy in Vision Transformer for Efficient Image Recognition
generate_logits 1 other paper
1 dated earlier
2203.03821 (2022-03)
CF-ViT: A General Coarse-to-Fine Method for Vision Transformer
get_index 1 other paper
1 later
2402.00033 (2024-02)
LF-ViT: Reducing Spatial Redundancy in Vision Transformer for Efficient Image Recognition
get_keep_indices 1 other paper
1 later
2402.00033 (2024-02)
LF-ViT: Reducing Spatial Redundancy in Vision Transformer for Efficient Image Recognition
get_transform 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 (ViT) have made many breakthroughs in computer vision tasks. However, considerable redundancy arises in the spatial dimension of an input image, leading to massive computational costs. Therefore, We propose a coarse-to-fine vision transformer (CF-ViT) to relieve computational burden while retaining performance in this paper. Our proposed CF-ViT is motivated by two important observations in modern ViT models: (1) The coarse-grained patch splitting can locate informative regions of an input image. (2) Most images can be well recognized by a ViT model in a small-length token sequence. Therefore, our CF-ViT implements network inference in a two-stage manner. At coarse inference stage, an input image is split into a small-length patch sequence for a computationally economical classification. If not well recognized, the informative patches are identified and further re-split in a fine-grained granularity. Extensive experiments demonstrate the efficacy of our CF-ViT. For example, without any compromise on performance, CF-ViT reduces 53% FLOPs of LV-ViT, and also achieves 2.01× throughput. Code of this project is at https://github.com/ChenMnZ/CF-ViT.

For agents

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

get_harvested_code_for_paper("aaai_25860")
get_code_for_paper("aaai_25860")
have("aaai_25860")

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

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

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

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

Connect an agent — have() is free.