Unleashing the Power of Visual Prompting At the Pixel Level

Junyang Wu, Xianhang Li, Chen Wei, Huiyu Wang, Alan Yuille, Yuyin Zhou, Cihang XieOpenReview 2024 · Submission to ICLR 2024 · Withdrawn

As artificial intelligence models scale to billions of parameters, "full fine-tuning"—updating every weight in a model for a new task—has become prohibitively expensive. To address this, researchers have sought parameter-efficient alternatives. In Natural Language Processing (NLP), "prompting" (adding a few learnable words to a query) has been a massive success.

However, in Computer Vision, visual prompting (VP) has historically struggled. Previous methods either added learnable "noise" directly onto the image pixels or inserted new tokens into the model's architecture. Surprisingly, these methods often performed worse than "linear probing," which simply trains a new classification layer on top of a frozen model.

Enhanced Visual Prompting (EVP) bridges this gap. By shrinking the input image and padding it with learnable pixels, and by borrowing optimization "tricks" from the world of adversarial attacks, EVP achieves a new state-of-the-art for visual prompting, proving that it can be a superior choice for efficient adaptation.

The EVP Approach: Shrink, Pad, and Optimize

The authors introduce two primary design pillars that set EVP apart from prior visual prompting attempts:

1. The "Shrink and Pad" Strategy Previous pixel-level prompting methods added the prompt as a transparent overlay or a border that overlapped with the image. This inadvertently corrupts the original image information (e.g., obscuring the defining features of an object). EVP instead shrinks the original image and pads the learnable prompt pixels around it. This keeps the image and the prompt as independent entities, allowing the frozen backbone model to process the original features clearly while utilizing the border as a contextual cue.

Comparison of VPT, standard VP, and the proposed EVP method.

2. Adversarial "Old Tricks" The authors noted a conceptual link: training a visual prompt is essentially the "inverse" of an adversarial attack. While an attacker seeks a pixel perturbation to make a model fail, a prompter seeks one to make it succeed. Consequently, they re-introduced two techniques from adversarial research to make prompts more generalizable:

  • Input Diversity: Applying data augmentations (like random cropping and flipping) to the prompted image during training to improve generalization.
  • Gradient Normalization: Using the $L_2$ norm to scale gradients during optimization, preventing the training process from getting stuck in poor local minima.

Additionally, the paper highlights that for Vision Transformers (ViTs), positional embeddings matter. Adding positional information to the learnable pixels is crucial for the model to distinguish the "context" (prompt) from the "content" (image).

Key Results and Performance

The study evaluated EVP across a diverse battery of benchmarks, including 12 popular classification datasets (like CIFAR, EuroSAT, and SUN397), robustness benchmarks (WILDS), and corruption datasets (CIFAR-C).

Using a frozen CLIP-B/32 model, EVP achieved an average accuracy of 82.5% across the 12 classification datasets. This establishes a new state-of-the-art, outperforming the previous best prompting method (VPT) by +5.2%. Most importantly, it surpasses the industry-standard linear probing baseline by +2.2%.

Performance vs. Parameter Count showing EVP outperforming linear probing with vastly fewer parameters.

EVP achieves these results with extreme efficiency, requiring only 0.06 million tunable parameters. This is roughly 2500x fewer parameters than full fine-tuning (151M parameters), yet it delivers highly competitive accuracy. Furthermore, in out-of-distribution tests (WILDS), EVP outperformed linear probing by 3.7%, suggesting that pixel-level prompts help models adapt to domain shifts better than simply retraining the model's classification head.

Limitations and Future Work

While EVP is highly effective, it does come with trade-offs. Shrinking the image to make room for the prompt border naturally results in a loss of some fine-grained image detail. Future work could explore ways to maintain high resolution while keeping the prompt and image separate.

Additionally, while EVP works exceptionally well on language-aligned models like CLIP, it is less effective on "pure" vision models (like those trained solely on ImageNet) unless a label mapping step is added to connect downstream classes to pre-trained categories. Finally, its efficacy on more complex spatial tasks, such as object detection or segmentation, remains an open question for future research.

Summary updated

BibTeX
@misc{wu2024unleashing,
  author = {Junyang Wu and Xianhang Li and Chen Wei and Huiyu Wang and Alan Yuille and Yuyin Zhou and Cihang Xie},
  title = {{Unleashing the Power of Visual Prompting At the Pixel Level}},
  year = {2024},
  url = {https://openreview.net/forum?id=YqitLs4nHa},
  howpublished = {OpenReview},
  note = {Submitted to ICLR 2024},
}
Figure