Diagnosing and Rectifying Vision Models using Language

Yuhui Zhang, Jeff Z. HaoChen, Shih-Cheng Huang, Kuan-Chieh Wang, James Zou, Serena Yeung

TL;DR

Researchers have developed DrML, a framework that uses natural language to find and fix "blind spots" in computer vision models. By leveraging the shared embedding space of multi-modal models like CLIP, DrML identifies error-prone data slices and retrains models to fix them—all without needing to collect a single new image.

The Challenge of Distribution Shifts

Machine learning models often fail when they encounter "distribution shifts"—situations in the real world that look different from their training data. For example, a bird classifier might learn to associate "waterbirds" with "watery backgrounds." If it sees a duck on a lawn, it fails.

Traditionally, diagnosing these failures requires a labor-intensive process: developers must notice the failure, collect thousands of new images representing that specific edge case (an "error slice"), annotate them, and then retrain the model. This is slow, expensive, and often impossible for rare events. The authors ask a compelling question: Can we use the descriptive power of language to probe and fix these models instead of hunting for rare images?

Introducing DrML

The core of the paper is a framework called DrML (Diagnosing and Rectifying Vision Models using Language). It relies on a phenomenon the authors call cross-modal transferability.

Overview of the DrML framework

The framework operates through several key steps:

  1. Bridging the Modality Gap: In models like CLIP, image and text embeddings are "aligned" but still live in separate clusters, creating a modality gap. The authors prove mathematically and empirically that this gap is mostly a constant vector. Because of this, a classifier trained on images can be "fooled" into working on text embeddings simply by shifting the data to close that gap.
Impact of closing the modality gap on model consistency
  1. Error Slice Discovery: Instead of looking for images, the researchers generate hundreds of text prompts combining different attributes (e.g., "a photo of a [species] in the [place]"). They feed these text embeddings into the vision classifier to see where it predicts incorrectly.
  2. Influential Attribute Identification: They use Shapley values—a concept from game theory—to determine which specific words (like "ocean" or "bamboo") are most responsible for a model's decision or failure.
  3. Rectification: Once a failure mode is identified (e.g., "Landbirds in water"), they generate a large set of text embeddings for that specific scenario and fine-tune the vision classifier on this synthetic "textual data."

Experimental Validation

The authors validated DrML on several benchmarks designed to simulate common model failures:

  • Waterbirds: Used to test spurious correlations (e.g., the model relies on the background rather than the bird).
  • FairFace: Used to test underrepresented data (e.g., how the model performs on different races/ages in gender classification).
  • dSpritesV: A synthetic dataset used to test unseen data (e.g., shapes or colors the model never saw during training).
  • MS-COCO: A standard large-scale image-captioning dataset used to verify the underlying theory of cross-modal transfer.

Key Insights and Results

  • Language as a Proxy: The most striking insight is that text embeddings are "good enough" stand-ins for images. You don't need a generative model (like DALL-E) to create a fake image; the raw text embedding from CLIP is actually a more reliable signal for the classifier.
  • Zero-Visual-Data Fixing: The paper demonstrates that you can significantly improve a model's performance on a specific real-world image failure mode by training it on text descriptions of that failure.
  • Accuracy Boosts: On the Waterbirds dataset, the accuracy for the "Waterbird in Land" error slice jumped from 32% to 56% after DrML rectification.
  • Fairness Improvements: On FairFace, the model's performance on the "Black" population slice improved from 89.9% to 90.7% without needing new photos.
  • Efficiency: DrML outperformed baselines that require visual data or computationally expensive text-to-image generation.

Limitations and Future Work

While powerful, DrML currently requires humans to define a set of attributes (like "ocean," "forest," "young," "old") to generate the prompts. If an error is caused by an unnamed attribute, the system won't find it. Furthermore, while great at identifying conceptual errors (like "wrong background"), it struggles to diagnose low-level visual attributes that are hard to describe in words, such as specific textures or complex lighting angles. Finally, the method's success is tied to the quality of the underlying multi-modal model; if the foundation model has its own inherent biases, DrML will inherit them.

Future work aims to automate attribute discovery using Large Language Models (LLMs) to make the diagnosis process even more autonomous.

Summary updated

BibTeX
@inproceedings{zhang2023diagnosing,
  author = {Yuhui Zhang and Jeff Z. HaoChen and Shih-Cheng Huang and Kuan-Chieh Wang and James Zou and Serena Yeung},
  title = {{Diagnosing and Rectifying Vision Models using Language}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=D-zfUK7BR6c},
}
Figure