DDxBasis: Explaining Frozen Foundation Encoder-based Medical Classification by Exact Differential Diagnosis
Organizations: Department of Biomedical Engineering, Johns Hopkins University, Baltimore, USA
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.
Figures & tables
| Method | Skin | PBC | OBM | BMC | Chest |
| (i) Frozen readout | |||||
| Linear probe, last layer | 71.1 0.2 | 96.6 0.1 | 62.5 0.3 | 59.4 0.2 | 75.2 0.0 |
| Linear probe, 12-layer vote § | 76.8 0.1 | 98.3 0.0 | 69.8 0.3 | 69.8 0.3 | 76.8 0.3 |
| Attentive probe [ 31 ] (ICML’24) | 76.4 0.4 | 98.3 0.1 | 68.5 0.6 | 70.1 1.1 | 79.2 0.2 |
| Head2Toe [ 33 ] (ICML’22) | 75.2 0.5 | 97.6 0.3 | 72.7 0.3 | 65.5 0.7 | 77.4 0.4 |
| (ii) Prototype / compact head | |||||
| (a) Within a layer (skin) | Mean acc. | Att. coverage (overlap ) | Slot similarity | Shared errors | Seed agreement |
| Probe heads (CLS mean) | 67.1 | 1.00 (–) | – | 0.43 | – |
| MQA ( ) | 73.8 | 0.26 (0.58) | 0.50 | 0.39 | 0.01 |
| Slot attention (SA, ) | 74.5 | 1.00 (0.22) | 0.45 | 0.39 | 0.48 |
| SA + covariance | 76.4 | 0.99 ( 0.17 ) | 0.59 | 0.40 | 0.66 |
| + gates (ours) | 75.0 | 0.99 ( 0.16 ) | 0.48 | 0.37 | 0.60 |
| (b) Merging across depth | Skin | PBC | OBM | BMC | Chest |
| Dataset | VLM | Admissible terms (AUROC) | Other terms (highest AUROC) |
| Skin | MONET | red-blue lacunae (0.96); pigment network (0.81); ulceration (0.79); comedo-like openings (0.74); blue-gray ovoid nests (0.74) | central white patch (0.69); scale and keratin (0.69); irregular blotches (0.65); multiple colors (0.64); arborizing vessels (0.64); milia-like cysts (0.63); streaks (0.63); dots and globules (0.63); blue-white veil (0.61); regression structures (0.60); negative network (0.58); asymmetric shape (0.55); shiny white structures (0.51); atypical pigment network (0.50); leaf-like areas (0.47); sharply demarcated border (0.42); strawberry pattern (0.39) |
| PBC | MedSigLIP | orange eosinophilic granules (0.88); gray-blue cytoplasm (0.80); platelet clumps (0.78); large cell (0.77); mature segmented neutrophil (0.74); band-shaped nucleus (0.72); dense dark round nucleus (0.72); indented kidney-shaped nucleus (0.72) | abundant cytoplasm (0.69); high nucleus to cytoplasm ratio (0.69); dark purple basophilic granules (0.65); small cell (0.64); cytoplasmic vacuoles (0.62); small anucleate cell fragments (0.61); round nucleus (0.59); pink granular cytoplasm (0.57); segmented multilobed nucleus (0.56); condensed clumped chromatin (0.54); fine lilac granules (0.50); fine open chromatin (0.37); scant cytoplasm (0.37) |
| BMC | MedSigLIP | smudged ruptured cell (0.81); orange eosinophilic granules (0.78); coarse purple granules (0.70); dark basophilic granules (0.70) | band-shaped nucleus (0.69); prominent nucleoli (0.65); abundant cytoplasm (0.64); pale gray cytoplasm (0.63); large cell (0.62); hairy cytoplasmic projections (0.62); indented kidney-shaped nucleus (0.61); fine azurophilic granules (0.60); Auer rods (0.59); high nucleus to cytoplasm ratio (0.56); deeply basophilic blue cytoplasm (0.55); fine open chromatin (0.55); perinuclear halo (0.55); small cell (0.54); segmented multilobed nucleus (0.54); mature cell (0.51); round nucleus (0.50); cytoplasmic vacuoles (0.49); bare nucleus without cytoplasm (0.47); pink cytoplasm (0.46); cell debris (0.46); eccentric nucleus (0.45); immature blast cell (0.41); agranular cytoplasm (0.39); condensed clumped chromatin (0.38); scant cytoplasm (0.34) |
| Chest | MedSigLIP | perihilar haziness (0.86); blunting of the costophrenic angle (0.81); basal opacity with a meniscus sign (0.81); hyperinflated lungs with flattened diaphragms (0.78); airspace consolidation (0.77); enlarged cardiac silhouette (0.74); visible pleural line without lung markings (0.74); clear lungs (0.73); lung opacity (0.72) | patchy infiltrates (0.64) |
| Axis | Differential (− ↔ +) | − pole names | + pole names |
| Skin E0 | MEL, AKIEC ↔ NV, VASC | ▸ pigment network; ▸ dots and globules | pigment network; ▸ red-blue lacunae |
| Skin E1 | MEL, NV ↔ BKL, AKIEC | pigment network ; red-blue lacunae | ▸ comedo-like openings |
| Skin E2 | VASC, DF ↔ NV, MEL | ulceration; ▸ red-blue lacunae | pigment network ; ▸ pigment network; ▸ dots and globules |
| Skin E3 | AKIEC, BCC ↔ BKL, MEL | ▸ ulceration; ▸ blue-gray ovoid nests | comedo-like openings |
| Skin E4 | DF ↔ AKIEC | ulceration | comedo-like openings; pigment network |
| Skin E5 | BCC, VASC ↔ AKIEC, DF | ▸ red-blue lacunae | pigment network |
| Dataset, model | Axis, pole | Name | Reference | Verdict |
| Skin, MONET | E0 + | pigment network | Task 2 masks: mask contrast −0.09 (toward −) | wrong sign |
| Skin, MONET | E1 − | pigment network | Task 2 masks: mask contrast −0.37 (toward −) | agrees |
| Skin, MONET | E2 + | pigment network | Task 2 masks: mask contrast +0.12 (toward +) | agrees |
| Skin, MONET | E4 + | pigment network | Task 2 masks: mask contrast +0.08 (toward +) | agrees |
| Skin, MONET | E5 + | pigment network | Task 2 masks: mask contrast +0.40 (toward +) | agrees |
| PBC, MedSigLIP | E0 − | indented kidney-shaped nucleus | stage order within NEU, IG | agrees |
| Axis | Name (tier) | Main support |
| Skin E0 | Excised vs follow-up ⚑ (acquisition variable) | histopathology-confirmed share −1.58 s.d. toward +; boundary AKIEC vs VASC: red-blue lacunae +2.68 |
| Skin E1 | Melanocytic vs keratinocytic (lineage split) | descriptor pigment network (−; BKL/MEL/NV; AUROC 0.71); boundary NV vs BKL: comedo-like openings +0.53; lesion contrast −0.88 s.d. |
| Skin E2 | Melanocytic structures (axis descriptor) | descriptor pigment network (+; BKL/MEL/NV; AUROC 0.81); boundary VASC vs NV: red-blue lacunae −1.75; lesion lightness +0.70 s.d. |
| Skin E3 | BCC structures (boundary cue) | boundary BCC vs BKL: ulceration −1.01; BCC vs MEL: blue-gray ovoid nests −0.84 |
| Skin E4 | Lesion tone (measurement descriptor) | lesion lightness +0.24 s.d., ρ +0.54; lesion texture +0.50 s.d. |
| Skin E5 | Vascular structures (boundary cue) | boundary VASC vs AKIEC: red-blue lacunae −2.35; VASC vs DF −1.77; lesion size +0.93 s.d. |
| Family | Method | Encoder | Trained parts | Schedule | Learning rate | Code |
| Frozen readout | Linear probe (last layer), attentive probe | DINOv3-B, frozen | head only | 30 epochs | grid, chosen on validation | ours, a standard head trained side by side with the others under the same protocol as our concept bottleneck |
| Linear probe, 12-layer vote | DINOv3-B, frozen | one linear head per layer | 30 epochs | grid, chosen on validation | ours, one linear head per layer, no reference code needed | |
| Head2Toe | DINOv3-B, frozen | group-lasso feature selection + linear head | 10 epochs selection + 30 epochs head | 1e-4; sparsity, fraction and weight decay chosen on validation | PyTorch port, as the official code is JAX for other backbones | |
| Cross-layer fusion (main Table 2b) | ScalarMix, VFusion, ALF, concatenated CLS and CLS‖mean heads | DINOv3-B, frozen | head only | 30 epochs | grid, chosen on validation | ours, from the papers (no released VFusion code, ScalarMix exists only for NLP), under the same protocol as our concept bottleneck |
| Prototype / compact head | PNP | DINOv3-B, frozen | part prototypes + head | official, stage 2 ≈ 540k images | official | port of the official code |
| PIP-Net | DINOv3-B, frozen | prototypes + head | official medical schedule, ≈ 2k + 10k updates | official | port of the official code |
| Arm | Mean acc. | Att. coverage (overlap ) | Slot similarity | Shared errors | Seed agreement |
| Skin | |||||
| Probe heads (CLS‖mean) | 67.1 | 1.00 (—) | — | 0.43 | — |
| MQA (n = 12) | 73.8 | 0.26 (0.58) | 0.50 | 0.39 | 0.01 |
| Slot attention (SA, n = 12) | 74.5 | 1.00 (0.22) | 0.45 | 0.39 | 0.48 |
| SA + covariance | 76.4 | 0.99 ( 0.17 ) | 0.59 | 0.40 | 0.66 |
| + gates (ours) | 75.0 | 0.99 ( 0.16 ) | 0.48 | 0.37 | 0.60 |
| Readout across depth | Skin | PBC | OBM | BMC | Chest |
| Best single layer | 80.0 ± 0.2 | 99.0 ± 0.1 | 73.3 ± 0.3 | 74.7 ± 0.4 | 80.2 ± 0.2 |
| Feature fusion: Head2Toe (main Table 1) | 75.2 ± 0.5 (79.6) | 97.6 ± 0.3 (98.4) | 72.7 ± 0.3 (63.2) | 65.5 ± 0.7 (69.1) | 77.4 ± 0.4 (79.7) |
| Feature fusion: ScalarMix | 73.7 ± 0.8 (78.6) | 97.5 ± 0.2 (97.7) | 69.8 ± 0.1 (61.7) | 64.3 ± 0.2 (64.5) | 75.4 ± 0.0 (77.2) |
| Feature fusion: VFusion | 70.8 ± 0.4 (72.0) | 98.4 ± 0.1 (98.8) | 70.6 ± 0.4 (64.7) | 65.1 ± 0.4 (71.1) | 68.4 ± 0.3 (71.6) |
| Feature fusion: ALF | 72.0 ± 0.5 (76.4) | 96.5 ± 0.1 (96.4) | 63.1 ± 0.1 (58.8) | 58.4 ± 0.3 (59.9) | 73.0 ± 0.1 (75.5) |
| Feature fusion: single head on the concatenated CLS | 69.2 ± 1.0 (71.9) | 98.3 ± 0.1 (99.2) | 71.3 ± 0.3 (64.8) | 68.7 ± 0.4 (66.4) | 73.9 ± 0.0 (75.3) |
| Dataset | Effective axes ↑ | Axes per decision ↓ (concepts) | Seed match ↑ (median) | Stability ↑ (concepts) | Decisions on 1 / 2 / 3 / ≥ 4 axes (%) | Most used axis, margin share (%) | Axes leading ≥ 5% of decisions | Distinct class leaders (classes) | Least needed axis, in 80% set (%) |
| Skin | 5.42/6 | 2.0 (26.0) | 0.89 (0.96) | 0.82 (0.72) | 6.9 / 69.5 / 22.8 / 0.8 | 30.6 | 5 | 5 (5) | 11.6 |
| PBC | 3.95/4 | 1.7 (21.3) | 0.99 (0.99) | 0.96 (0.86) | 40.7 / 23.0 / 34.6 / 1.6 | 33.4 | 4 | 4 (8) | 23.1 |
| OBM | 3.88/4 | 1.0 (20.3) | 0.98 (0.98) | 0.78 (0.60) | 78.6 / 19.8 / 1.6 / 0.0 | 35.0 | 4 | 4 (5) | 6.3 |
| BMC | 5.62/6 | 2.7 (27.3) | 0.85 (0.90) | 0.97 (0.92) | 7.5 / 40.3 / 41.7 / 10.5 | 32.4 | 3 | 3.7 (17) | 16.5 |
| Chest | 5.61/6 | 1.0 (15.3) | 0.88 (0.95) | 0.93 (0.81) | 75.3 / 15.3 / 9.0 / 0.4 | 32.8 | 4 | 5 (10) | 6.2 |
| Readout | Skin | PBC | OBM | BMC | Chest |
| DINOv3-B/16 (main paper) | |||||
| Linear probe | 71.1 ± 0.2 | 96.6 ± 0.1 | 62.5 ± 0.3 | 59.4 ± 0.2 | 75.2 ± 0.0 |
| Best layer | 80.0 ± 0.2 | 99.0 ± 0.1 | 73.3 ± 0.3 | 74.7 ± 0.4 | 80.2 ± 0.2 |
| Logit sum | 86.1 ± 0.2 | 99.4 ± 0.0 | 78.6 ± 0.3 | 80.6 ± 0.3 | 81.3 ± 0.0 |
| DINOv2-B/14 | |||||
| Linear probe | 69.8 ± 0.4 | 96.8 ± 0.2 | 58.4 ± 1.4 | 62.1 ± 0.4 | 75.2 ± 0.2 |
| Family | Method | Exactness ↑ | Balance ↑ | Completeness ↑ | Distinctness ↑ | Coherence ↑ | Reproducibility ↑ |
| Factor rotation | Varimax | 1.00 | 0.54 | 0.98 | 0.67 | 0.93 | 0.47 |
| Promax | 1.00 | 0.56 | 0.98 | 0.61 | 0.96 | 0.29 | |
| ICA | 1.00 | 0.55 | 0.98 | 0.54 | 0.99 | 0.47 | |
| Sparse PCA | 1.00 | 0.59 | 0.99 | 0.55 | 0.97 | 0.48 | |
| PCA † | 1.00 | 0.53 | 0.98 | 0.65 | 0.94 | 0.68 | |
| Correlation clustering | k -means (ACE) | 1.00 | 0.59 | 0.97 | 0.43 | 0.98 | 0.73 |
| Variant | Balance ↑ | Distinctness ↑ | Coherence ↑ | Reproducibility ↑ (median) |
| Full recipe (main Fig. 3) | 0.80 | 0.91 | 0.78 | 0.83 (0.95) |
| Without balance band | 0.46 | 0.87 | 0.92 | 0.60 (0.96) |
| Without volume | 0.79 | 0.39 | 0.99 | 0.93 (0.98) |
| Without coherent poles | 0.80 | 0.97 | 0.29 | 0.86 (0.94) |
| Without consensus | 0.77 | 0.92 | 0.78 | 0.19 (0.84) |
| Dataset, split (images) | Recon. LPIPS | Reader: maturation | Random control | Selectivity |
| PBC, test (96) | 0.0003 | 0.36 (0.30–0.43) | ≤ 0.07 | 4.1–7.5 † |
| BMC, val. (68) | 0.0011 | 0.26 (0.18–0.35) | ≤ 0.04 | 7.4–14.3 ‡ |
| Abnormal vs parent | n, rare vs. common | Separate labels | Merged parent labels |
| Hairy cell vs lymphocyte | 409 vs. 26,242 | 0.86 ± 0.02 | 0.81 ± 0.01 |
| Immature vs mature lymphocyte | 65 vs. 26,242 | 0.98 ± 0.00 | 0.89 ± 0.02 |
| Faggot cell vs promyelocyte | 47 vs. 11,994 | 0.91 ± 0.03 | 0.92 ± 0.01 |
| Structure | Diagnosis alone | Six axis positions alone | Gain |
| Pigment network | 0.61 | 0.78 ± 0.01 | +0.17 |
| Globules | 0.51 | 0.64 ± 0.01 | +0.13 |
| Streaks | 0.55 | 0.68 ± 0.05 | +0.13 |
| Negative network | 0.69 | 0.78 ± 0.01 | +0.09 |
| Milia-like cysts | 0.54 | 0.55 ± 0.00 | +0.01 |
| Mean | 0.58 | 0.69 ± 0.01 | +0.11 |
| Dataset | None | 1 axis | 1 concept | 24 concepts | Concepts matching 1 axis |
| Skin | 82.3 | 94.8 | 85.1 | 96.9 | 12 |
| PBC | 99.2 | 99.7 | 99.3 | 99.8 | 24 |
| OBM | 75.3 | 83.2 | 78.0 | 83.8 | 24 |
| BMC | 83.9 | 93.2 | 85.6 | 96.1 | 12 |
| Training marker | Strong dot | Weak dot |
| Dot share on one pole | 0.83 | 0.74 |
| Aligned → reversed | −25.1 | −11.5 |
| Axis removal, reversed | +19.9 | +5.2 |
| Axis removal, unmarked | +1.6 | +1.2 |
| Best other-axis removal | −1.2 | −0.6 |
| Axis (variable) | Var. AUROC | AUROC with / against | Gap (95% CI) | Verdict |
| Chest E0, E2 (view) | 0.85 / 0.86 | 0.881 / 0.656 | 0.225 (0.210–0.242) | relied on |
| Chest E4 (rotation) | 0.79 | 0.821 / 0.775 | 0.046 (0.030–0.062) | small * |
| BMC E2 (crowding) | 0.74 | 0.984 / 0.977 | 0.007 (0.004–0.010) | negligible |
| Skin E0 (excision) | 0.86 | 0.983 / 0.963 | 0.020 (0.003–0.037) | small |
Explainable Medical Image Analysis
Explainable Medical Image Analysis develops methods that make medical image predictions understandable, verifiable, and useful for clinical review.
See all 287 papers