DDxBasis: Explaining Frozen Foundation Encoder-based Medical Classification by Exact Differential Diagnosis

Luojie Huang, Gregory N. McKay, Nicholas J. DurrarXiv 2026

TL;DR

When doctors diagnose a medical image, they don't just blurt out a label—they perform a differential diagnosis, weighing the few key visual clues that separate one suspect condition from another. DDxBasis teaches AI classifiers built on frozen foundation models to explain themselves in this exact same way, compressing hundreds of scattered internal features into a handful of clean, two-pole clinical scales. Best of all, it achieves zero loss in mathematical faithfulness while actually boosting accuracy to become the strongest frozen-encoder model across five diverse medical tasks.

What Problem Does This Paper Address?

Vision foundation models (like DINOv3) are remarkably good at classifying medical images even when their core weights are kept frozen. However, in high-stakes medicine, a naked prediction isn't enough—clinicians need to know why the model chose benign keratosis over an early-stage skin cancer, especially since plausible-sounding explanations for wrong predictions can actively mislead experts.

Existing explainability tools force an uncomfortable trade-off:

  • Saliency maps point to where the model is looking, but not what it sees.
  • Concept bottlenecks and prototype networks are 100% faithful to the model's math, but scatter a single decision across a hundred or more overlapping visual concepts—far too many for a human to weigh at once.
  • Post-hoc concept dictionaries compress explanations into a compact list, but leave behind an unexplained mathematical "residual"—a dark-matter gap between the explanation and the model's actual decision.

DDxBasis asks: Can we get explanations that are simultaneously human-sized, contrastively structured like a doctor's differential diagnosis, and 100% mathematically exact?

Methods

DDxBasis sits on top of a frozen Vision Transformer (DINOv3 ViT-B/16) and operates in three stages:

  1. Multi-Layer Gated Slot Bottleneck (New): Instead of just reading the final layer of the frozen encoder, DDxBasis attaches competing "slots" (via slot attention) to every encoder layer. Rather than just averaging image patches, each slot computes second-order covariance, capturing vital diagnostic textures—like chromatin patterns in cells or lesion border symmetry—that simple averages wash out. Each slot passes through a non-negative presence gate, and logits from all layers are merged via a plain sum.
  2. Exact Two-Pole Concept Basis (New): That bottleneck still yields 144 concepts. To make this human-readable, the authors use a sparse assignment function (1.5-entmax) to regroup all 144 concepts into just 4 to 6 bipolar scales called a concept basis. Because every concept's evidence is non-negative and fully accounted for, summing across these few axes equals the model's exact decision margin with zero residual. Four regularization terms ensure the axes remain distinct, load-balanced, internally coherent, and reproducible across random seeds.
  3. Reading the Differential Diagnosis: Clinicians inspect each axis in three ways:
  4. Typical presentations: Named automatically post-hoc using pretrained medical vision-language models (MONET or MedSigLIP).
  5. Pertinent findings: Spatial margin maps highlighting what pushed the case toward one diagnosis over its competitor.
  6. Counterfactual edits: A co-trained pixel-space rectified flow generator (U-Net) visually simulates how a borderline image would look if shifted along a single diagnostic axis toward the competing diagnosis.
DDxBasis explaining a skin lesion diagnosis: pertinent findings across six bipolar axes summing to the exact margin, VLM pole naming, and counterfactual visual edits.

Datasets

The authors evaluate across five imbalanced datasets spanning four distinct imaging modalities (no concept annotations are used during training):

  • Skin (ISIC 2018 Task 3): 10,015 dermoscopic images across 7 skin lesion classes (with Task 2 dermatologist structure masks held out strictly for evaluation).
  • PBC: 17,092 stained peripheral blood smear images (8 classes, plus held-out granulocyte maturation stages).
  • BMC: 171,374 bone-marrow cytology smear images (21 classes).
  • Chest (NIH ChestX-ray14): 112,120 chest radiographs across 14 multi-label findings.
  • OBM (Private): 40,920 stain-free white blood cell images (5 classes) captured via oblique back-illumination microscopy, representing a steep domain shift from natural images.

