Causal Attention for Vision-Language Tasks

Xu Yang, Hanwang Zhang, Guojun Qi, Jianfei Cai

Introduction

Modern vision-language (V-L) models have achieved remarkable success across tasks like image captioning and visual question answering (VQA). However, these models often rely on "spurious correlations" found in training datasets rather than a true understanding of visual evidence. For instance, if a dataset predominantly features men riding horses, a model might learn a strong statistical link between the "horse" region and the word "man." Consequently, when presented with an image of a woman on a horse, the model may incorrectly predict "man" because it prioritizes learned dataset biases over the actual visual features of the person. In causal terms, this "common sense" bias acts as a confounder—an unobserved variable that creates a misleading backdoor path between input and output.

The Causal Attention (CATT) Framework

To address this, we introduce Causal Attention (CATT), a plug-and-play module designed to perform causal intervention. Unlike traditional deconfounding methods that rely on "back-door adjustment" (which requires identifying and measuring specific confounders), CATT utilizes the front-door adjustment principle. This approach is more robust as it works even when the exact nature of the dataset bias is unknown.

CATT architecture and the underlying causal graph showing the relationship between input (X), mediator (Z), and output (Y).

Core Mechanism: IS-ATT and CS-ATT

CATT reformulates the standard attention mechanism into two parallel components:

  1. In-Sample Attention (IS-ATT): The standard attention mechanism that processes features within the current image-sentence pair.
  2. Cross-Sample Attention (CS-ATT): A novel component that forcibly introduces features from other samples in the dataset.

To implement CS-ATT efficiently, a Global Dictionary is constructed using K-means clustering on the entire training set. During training, the model's query attends to both the current sample's features and this global dictionary. By shuffling features across samples, CS-ATT acts as a physical intervention. It forces the model to break shortcut dependencies (e.g., "horse implies man") by requiring it to predict labels even when the primary object is paired with visual features from unrelated contexts. To maintain mathematical consistency, the weights for the Query, Key, and Value matrices are shared between both modules.

Experimental Evaluation

CATT was evaluated across several benchmarks, including MS COCO (Image Captioning), VQA2.0, GQA, and NLVR2. The module was also tested in large-scale pre-training scenarios using a combined dataset of 9.18 million image-sentence pairs.

Performance and Bias Mitigation

Integrating CATT into standard architectures like BUTD and Transformers resulted in significant performance gains, including a 3.0 to 3.2 point increase in CIDEr-D scores for image captioning. In VQA tasks, the "Number" category saw the most substantial improvement (+4.75 points), suggesting that the model is genuinely attending to objects to count them rather than guessing based on linguistic context.

Qualitative examples where standard models (red) fail due to dataset bias, while CATT-equipped models (blue) correctly identify visual evidence.

As shown in the qualitative results, CATT-equipped models are significantly better at grounding. For example, when asked about the color of a necklace, a biased model might default to "black" due to the frequency of that color in the dataset, whereas CATT correctly identifies "white" by focusing on the specific visual region. Furthermore, CATT allows "lighter" models to outperform heavier competitors; a CATT-enhanced LXMERT model outperformed the much larger UNITER model on VQA2.0 while requiring approximately 30% fewer GPU hours for training.

Conclusion and Future Work

Causal Attention provides a scalable, efficient way to mitigate dataset bias in vision-language tasks without requiring explicit knowledge of the confounders. While the current implementation relies on a fixed global dictionary, future research will explore dynamic dictionary generation and the impact of multi-layer causal interventions. CATT demonstrates that by moving from statistical correlation to causal inference, we can build V-L models that are both more accurate and more robust to real-world distribution shifts.

Summary updated

BibTeX
@inproceedings{yang2021causal,
  author = {Xu Yang and Hanwang Zhang and Guojun Qi and Jianfei Cai},
  title = {{Causal Attention for Vision-Language Tasks}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  doi = {10.1109/cvpr46437.2021.00972},
}
Figure