This paper introduces Spurious Feature Eraser (SEraser), a test-time adaptation method designed to stop vision-language models (VLMs) like CLIP from taking "decision shortcuts." By optimizing a learnable prompt to ignore spurious background features during inference, the authors significantly improve model robustness on fine-grained classification tasks without needing to retrain the model or alter its architecture.
TL;DR
SEraser is a test-time prompt tuning method that improves VLM reliability by "erasing" spurious features. By maximizing prediction entropy on auxiliary images representing potential decision shortcuts, it forces models like CLIP to rely on invariant causal features rather than misleading background context.
What Problem Does This Paper Address?
Vision-Language Foundation Models (VLFMs) like CLIP are incredibly powerful, but they are prone to "decision shortcuts." Instead of identifying an object by its core characteristics, the model might rely on the background. For example, as shown in Figure 1, CLIP might correctly identify a spider in a neutral setting, but if that same spider is placed on a beach, the model predicts "crab" with high confidence.
The authors argue that CLIP actually possesses the correct features (it "knows" what a spider looks like), but the inference process is dominated by these spurious associations. Existing solutions often require expensive fine-tuning of the entire model or complex architectural changes. SEraser aims to fix this "out-of-the-box" during the inference phase.
Methods
The core of SEraser is a test-time prompt tuning paradigm. Unlike standard fine-tuning, this method keeps the model weights frozen and only optimizes a small set of learnable vectors (the "prompt") for each test sample.
The process involves two main steps:
- Constructing Auxiliary Images: The system identifies potential spurious features by creating "auxiliary images" ($x_e$). These can be generated in three ways:
- Annotations: Using tools like Segment Anything (SAM) to isolate the background.
- Patches: Sampling small crops (e.g., corner patches) from the original image.
- Reference Images: Using images from unrelated datasets (OOD data) as proxies for non-target features.
- The Eraser Objective: During optimization, the model is forced to produce a uniform distribution (maximum entropy) when looking at these auxiliary images. Mathematically, this is done by minimizing the Kullback-Leibler (KL) divergence between the model's prediction on the auxiliary image and a uniform distribution.
By "erasing" the model's ability to make a confident prediction based on the background or random patches, the learnable prompt is forced to focus the model's attention on the remaining invariant features—the actual object—for the final classification.
Datasets
The authors evaluate SEraser on several fronts:
- Real-world Scenarios: Tiny-ImageNet, CUB-200 (birds), and ImageNet-A.
- Simulated Benchmarks: The Waterbirds dataset, a classic benchmark for spurious correlations where landbirds appear on water backgrounds and vice versa.
- S2E (Shortcut-to-Evaluate): A new evaluation paradigm proposed by the authors. They argue that traditional benchmarks suffer from "data leakage" because foundation models were likely trained on parts of their test sets. To solve this, they used AI generators (DALL-E/Midjourney) to create new, unconventional test sets like CamelDeer (camels in grasslands, deer in deserts) and SpiderCrab (spiders on beaches).
Key Insights and Ideas
- CLIP is "Smarter" Than It Acts: The paper's foundational observation is that CLIP already has a rich set of invariant features. The failure isn't a lack of knowledge, but a failure of feature selection during inference.
- Erasing vs. Forcing: Most prior work tries to force the model to look at specific regions (e.g., masking everything but the object). SEraser is more flexible; it tells the model what not to rely on. This "soft constraint" is more robust to imperfect segmentations.
- Entropy as a Tool for Robustness: By maximizing entropy on spurious features, the method effectively "blinds" the model to those features, preventing "hasty judgments" based on partial or misleading information.
Key Results
SEraser consistently outperformed baseline methods, particularly in "Worst Group" (W.G.) accuracy—the metric that measures how well the model performs on the most challenging, counter-intuitive examples (like the spider on the beach).
- Waterbirds: SEraser achieved a 25.21% improvement in Worst Group accuracy over the vanilla CLIP model.
- SpiderCrab (S2E): The Worst Group accuracy soared from 42.00% to 94.67%.
- Cross-Architecture Success: The method proved effective not just for CLIP (ViT-B and ViT-L), but also for other architectures like BLIP-2, showing its generalizability.
Limitations and Future Work
While effective, SEraser requires a test-time optimization step for each image, which introduces computational overhead compared to a single forward pass. The authors also note that the method's performance is somewhat dependent on the strategy used to construct auxiliary images.
Future work could explore more automated ways to identify spurious features without relying on external tools like SAM or manual patch selection, further streamlining the "erasing" process for real-time applications.
Summary updated