SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2311.11261 · 2023

Adversarial Prompt Tuning for Vision-Language Models

arXiv · PDF · Open in the Atlas

Code that ran

2 of 5 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; 1 failure of our instrument; 3 no recorded run), measured 2026-11-23; 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/2311.11261.json · badge: /api/ran/2311.11261.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
jiamingzhang94/adversarial-prompt-tuning canonical (classifier label)
classifier basis: census
2 ran · 3 no recorded run
FunctionStatusWhere it lives
compute_ci95 Ran
ran, honoured the contract we drafted
jiamingzhang94/adversarial-prompt-tuning/parse_test_res.py
code served (permissive licence) · get_code("ba26afd892405335")
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 float64, ndim 0, 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 numpy as np

# compute_ci95 takes a single parameter 'res' which is used with:
# - np.std(res) - needs array-like
# - np.sqrt(len(res)) - needs len() to work
# A simple numpy array or list works perfectly

res = np.array([1.2, 2.3, 3.1, 4.5, 5.2, 6.1, 7.3, 8.9])

ARGS = {
    "res": res
}
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 float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
wrap_model Ran
ran; our contract draft was wrong, not the code
jiamingzhang94/adversarial-prompt-tuning/black.py
code served (permissive licence) · get_code("419e1fe5de09cb00")
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 Sequential. 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 torchvision

torch.manual_seed(0)

# Create a minimal model that wrap_model will work with
# The function applies normalize then the model to an input
# So the model just needs to be a valid nn.Module
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(3, 4)
    
    def forward(self, x):
        # x will be shape (batch, 3, height, width) after normalize
        # We need to handle that
        return self.linear(x.mean(dim=(2, 3)))

model = SimpleModel()

ARGS = {
    "model": model
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 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
build_model Not yet run
unverified (harvested, no recorded run)
jiamingzhang94/adversarial-prompt-tuning/clip/model.py
code served (permissive licence) · get_code("39e6b23b55f376ea")
How it ran

no invocation recorded.

load Not yet run
unverified (harvested, no recorded run)
jiamingzhang94/adversarial-prompt-tuning/clip/clip.py
pointer only (licence: MIT); the stored copy get_code serves, from yusukekwn/Black-Box-Forgetting, is pointer only (licence: NONE) · get_code("2da7ec0975be872a")
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 yusukekwn/Black-Box-Forgetting, 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.

super_resolution Not yet run
unverified (harvested, no recorded run)
jiamingzhang94/adversarial-prompt-tuning/attack/purification.py
code served (permissive licence) · get_code("f861f234105fa2aa")
How it ran

no invocation recorded.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 3 the same month, 3 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
build_model 53 other papers
15 dated earlier, 1 the same month, 37 later
2107.06383 (2021-07)
How Much Can CLIP Benefit Vision-and-Language Tasks?
2210.01115 (2022-10)
LASP: Text-to-Text Optimization for Language-Aware Soft Prompting of Vision & Language Models
2211.09552 (2022-11)
UniFormerV2: Spatiotemporal Learning by Arming Image ViTs with Video UniFormer
and 50 more not named here
compute_ci95 37 other papers
12 dated earlier, 2 the same month, 21 later, 1 same year, order not determinable, 1 undated
2106.00592 (2021-06)
Semi-Supervised Domain Generalization with Stochastic StyleMatch
2203.05557 (2022-03)
Conditional Prompt Learning for Vision-Language Models
2203.07740 (2022-03)
Exact Feature Distribution Matching for Arbitrary Style Transfer and Domain Generalization
and 34 more not named here
load 18 other papers
1 dated earlier, 1 the same month, 16 later
2107.06383 (2021-07)
How Much Can CLIP Benefit Vision-and-Language Tasks?
2311.18231 (2023-11)
TCP:Textual-based Class-aware Prompt tuning for Visual-Language Model
2312.03781 (2023-12)
Lite-Mind: Towards Efficient and Robust Brain Representation Network
and 15 more not named here

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-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

With the rapid advancement of multimodal learning, pre-trained Vision-Language Models (VLMs) such as CLIP have demonstrated remarkable capacities in bridging the gap between visual and language modalities. However, these models remain vulnerable to adversarial attacks, particularly in the image modality, presenting considerable security risks. This paper introduces Adversarial Prompt Tuning (AdvPT), a novel technique to enhance the adversarial robustness of image encoders in VLMs. AdvPT innovatively leverages learnable text prompts and aligns them with adversarial image embeddings, to address the vulnerabilities inherent in VLMs without the need for extensive parameter training or modification of the model architecture. We demonstrate that AdvPT improves resistance against white-box and black-box adversarial attacks and exhibits a synergistic effect when combined with existing image-processing-based defense techniques, further boosting defensive capabilities. Comprehensive experimental analyses provide insights into adversarial prompt tuning, a novel paradigm devoted to improving resistance to adversarial images through textual input modifications, paving the way for future robust multimodal learning research. These findings open up new possibilities for enhancing the security of VLMs. Our code is available at https://github.com/jiamingzhang94/Adversarial-Prompt-Tuning.

For agents

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

get_harvested_code_for_paper("2311.11261")
get_code_for_paper("2311.11261")
have("2311.11261")

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

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

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

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

Connect an agent — have() is free.