Unleashing the Power of Visual Prompting At the Pixel Level

Junyang Wu, Xianhang Li, Chen Wei, Huiyu Wang, Alan L. Yuille, Yuyin Zhou, Cihang XiearXiv 2022 · DOI

Abstract

Adapting massive pre-trained foundation models to downstream tasks is often computationally prohibitive. Visual Prompting (VP) offers a parameter-efficient alternative by learning a small set of input pixels while keeping the model frozen. However, traditional VP often underperforms compared to linear probing. This paper introduces Enhanced Visual Prompting (EVP), which utilizes a "shrink and pad" strategy, input diversity, and gradient normalization to significantly improve performance. EVP outperforms previous prompting methods and the standard linear probing baseline across 12 datasets while using only 0.04% of the model's parameters.

Introduction

As foundation models like CLIP scale to billions of parameters, full fine-tuning for specific tasks—such as satellite imagery or medical scan classification—becomes impractical. Visual Prompting (VP) has emerged as a solution, where the model remains frozen and only a set of "prompt" pixels is learned. Despite its potential, existing VP methods suffer from information corruption (where prompts obscure image features) and optimization difficulties (leading to overfitting).

Accuracy vs. Parameter Efficiency: EVP achieves high accuracy with significantly fewer parameters compared to full fine-tuning and outperforms other prompting methods.

The authors identify that pixel-level prompting can be viewed as an "inverse adversarial attack." While adversarial attacks seek perturbations that cause failure, visual prompting seeks perturbations that guide the model toward success. By applying techniques from the adversarial machine learning community, EVP bridges the performance gap between prompting and traditional adaptation methods.

Methods

Enhanced Visual Prompting (EVP) introduces several key innovations to overcome the limitations of prior work:

  • Shrink and Pad Strategy: Unlike previous methods that overlay prompt pixels on the image, EVP shrinks the original image and pads the learnable prompt pixels around it as a frame. This ensures the prompt and image content remain independent, preventing information loss.
  • Input Diversity: To improve generalization and prevent overfitting, EVP applies data augmentations (e.g., random horizontal flips) to the image during the prompt-learning phase.
  • Gradient Normalization: The use of $L_2$ normalization on gradients during training stabilizes the optimization process and prevents extreme pixel values.
  • Positional Embedding Alignment: For Vision Transformer (ViT) architectures, EVP ensures positional embeddings are correctly interpolated to maintain spatial relationships between the prompt frame and the image content.
Comparison of Visual Prompting Architectures: (a) Visual Prompt Tuning (VPT) inserts prompts into transformer layers; (b) Standard Visual Prompting (VP) overlays prompts; (c) EVP (Ours) utilizes the shrink-and-pad strategy with input diversity.

Experimental Results

EVP was evaluated across 12 classification datasets, ranging from general-purpose (CIFAR10/100) to specialized domains (EuroSAT, RESISC45).

  • Performance: EVP achieved an average accuracy of 82.5%, a +5.2% improvement over Visual Prompt Tuning (VPT).
  • Efficiency: These gains were achieved using only ~0.04% of the total model parameters, representing a ~2500x reduction compared to full fine-tuning.
  • Baselines: EVP outperformed the standard linear probing baseline (80.3%) by 2.2% on average, succeeding on 7 out of 12 datasets.
  • Robustness: On the WILDS benchmark for distribution shifts, EVP surpassed linear probing by 3.7%, indicating superior resilience to environmental changes.

Conclusion and Future Work

EVP demonstrates that pixel-level prompting can be a highly effective and efficient method for model adaptation. While it excels in general and domain-specific tasks, it still faces challenges in extremely fine-grained classification (e.g., Flowers102). Future research may explore hybrid approaches that combine pixel-level prompting with deep feature-level prompting to further push the boundaries of parameter-efficient transfer learning.

Summary updated

BibTeX
@misc{wu2022unleashing,
  author = {Junyang Wu and Xianhang Li and Chen Wei and Huiyu Wang and Alan L. Yuille and Yuyin Zhou and Cihang Xie},
  title = {{Unleashing the Power of Visual Prompting At the Pixel Level}},
  year = {2022},
  eprint = {2212.10556},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2212.10556},
}
Figure