Key Insights and Ideas

  • Plain sums beat fancy cross-layer fusion: Intermediate ViT layers hold complementary diagnostic clues (layers four apart share only 37% of their errors on skin). Surprisingly, merging all 12 layers with a plain, unweighted sum outperforms learned layer weights and complex feature-fusion heads, which tend to overfit on small medical datasets.
  • Emergent biological ordering without supervision: On blood cells (PBC), the classifier was only trained on two coarse, unordered labels ("immature granulocyte" vs. "neutrophil"). Yet a single learned axis spontaneously arranged five underlying biological maturation stages in exact chronological order (Spearman $\rho = 0.87$).
  • Catching hidden rare subtypes: When rare "hairy cells" were secretly merged into normal lymphocytes during training (outnumbered 64-to-1), a single basis axis still separated them at test time with 0.81 AUROC.
  • Surgical shortcut removal: Medical models notoriously cheat using acquisition artifacts. DDxBasis flags suspect axes by testing them against image metadata. On chest X-rays, it caught an axis exploiting bedside AP vs. standing PA camera views (0.86 AUROC). When the authors planted a synthetic "green dot" shortcut on 90% of melanomas, the basis isolated 83% of that shortcut's evidence onto a single pole (which the VLM literally named "a green dot"). Deleting that one axis boosted accuracy on shortcut-reversed test images by 19.9 points.
Chest X-ray differential diagnosis showing pertinent spatial opacity findings, VLM-derived pole names, and counterfactual edits clearing an effusion and shrinking an enlarged heart.

Key Results

  • Classification Accuracy: DDxBasis is the top-performing frozen-encoder method on all five benchmarks—beating a standard linear probe on the same DINOv3 encoder by an average of 12 percentage points (e.g., 86.1% vs. 71.1% balanced accuracy on Skin; 80.6% vs. 59.4% on BMC; 81.3% vs. 75.2% macro AUROC on Chest). It matches domain-specific SOTA on Skin and PBC, and surpasses published SOTA on BMC (80.6% vs. 71.4–75.7%).
  • Compactness & Reproducibility: Decisions require just 1.0 to 2.7 axes on average to explain 80% of the positive decision margin (compared to 15–27 raw bottleneck concepts), with cross-seed axis correlation ranging from 0.85 to 0.99.
  • Clinical Alignment: On Skin, the six unsupervised axis positions predict dermatologist-annotated physical structures better than the actual diagnosis labels do (0.69 vs. 0.58 AUROC).

Limitations and Future Work

  • Dictionary & VLM Constraints: Because axis names are mined post-hoc using a fixed clinical vocabulary and pretrained VLMs, concepts outside that dictionary or the VLM's knowledge won't be cleanly named (for example, MedSigLIP struggled with specialized bone-marrow morphology terms).
  • No Guarantee of Disentangled Clinical Variables: While the axes are 100% mathematically faithful to the model, a single axis is not guaranteed to map to a single pure biological variable.
  • Resolution & Clinical Validation: Images are processed at $224 \times 224$ resolution, which can miss subtle chest X-ray details (like tiny nodules vs. masses), and neither the VLM names nor the counterfactual images have yet been evaluated by blinded clinicians.
  • Future Work: While the framework successfully diagnoses real-world dataset shortcuts like X-ray view position, actively fixing these real confounds via data curation and retraining is left for future research.

Summary updated

Abstract

In differential diagnosis (DDx), a clinician explains a diagnosis by the few findings that separate it from the alternatives. Medical image classifiers cannot yet explain themselves this way. Existing explanations are either faithful but spread over hundreds of concepts, or compact but leave part of each decision unexplained. We present DDxBasis, which explains a classifier on a frozen foundation encoder as a differential diagnosis in three steps. First, a concept bottleneck reads all patch tokens at every encoder layer using gated, second-order slot attention. A concept basis then regroups the concepts into two-pole axes, each a differential between groups of diagnoses. Finally, we read a differential diagnosis from each axis through the typical presentation of its poles, the pertinent findings of the case, and counterfactual edits of borderline cases. Across five medical datasets, DDxBasis is the most accurate frozen-encoder model and close to the best published domain-specific results. Because every concept adds its own evidence, its reproducible concept basis splits each decision exactly, at no cost in accuracy. Without ordered stage or concept labels, the axes recover cell lineages and rare subtypes, agree with dermatologists' structure annotations, and expose planted and real shortcuts.
BibTeX
@misc{huang2026ddxbasis,
  author = {Luojie Huang and Gregory N. McKay and Nicholas J. Durr},
  title = {{DDxBasis: Explaining Frozen Foundation Encoder-based Medical Classification by Exact Differential Diagnosis}},
  year = {2026},
  eprint = {2611.33358},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.33358},
}
Figure