Do Input Gradients Highlight Discriminative Features?

Harshay Shah, Prateek Jain, Praneeth Netrapalli

In the quest to peek inside the "black box" of deep learning, researchers often rely on input gradients—calculating how much a tiny change in a pixel affects the model's output. The intuitive assumption is simple: if a pixel has a large gradient magnitude, it must be a "discriminative feature" that the model uses to make its decision.

But is this assumption actually true? A NeurIPS 2021 paper by Harshay Shah, Prateek Jain, and Praneeth Netrapalli suggests that for standard models, the answer is a resounding "no."

TL;DR

This paper demonstrates that input gradients in standard neural networks often fail to highlight the actual features used for prediction, a phenomenon the authors call feature leakage. By introducing a new evaluation framework (DiffROAR) and a controlled dataset (BlockMNIST), they show that while standard models produce "noisy" and misleading explanations, adversarially robust models yield gradients that are significantly more faithful to the underlying task.

What Problem Does This Paper Address?

Most post-hoc interpretability methods (like Saliency Maps, SmoothGrad, or Integrated Gradients) rest on Assumption (A): Coordinates with larger input gradient magnitudes are more relevant for model prediction.

However, evaluating this is tricky. If a saliency map looks like a "ghostly" version of the input image, we tend to think it's working. But "looking good" to a human isn't the same as being "faithful" to the model's internal logic. Previous sanity checks have shown that some methods produce the same explanation even if you randomize the model's weights. This paper seeks to move beyond visual intuition and rigorously test whether gradients actually point to the features that drive classification.

Methods

The authors tackle the problem using a three-pronged approach:

  1. DiffROAR (Difference in Remove-and-Retrain): This is an evolution of the ROAR framework. To test if the "top" features are truly important, they create two new datasets: one containing only the top-$k$ fraction of pixels (by gradient magnitude) and one containing only the bottom-$k$ fraction. They then retrain a fresh model on these masked datasets. If the gradients are meaningful, the model trained on "top" features should be much more accurate than the one trained on "bottom" features.
  2. BlockMNIST: A semi-real dataset designed to have "ground truth" importance. Each image contains a "signal" block (an MNIST digit) and a "null" block (a square with diagonals). The digit determines the class; the null block is useless noise.
  3. Theoretical Proof: They provide a mathematical proof using infinite-width Multi-Layer Perceptrons (MLPs) to show why standard models fail to isolate instance-specific signals.

Key Insights: Feature Leakage and Robustness

  • Feature Leakage: This is the "Aha!" moment of the paper. In standard models, the gradient for a specific image doesn't just highlight where the signal is in that image; it highlights every location where a signal could potentially appear across the entire dataset. For example, if a model sees digits at both the top and bottom in different training images, its gradient for a "top-digit" image will "leak" and highlight the empty bottom area too.
  • Robustness is the Key: Adversarially trained models (those trained to resist small perturbations) don't suffer from this leakage. Their gradients are "clean" and focus almost exclusively on the actual discriminative features in the specific instance.
BlockMNIST Gradients

As seen in the BlockMNIST visuals above, standard models highlight both the digit and the null patch. Robust models completely suppress the null patch, focusing only on the digit.

Key Results

  • The "Negative" Gap: On complex datasets like CIFAR-10 and ImageNet-10, standard ResNet models showed a negative DiffROAR score for $k < 40\%$. This means the pixels the model claimed were "unimportant" actually held more predictive power than the "important" ones.
DiffROAR Results
  • Robust Superiority: In SVHN, robust MLPs outperformed standard MLPs on the DiffROAR metric by 10-30%. The plots above clearly show robust models maintaining positive DiffROAR scores, while standard models dip below zero.
  • Retraining Matters: The authors emphasize that you must retrain models on masked data to account for "distribution shift." Simply masking pixels and testing a pre-trained model can give misleading results.

Limitations and Future Work

  • Scope: The study focuses primarily on "vanilla" input gradients. While these are the building blocks for many other methods (like Integrated Gradients), those more complex methods weren't the primary focus of the theoretical proofs.
  • The "Why" of Robustness: While the paper proves that adversarial training mitigates feature leakage, the exact mechanism of how it forces the model to ignore "potential" signal locations in favor of "actual" ones remains an area for deeper investigation.
  • Computational Cost: The DiffROAR framework requires retraining models multiple times, which is computationally expensive for very large-scale architectures or datasets.

This work serves as a vital "sanity check" for the XAI (Explainable AI) community, reminding us that until we fix feature leakage, our model's explanations might just be showing us the map of the dataset, rather than the logic of the decision.

Summary updated

BibTeX
@inproceedings{shah2021do,
  author = {Harshay Shah and Prateek Jain and Praneeth Netrapalli},
  title = {{Do Input Gradients Highlight Discriminative Features?}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=bzcm4ivXrY},
}
Figure