SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.07050 · 2023

Revisiting Token Pruning for Object Detection and Instance Segmentation

arXiv · PDF · Open in the Atlas

Code that ran

3 of 4 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 1 has no contract verdict; 1 failure of our instrument; 1 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/2306.07050.json · badge: /api/ran/2306.07050.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
uzh-rpg/svit canonical (classifier label)
classifier basis: census
3 ran · 1 no recorded run
FunctionStatusWhere it lives
change_key_name_from_timm_to_evo Ran
ran on a synthesized input
uzh-rpg/svit/change_key_name.py
code served (permissive licence) · get_code("c4b625d3c5b8a58d")
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 OrderedDict. 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 collections import OrderedDict

torch.manual_seed(0)

# Create a sample input_dict that matches the patterns the function expects
input_dict = OrderedDict()

# Add norm1 weight and bias entries
input_dict['backbone.blocks.0.norm1.weight'] = torch.randn(4)
input_dict['backbone.blocks.0.norm1.bias'] = torch.randn(4)
input_dict['backbone.blocks.1.norm1.weight'] = torch.randn(4)
input_dict['backbone.blocks.1.norm1.bias'] = torch.randn(4)

# Add attn.qkv weight and bias entries (must be divisible by 3 for splitting into qk and v)
# Shape: (12, 4) so it can be split into qk (8, 4) and v (4, 4)
input_dict['backbone.blocks.0.attn.qkv.weight'] = torch.randn(12, 4)
input_dict['backbone.blocks.0.attn.qkv.bias'] = torch.randn(12)
input_dict['backbone.blocks.1.attn.qkv.weight'] = torch.randn(12, 4)
input_dict['backbone.blocks.1.attn.qkv.bias'] = torch.randn(12)

# Add attn.proj weight and bias entries
input_dict['backbone.blocks.0.attn.proj.weight'] = torch.randn(4, 4)
input_dict['backbone.blocks.0.attn.proj.bias'] = torch.randn(4)
input_dict['backbone.blocks.1.attn.proj.weight'] = torch.randn(4, 4)
input_dict['backbone.blocks.1.attn.proj.bias'] = torch.randn(4)

# Add some entries that don't match any pattern (to test the else case)
input_dict['backbone.patch_embed.proj.weight'] = torch.randn(4, 3)
input_dict['other.layer.weight'] = torch.randn(5, 5)

ARGS = {
    'input_dict': input_dict
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type OrderedDict — a OrderedDict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a OrderedDict 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
drop_path Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
uzh-rpg/svit/classification/TransformerEncoderLayer.py
code served (permissive licence) · get_code("87577b3ff9d32712")
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 Tensor, ndim 4, dtype family float, shape (2, 3, 4, 5) 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)

# Create a small tensor with batch size 2 and 4 dimensions
x = torch.randn(2, 3, 4, 5)

# Define all parameters for drop_path
ARGS = {
    "x": x,
    "drop_prob": 0.5,
    "training": True,
    "scale_by_keep": True,
}
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 Tensor, ndim 4, dtype family float, shape (2, 3, 4, 5) — shape (2, 3, 4, 5) 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
get_num_layer_for_vit Ran
ran, honoured the contract we drafted
uzh-rpg/svit/mmcv_custom/layer_decay_optimizer_constructor.py
code served (permissive licence) · get_code("62f6742745cb0637")
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 int, ndim 0, dtype family int, 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 torch
import torch.nn as nn

torch.manual_seed(0)

# The function uses:
# - var_name: a string that is checked against specific prefixes and values
# - num_max_layer: an integer used in arithmetic operations

# Test case 1: var_name with backbone.cls_token
var_name_1 = 'backbone.cls_token'
num_max_layer_1 = 12

# Test case 2: var_name with backbone.blocks layer
var_name_2 = 'backbone.blocks.5.weight'
num_max_layer_2 = 12

# Test case 3: var_name with backbone.layers layer
var_name_3 = 'backbone.layers.3.bias'
num_max_layer_3 = 12

# Test case 4: var_name that doesn't match any condition
var_name_4 = 'head.fc.weight'
num_max_layer_4 = 12

# Test case 5: var_name with backbone.patch_embed
var_name_5 = 'backbone.patch_embed.proj.weight'
num_max_layer_5 = 12

# Test case 6: var_name with backbone.visual_embed
var_name_6 = 'backbone.visual_embed.weight'
num_max_layer_6 = 12

# Test case 7: var_name with backbone.pos_embed
var_name_7 = 'backbone.pos_embed'
num_max_layer_7 = 12

ARGS = {
    'var_name': 'backbone.blocks.2.attn.qkv.weight',
    'num_max_layer': 12
}
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 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
draw_selected_patches Not yet run
unverified (harvested, no recorded run)
uzh-rpg/svit/draw_functions.py
code served (permissive licence) · get_code("efeb582da75b5214")
How it ran

no invocation recorded.

Also present in other papers' code

Of 4 samples lifted from this paper's linked repositories, 4 carry a function identity and 0 do not. Of the 4 distinct functions with an identity, 2 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 2 later) and 2 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
drop_path 66 other papers
17 dated earlier, 47 later, 2 undated · 15 only as an assembly brick
1906.01502 (2019-06)
How multilingual is Multilingual BERT?
2011.10566 (2020-11)
Exploring Simple Siamese Representation Learning
2103.03230 (2021-03)
Barlow Twins: Self-Supervised Learning via Redundancy Reduction
and 63 more not named here
get_num_layer_for_vit 1 other paper
1 later
2403.02308 (2024-03)
Vision-RWKV: Efficient and Scalable Visual Perception with RWKV-Like Architectures

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 shown impressive performance in computer vision, but their high computational cost, quadratic in the number of tokens, limits their adoption in computation-constrained applications. However, this large number of tokens may not be necessary, as not all tokens are equally important. In this paper, we investigate token pruning to accelerate inference for object detection and instance segmentation, extending prior works from image classification. Through extensive experiments, we offer four insights for dense tasks: (i) tokens should not be completely pruned and discarded, but rather preserved in the feature maps for later use. (ii) reactivating previously pruned tokens can further enhance model performance. (iii) a dynamic pruning rate based on images is better than a fixed pruning rate. (iv) a lightweight, 2-layer MLP can effectively prune tokens, achieving accuracy comparable with complex gating networks with a simpler design. We assess the effects of these design decisions on the COCO dataset and introduce an approach that incorporates these findings, showing a reduction in performance decline from ~1.5 mAP to ~0.3 mAP in both boxes and masks, compared to existing token pruning methods. In relation to the dense counterpart that utilizes all tokens, our method realizes an increase in inference speed, achieving up to 34% faster performance for the entire network and 46% for the backbone.

For agents

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

get_harvested_code_for_paper("2306.07050")
get_code_for_paper("2306.07050")
have("2306.07050")

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

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

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

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

Connect an agent — have() is free.