SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2210.01035 · NeurIPS · 2022

Expediting Large-Scale Vision Transformer for Dense Prediction without Fine-tuning

Chao Zhang, Zheng Zhang, Han Hu, Yuhui Yuan, Weihong Lin, Henghui Ding, Weicong Liang, Xiao Luo, Ding Jia

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 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; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 4 failures of our instrument; 0 no recorded run), 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/2210.01035.json · badge: /api/ran/2210.01035.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
Expedit-LargeScale-Vision-Transformer/Expedit-DPT canonical (classifier label)
classifier basis not recorded on the link
7 ran · 0 no recorded run
FunctionStatusWhere it lives
apply_min_size Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Expedit-LargeScale-Vision-Transformer/Expedit-DPT/dpt/transforms.py
code served (permissive licence) · get_code("8d4e5ab503856d09")
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 tuple, ndim 1, dtype family int; 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 numpy as np
import cv2
import math

# Create a sample dictionary with required keys
sample = {
    'disparity': np.random.rand(10, 15).astype(np.float32),
    'image': np.random.randint(0, 256, (10, 15, 3), dtype=np.uint8),
    'mask': np.random.rand(10, 15) > 0.5
}

# Define the size parameter
size = (20, 25)

# Define the image interpolation method
image_interpolation_method = cv2.INTER_AREA

