SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · aaai_28243 · AAAI · 2024

SA 2 VP: Spatially Aligned-and-Adapted Visual Prompt

Wenjie Pei, Guangming Lu, Jinsong Li, Jiandong Tian, Tongqi Xia, Fanglin Chen

Open in the Atlas

Code that ran

10 of 10 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; 5 honoured the contract we drafted, 2 violated it and 0 have no contract verdict; 3 failures of our instrument; 0 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_28243.json · badge: /api/ran/aaai_28243.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
tommy-xq/SA2VP canonical (classifier label)
classifier basis: census
10 ran · 0 no recorded run
FunctionStatusWhere it lives
cosine_scheduler Ran
ran, honoured the contract we drafted
tommy-xq/SA2VP/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from boyazeng/understand_bias, is pointer only (licence: NONE) · get_code("b700fb0a3496b255")
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 boyazeng/understand_bias, 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.

cosine_scheduler_epoch Ran
ran, honoured the contract we drafted
tommy-xq/SA2VP/utils.py
code served (permissive licence) · get_code("7468079f7c4e2b5e")
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 ndarray, ndim 1, dtype family float, shape (500,) 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 numpy as np

# Construct arguments for cosine_scheduler_epoch function
ARGS = {
    'base_value': 0.1,
    'final_value': 0.0001,
    'epochs': 10,
    'niter_per_ep': 50,
    'warmup_epochs': 2,
    'start_warmup_value': 1e-06,
    'warmup_steps': -1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (500,) — shape (500,) 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
find_best_lrwd Ran
ran, honoured the contract we drafted
tommy-xq/SA2VP/vpt_main/tune_vtab.py
pointer only (licence: MIT); the stored copy get_code serves, from runtsang/VFPT, is pointer only (licence: NOASSERTION) · get_code("3e009472c0d2fa50")
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 runtsang/VFPT, and GitHub could not classify the licence of that repository (NOASSERTION). 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_loss_scale_for_deepspeed Ran
ran, honoured the contract we drafted
tommy-xq/SA2VP/engine_for_train.py
pointer only (licence: MIT); the stored copy get_code serves, from kangsankim07/videoicl, is pointer only (licence: NONE) · get_code("29416043c7035e7c")
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 kangsankim07/videoicl, 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_num_layer_for_vit Ran
ran, honoured the contract we drafted
tommy-xq/SA2VP/optim_factory.py
code served (permissive licence) · get_code("a3448702d6025ce6")
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 takes two parameters:
# 1. var_name: a string representing a variable name
# 2. num_max_layer: an integer representing the maximum number of layers

# Based on the function body, var_name is checked against various patterns
# and num_max_layer is used as a fallback return value

ARGS = {
    'var_name': 'blocks.5.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
get_parameter_groups Ran
ran; our contract draft was wrong, not the code
tommy-xq/SA2VP/optim_factory.py
pointer only (licence: MIT); the stored copy get_code serves, from boyazeng/understand_bias, is pointer only (licence: NONE) · get_code("0ef0019514eaaa09")
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 boyazeng/understand_bias, 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.

has_file_allowed_extension Ran
ran, violated the contract we drafted
tommy-xq/SA2VP/dataset_folder.py
pointer only (licence: MIT); the stored copy get_code serves, from dlyuangod/vit-1.58b, is pointer only (licence: NONE) · get_code("18ae3e6ef2cf02ec")
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 dlyuangod/vit-1.58b, 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.

is_image_file Ran
ran, violated the contract we drafted
tommy-xq/SA2VP/dataset_folder.py
pointer only (licence: MIT); the stored copy get_code serves, from dlyuangod/vit-1.58b, is pointer only (licence: NONE) · get_code("8ac50ae8773b9431")
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 dlyuangod/vit-1.58b, 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.

make_dataset Ran
ran; our contract draft was wrong, not the code
tommy-xq/SA2VP/dataset_folder.py
code served (permissive licence) · get_code("fb6aea1653b20bba")
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 list, ndim 2, 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 os
import os.path
import tempfile
from typing import Tuple, Dict, Optional, Callable, List

# Create a temporary directory structure for testing
temp_dir = tempfile.mkdtemp()

# Create class subdirectories and some dummy files
class_names = ["cat", "dog"]
for class_name in class_names:
    class_dir = os.path.join(temp_dir, class_name)
    os.makedirs(class_dir, exist_ok=True)
    # Create some dummy files with various extensions
    for i in range(2):
        with open(os.path.join(class_dir, f"image_{i}.jpg"), "w") as f:
            f.write("dummy")
        with open(os.path.join(class_dir, f"image_{i}.png"), "w") as f:
            f.write("dummy")
        with open(os.path.join(class_dir, f"other_{i}.txt"), "w") as f:
            f.write("dummy")

# Define the arguments
directory = temp_dir
class_to_idx = {"cat": 0, "dog": 1}
extensions = (".jpg", ".png")
is_valid_file = None

ARGS = {
    "directory": directory,
    "class_to_idx": class_to_idx,
    "extensions": extensions,
    "is_valid_file": is_valid_file,
}
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 list, ndim 2, dtype family float — a list 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
train_class_batch Ran
ran; our contract draft was wrong, not the code
tommy-xq/SA2VP/engine_for_train.py
code served (permissive licence) · get_code("d15b621dd834bc4f")
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. 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)

# Define a simple model that returns outputs and prompt when called
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, samples):
        outputs = self.linear(samples)
        prompt = self.linear(samples)
        return outputs, prompt

# Create model instance
model = SimpleModel()

# Create small tensors
samples = torch.randn(2, 4)  # batch size 2, feature dim 4
target = torch.randn(2, 3)   # batch size 2, output dim 3

