Metric-Guided Synthesis for Class Activation Mapping

Alejandro Luque-Cerpa, Elizabeth Polgreen, Ajitha Rajan, Hazem Torfah

Introduction

Convolutional Neural Networks (CNNs) have become the backbone of modern computer vision, yet their internal decision-making processes remain largely opaque. To foster trust in high-stakes domains like medical diagnostics or autonomous driving, researchers have developed Class Activation Mapping (CAM) techniques. These methods generate saliency maps—heatmaps that highlight the image regions most influential to a model's prediction. However, existing CAM methods like GradCAM or ScoreCAM rely on fixed, hand-crafted mathematical formulas. These static approaches often fail to adapt to specific evaluation metrics or user requirements, such as aligning with biological ground truth in clinical settings.

The SyCAM Framework

This paper introduces SyCAM, a novel framework that treats the creation of CAM methods as a Syntax-Guided Synthesis (SyGuS) problem. Instead of manually engineering a weighting formula for feature maps, SyCAM automatically searches for an optimal mathematical expression tailored to a specific dataset and evaluation metric.

Overview of the CAM process where feature maps are weighted and combined to produce a final explanation.

The framework utilizes an Oracle-Guided Inductive Synthesis (OGIS) approach consisting of three main components:

  1. Grammar Definition: Users define a search space of mathematical primitives (e.g., addition, ReLU, gradients, confidence scores).
  2. Equivalence Oracle: This component prunes the search space by identifying and discarding formulas that produce visually identical heatmaps on a small sample set.
  3. Correctness Oracle: Candidate formulas are evaluated against a target metric (e.g., faithfulness to the model or alignment with ground truth). To optimize performance, SyCAM uses a multi-stage evaluation, testing candidates on increasingly larger data subsets to quickly eliminate underperforming expressions.

A key innovation in SyCAM is Class-Based Decomposition, which allows the system to synthesize unique, optimal expressions for individual output classes, recognizing that the "best" explanation for a "dog" may differ mathematically from the best explanation for an "airplane."

Experimental Evaluation and Results

The authors evaluated SyCAM across diverse datasets, including PASCAL VOC 2007, Imagenette, and the COVID-QU-Ex medical imaging dataset.

Qualitative comparison of SyCAM against baseline methods across different image domains, including medical imaging with ground truth.

Performance on General Benchmarks

On the Imagenette dataset, SyCAM consistently outperformed established baselines like GradCAM, GradCAM++, ScoreCAM, and AblationCAM. Using perturbation-based metrics (Deletion and Insertion), the synthesized expressions demonstrated superior faithfulness to the underlying model's behavior. In a sanity check, SyCAM successfully rediscovered the GradCAM++ formula when restricted to a basic grammar, and found even better expressions when the search space was expanded.

Medical Imaging and Expert Knowledge

In the context of COVID-19 lesion detection, SyCAM was guided by metrics that reward similarity to human-annotated ground-truth masks. The framework synthesized a novel expression—specifically $2 \cdot Grads^5$—which significantly outperformed standard methods. Qualitatively, SyCAM's heatmaps were more tightly localized on actual lung lesions, whereas baseline methods often highlighted irrelevant background noise or anatomical structures outside the area of interest.

Discussion and Conclusion

SyCAM represents a shift from human-engineered to metric-optimized explainability. By automating the design of XAI algorithms, researchers can generate explanations that are precisely tuned to the needs of the end-user, whether that be model debugging or clinical validation.

While the current synthesis process is computationally intensive—often requiring hours or days to find the optimal formula—the resulting expressions are as fast to execute as traditional CAM methods. Future work aims to improve search efficiency and explore multi-objective synthesis to balance competing requirements, such as model faithfulness and human interpretability, simultaneously.

Summary updated

BibTeX
@inproceedings{luquecerpa2025metric,
  author = {Alejandro Luque-Cerpa and Elizabeth Polgreen and Ajitha Rajan and Hazem Torfah},
  title = {{Metric-Guided Synthesis for Class Activation Mapping}},
  booktitle = {xAI},
  year = {2025},
  doi = {10.1007/978-3-032-08327-2\_17},
}
Figure