GSCLIP : A Framework for Explaining Distribution Shifts in Natural Language

Zhiying Zhu, Weixin Liang, James ZouarXiv 2022 · DOI

Abstract

Distribution shift remains a critical challenge in machine learning, where models often fail when test data deviates from training distributions. While statistical methods can detect the presence of a shift, they rarely provide semantic explanations. We present GSCLIP, a training-free framework that automatically generates human-readable explanations for dataset differences. By leveraging Large Language Models (LLMs) for candidate generation and the CLIP embedding space for explanation selection, GSCLIP identifies specific semantic shifts (e.g., "indoor" vs. "outdoor") without additional fine-tuning.

Introduction

Machine learning models are frequently deployed in environments where the data distribution differs from the training set, a phenomenon known as distribution shift. Traditional shift detection methods typically output a p-value, indicating if a shift exists but failing to describe what the shift entails. Understanding these shifts—whether they involve lighting, background context, or geographic bias—usually requires labor-intensive manual inspection. This paper introduces the task of dataset explanation: the automated generation of natural language descriptions for the semantic differences between two datasets.

Methodology

The GSCLIP framework operates without training or fine-tuning, utilizing two primary components: a Candidate Generator and an Explanation Selector.

Candidate Generator

To describe a shift, the system first generates a set of potential descriptions. GSCLIP employs a dual approach:

  1. Rule-Based Generation: Uses pre-defined templates (e.g., "a photo of a [attribute] [object]") filled with known labels.
  2. LM-Based Generation: Leverages GPT-2 to creatively complete sentence prefixes such as "a photo of a cat that is...". This allows for the discovery of nuanced, non-pre-coded explanations.

Explanation Selector

The selector identifies the most valid candidate by analyzing the geometry of the CLIP feature space. For a given candidate (e.g., "indoor"), the system:

  1. Computes CLIP text embeddings for the candidate and its negation (e.g., "outdoor").
  2. Derives a difference vector between these embeddings, representing the semantic axis of the shift.
  3. Projects image embeddings from both datasets onto this vector.
  4. Applies a t-test to the projection scores to determine if the datasets differ significantly along this axis.
The GSCLIP Explanation Selector uses CLIP embeddings and t-tests to validate candidate explanations.

Experimental Evaluation

The framework was evaluated on several benchmarks, including MetaShift, a large-scale benchmark containing 12,868 image sets across 410 classes designed for contextual shift analysis, and MetaShift-Attributes, a fine-grained version focused on specific image attributes.

Results and Discussion

GSCLIP demonstrates strong performance in identifying semantic shifts. On the MetaShift-Attributes dataset, the system achieved a 71% Acc@5, indicating the correct explanation is frequently among the top suggestions.

Accuracy results for GSCLIP on MetaShift and MetaShift-Attributes benchmarks.

Key insights include:

  • CLIP Geometry: The semantic consistency of CLIP's vector space allows for effective measurement of concepts using "difference vectors."
  • Negation as a Filter: Comparing a description to its negation isolates the shifting attribute from common features (e.g., the shared object "cat").
  • LLM Advantage: Using GPT-2 for candidate generation improved accuracy by 4% to 13% over word-frequency baselines like Wikipedia.

Conclusion

GSCLIP provides a scalable, training-free solution for explaining distribution shifts in natural language. While currently object-centric and dependent on the quality of the candidate generator, it offers a significant step toward interpretable and actionable shift detection. Future work may address complex scenes with multiple interacting objects and more subtle, non-semantic shifts.

Summary updated

BibTeX
@misc{zhu2022gsclip,
  author = {Zhiying Zhu and Weixin Liang and James Zou},
  title = {{GSCLIP : A Framework for Explaining Distribution Shifts in Natural Language}},
  year = {2022},
  eprint = {2206.15007},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2206.15007},
}
Figure