# Define criterion (loss function)
criterion = nn.MSELoss()

ARGS = {
    "model": model,
    "samples": samples,
    "target": target,
    "criterion": criterion
}
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 tuple — a tuple output has no array shape of its own; none is 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 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 10 are also present in other papers whose code we hold (10 with at least one paper dated earlier, 0 the same month, 2 later) and 0 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
cosine_scheduler 26 other papers
18 dated earlier, 8 same year, order not determinable
1905.02244 (2019-05)
Searching for MobileNetV3
136810051 (2022 (year only))
AMixer: Adaptive Weight Mixing for Self-Attention Free Vision Transformers
136860514 (2022 (year only))
SLIP: Self-supervision meets Language-Image Pre-training
and 23 more not named here
get_parameter_groups 18 other papers
14 dated earlier, 2 later, 2 same year, order not determinable
1905.02244 (2019-05)
Searching for MobileNetV3
136810051 (2022 (year only))
AMixer: Adaptive Weight Mixing for Self-Attention Free Vision Transformers
136860514 (2022 (year only))
SLIP: Self-supervision meets Language-Image Pre-training
and 15 more not named here
get_loss_scale_for_deepspeed 15 other papers
9 dated earlier, 1 later, 5 same year, order not determinable
2203.14415 (2022-03)
Mugs: A Multi-Granular Self-Supervised Learning Framework
2211.09120 (2022-11)
AdaMAE: Adaptive Masking for Efficient Spatiotemporal Learning with Masked Autoencoders
2212.10368 (2022-12)
Masked Event Modeling: Self-Supervised Pretraining for Event Cameras
and 12 more not named here
is_image_file 12 other papers
7 dated earlier, 5 same year, order not determinable
2203.14415 (2022-03)
Mugs: A Multi-Granular Self-Supervised Learning Framework
2204.08381 (2022-04)
Multiple-environment Self-adaptive Network for Aerial-view Geo-localization
2205.03892 (2022-05)
ConvMAE: Masked Convolution Meets Masked Autoencoders
and 9 more not named here
has_file_allowed_extension 10 other papers
7 dated earlier, 3 same year, order not determinable
2203.14415 (2022-03)
Mugs: A Multi-Granular Self-Supervised Learning Framework
2204.08381 (2022-04)
Multiple-environment Self-adaptive Network for Aerial-view Geo-localization
2205.03892 (2022-05)
ConvMAE: Masked Convolution Meets Masked Autoencoders
and 7 more not named here
get_num_layer_for_vit 8 other papers
7 dated earlier, 1 same year, order not determinable
136860514 (2022 (year only))
SLIP: Self-supervision meets Language-Image Pre-training
2209.03917 (2022-09)
Exploring Target Representations for Masked Autoencoders
2211.09120 (2022-11)
AdaMAE: Adaptive Masking for Efficient Spatiotemporal Learning with Masked Autoencoders
and 5 more not named here
make_dataset 6 other papers
5 dated earlier, 1 same year, order not determinable
2205.03892 (2022-05)
ConvMAE: Masked Convolution Meets Masked Autoencoders
2208.07049 (2022-08)
Self-Supervised Vision Transformers for Malware Detection
aaai_25604 (2023 (year only))
One-for-All: Proposal Masked Cross-Class Anomaly Detection
and 3 more not named here
find_best_lrwd 5 other papers
3 dated earlier, 2 same year, order not determinable
2212.03220 (2022-12)
Visual Query Tuning: Towards Effective Usage of Intermediate Representations for Parameter and Memory Efficient Transfer Learning
2307.13770 (2023-07)
(d) Ours (c) Prompt tuning
2312.10376 (2023-12)
STA-VPT: SpatioTemporally Aligned Visual Prompt Tuning
and 2 more not named here
cosine_scheduler_epoch 1 other paper
1 dated earlier
2312.10376 (2023-12)
STA-VPT: SpatioTemporally Aligned Visual Prompt Tuning
train_class_batch 1 other paper
1 dated earlier
2312.10376 (2023-12)
STA-VPT: SpatioTemporally Aligned Visual Prompt Tuning

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

As a prominent parameter-efficient fine-tuning technique in NLP, prompt tuning is being explored its potential in computer vision. Typical methods for visual prompt tuning follow the sequential modeling paradigm stemming from NLP, which represents an input image as a flattened sequence of token embeddings and then learns a set of unordered parameterized tokens prefixed to the sequence representation as the visual prompts for task adaptation of large vision models. While such sequential modeling paradigm of visual prompt has shown great promise, there are two potential limitations. First, the learned visual prompts cannot model the underlying spatial relations in the input image, which is crucial for image encoding. Second, since all prompt tokens play the same role of prompting for all image tokens without distinction, it lacks the fine-grained prompting capability, i.e., individual prompting for different image tokens. In this work, we propose the Spatially Aligned-and-Adapted Visual Prompt model (SA 2 VP), which learns a two-dimensional prompt token map with equal (or scaled) size to the image token map, thereby being able to spatially align with the image map. Each prompt token is designated to prompt knowledge only for the spatially corresponding image tokens. As a result, our model can conduct individual prompting for different image tokens in a fine-grained manner. Moreover, benefiting from the capability of preserving the spatial structure by the learned prompt token map, our SA 2 VP is able to model the spatial relations in the input image, leading to more effective prompting. Extensive experiments on three challenging benchmarks for image classification demonstrate the superiority of our model over other state-of-the-art methods for visual prompt tuning. Code is available at https://github.com/tommy-xq/SA2VP.

For agents

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

get_harvested_code_for_paper("aaai_28243")
get_code_for_paper("aaai_28243")
have("aaai_28243")

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

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

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

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

Connect an agent — have() is free.