Query-Only, Prompt-Agnostic Attacks on Visual In-Context LearningQuery-Only Prompt-Agnostic Attacks on Visual In-Context Learning
The authors propose a query-only, prompt-agnostic attack CH/TH and the SPS surrogate prompt for VICL segmentation, and the authors state that on SegGPT the CH foreground retention rate drops from 0.918 to 0.155.
query-only, prompt-agnostic targeted attack: the attacker can only query the target system with their own visual demonstrations and observe the returned RGB outputs, and cannot access model internals (parameters, logits, gradients, intermediate features) or the deployment prompt Pdep; only the query image is perturbed, so that the segmentation result exhibits an attacker-defined appearance-level effect and transfers to unseen deployment prompts. The victim system is the VICL segmentation and auto-labeling pipeline.
- VICL segmentation renders prompt-specified tasks into RGB outputs and is commonly used for auto-labeling, but its robustness under query-only access with unknown deployed prompts has not been studied; existing attacks mostly target fixed label/mask spaces and do not directly apply.
- The authors treat the prompt-conditioned RGB output space as the attack surface: CH pushes foreground colors toward the background color, and TH pushes instance colors toward a shared color; a Self-Prompt Surrogate (SPS) is constructed from the query image and its clean output, and then a zeroth-order optimizer optimizes within a low-dimensional ROI perturbation space using only the returned RGB outputs.
- Evaluated on four models—Painter, SegGPT, ConText, ConTextV—and on COCO and HierText: SPS on SegGPT reduces CH foreground retention rate from 0.918 with RPS to 0.155; TH reduces instance count and mask retention after palette decoding; 30% CH-poisoned annotations reduce downstream YOLO-seg mAP50 from 0.761 to 0.281.
- The authors state that defenses need to balance robustness with prompt adaptability, and that randomization alone may not be sufficient. The experiments cover four VICL models and two datasets; TH is evaluated only on the instance-style outputs of Painter and SegGPT, and downstream impact is measured only on the SegGPT+YOLO-seg pipeline.
- Evaluated models
- PainterSegGPTConTextConTextVYOLO-seg
- Benchmarks
- COCO person-keypoint subsetHierTextAutodistill VICL pipeline
- Metrics
- foreground retention (Retain)Pal. TolDistCCCount RatioMask Ret.@50Pair MergemAP50
The authors propose query-only, prompt-agnostic targeted attacks on promptable segmentation in visual in-context learning (VICL), where the attacker can only see the returned RGB output and cannot access model internals or deployment prompts. The method includes two types of appearance-space attacks: Color Hijack (CH), which pushes foreground colors toward the background to suppress visibility, and Task Hijack (TH), which converges the colors used to distinguish instances into the same color assignment; to transfer to unseen prompts, the authors construct a Self-Prompt Surrogate (SPS) using clean queries and their outputs. In a budget-matched comparison on SegGPT, SPS outperforms the Random-Prompt Surrogate (RPS), reducing the CH instance foreground retention rate from 0.918 to 0.155 and the TH palette-aware tolerance distance from 0.345 to 0.225. Under 30% contamination, CH-contaminated annotations produced by a publicly accessible VICL-based auto-labeling pipeline reduced downstream YOLO-seg's mAP50 from 0.761 to 0.281.
Paper analysis
What problem does this paper attempt to solve?
The study investigates how to launch targeted attacks on VICL segmentation that transfer across prompts when only querying is possible and the deployment prompt is unknown.
Core question: under a query-only, prompt-agnostic threat model, how to carry out targeted attacks on VICL segmentation systems that transfer to unseen deployed prompts.
- Setting and importance: VICL segmentation uses image–output pairs as visual prompts and post-processes RGB predictions into annotations, for auto-labeling and downstream training; the authors consider its robustness under query-only access with unknown deployed prompts unexplored.
- Shortcomings of existing methods: The authors state that existing targeted segmentation attacks target traditional models or SAM-style models with fixed label/mask spaces, and black-box versions mostly rely on white-box surrogate model transfer, so they do not directly apply to prompt-conditioned RGB outputs.
- Core observation: VICL RGB outputs exhibit appearance-level regularities—foreground–background contrast and instance-specific color assignment; transfer across prompts depends on the surrogate prompt used during optimization.
- The paper proposes: two appearance-space attacks, Color Hijack (CH) and Task Hijack (TH), and a Self-Prompt Surrogate (SPS) constructed from clean queries and their outputs.
- Threat model:
- Goal: perturb only the query image so that its segmentation exhibits an attacker-defined appearance-level effect and transfers to unseen deployed prompts.
- Knowledge: query-only—only the returned RGB outputs can be observed; no model parameters, logits, gradients, or intermediate features; the deployed prompt Pdep is invisible and uncontrollable.
- Capability: use attacker-controlled visual demonstration queries against the target system to construct adversarial query images.
- Victim system: VICL segmentation systems and auto-labeling pipelines that use them as upstream annotators.
What related research exists?
Related work falls into three categories: traditional segmentation black-box attacks, SAM-style model attacks, and VICL methods; the authors state that the first two categories do not directly apply to prompt-conditioned RGB outputs.
Black-box attacks on traditional segmentation and dense prediction
- Xie et al. (2017) demonstrated transferable pixel-level attacks; Cai, Tan, and Asif (2023) used surrogate ensembles for black-box attacks and queried the victim model to adjust ensemble weights. The paper notes that such methods assume a fixed label/mask prediction space.
- Arnab, Miksik, and Torr (2018) and Rony, Pesquet, and Ben Ayed (2023) documented, under white-box settings, the challenge that targeted attacks on structured outputs are harder than classification.
Attacks on SAM-style promptable models
- Zhang et al. (2023) (Attack-SAM) optimized perturbations for fixed prompt configurations; Lu, Yang, and Wang (2024) performed Unsegment Anything by aligning adversarial features to deformed targets.
- Zheng, Zhang, and Hao (2025) perturbed the image representation shared by prompts to reduce prompt dependence; Shen, Li, and Wang (2024) defined region-level targets effective under different clicks. The paper notes that these methods still target mask outputs and often rely on transferable features or surrogate models.
VICL methods and prompt selection
- Bar et al. (2022) and Bai et al. (2024) used VQ-GAN codebooks for discrete visual token prediction; Painter (Wang et al. 2023a), SegGPT (Wang et al. 2023b), and ConText/ConTextV (Zhang et al. 2025) directly represent task outputs as RGB images.
- Suo et al. (2024), Zhang, Zhou, and Liu (2023), and Wang et al. (2025) studied the selection and fusion of visual prompts; the authors state that the choice of demonstrations significantly affects VICL performance, and this paper's SPS is inspired by this.
Baselines and benchmarks: The comparison baselines are Random-Prompt Surrogate (RPS) and three general attack baselines: random ROI perturbation, untargeted output disruption, and RGB matching; the benchmarks are the COCO person-keypoint subset and HierText.
Author positioning: VICL prompts are independent demonstrations that define task semantics and RGB rendering conventions, and outputs are prompt-conditioned RGB predictions rather than fixed labels/masks; therefore existing label/mask-space transfer attacks do not directly apply, and this paper studies query-only targeted attacks that use only returned RGB outputs.
How does the paper address this problem?
Treating prompt-conditioned RGB outputs as the attack surface: CH/TH appearance objectives + SPS surrogate prompt + zeroth-order query optimization.
Overall idea: instead of matching a complete high-dimensional RGB target, optimize appearance-level regularities (foreground–background contrast, instance color assignment), and use a surrogate prompt aligned with the query to achieve cross-prompt transfer. The framework contains three components: SPS, CH/TH objectives, and a query-only zeroth-order optimizer.
Problem formulation
- Given a normalized query image x, the attacker seeks a bounded perturbation δ such that xadv = clip[0,1](x+δ), |δ|∞ ≤ ϵ, i.e., an adversarial query under an L∞ norm constraint.
- During optimization, a surrogate prompt Psur is used to observe the returned output yδPsur; the deployment prompt Pdep is unknown, and the goal is for the effect optimized under Psur to transfer to Pdep.
Self-Prompt Surrogate (SPS)
- The attacker first submits a clean query with an initialization prompt Pinit, obtaining the clean output y 0 = f(x; Pinit), then constructs PSPS = (x, y0), i.e., forms a surrogate demonstration from the query image and its own clean output.
- The authors state that this construction is aligned with the query and reflects the model's initial behavior on that image, reducing dependence on prompt content, palette, and composition; it does not require access to Pdep.
- The control RPS uses random external demonstrations as both Pinit and Psur; in the paired comparison, the two share the clean output and reference, and differ only in the surrogate construction.
CH and TH objectives
- The foreground region Rf is parsed from y 0 (using semantic/text-style channel discretization or instance-style color-kernel post-processing), and dilated with a 25×25 kernel to obtain the optimization ROI Ro; the perturbation is restricted to within Ro.
- CH: minimize the mean squared distance between the attack output within Ro and the background color cbg, pushing foreground colors toward the background appearance.
- TH: push instance colors toward a shared color c⋆ (the clean RGB mean of the inner region Rc obtained by eroding Rf with a 5×5 kernel); the objective has two terms—convergence toward c⋆ within Rc, and a color-variance penalty within Ro with weight λvar = 0.12, extending the collapse to the boundary.
Query-only zeroth-order optimization
- Optimize low-dimensional parameters p ∈ R64×64×3, bilinearly upsampled to 448×448, restricted within the ROI and projected onto the L∞ perturbation set.
- Use an SPSA-style simultaneous-perturbation zeroth-order estimator: each iteration uses K = 32 Rademacher directions (2K model evaluations plus 1 tracking evaluation), with a mean-normalized update; 600 iterations in total.
- CH uses (µ, η) = (0.031373, 0.007843); TH switches among three sets of (µ, η) at iterations 0, 250, and 450. Unless otherwise stated, ϵ ∈ {8/255, 16/255, 32/255}.
- The final iteration is selected using only the surrogate objective (without querying Pdep), and is saved as PNG and read back in to simulate serialization in an actual pipeline.
Evaluation method
- Each model–style setting is evaluated and averaged over 10 held-out deployment prompts; the CH metric is foreground retention rate Retain (lower is stronger), and the TH metrics are TolDistpal (palette tolerance distance with ρ = 12/255) and CC (color concentration).
- Structural impact is measured by Count Ratio, Mask Ret.@50, and Pair Merge after palette decoding.
What experiments did the paper conduct?
Four VICL models, two datasets: on SegGPT, SPS reduces the CH retention rate from 0.918 to 0.155, and 30% CH contamination reduces downstream mAP50 from 0.761 to 0.281.
Experimental setup
- Models tested: Painter, SegGPT (COCO person-keypoint subset, 200 query images, each with at least two clearly annotated person instances); ConText, ConTextV (50 HierText query images).
- Evaluation coverage: CH is evaluated on the semantic and instance styles of Painter/SegGPT and the text style of ConText/ConTextV; TH is evaluated only on the instance style of Painter/SegGPT.
- Prompt protocol: 10 held-out deployment prompts per setting, disjoint from the queries and unavailable during optimization; in the paired SPS–RPS comparison, two initialization prompts are sampled per query and averaged.
- Baselines: RPS (task- and domain-matched); random ROI perturbation (averaged over 5 samples), untargeted output disruption, RGB matching.
- Metrics: CH uses Retain; TH uses TolDistpal and CC; structural impact uses Count Ratio, Mask Ret.@50, Pair Merge; downstream uses mAP50.
- Budget: default 600 iterations, K = 32; Table 4 reports that 600 steps correspond to 39.0k evaluations (excluding initialization).
Main results
Paired SPS–RPS comparison (ϵ = 16/255, lower is better, per Table 2):
Swipe horizontally to read the table
Model and style Metric SPS RPS Painter, instance CH Retain 0.460 0.627 Painter, semantic CH Retain 0.293 0.404 SegGPT, instance CH Retain 0.155 0.918 SegGPT, semantic CH Retain 0.364 0.792 ConText, text CH Retain 0.522 0.784 ConTextV, text CH Retain 0.613 0.833 Painter TH TolDistpal 0.244 0.278 SegGPT TH TolDistpal 0.225 0.345 - The authors state that SPS outperforms the task- and domain-matched RPS on all model–style combinations, with the largest gap on SegGPT.
- TH across budgets (Table 1(a)): SegGPT largely saturates after 16/255 (TolDistpal 0.181→0.176), while Painter's CC continues to rise (0.440→0.483).
- Figure 3 shows that CH transfers across semantic, instance, and text styles under held-out prompts, and the authors state that suppression is strongest on SegGPT.
Comparison with generic baselines
- On SegGPT at ϵ = 16/255 (Table 3): random ROI, output disruption, and RGB matching give CH-I retention rates of 0.987–0.999 and TH TolDistpal of 0.344–0.397, whereas CH/TH give 0.148 and 0.181, respectively.
- The authors state that only the objectives in this paper produce strong CH and TH effects; RGB matching is ineffective even when given the exact surrogate output and re-optimized.
Transfer and generalization
- Cross-palette and cross-style (SegGPT, Table 5): under an alternative palette, CH instance retention rate is 0.355 (original palette 0.148); cross-style retention rates for semantic→instance and instance→semantic are 0.533 and 0.532, respectively; under an alternative palette, TH TolDistpal is 0.242 (original-palette attack value 0.181).
- Few-shot prompts (SegGPT, Table 6): without re-optimization, CH instance retention rates under 1/2/3-shot are 0.148/0.125/0.108; after the TH attack, TolDistpal is 0.181/0.191/0.192 (clean: 0.344/0.299/0.246).
Practical impact
- Decoded structure (Table 7, ϵ = 16/255): TH gives Painter a Count Ratio of 0.733, Mask Ret.@50 of 0.058, and Pair Merge of 0.205; SegGPT gives 0.671, 0.237, and 0.397. The authors state that TH reduces the number of decoded instances and mask retention and induces many-to-one merging.
- Downstream training (Figure 4): using the public Autodistill pipeline with SegGPT as the labeler, as the CH contamination proportion among 120 annotation inputs rises from 0% to 30%, YOLO-seg mAP50 on 30 clean validation images drops from 0.761 to 0.281.
Other ablations and analyses
- TH variance weight (Table 1(b), SegGPT, ϵ = 16/255): λvar = 0.12 gives the best mean (TolDistpal 0.181, CC 0.533), while λvar = 0 gives 0.187/0.513.
- Query budget (Table 4, SegGPT, ϵ = 16/255): at 200 iterations (13.0k evaluations), CH instance/semantic retention rates are 0.508/0.497 and TH TolDistpal is 0.210; TH approaches final performance at 400 iterations, while CH is still improving at 600.
- The authors note that the 600-step TH values in Table 4 differ slightly from the main results because that ablation evaluates a fixed checkpoint rather than the best iteration selected by the surrogate.
What are some points that can be further explored?
The authors do not have a dedicated limitations section; the conclusion discusses defense trade-offs, experiments cover four models and two datasets, and TH is limited to the instance style.
Limitations and future directions noted by the authors
- Defense trade-off (Conclusion): the authors state that defenses must balance robustness with prompt adaptability and automation—stronger prompt invariance may resist attacks but would limit legitimate adaptation, and human review would reduce scalability.
- Insufficient randomization (Conclusion): the authors believe that because the attack transfers across unseen prompts and palettes, randomization alone is unlikely to be sufficient.
- Possible defense directions (Conclusion): the authors propose combining robust training, trusted prompt consistency checks, and automated verification of RGB appearance and decoded instance structure, leaving human review for high-risk annotation.
Scope of experimental coverage
- The models tested are Painter, SegGPT, ConText, and ConTextV, 4 in total; the datasets are a COCO person-keypoint subset (200 query images) and HierText (50 query images).
- TH is evaluated only on the instance-style outputs of Painter and SegGPT; cross-palette, cross-style, and few-shot transfer experiments are conducted only on SegGPT (Table 5, Table 6).
- Downstream impact is measured only on an Autodistill pipeline with SegGPT as the labeler and YOLO-seg as the downstream model, with a validation set of 30 clean images and 120 annotation inputs.
- The paper does not report evaluation against any existing defenses or adaptive attacks; the defense content is only a directional discussion in the conclusion.
- The paper does not report the number of repeated runs (with different random seeds); ± values are standard deviations across queries.
Summarize the main content of the paper
Query-only, prompt-agnostic attack on VICL segmentation: CH/TH plus SPS, transfers across unseen prompts and degrades downstream training performance.
An attack paper targeting visual in-context learning (VICL) segmentation, investigating targeted attacks when only the returned RGB outputs can be observed and the deployment prompt is unknown.
- Problem: VICL segmentation renders the task specified by the prompt as RGB outputs, used for auto-labeling; the authors state that existing attacks targeting fixed label/mask spaces do not directly apply, and robustness in this setting has not yet been explored.
- Method: treat the prompt-conditioned RGB output space as the attack surface—CH pushes foreground colors toward the background to suppress visibility, and TH pushes instance colors toward a shared color to break instance discrimination; a Self-Prompt Surrogate (SPS) is constructed from the clean query and its output, and then a zeroth-order optimizer optimizes for 600 iterations within a 64×64×3 low-dimensional ROI perturbation space using only output feedback.
- Main results:
- In the paired comparison, on SegGPT, SPS reduces the CH instance foreground retention rate from 0.918 for RPS to 0.155, and TH TolDistpal from 0.345 to 0.225 (Table 2, ϵ = 16/255).
- CH suppresses the foreground on the semantic, instance, and text-style outputs of all four models; generic baselines (random perturbation, output disruption, RGB matching) are ineffective on SegGPT (Table 3).
- The attack transfers on SegGPT across palettes, output styles, and 1–3-shot prompt combinations without re-optimization (Table 5, 6).
- After palette decoding, TH reduces the number of instances and mask retention and induces instance merging (Table 7).
- 30% CH-contaminated annotations reduce downstream YOLO-seg mAP50 from 0.761 to 0.281 (Figure 4).
- Authors' conclusion: the authors state that defenses need to balance robustness with prompt adaptability, that randomization alone is unlikely to be sufficient, and suggest combining robust training, prompt consistency checks, and automated verification.