Debiasing CLIP: Interpreting and Correcting Bias in Attention Heads

Wei Jie Yeo, Rui Mao, Moloud Abdar, Erik Cambria, Ranjan Satapathy · OpenReview

Abstract: Multimodal models like CLIP have gained significant attention due to their remarkable zero-shot performance across various tasks. However, studies have revealed that CLIP can inadvertently learn spurious associations between target variables and confounding factors. To address this, we introduce Locate-Then-Correct (LTC), a contrastive framework that identifies spurious attention heads in Vision Transformers via mechanistic insights and mitigates them through targeted ablation. Furthermore, LTC identifies salient, task-relevant attention heads, enabling the integration of discriminative features through orthogonal projection to improve classification performance. We evaluate LTC on benchmarks with inherent background and gender biases, achieving over a >50% gain in worst-group accuracy compared to non-training post-hoc baselines. Additionally, we visualize the representation of selected heads and find that the presented interpretation corroborates our contrastive mechanism for identifying both spurious and salient attention heads.

Introduction

Large-scale multimodal models, particularly CLIP, have revolutionized zero-shot visual recognition. Despite their versatility, these models are prone to learning "spurious correlations"—statistical shortcuts where the model relies on confounding factors rather than the actual object of interest. A classic example is the "Waterbirds" problem: if a model frequently sees waterbirds in aquatic environments and landbirds in forests during training, it may learn to classify a bird based on its background. This leads to significant performance drops on "worst-group" samples, such as a waterbird on land.

Beyond background bias, these models also inherit societal biases, such as gender-occupation stereotypes. While debiasing methods exist, they typically involve expensive fine-tuning or lack transparency. This paper introduces Locate-Then-Correct (LTC), a surgical, post-hoc framework designed to identify and fix biased attention heads within CLIP’s Vision Transformer (ViT) architecture without requiring additional training.

The Locate-Then-Correct (LTC) Framework

LTC operates on the "linear representation hypothesis," which posits that high-level concepts are linearly separable in a model's latent space. The framework follows a two-stage process:

  1. Locate: The authors use a "Logit Lens" technique to decompose the final prediction into contributions from individual attention heads. By contrasting model activations on samples where the model succeeds versus where it fails under biased conditions (e.g., correctly identifying a bird despite a misleading background), LTC mathematically isolates "spurious" heads (encoding bias) and "target" heads (encoding class features).
  2. Correct: Once identified, heads receive targeted treatments:
  3. Spurious Ablation: Heads strongly encoding confounding factors like backgrounds are "mean-ablated," neutralizing their negative influence.
  4. Knowledge Injection: For target heads, LTC injects discriminative features. Using an LLM (like GPT-4), the authors generate text descriptions of visual differences (e.g., "webbed feet" vs. "talon feet"). These features are projected onto the target heads via orthogonal projection to sharpen the model's focus.
The LTC framework identifies spurious states (background) for ablation and target states (class features) for knowledge injection.

Experimental Evaluation

The LTC framework was evaluated across several challenging benchmarks known for inherent biases:

  • Waterbirds: Tests for background bias (birds vs. water/land backgrounds).
  • CounterAnimal: A multi-class dataset featuring animals in rare or atypical habitats.
  • GenderBias-VL: Evaluates gender-occupation stereotypes across 177 occupations.
  • FairFace: Assesses generalization on sensitive concepts across demographic groups.

Results

LTC demonstrates superior performance compared to existing non-training post-hoc baselines. On the Waterbirds dataset using a ViT-B/16 backbone, LTC achieved a 73.3% worst-group accuracy (WGA), a massive improvement over the 49.7% achieved by standard zero-shot CLIP. Crucially, it reduced the performance "Gap" between average and worst-group samples to a mere 1.3%.

Quantitative results on Waterbirds and CounterAnimal benchmarks demonstrate LTC's superior worst-group accuracy (WG) compared to baselines.

In the multi-class CounterAnimal setting, LTC was the only method to consistently improve upon zero-shot CLIP. For gender bias, LTC significantly reduced bias scores in occupation classification (e.g., from 74.0 to 10.0 on ViT-B/16 for highly biased occupations).

Discussion and Insights

The success of LTC highlights several key findings:

  • Surgical Precision: Bias is not uniformly distributed; it often resides in specific attention heads. Targeting these is more efficient than global debiasing.
  • Mechanistic Logic: Contrastive discovery allows the model to distinguish between "what looks at the bird" and "what looks at the water."
  • LLMs as Feature Engineers: LLM-generated descriptions provide a cleaner signal for knowledge injection than the model's own biased training data.
  • Interpretability: Heatmap visualizations confirm that target heads focus on objects while spurious heads focus on environments, validating the selection mechanism.

Conclusion

LTC provides a powerful, interpretable, and efficient way to debias foundation models. While the current work focuses on CLIP, the "Locate-Then-Correct" philosophy could potentially be extended to generative models. However, the authors note a dual-use risk: the same mechanistic insights could be used to amplify biases if applied maliciously. Future work will explore optimizing selection thresholds and broader model applications.

Summary updated

Abstract

Multimodal models like CLIP have gained significant attention due to their remarkable zero-shot performance across various tasks. However, studies have revealed that CLIP can inadvertently learn spurious associations between target variables and confounding factors. To address this, we introduce \textsc{Locate-Then-Correct} (LTC), a contrastive framework that identifies spurious attention heads in Vision Transformers via mechanistic insights and mitigates them through targeted ablation. Furthermore, LTC identifies salient, task-relevant attention heads, enabling the integration of discriminative features through orthogonal projection to improve classification performance. We evaluate LTC on benchmarks with inherent background and gender biases, achieving over a $>50\%$ gain in worst-group accuracy compared to non-training post-hoc baselines. Additionally, we visualize the representation of selected heads and find that the presented interpretation corroborates our contrastive mechanism for identifying both spurious and salient attention heads. Code available at https://github.com/wj210/CLIP_LTC.
BibTeX
@inproceedings{yeo2026debiasing,
  author = {Wei Jie Yeo and Rui Mao and Moloud Abdar and Erik Cambria and Ranjan Satapathy},
  title = {{Debiasing CLIP: Interpreting and Correcting Bias in Attention Heads}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=Sd5KwQbOdd},
}
Figure