Source-linked AI summary
Causal Attention for Unbiased Visual Recognition
Tan Wang, Chang Zhou, Qianru Sun, Hanwang Zhang
TL;DR
The paper addresses attention models' reliance on contextual confounders, which can help IID prediction but harm OOD recognition. It introduces CaaM, an unsupervised module that progressively self-annotates confounders through iterative partitions and disentangled attentions. The paper reports consistent gains, including improvements for both frequent and rare contexts.
Problem
Attention can capture spurious contextual correlations instead of causal visual features, benefiting IID prediction but harming OOD recognition.
Method
CaaM iteratively partitions data, self-annotates confounders, and adversarially separates causal from confounding attention without requiring confounder annotations.
Results
CaaM delivers consistent gains across experiments and improves both frequent-context accuracy by 9.64% and rare-context accuracy by 13.37%.
Takeaways & Limitations
CaaM provides a generic attention module for robust OOD recognition while retaining IID performance and improving attention localization.
Takeaways & Limitations
Prior intervention methods cannot collect every class in every context, and coarse partitions can remove beneficial causal features such as object parts.
Abstract
from arXiv · showhide
Attention module does not always help deep models learn causal features that are robust in any confounding context, e.g., a foreground object feature is invariant to different backgrounds. This is because the confounders trick the attention to capture spurious correlations that benefit the prediction when the training and testing data are IID (identical & independent distribution); while harm the prediction when the data are OOD (out-of-distribution). The sole fundamental solution to learn causal attention is by causal intervention, which requires additional annotations of the confounders, e.g., a "dog" model is learned within "grass+dog" and "road+dog" respectively, so the "grass" and "road" contexts will no longer confound the "dog" recognition. However, such annotation is not only prohibitively expensive, but also inherently problematic, as the confounders are elusive in nature. In this paper, we propose a causal attention module (CaaM) that self-annotates the confounders in unsupervised fashion. In particular, multiple CaaMs can be stacked and integrated in conventional attention CNN and self-attention Vision Transformer. In OOD settings, deep models with CaaM outperform those without it significantly; even in IID settings, the attention localization is also improved by CaaM, showing a great potential in applications that require robust visual saliency. Codes are available at \url{https://github.com/Wangt-CN/CaaM}.
1. Introduction
The paper argues that conventional attention can exploit contextual confounders, helping in IID settings but harming OOD recognition. It proposes CaaM, an unsupervised causal attention module that progressively self-annotates confounders through fine-grained partitions and disentangled attentions.
- Motivation: Conventional attention may attend to contextual regions rather than salient object features because it lacks region-level labels.This makes attention a weakly supervised selection process.
- Motivation: In OOD settings, contextual cues can mislead attention models, making them worse than non-attention baselines.A ground region associated with birds during training can cause a bear-in-ground image to be misclassified as a bird.
- Causal analysis: Context acts as a confounder between image features and labels, allowing models to use statistical context cues as features of the input.The paper represents this relationship as X ← S → Y.
- Limitations of prior intervention: Existing context-splitting interventions are impractical because some classes cannot be collected across every context, violating the confounder positivity assumption.The paper gives finding fish in the sky as an example.
- Limitations of prior intervention: Coarse context partitions can over-adjust by removing beneficial causal object features, such as bird wings correlated with sky contexts.The paper identifies this as improper causal intervention.
- Proposed method: CaaM iteratively generates fine-grained partitions, progressively self-annotates confounders, and adversarially disentangles causal and confounding attentions.Multiple CaaMs can be integrated into attention CNNs and Vision Transformers.
- Contributions: CaaM is designed to improve OOD robustness without sacrificing IID performance and is supported by causal analysis and extensive experiments.The paper reports consistent gains across its evaluated settings and describes the module as generic to popular deep networks.
2. Related Work
Prior visual-attention methods select informative features without strong localized supervision, which can bias attention under OOD conditions. CaaM differs from related visual causal-inference approaches by self-annotating confounders without supervision.
- Visual Attention: Conventional and self-attention methods primarily select informative features using context or token queries.The related-work discussion covers both conventional attention and recent self-attention models.
- Visual Attention: Because attention lacks strong localized supervision, the paper characterizes it as inherently biased in OOD settings.
- Visual Causal Inference: CaaM technically differs from recent visual causal-inference work by self-annotating confounders in an unsupervised way.
3. CaaM: Causal Attention Module
CaaM performs causal intervention through iterative data partitioning and complementary attention, disentangling causal and confounder features for unbiased recognition. It is integrated into CNN and ViT architectures, with stacked blocks progressively refining these features.
- Causal intervention: Improper partitions can remove beneficial mediation effects when causal and confounding features remain entangled within each split.Such partitions may cut off the robust path X →M →Y rather than isolating confounding bias.
- Causal intervention: CaaM approximates causal intervention by discovering increasingly fine-grained data partitions across iterative training steps.After N steps, the resulting predictions approximate the backdoor-adjusted effect across partitions.
- Causal intervention: Complementary attention modules separate robust causal effects from confounding effects through adversarial training and split-invariant learning.The causal attention supports prediction, while the complementary attention captures bias for partition updates.
- CNN-CaaM and ViT-CaaM: CaaM is implemented in both CBAM-based CNNs and T2T-ViT-based transformers, enabling complementary attention in two model families.ViT-CaaM computes standard query, key, and value vectors before applying complementary Softmax attentions.
- CNN-CaaM: CNN-CaaM uses D-Blocks to disentangle causal and confounder features, while M-Blocks fuse them before subsequent refinement.The first D-Block has modified skip connections, and later D- and M-Blocks are stacked progressively.
4. Experiments
Experiments evaluate CaaM on challenging OOD datasets, through comparisons with annotated and unannotated intervention methods, ablations, attention localization, and qualitative visualizations. CaaM consistently improves recognition and attention quality, including on rare contexts.
- Datasets and settings: NICO evaluation uses long-tailed, zero-shot, and orthogonal context shifts across animal classes to create a challenging OOD setting.The animal subset is restricted to 10 context classes, with seven seen during training and three reserved for testing per class.
- Comparison to baselines: CaaM achieves top recognition performance across NICO, ImageNet-9, and ImageNet-A, outperforming intervention baselines with and without human-annotated partitions.On ImageNet-A with CNN, the margin over IRM grows from 2.1% with annotations to 5% without them.
- Ablation study: CaaM performance saturates around M=2 layers for CNN-CaaM and M=4 for ViT-CaaM, while m=4 partitions performs best but is not sensitive.These settings are reported in the NICO ablation study.
- Ablation study: Removing progressive optimization causes sharp performance drops, averaging 2% for Reboot Training, while randomizing θ also reduces performance.The ablations support the contribution of collaborative, progressively optimized CaaM components.
- Attention localization: CaaM produces more accurate attention localization than conventional attention and intervention methods on ImageNet-9, with and without partitions.Attention accuracy is measured by the fraction of attention area inside ground-truth object bounding boxes.
- Context robustness: CaaM improves both frequent and rare context accuracy, with gains of 9.64% and 13.37%, respectively.The reported improvement is larger for rare contexts, including zero-shot classes, without sacrificing frequent-context performance.
- Qualitative results: Qualitative comparisons show more accurate CaaM attention activation, although it remains unreliable for multiple objects or objects co-existing with other entities.The latter cases motivate future surrounding-object adjustment.
5. Conclusion
The conclusion identifies confounding as the source of conventional attention’s OOD bias and presents CaaM as a remedy for improper causal intervention. Experiments on three challenging benchmarks support its effectiveness.
- Conventional attention is particularly biased in OOD settings because confounding affects its learned visual cues.
- CaaM addresses improper causal intervention, and experiments on three challenging benchmarks demonstrate its effectiveness.
Appendix
The appendix supplies interpretations, theoretical evidence, implementation details, dataset-generation procedures, training details, and additional experimental results. It also documents attention-accuracy computation.
- Appendix Section A.1 provides further interpretations of the proposed CaaM.
- Appendix Section A.2 presents theoretical evidence for improper causal intervention and convergence of adversarial training.
- Appendix Section A.3 gives implementation details for invariant loss and adversarial training.
- Appendix Section A.4 describes OOD dataset generation, additional training details, attention-accuracy computation, and additional experimental results.
A.1.1. Invariant Loss is not Intervention?
The appendix clarifies that optimizing cross-entropy separately within data splits is not sufficient to implement the intended causal intervention. The invariant loss includes this objective but is not reducible to it.
- Optimizing cross-entropy in each data split uses only the first invariant-loss objective and does not by itself implement the full backdoor adjustment.
A.1.2. Mediator in Causal Graph
The mediator M is part of the causal effect and must be retained when separating it from the confounder for analysis.
- M is a causal-effect component that the paper manually separates to explain improper intervention.The separation is intended to clarify how incorrectly including M in the confounder set harms causal representation.
A.2.1. Proof of Improper Causal Intervention
The appendix derives the backdoor adjustment through do-calculus and shows that confounding and mediator entanglement invalidates the simplified adjustment formula.
- The derivation uses do-calculus rules to obtain the desired interventional distribution P(Y |do(X)).The manipulated graph notation deletes incoming or outgoing arrows to represent interventions.
- When M and S are conditionally independent given X, the backdoor adjustment formula simplifies using the law of total probability.The derivation applies Rule 3 and Rule 2 before using conditional independence between M and S.
- When M and S are entangled, P(m|X, s) differs from P(m|X), so the simplified equations are unequal and the objective changes.This is the improper-intervention case described in the appendix.
A.2.2. Proof of Convergence of CaaM
CaaM iteratively improves confounder partitions and causal representations through complementary attention, invariant learning, and differentiable partition optimization, with reported gains and manageable overhead.
- CaaM convergence: CaaM alternates between disentangling causal and confounder features and using confounder features to improve subsequent data partitions.The two stages mutually promote one another through positive feedback.
- CaaM convergence: Theoretical analysis states that better partitions approach oracle causal and confounder representations, reaching a global optimum under the stated assumptions.The argument assumes x = c ◦ s and links optimal representation learning with optimal partition updates.
- Invariant Loss: Invariant Loss seeks a representation whose optimal classifier remains stable across dataset partitions.The practical implementation encourages split-specific classifiers to converge toward a common matrix.
- Model design: CaaM uses complementary attention and adversarial training to separate robust causal features from confounding features and update partitions.The contribution combines invariant learning with a partition-updating pipeline.
- Experimental setting: The NICO evaluation combines long-tailed, zero-shot, and orthogonal context shifts, while ImageNet-9 uses proxy context labels from texture clustering.These settings test robustness to context distributions that differ between training and testing.
- Results: CaaM adds few parameters, has comparable single-layer computation to baselines, and produces more accurate predictions and precise object-focused attention maps.Multi-layer computational costs increase linearly with the number of layers, while qualitative gains are reported for CNN and ViT models.