Why interpretability matters in production
A CNN that says "cat" with 99% confidence is useless if you don't know which pixels it looked at. Grad-CAM (Gradient-weighted Class Activation Mapping) generates a heatmap showing which image regions most influenced a specific class prediction.
The technique: for a chosen class, compute gradients of that class's logit with respect to the last convolutional layer's feature maps. Average those gradients over spatial dimensions to get per-channel importance weights. Multiply each feature map by its weight and sum — the result is a 2D heatmap, upsampled to the original image size.
This is how you debug "the model is overconfident on cats" — you find that it's looking at the watermark in the corner, not the cat. Same technique is used in medical imaging audits, content moderation explanations, and dataset auditing.