When a deep network grades a knee radiograph as Kellgren-Lawrence grade 2 instead of grade 1, or a retinal photograph as moderate rather than mild diabetic retinopathy, the clinically useful question is narrow: which structure in this image pushed the case across that boundary? Standard heatmaps do not answer it. Grad-CAM, which weights a network's last convolutional feature maps by their pooled gradients, tends to light up the whole joint or the whole retina for both grades. On fine-grained tasks, heatmaps for correct and incorrect predictions are nearly indistinguishable (Towards Fine-Grained Interpretability). Many of the hallmarks that separate adjacent grades are about shape and connectivity rather than position: a gap between two bones that closes, a dark speck that appears as a new isolated blob, a cystic hole inside a nodule. Persistent homology is a tool from topology that lists every blob and every loop in an image, together with the intensity level at which each one appears and disappears. It therefore yields a complete, finite inventory of exactly these structures, and it records for each one the specific pixels where it is born and where it dies.
We propose to explain a fixed, already-trained ordinal grader in units of these structures. For each blob or loop in the image, we build a counterfactual image in which only that structure has been topologically erased: its basin is filled to its death level, so it vanishes without creating new edges. We then run Integrated Gradients, which integrates the model's gradient along a path between two inputs, from that counterfactual to the real image. The target is the contrast between adjacent grades, the score of grade $k+1$ minus the score of grade $k$. The output is a short ranked list of anatomical structures, each with a pixel location, a type (component or loop), and a share of the decision margin. This is a contrastive, structure-level explanation that needs no reference images and no concept labels. It can also report honestly when the model's decision is not driven by any structure at all.
Core Claim
The claim is that topologically defined counterfactual baselines turn gradient attribution into a spatially grounded, structure-level explanation of adjacent-grade decisions. These explanations should separate grade $k$ from grade $k+1$ where Grad-CAM does not, should be more faithful under deletion and insertion than region-based occlusion of matched size, and should recover planted ground-truth structures in controlled tests. A second deliverable is a "topological coverage" number per decision: the fraction of the adjacent-grade margin accounted for by the top few structures. It works as a diagnostic of whether a black-box grader relies on morphology or on texture and intensity cues.
What is new relative to existing work is the direction of the bridge between topology and attribution. Prior methods inject topology into the model. PHG-Net encodes persistence diagrams with a PointNet-style network and gates them into a vision backbone (PHG-Net); its multi-scale, multi-filtration successor does the same with vineyard tracking across scales (Integrating Multi-scale and Multi-filtration Topological Features). Both report accuracy gains, but neither says where in the image a useful topological feature lives, and the gated topological vector is itself opaque. We leave the model untouched and use topology only to define what is removed during attribution. Higher-Order Feature Attribution also connects Integrated Gradients to simplicial complexes, but it uses the complexes to display tabular feature interactions and never filters an image. Learning Coherent Representations constrains latent geometry during training, and its authors report that supervised cross-entropy collapses the manifold structure the method needs. That negative result is one reason we avoid training-time topological constraints on supervised graders and work post hoc.
Method
Cubical persistent homology is run on the grayscale image $x$. Under the sublevel filtration, pixels are added from dark to bright, and every dark blob (a 0-dimensional class) and every enclosed bright hole (a 1-dimensional class) gets a birth value $b$ and a death value $d$. The superlevel filtration does the same for bright structures. Each pair $p$ comes with a birth pixel, a death pixel, and a support region: the connected set of pixels that the structure occupies at its death level. These are recoverable with the same union-find bookkeeping used to compute persistence.
The topological removal of $p$ produces an image $\tilde x_p$. For a dark blob, its support is raised to $d$. For a hole, its interior is set to $b$. In both cases the pair's persistence drops to zero and every other pair is left as unchanged as possible. With $\Delta_k(x) = S_{k+1}(x) - S_k(x)$, where $S_j$ is the model's logit for grade $j$, the pixel attribution for structure $p$ is Integrated Gradients along the straight path from $\tilde x_p$ to $x$:
$$ A_p(x)_i = (x_i - \tilde x_{p,i}) \int_0^1 \frac{\partial \Delta_k}{\partial x_i}\big(\tilde x_p + t(x - \tilde x_p)\big)\, dt . $$
This is nonzero only inside the support of $p$. By the completeness property of Integrated Gradients, its sum equals $\Delta_k(x) - \Delta_k(\tilde x_p)$.
That sum is therefore an interventional effect, and we say so plainly: the structure-level score is a topologically masked occlusion. Integrated Gradients contributes the within-structure pixel distribution, and with it the localization that clinicians would inspect. The contribution of topology is the choice of what to remove and what value to fill it with. The ablations described below test whether that choice matters.
Computing this for every pair is unnecessary. We keep pairs above a persistence threshold, cap them at the top fifty, and batch the Integrated Gradients steps. Cubical persistence on a 2D image costs far less than a forward-backward pass of a ResNet.
Research Program
The work has three parts. The first is the attribution tool itself, together with a cheap variant that propagates the gradient of $\Delta_k$ only through each pair's birth and death pixels. This variant is fast but should suffer from gradient saturation, and it serves as an internal comparison.
The second part is a controlled benchmark that plants structures. Images contain rings, blobs and textured backgrounds, and the ordinal grade is defined either by topology (the number of closed rings, or whether a gap between two bars is closed) or by non-topological cues (mean intensity, texture frequency). Standard CNNs are trained on each version, which gives us ground truth for which structure determines the grade. It also gives a regime where a topological explanation should explicitly fail and report low coverage.
The third part applies the tool to real ordinal graders on knee osteoarthritis, diabetic retinopathy and thyroid nodules. On each we measure faithfulness, localization against expert annotation, and whether explanations differ between adjacent grades.
Baselines
The naive reference point is vanilla Grad-CAM on the predicted class. This is the practice in Automatic Knee Osteoarthritis Diagnosis from Plain Radiographs, which used it to confirm focus on joint space and osteophytes. That paper's grader reports a quadratic kappa of 0.83 and 66.71% five-class accuracy on Kellgren-Lawrence grading. These are the grader numbers our reimplemented models should approach, so that we are explaining a realistic model rather than a weak one.
The first ablation keeps standard attribution methods but gives them the contrastive target. We run Grad-CAM and Integrated Gradients, with black and blurred baselines, on $\Delta_k$ rather than on $S_c$. This isolates whether the contrastive target alone solves the adjacent-grade problem.
The strongest existing method for fine-grained explanation is FG-VCE (Towards Fine-Grained Interpretability). It partitions the image with Gaussian kernels, scores regions with Shapley values, and substitutes patches from correctly classified reference images. On CUB-200-2011 with ResNet-50 it reports an insertion score of 43.02% and a deletion score of 10.27%, at 5.2 seconds per explanation. We will run its released procedure on the same trained models. On the clinical datasets we will draw its reference images from training images of the adjacent grade. We match the wall-clock budget per explanation, and we also report results at FG-VCE's native budget. On the clinical datasets there is no reported result on Lacuna for FG-VCE, or for any saliency method under insertion and deletion. Those numbers will be produced here under identical protocols.
The key ablation isolates topology. It uses the same support regions with a non-topological fill (local mean or Gaussian blur instead of filling to the death level). It also uses superpixel occlusion units matched in count and in area distribution to the persistence pairs. Our method beats these if, at matched budget, it gives lower deletion area under the curve and higher insertion area under the curve on $\Delta_k$, and a higher pointing-game hit rate against annotated lesions. All comparisons use the same frozen models, the same images, and the same number of forward-backward passes per explanation. Differences must be significant under a paired bootstrap over images.
Why not just…?
Why not just run Grad-CAM or Integrated Gradients with the contrastive target $S_{k+1} - S_k$? This is the cheapest fix and it might partly work. Contrasting adjacent logits removes the shared "this is a knee" component that makes heatmaps overlap. It still leaves a coarse map, at the resolution of the last convolutional layer, with no unit of meaning, and Integrated Gradients' result depends heavily on an arbitrary black or blurred baseline. The contrastive baselines above test this directly. If they match our deletion, insertion and pointing scores and our adjacent-grade separability, then the structure-level reframing adds presentation but not substance, and we would report that.
Why not just occlude superpixels or use FG-VCE-style region Shapley values? This is the real threat, because the structure-level score is itself an occlusion effect. The case for topological units is that they match how hallmarks are defined. A narrowing joint gap or a ring-shaped margin can span several superpixels, and a microaneurysm can be smaller than one. The topological fill also removes a structure without drawing new edges, whereas a mean fill can create artifacts the model reacts to. The matched-superpixel and non-topological-fill ablations settle this. If they tie on the planted benchmark, where ground truth is known, the topological contribution is not supported.
Why not just train the grader with persistent-homology features, as PHG-Net does, or add attribute heads? Injecting topology improves accuracy (PHG-Net reports 73.51% to 77.23% on CBIS-DDSM with SwinV2-B), but it does not localize anything, and it changes the model one is trying to audit. Attribute heads need dense expert ratings: PN-SAMP needed nine radiologist attributes per nodule (Joint Learning for Pulmonary Nodule Segmentation, Attributes and Malignancy Prediction), and CMCNet reports that auxiliary heads handle imbalanced features poorly (CMCNet). Our tool needs no labels and applies to deployed black-box models with gradient access. We do not claim it improves accuracy.
Why not just use the cheap chain-rule gradient through birth and death pixels? It costs one backward pass. It is local, however, and saturates exactly where graders are confident. We include it as a variant and expect it to lose on deletion and insertion scores for high-confidence cases. We will stratify the results by predicted-grade confidence to show where it holds up and where it does not.
Proposed Experiments
On the planted benchmark, the decisive check is recovery: for models whose grade depends on ring count or gap closure, the top-ranked pair should be the planted structure, measured by top-1 recovery rate. Topological coverage should be high there and near zero for the intensity- and texture-graded variants. A tool that reports high coverage on texture-driven models fails.
For knee osteoarthritis we train on MOST and test on OAI, following Tiulpin et al.. We evaluate the KL1/KL2 and KL2/KL3 contrasts, using the medial and lateral joint-space region as a weak localization target.
For diabetic retinopathy we use the Kaggle re-annotated set from Yang et al., whose 12,206 expert lesion patches allow a pointing game against microaneurysms, hemorrhages and exudates for the stage 0/1 and 1/2 contrasts. We report attribution hit rate per lesion type alongside that paper's supervised detector recalls (microaneurysm 70.29%, exudate 90.79%) as a ceiling reference, not as a like-for-like comparison.
For thyroid nodules we use STN (CMCNet). We test whether the attribution mass on loop-type pairs inside the nodule correlates with the expert composition rating, and component-type mass on bright specks with the echogenic-foci rating, for adjacent TR contrasts. These correlations are expected, not assumed.
On CUB-200-2011 we report insertion and deletion against FG-VCE's published 43.02% and 10.27%, with the explicit expectation that topology matters less for bird species and that we may lose there.
Across all datasets we operationalize Zhang et al.'s overlap observation as adjacent-grade separability. A small classifier given only an explanation must predict which adjacent contrast it came from. Our method should exceed contrastive Grad-CAM on this test. Every method also faces the model-randomization sanity test motivated by When Random Saliency Looks Trained: structure rankings must decorrelate when the weights are randomized, or the method is reporting image topology rather than model behavior.
References
- Towards Fine-Grained Interpretability: Counterfactual Explanations for Misclassification with Saliency Partition
- PHG-Net: Persistent Homology Guided Medical Image Classification*
- Integrating Multi-scale and Multi-filtration Topological Features for Medical Image Classification
- Higher-Order Feature Attribution: Bridging Statistics, Explainable AI, and Topological Signal Processing
- Learning Coherent Representations: A Topological Approach to Interpretability
- Automatic knee osteoarthritis diagnosis from plain radiographs:a deep learning-based approach
- Joint learning for pulmonary nodule segmentation, attributes and malignancy prediction
- CMCNet: Aligning Ultrasound Image Embeddings with Textual TI-RADS Representations for Fine-Grained Thyroid Classification
- Lesion Detection and Grading of Diabetic Retinopathy via Two-Stages Deep Convolutional Neural Networks
- When Random Saliency Looks Trained: Architectural Center Bias in CNN Interpretability