ARGS = {
    'sample': sample,
    'size': size,
    'image_interpolation_method': image_interpolation_method
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, numpy — 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 int — 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_activation Ran
ran; our contract draft was wrong, not the code
Expedit-LargeScale-Vision-Transformer/Expedit-DPT/dpt/evit.py
code served (permissive licence) · get_code("1c094193a4506a40")
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 function. 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

torch.manual_seed(0)

# The function get_activation takes a single parameter: name
# It returns a hook function that captures activations by name
# The hook function itself takes (model, input, output) but we only need to
# construct arguments for get_activation, which just needs a name string

ARGS = {
    "name": "layer_output"
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
get_aspect_ratio Ran
ran on a synthesized input
Expedit-LargeScale-Vision-Transformer/Expedit-DPT/dpt/evit.py
code served (permissive licence) · get_code("348cb9ca5bb1dc15")
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 tuple, ndim 1, dtype family int; 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 math

def get_aspect_ratio(x, y):
    gcd = math.gcd(x, y)
    return (x // gcd, y // gcd)

ARGS = {
    "x": 1920,
    "y": 1080
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 tuple, ndim 1, dtype family int — 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_attention Ran
ran; our contract draft was wrong, not the code
Expedit-LargeScale-Vision-Transformer/Expedit-DPT/dpt/vit.py
code served (permissive licence) · get_code("a552c8f30bbe3f97")
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 function. 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

torch.manual_seed(0)

# Build a minimal Vision Transformer attention module
class AttentionModule(nn.Module):
    def __init__(self, dim, num_heads):
        super().__init__()
        self.num_heads = num_heads
        self.dim = dim
        self.head_dim = dim // num_heads
        self.scale = self.head_dim ** -0.5
        
        # qkv projection: projects dim -> 3*dim
        self.qkv = nn.Linear(dim, 3 * dim)
    
    def forward(self, x):
        return x

# Create a small attention module
# B=2 (batch), N=3 (sequence length), C=4 (channel/embed dim)
dim = 4
num_heads = 2
attention_module = AttentionModule(dim=dim, num_heads=num_heads)

# Create input tensor: (B, N, C) = (2, 3, 4)
x = torch.randn(2, 3, 4)

# The name parameter is just a string identifier
name = "layer_0"

ARGS = {
    "name": name
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
get_mean_attention_map Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Expedit-LargeScale-Vision-Transformer/Expedit-DPT/dpt/vit.py
pointer only (licence: MIT); the stored copy get_code serves, from ruili3/Know-Your-Neighbors, is pointer only (licence: NONE) · get_code("0f6587dd0ee20c03")
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 ruili3/Know-Your-Neighbors, 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.

naive_unpool Ran
ran on a synthesized input
Expedit-LargeScale-Vision-Transformer/Expedit-DPT/dpt/reconstruction.py
code served (permissive licence) · get_code("6d02446a8bd47021")
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, 4, 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
import torch.nn as nn

torch.manual_seed(0)

# Construct arguments for naive_unpool(f_regions, region_indices)
# 
# From the function body:
# - f_regions.shape is unpacked as (_, _, C), so it's a 3D tensor
# - region_indices.shape is unpacked as (N, L), so it's a 2D tensor
# - region_indices is viewed and expanded to (N, L, C)
# - f_regions.gather(1, index) is called, which gathers along dimension 1
#
# For gather to work on f_regions:
# - dimension 1 should have size >= max(region_indices)
# - f_regions should have shape (N, num_regions, C)
# - region_indices should contain valid indices in [0, num_regions)

N = 2      # batch size
L = 4      # sequence length
C = 3      # feature dimension
num_regions = 5  # number of regions in f_regions

# f_regions: shape (N, num_regions, C)
f_regions = torch.randn(N, num_regions, C)

# region_indices: shape (N, L) with values in [0, num_regions)
region_indices = torch.randint(0, num_regions, (N, L))

ARGS = {
    "f_regions": f_regions,
    "region_indices": region_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, 4, 3) — shape (2, 4, 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
reshape_as_aspect_ratio Ran
ran on a synthesized input
Expedit-LargeScale-Vision-Transformer/Expedit-DPT/dpt/evit.py
code served (permissive licence) · get_code("65e23d3e3337a16b")
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 4, dtype family float, shape (2, 4, 4, 6) 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
import math

torch.manual_seed(0)

# x is a 3D tensor with shape (B, N, C)
# The function expects N = ratio[0] * ratio[1] * s^2
# Let's set up a concrete example:
# B=2 (batch size)
# ratio = (2, 3) so ratio[0] * ratio[1] = 6
# s should be an integer, let's say s=2, so N = 6 * 4 = 24
# C=4 (channels)

x = torch.randn(2, 24, 4)
ratio = (2, 3)
channel_last = False

ARGS = {
    "x": x,
    "ratio": ratio,
    "channel_last": channel_last,
}
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 4, dtype family float, shape (2, 4, 4, 6) — shape (2, 4, 4, 6) 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

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 4 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 4 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
get_activation 10 other papers
2 dated earlier, 8 later · 1 only as an assembly brick
2103.13413 (2021-03)
Vision Transformers for Dense Prediction
2202.00273 (2022-02)
StyleGAN-XL: Scaling StyleGAN to Large Diverse Datasets
2303.16890 (2023-03)
DPF: Learning Dense Prediction Fields with Weak Supervision
and 7 more not named here
apply_min_size 4 other papers
1 dated earlier, 3 later
1907.01341 (2019-07)
Towards Robust Monocular Depth Estimation: Mixing Datasets for Zero-shot Cross-dataset Transfer
2305.19201 (2023-05)
DäRF: Boosting Radiance Fields from Sparse Inputs with Monocular Depth Adaptation
2310.15171 (2023-10)
RoboDepth: Robust Out-of-Distribution Depth Estimation under Corruptions
and 1 more not named here
get_attention 3 other papers
1 dated earlier, 2 later
2103.13413 (2021-03)
Vision Transformers for Dense Prediction
2310.15171 (2023-10)
RoboDepth: Robust Out-of-Distribution Depth Estimation under Corruptions
2404.03658 (2024-04)
Know Your Neighbors: Improving Single-View Reconstruction via Spatial Vision-Language Reasoning
get_mean_attention_map 2 other papers
2 later
2310.15171 (2023-10)
RoboDepth: Robust Out-of-Distribution Depth Estimation under Corruptions
2404.03658 (2024-04)
Know Your Neighbors: Improving Single-View Reconstruction via Spatial Vision-Language Reasoning

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 have recently achieved competitive results across various vision tasks but still suffer from heavy computation costs when processing a large number of tokens. Many advanced approaches have been developed to reduce the total number of tokens in large-scale vision transformers, especially for image classification tasks. Typically, they select a small group of essential tokens according to their relevance with the [class] token, then fine-tune the weights of the vision transformer. Such fine-tuning is less practical for dense prediction due to the much heavier computation and GPU memory cost than image classification. In this paper, we focus on a more challenging problem, i.e., accelerating large-scale vision transformers for dense prediction without any additional re-training or finetuning. In response to the fact that high-resolution representations are necessary for dense prediction, we present two non-parametric operators, a token clustering layer to decrease the number of tokens and a token reconstruction layer to increase the number of tokens. The following steps are performed to achieve this: (i) we use the token clustering layer to cluster the neighboring tokens together, resulting in low-resolution representations that maintain the spatial structures; (ii) we apply the following transformer layers only to these low-resolution representations or clustered tokens; and (iii) we use the token reconstruction layer to re-create the high-resolution representations from the refined low-resolution representations. The results obtained by our method are promising on five dense prediction tasks, including object detection, semantic segmentation, panoptic segmentation, instance segmentation, and depth estimation. Accordingly, our method accelerates 40% ↑ FPS and saves 30% ↓ GFLOPs of "Segmenter+ViT-L/16" while maintaining 99.5% of the performance on ADE20K without fine-tuning the official weights.

For agents

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

get_harvested_code_for_paper("2210.01035")
get_code_for_paper("2210.01035")
have("2210.01035")

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

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

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

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

Connect an agent — have() is free.