SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.05067 · ICML · 2023

Improving Visual Prompt Tuning for Self-supervised Vision Transformers

Sungroh Yoon, Dahuin Jung, Jungbeom Lee, Eunji Kim, Seungryong Yoo

arXiv · PDF · Open in the Atlas

Code that ran

4 of 4 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 0 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/2306.05067.json · badge: /api/ran/2306.05067.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
ryongithub/gatedprompttuning marked official in Papers with Code
Papers with Code archive
4 ran · 0 no recorded run
FunctionStatusWhere it lives
Attention Ran
ran on a synthesized input
ryongithub/gatedprompttuning/src/models/vit_prompt/vit_mae.py
code served (permissive licence) · get_code("9d53ec26dfcd7416")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, 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
import torch.nn as nn

INIT_ARGS = {
    'dim': 4,
    'num_heads': 2,
    'qkv_bias': False,
    'attn_drop': 0.0,
    'proj_drop': 0.0,
}

ARGS = {
    'x': torch.randn(2, 3, 4),
    'temp': 1.0,
}

if __name__ == '__main__':
    attention = nn.Attention(**INIT_ARGS)
    output = attention(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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 — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
Block Ran
ran on a synthesized input · constructed an object; no result was computed
ryongithub/gatedprompttuning/src/models/vit_prompt/vit_mae.py
code served (permissive licence) · get_code("5667ba706eacf9a5")
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 an instance of its own class, Block: the run constructed the object and did not call it, so no result was computed. 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
from timm.models.layers import Mlp, DropPath

torch.manual_seed(0)

ARGS = {
    "dim": 64,
    "num_heads": 8,
    "mlp_ratio": 4.0,
    "qkv_bias": False,
    "drop": 0.1,
    "attn_drop": 0.1,
    "drop_path": 0.1,
    "act_layer": nn.GELU,
    "norm_layer": nn.LayerNorm,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Block — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Block 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
PromptedVisionTransformer Ran
ran on a synthesized input · constructed an object; no result was computed
ryongithub/gatedprompttuning/src/models/vit_prompt/vit_mae.py
code served (permissive licence) · get_code("f949bff696b4d036")
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 an instance of its own class, PromptedVisionTransformer: the run constructed the object and did not call it, so no result was computed. 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
from functools import reduce
from operator import mul

torch.manual_seed(0)

# Create a minimal prompt config class with all required attributes
class PromptConfig:
    def __init__(self):
        self.DEEP = False
        self.LOCATION = 'prepend'
        self.NUM_TOKENS = 4
        self.DROPOUT = 0.1
        self.TEMP = 1.0
        self.TEMP_LEARN = False
        self.TEMP_NUM = 1
        self.INITIATION = 'random'
        self.GATE_PRIOR = False
        self.GATE_NUM = 1
        self.GATE_INIT = 0.5

# Create minimal patch embedding
class PatchEmbed(nn.Module):
    def __init__(self, patch_size=2, embed_dim=4):
        super().__init__()
        self.patch_size = (patch_size, patch_size)
        self.proj = nn.Linear(3 * patch_size * patch_size, embed_dim)
    
    def forward(self, x):
        B, C, H, W = x.shape
        patches = x.reshape(B, C * self.patch_size[0] * self.patch_size[1], -1)
        patches = patches.permute(0, 2, 1)
        x = self.proj(patches)
        return x

# Create kwargs for VisionTransformer parent class
vit_kwargs = {
    'img_size': 16,
    'patch_size': 2,
    'in_chans': 3,
    'num_classes': 10,
    'embed_dim': 4,
    'depth': 2,
    'num_heads': 2,
    'mlp_ratio': 4.0,
    'qkv_bias': False,
    'drop_rate': 0.0,
    'attn_drop_rate': 0.0,
    'drop_path_rate': 0.0,
    'norm_layer': nn.LayerNorm,
    'act_layer': nn.GELU,
    'global_pool': False,
}

# Create a minimal VisionTransformer-like parent to inherit from
class MinimalVisionTransformer(nn.Module):
    def __init__(self, **kwargs):
        super().__init__()
        self.patch_embed = PatchEmbed(patch_size=kwargs['patch_size'], embed_dim=kwargs['embed_dim'])
        self.embed_dim = kwargs['embed_dim']
        self.cls_token = nn.Parameter(torch.zeros(1, 1, kwargs['embed_dim']))
        self.pos_embed = nn.Parameter(torch.zeros(1, 65, kwargs['embed_dim']))
        self.pos_drop = nn.Dropout(kwargs.get('drop_rate', 0.0))
        
        # Create blocks
        depth = kwargs['depth']
        num_heads = kwargs['num_heads']
        mlp_ratio = kwargs['mlp_ratio']
        norm_layer = kwargs['norm_layer']
        
        self.blocks = nn.Sequential(*[
            nn.Linear(kwargs['embed_dim'], kwargs['embed_dim'])
            for _ in range(depth)
        ])
        self.norm = norm_layer(kwargs['embed_dim'])

ARGS = {
    'prompt_config': PromptConfig(),
    'img_size': 16,
    'patch_size': 2,
    'in_chans': 3,
    'num_classes': 10,
    'embed_dim': 4,
    'depth': 2,
    'num_heads': 2,
    'mlp_ratio': 4.0,
    'qkv_bias': False,
    'drop_rate': 0.0,
    'attn_drop_rate': 0.0,
    'drop_path_rate': 0.0,
    'norm_layer': nn.LayerNorm,
    'act_layer': nn.GELU,
    'global_pool': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PromptedVisionTransformer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a PromptedVisionTransformer 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
VisionTransformer Ran
ran on a synthesized input · constructed an object; no result was computed
ryongithub/gatedprompttuning/src/models/vit_prompt/vit_mae.py
code served (permissive licence) · get_code("33fb7be835804856")
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 an instance of its own class, VisionTransformer: the run constructed the object and did not call it, so no result was computed. 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
from timm.models.layers import PatchEmbed, Mlp
import timm.models.vision_transformer

torch.manual_seed(0)

# Minimal VisionTransformer configuration
ARGS = {
    'img_size': 32,
    'patch_size': 8,
    'in_chans': 3,
    'num_classes': 10,
    'embed_dim': 16,
    'depth': 2,
    'num_heads': 2,
    'mlp_ratio': 2.0,
    'qkv_bias': True,
    'drop_rate': 0.0,
    'attn_drop_rate': 0.0,
    'drop_path_rate': 0.0,
    'norm_layer': nn.LayerNorm,
    'act_layer': nn.GELU,
    'global_pool': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type VisionTransformer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a VisionTransformer 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

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, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 4 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.

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

Visual Prompt Tuning (VPT) is an effective tuning method for adapting pretrained Vision Transformers (ViTs) to downstream tasks. It leverages extra learnable tokens, known as prompts, which steer the frozen pretrained ViTs. Although VPT has demonstrated its applicability with supervised vision transformers, it often underperforms with self-supervised ones. Through empirical observations, we deduce that the effectiveness of VPT hinges largely on the ViT blocks with which the prompt tokens interact. Specifically, VPT shows improved performance on image classification tasks for MAE and MoCo v3 when the prompt tokens are inserted into later blocks rather than the first block. These observations suggest that there exists an optimal location of blocks for the insertion of prompt tokens. Unfortunately, identifying the optimal blocks for prompts within each self-supervised ViT for diverse future scenarios is a costly process. To mitigate this problem, we propose a simple yet effective method that learns a gate for each ViT block to adjust its intervention into the prompt tokens. With our method, prompt tokens are selectively influenced by blocks that require steering for task adaptation. Our method outperforms VPT variants in FGVC and VTAB image classification and ADE20K semantic segmentation. The code is available at https://github. com/ryongithub/GatedPromptTuning.

For agents

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

get_harvested_code_for_paper("2306.05067")
get_code_for_paper("2306.05067")
have("2306.05067")

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

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

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

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

Connect an agent — have() is free.