NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Matching-Based Few-Shot Semantic Segmentation Models Are Interpretable by Design

Pasquale De Marinis, Uzay Kaymak, Rogier Brussee, Gennaro Vessio, Giovanna CastellanoNeurIPS 2026

TL;DR

When a few-shot segmentation model makes a mistake, how do you know whether to blame the model or the reference images you fed it? This paper reveals that standard matching-based segmentation models don't need clunky, post-hoc explainability wrappers—they already compute their own explanations internally. By simply reading and normalizing the dense similarity scores generated during a standard forward pass, the authors extract fast, faithful heatmaps showing exactly which reference pixels drove a prediction.

What Problem Does This Paper Address?

In Few-Shot Semantic Segmentation (FSS), you hand a model a "support set" (just one or a handful of labeled example images) and ask it to outline that same object class in a brand-new "query" image. Because the support set is the model's only definition of what to look for, debugging a bad prediction requires knowing which specific pixels in your examples led the model astray.

Surprisingly, Explainable AI (XAI) has largely overlooked this support-side perspective. Previous visualizations mostly looked at the query image, not the reference examples. Furthermore, standard XAI tools (like Integrated Gradients or LIME) struggle here: they are computationally heavy, frequently fail to beat trivial baselines when adapted to FSS, or completely break down on modern Vision Foundation Model (VFM) pipelines that contain discrete, non-differentiable steps like clustering or nearest-neighbor voting.

Methods

Instead of treating FSS models as black boxes, the authors observe that matching-based architectures—which compare every query feature position against every support feature position—are interpretable by design. They introduce Affinity Explainer (AffEx), a lightweight read-out mechanism requiring zero training, zero gradients, and just a single forward pass.

Overview of the Affinity Explainer (AffEx) pipeline reading internal matching scores.

Here is how AffEx turns raw internal math into an explanation:

  1. Intercept Scores: During inference, AffEx taps into the raw query–support similarity matrices across feature layers.
  2. Double Normalization: It applies a softmax across all support pixels for each query position, then divides by the total attention each support pixel receives across the whole query. Averaging this over a target region (e.g., the predicted mask) isolates the exact share of attention coming from that region.
  3. Aggregate & Sign: Per-layer maps are rescaled and averaged uniformly. Finally, a smoothed version of the support mask assigns signs—positive for foreground, negative for background—producing a clean heatmap over the reference images.

To test if these maps are actually faithful to the model's reasoning, the authors adapt standard Insertion/Deletion causal curves to perturb the support pixels rather than the query. Because FSS models only need a tiny fraction of key pixels to recognize an object, full curves mostly measure noise. Thus, the authors introduce $\text{mIoULoss}@p$: how much segmentation accuracy (mIoU) drops when the model is only allowed to see the top $p$ fraction (e.g., 1% or 5%) of the highest-attributed support pixels.

Datasets

Experiments are conducted on two standard FSS benchmarks: COCO-$20^i$ and Pascal-$5^i$, evaluated across 1-way 1-shot and 1-way 5-shot episodes. No new datasets are introduced, though the authors establish a comprehensive causal evaluation benchmark across seven diverse architectures (including DCAMA, DMTNet, DINOv3-based INSID3, SAM2-based SANSA, GF-SAM, Matcher, and a PANet-style prototype head).

Key Insights and Ideas

  • Standard XAI fails the "Mask Prior" test: The authors created a dead-simple baseline called Gaussian Noise Mask, which just returns the support mask with slight random noise. Most established gradient- and perturbation-based XAI methods failed to beat this naive baseline—meaning they couldn't even reliably figure out that the model looks inside the labeled mask!
  • Explanations as architectural diagnostics: Not all VFM pipelines rely equally on matching. In "decoder-dominated" models like GF-SAM and Matcher, matching scores merely seed point prompts for SAM, which then segments whole objects on its own. Here, the naive mask baseline beats AffEx. Rather than a bug, this acts as a diagnostic tool: weak AffEx performance signals that the downstream decoder—not the feature matcher—is driving the final decision.
  • Subsuming prototypes: On classical prototype-based heads (which pool masked support features into a single vector), the math of the foreground logit factorizes cleanly into pairwise similarities. AffEx applies unchanged and outperforms standard prototype activation maps because it stays sensitive to the specific query region.

Key Results

Across matching-dominated models (DCAMA, DMTNet, INSID3, and SANSA), AffEx achieves the lowest (best) $\text{mIoULoss}@0.01$ and [email protected]$ in nearly every setting, beating both adapted XAI methods and the Gaussian Noise Mask baseline.

Quantitative comparison showing AffEx outperforming baselines on mIoULoss@p.
  • Quantitative: On Pascal-$5^i$ (5-shot DCAMA), keeping just the top 1% of AffEx-selected pixels results in an mIoU loss of only 11.56 points, compared to 26.25 for XRAI, 33.81 for LIME, and 35.65 for the Gaussian Noise Mask. On non-differentiable pipelines like INSID3 where gradient methods crash, AffEx cuts $\text{mIoULoss}@0.01$ on 5-shot COCO-$20^i$ to 25.90, versus 62.31 for LIME.
  • Speed & Memory: Because it piggybacks on the forward pass, AffEx is orders of magnitude faster than path-integral methods. On 5-shot SANSA, AffEx takes 0.79 seconds, whereas the integrated-gradients family requires up to 257 seconds and 44 GB of VRAM.
  • Qualitative: AffEx heatmaps visibly reflect each model's inductive biases—showing coarse blobs for ResNet-based DMTNet, sharp silhouettes for DINOv3, and distinct object sub-parts for transformer-based DCAMA—helping practitioners spot and fix false-positive triggers in the support masks.

Limitations and Future Work

  • Decoder blind spots: AffEx only explains the matching stage; on pipelines like GF-SAM where a heavyweight decoder reshapes the output, decoder-side reasoning goes uncaptured.
  • Grid approximations & zero-padding: Mapping feature grids directly back to image space ignores the encoder's receptive field. Additionally, causal metrics zero out perturbed pixels, pushing inputs slightly out-of-distribution, and experiments only cover 1-way (single-class) episodes rather than competitive multi-way segmentation.
  • Future directions: The authors suggest pairing AffEx with decoder-side explainers to cover hybrid VFM pipelines end-to-end, and incorporating relevance propagation to sharpen spatial resolution.

Summary updated

BibTeX
@inproceedings{marinis2026matching,
  author = {Pasquale De Marinis and Uzay Kaymak and Rogier Brussee and Gennaro Vessio and Giovanna Castellano},
  title = {{Matching-Based Few-Shot Semantic Segmentation Models Are Interpretable by Design}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=jqykrG5xAb},
}
Figure