Targeted Activation Penalties Help CNNs Ignore Spurious Signals

Dekai Zhang, Matt Williams, Francesca ToniAAAI 2024

Introduction

Convolutional Neural Networks (CNNs) are prone to learning "shortcuts"—spurious correlations in training data that do not generalize to real-world scenarios. For instance, a model trained to detect pneumonia from chest X-rays might inadvertently learn to identify hospital-specific text tags associated with positive cases rather than the underlying pathology. This phenomenon leads to catastrophic failures in deployment when these tags are absent or changed.

Existing solutions often employ Explanatory Supervision (XS), such as "Right for the Right Reasons" (RRR) or "Right for Better Reasons" (RBR). These methods require human-annotated masks over spurious regions and penalize the model's input gradients if they focus on these areas. However, these approaches suffer from high computational costs due to second-order derivatives, the "re-emergence" of spurious signals in deeper layers, and the high cost of manual annotation.

The Targeted Activation Penalty (TAP) Method

To address these challenges, this research introduces Targeted Activation Penalties (TAP). Unlike previous methods that penalize input gradients, TAP directly supervises the activations of intermediate convolutional layers.

Overview of the TAP architecture and loss application across convolutional blocks.

Since CNNs maintain spatial correspondence between input pixels and activation maps, TAP downsamples the annotation mask to match the dimensions of specific intermediate layers. An L1 penalty is then applied to the neurons corresponding to the masked spurious regions, effectively forcing the network to "ignore" these signals during the forward pass. This first-order approach avoids the expensive gradient-of-gradient calculations required by RRR and RBR.

Automated Annotation via Teacher-Student Framework

To mitigate the cost of human labeling, the authors propose a teacher-student framework. A "teacher" model is trained on a small fraction (e.g., 1%) of clean data. This teacher then generates saliency maps for the remaining contaminated data. These maps are thresholded to create noisy annotation masks, which are subsequently used to train a "student" model using the TAP objective.

Experimental Evaluation

The method was evaluated on three datasets: Contaminated MNIST (digits with colored corner patches), PNEU (pediatric chest X-rays with synthetic text tags), and KNEE (knee radiographs with grade-specific text strings).

Key Results and Insights

TAP demonstrates significant improvements in both efficiency and robustness over existing explanatory supervision techniques.

Suppression in Deep Layers

A critical finding is that input-gradient penalties often fail to suppress spurious signals in deeper layers of modern architectures like ResNet or DenseNet. As shown in the visualization below, while RRR and RBR may reduce input sensitivity, the spurious signal often re-emerges in later activation maps (Act 4). TAP successfully suppresses these signals throughout the network.

Comparison of activation maps across layers for RRR, RBR, and TAP. TAP shows superior suppression of spurious signals in deeper layers (Act 4).

Efficiency and Performance

  • Speed and Memory: TAP is up to 4x faster than RRR/RBR and uses approximately half the GPU memory. For example, on VGG-16, TAP processed 11.8 iterations/second compared to RBR's 1.7. DenseNet-121, which ran out of memory with RBR, was easily trained using TAP.
  • Robustness to Noisy Labels: The teacher-student approach proved highly effective. On the PNEU dataset, a student trained with TAP using masks from a teacher trained on just 1% clean data achieved an F-score of 0.668, vastly outperforming models trained with random annotations.
  • Generalization: When spurious tags were randomized or removed during testing, TAP-trained models maintained high accuracy, whereas standard models collapsed, proving that TAP successfully forced the model to learn genuine features.

Conclusion

Targeted Activation Penalties provide a computationally efficient and robust alternative to gradient-based explanatory supervision. By directly targeting intermediate representations and leveraging automated noisy annotations, TAP makes it feasible to train reliable medical imaging models even when datasets are contaminated with spurious artifacts. Future work will explore adapting TAP for non-spatial architectures like Vision Transformers.

Summary updated

BibTeX
@inproceedings{zhang2024targeted,
  author = {Dekai Zhang and Matt Williams and Francesca Toni},
  title = {{Targeted Activation Penalties Help CNNs Ignore Spurious Signals}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i15.29610},
}
Figure