Abstract
ExCon (Explanation-driven Supervised Contrastive Learning) addresses a fundamental limitation in contrastive learning: the semantic blindness of random data augmentations. By integrating saliency maps (Grad-CAM) into the training loop, ExCon ensures that augmented "views" preserve the most critical semantic features of an image. This approach leads to more robust feature representations, improved classification accuracy, and enhanced adversarial resistance. We evaluate ExCon on CIFAR-100 and Tiny ImageNet, demonstrating its superiority over standard supervised contrastive learning (SupCon) in both performance and model interpretability.
Introduction
Contrastive learning has revolutionized representation learning by teaching models to map different views of the same image to similar embeddings. However, standard augmentation techniques like random cropping are stochastic and agnostic to the image's semantic content. For instance, a random crop of a "leopard" might capture only the surrounding grass. If the model is trained to associate this background patch with the "leopard" label, it develops a reliance on spurious features, leading to fragile decision logic and poor generalization.
ExCon proposes a solution by asking: Can we guide data augmentation to always preserve task-relevant content? By using the model's own internal explanations as a supervisory signal, ExCon ensures that the features being contrasted are semantically meaningful.
Methodology
The ExCon framework introduces an explanation-driven masking mechanism to refine the contrastive learning process.
Explanation-Driven Masking
Instead of relying solely on random transformations, ExCon utilizes Grad-CAM to generate a heatmap of the regions most influential to the model's prediction. A "masked" version of the image is then created, retaining only these high-importance pixels.
ExCon and ExConB Variants
The framework operates in two primary modes:
- ExCon: If the masked image results in a correct classification, it is treated as a positive pair for the original image, reinforcing the model's focus on correct semantic features.
- ExConB (Background Variant): If the masked image leads to an incorrect prediction, the model identifies that it focused on misleading features. Rather than discarding this view, ExConB labels it as "background" and uses it as a negative example, explicitly teaching the model to ignore such features in the future.
Iterative Training
To account for the evolving nature of the model's "importance" maps, the training process is iterative. The system alternates between updating the feature encoder and the classifier, ensuring that the explanations used for masking remain accurate as the model improves.
Experimental Results
The authors evaluated ExCon on two standard benchmarks: CIFAR-100 and Tiny ImageNet.
Classification Accuracy
ExCon consistently outperformed the Supervised Contrastive (SupCon) baseline. On the Tiny ImageNet dataset, ExCon achieved an accuracy of approximately 65.7%, a notable improvement over SupCon’s 63.5%.
Explanation Faithfulness and Robustness
Beyond raw accuracy, ExCon models demonstrated superior "faithfulness." When presented with only the pixels identified as important, the models showed a significantly higher rate of increase in confidence compared to baselines. Furthermore, the models exhibited increased resistance to adversarial attacks, such as the Fast Gradient Sign Method (FGSM). By focusing on core semantic features rather than high-frequency pixel noise, the representations learned by ExCon are inherently more stable.
Discussion and Limitations
While ExCon provides significant benefits in robustness and accuracy, it introduces additional computational overhead due to the requirement of generating Grad-CAM maps and the iterative nature of the training process. Additionally, the current study was constrained by hardware limitations, preventing testing with the massive batch sizes typically used in industry-scale contrastive learning. Future research could explore the application of explanation-driven augmentation in other domains, such as natural language processing or medical imaging, where semantic preservation is critical.
Conclusion
ExCon represents a significant step toward more interpretable and robust deep learning. By treating model explanations not just as a post-hoc debugging tool but as an active training signal, ExCon bridges the gap between high-performance classification and semantically grounded reasoning.
Summary updated