Model Reprogramming Outperforms Fine-tuning on Out-of-distribution Data in Text-Image Encoders

Andrew Geng, Pin-Yu Chen · DOI

Introduction

Large-scale pre-trained multi-modal models, such as CLIP, have demonstrated remarkable zero-shot capabilities across a wide array of visual tasks. However, when practitioners seek to specialize these models for specific downstream applications, they typically rely on fine-tuning—either through linear probing or full-network updates. While these methods improve performance on the target task, they often introduce a "hidden cost": the distortion of the robust, high-quality representations learned during the pre-training phase. This paper introduces REPROGRAMMER, a non-intrusive adaptation framework that preserves model robustness by transforming input data rather than modifying the model's internal weights.

The Problem: The Robustness-Accuracy Trade-off

Standard fine-tuning methods are inherently "intrusive." By altering the weights of a pre-trained encoder, the model often experiences a significant drop in reliability when encountering out-of-distribution (OOD) data. The authors identify two primary areas where fine-tuning fails:

  1. OOD Generalization (Covariate Shift): The ability to recognize known objects in unfamiliar styles or environments (e.g., identifying a sketch or an adversarial rendition of a dog).
  2. OOD Detection (Semantic Shift): The safety-critical ability to identify when an input belongs to a category not seen during training (e.g., flagging a "car" as unknown when the model was only trained on "cats" and "dogs").

Empirical evidence suggests that full fine-tuning can actually make a model less capable of OOD detection than the original, unmodified zero-shot model, creating a dangerous trade-off between task-specific accuracy and general safety.

Methodology: Model Reprogramming

To address these limitations, the authors propose Model Reprogramming, which wraps the frozen pre-trained model in learnable input transformation functions. This approach treats the model as a fixed "black box" and learns to map downstream data into the model's existing feature space.

The REPROGRAMMER Architecture

  • Image Reprogramming: The input image is up-sampled and surrounded by a learnable "edge perturbation"—a frame of pixels that acts as a task-specific signal to the frozen vision encoder.
  • Text Reprogramming: The model applies a learnable lookup table and bias to the token embeddings of class prompts (e.g., "a photo of a {label}"), refining how the text encoder perceives the target categories.
  • Residual Reprogrammer (RRP): The authors' most advanced variant, RRP, introduces a residual connection that fuses the newly learned reprogrammed features with the original zero-shot features. This ensures that the model retains its broad, pre-trained knowledge while gaining task-specific expertise.

Experimental Results

The researchers evaluated REPROGRAMMER against standard fine-tuning methods (like Linear Probing and LP-FT) across massive benchmarks, including CIFAR-10 and ImageNet-1k, along with various OOD variants (ImageNet-R, -A, and -Sketch).

Holistic Performance

On the CIFAR benchmarks, the Residual Reprogrammer (RRP) achieved an aggregate score of 92.69%, outperforming the state-of-the-art LP-FT method by nearly 3%. On ImageNet-1k, RRP maintained a lead of +0.69% in aggregate performance across both ID and OOD tasks.

Safety and OOD Detection

One of the paper's most significant findings is in OOD detection. While full fine-tuning often causes OOD detection performance to plummet—dropping the AUROC on CIFAR-10 from 95.10% to 93.40%—RRP consistently matches or exceeds the zero-shot baseline. This suggests that reprogramming is a "safety-first" adaptation method.

Discussion and Insights

The success of REPROGRAMMER suggests that for multi-modal models, alignment is superior to adaptation. Rather than forcing the model's weights to change to accommodate new data (adaptation), reprogramming aligns the new data to the model's existing expectations (alignment). This prevents the destruction of the feature space and allows the model to generalize to covariate-shifted samples (like sketches) far more effectively.

Limitations and Future Work

While highly effective, the authors note that the gains from model reprogramming are currently more pronounced on tasks with fewer classes. As the label space grows (e.g., the 1000 classes of ImageNet), the performance gap between reprogramming and fine-tuning narrows. Future research may explore more complex reprogramming functions and the application of these techniques to pure vision or pure language architectures beyond the CLIP-like joint encoders studied here.

Summary updated

BibTeX
@inproceedings{geng2024model,
  author = {Andrew Geng and Pin-Yu Chen},
  title = {{Model Reprogramming Outperforms Fine-tuning on Out-of-distribution Data in Text-Image Encoders}},
  booktitle = {SaTML},
  year = {2024},
  doi = {10.1109/satml59370.2024.00034},
}
Figure