When a clinician asks "which past patients look like this one?", the answer depends on two things that current multimodal clinical models ignore. The first is where the patient sits in the population. For a septic patient, lactate and blood pressure trajectories should dominate similarity. For a heart-failure patient with kidney disease, creatinine and the radiology note may matter more. The second is which data were collected at all. A patient with a chest X-ray and a discharge summary is not comparable, feature for feature, to one with only vitals and labs. That gap is not random noise. Clinicians order tests selectively for sicker patients, so missing data carries information about the patient. We propose a model that learns a small set of local distance functions over patients. Each function is a way of measuring patient-to-patient similarity that holds only within one region of the patient population and is adjusted according to which modalities were observed. Each local distance function acts as an "expert" in a mixture of experts, which is an architecture where a gating rule sends each input to a few specialized sub-models. Here the gating rule is itself a distance computation, and each expert predicts by consulting the stored training patients it judges most similar.
The practical payoff is threefold, and each part is testable. A retrieval-based predictor can name the past patients behind a prediction. It can absorb newly admitted patients by adding them to a memory bank, with no retraining and no rebuilt cohort graph. If similarity is measured correctly in each region, it should help most where parametric classifiers fail: rare phenotypes, where high discrimination scores coexist with very poor precision. On ICD-10 emergency-department diagnosis prediction, Revisiting Clinical Outcome Prediction for MIMIC-IV reports PubMedBERT at 86.86% AUROC but only 17.24% PR-AUC. The central claim is narrow and falsifiable. On MIMIC-IV with paired chest X-rays and notes, the right notion of patient similarity changes measurably across both patient regions and observed-modality patterns. Modeling that variation beats a single learned similarity on the same embeddings, and it also beats a same-capacity softmax mixture of experts. The gains should concentrate on rare phenotypes and on calibration.
What exists and what is missing
Localized metric learning supplies the core mechanism. Hastie and Tibshirani (paper) and Domeniconi et al. (paper) showed that a single distance function, such as a fixed Mahalanobis metric (a distance that reweights and rotates feature axes), treats feature relevance as uniform across the space. Nearest-neighbor neighborhoods then include irrelevant points, and these papers motivate local metrics. Parametric Local Metric Learning (PLML) makes local metrics workable. It attaches basis metrics to k-means anchors and smoothly interpolates them, and it outscored global metric learning in its benchmark ranking (37 points versus 28.5 for SML). Data-Adaptive Metric Learning with Scale Alignment (DAML) builds each pair's metric as a combination of candidate matrices. It adds a regularizer that keeps their scales comparable, without which local distances cannot be ranked against each other. We reuse two techniques from these papers: anchored basis metrics from PLML, and a scale constraint from DAML. We change what the metric is conditioned on. DAML regresses its mixing weights from the sum of the two inputs, a linear heuristic its own limitations flag. We instead condition the metric on the patient's observed-modality pattern. Neighborhood Components Analysis (Goldberger et al.) supplies the differentiable soft nearest-neighbor objective each expert trains with.
On the clinical side, three lines of work define the problem without solving it. DrFuse splits EHR and X-ray features into modality-specific and shared parts, and it weights modalities per disease. Its weighting is fixed per disease rather than adapted per patient, and its latent space has no geometric constraint on patient-to-patient distance. CRL-MMNAR shows that missingness in MIMIC-IV is informative: 24.5% of ICU patients lack discharge summaries, and complete-data patients have higher mortality and readmission. It embeds the missingness pattern and gates attention with it. Its contrastive alignment still uses one global projection and one temperature. We take its central finding as a design constraint: the metric must treat missingness as signal, not as corruption to repair. PM2F2N is the closest existing use of inter-patient similarity. It builds a cohort graph from fixed Jaccard overlap of extracted clinical entities and runs graph convolutions, gaining 1.1–3.7% AUROC on MIMIC-III. That graph has a fixed similarity and must be rebuilt as patients arrive. We replace it with learned, inductive retrieval. A Pipeline for Interpretable Clinical Subtyping with Deep Metric Learning shows that metric-learned patient spaces beat ordinary supervised training for subtyping on All of Us and MIMIC-III. It learns one global embedding, which is exactly the assumption we test.
On the mixture-of-experts side, two papers come closest, and both differ in key ways. Generalizable and Composable Multi-Model Embedding Translation (H-MoE) assigns lightweight experts to local geometric regions of an embedding space. It shows that geometry-aware experts avoid the collapse unconstrained translators suffer under distribution shift. That work covers homogeneous text-embedding translation only, and its authors leave multimodal spaces open. UMQ routes samples by estimated modality quality on sentiment benchmarks. It treats missing modalities as degradation, a framing that CRL-MMNAR's evidence argues is wrong for clinical data. LIFTED applies a sparse mixture of experts to clinical trial prediction, using ordinary softmax gating over text-linearized inputs. No work we found makes the gate a learned local patient distance, conditions that distance on the missingness pattern, and predicts through retrieval inside each expert.
Core Claim and Mechanism
Shared modality encoders map a patient $x$ to an embedding $z \in \mathbb{R}^D$, and $m \in \{0,1\}^J$ records which of $J$ modalities were observed. Expert $k$ owns an anchor $c_k$ and a metric matrix
$$M_k(m) = \Big(L_k^{0} + \sum_{j=1}^{J} m_j L_k^{j}\Big)\Big(L_k^{0} + \sum_{j=1}^{J} m_j L_k^{j}\Big)^{\top} + \lambda I,$$
where each $L_k^{j}$ is a $D \times r$ low-rank factor with $r \ll D$. The factors let modality $j$'s presence reshape which directions count as different. The $\lambda I$ term keeps the matrix well-conditioned. The low rank cuts the per-expert parameter count from $D^2$ to $(J{+}1)Dr$, which addresses the overfitting problem of unconstrained local metrics. We fix $\operatorname{tr} M_k(m)$ to a constant across experts. This is a hard version of DAML's scale alignment, needed because the gate compares distances measured under different metrics. Writing $d_k(z,z') = (z-z')^\top M_k(m)(z-z')$, the model predicts
$$p(y \mid x) = \sum_{k} \underbrace{\frac{e^{-d_k(z,c_k)/\tau}}{\sum_{k'} e^{-d_{k'}(z,c_{k'})/\tau}}}_{\text{gate } g_k}\;\underbrace{\sum_{i \in \mathcal{B}} \frac{e^{-d_k(z,z_i)}}{\sum_{i' \in \mathcal{B}} e^{-d_k(z,z_{i'})}}\, y_i}_{\text{soft neighbor vote in expert } k},$$
where $\mathcal{B}$ is a memory bank of stored training-patient embeddings with labels $y_i$, and $\tau$ is a temperature. For efficiency, neighbor search is restricted to the top candidates from a cheap Euclidean pre-filter. A small parametric head per expert is mixed in with a learned weight, so retrieval never has to carry all the signal. Training uses multilabel cross-entropy through the full expression. Encoders, anchors, and factors are trained jointly. Anchors are initialized by k-means, as in PLML. New patients enter $\mathcal{B}$ at inference with no parameter update, which removes PM2F2N's graph rebuild.
The gate's ellipsoidal boundaries, the shapes of the regions each expert claims, could be emulated by a deep enough MLP gate. The proposal's claim does not rest on the gate shape alone. It rests on one geometry doing double duty: the distance that decides which expert owns a patient is also the distance that expert uses to retrieve neighbors. That shared geometry is what a softmax router plus a global retriever cannot provide.
Research Program
The first stage is a cheap test of whether there is any headroom, designed so it can kill the project. On fixed DrFuse-style embeddings of MIMIC-IV, we fit separate global NCA metrics on patient subgroups. The subgroups come from two sources: k-means clusters, and modality patterns (X-ray present or absent, notes present or absent). We then measure transfer loss: how much worse subgroup A's neighbor-retrieval PR-AUC gets under subgroup B's metric than under its own. If transfer loss is near zero, similarity is effectively global, and the local machinery is unjustified. In that case we would publish the negative result and stop.
The second stage builds the full model and runs the comparisons below. The third stage is analysis. We examine what the metrics learned: which modality factors $L_k^{j}$ carry weight in which experts, whether experts correspond to recognizable clinical groups, and whether retrieved neighbors are judged clinically plausible on a sample reviewed by a clinician collaborator. We also check whether expert usage tracks the informative-missingness structure CRL-MMNAR documents.
Baselines
The naive reference point is late fusion. Modality-specific encoders are concatenated with binary missingness indicators and fed to a multilabel classifier. Its encoders are the same as ours, and it shows what the problem yields without structure.
The strongest existing methods are DrFuse and CRL-MMNAR. DrFuse is the purpose-built model for the 25-phenotype MIMIC-IV/MIMIC-CXR task under missing X-rays. CRL-MMNAR is the strongest file-reported method on readmission, ICU admission, and mortality under informative missingness, and it already beats DrFuse among 13 baselines. Neither reports an absolute number in the material available to us. DrFuse reports only an 8% relative PR-AUC gain over MedFuse and MMTM, and CRL-MMNAR reports only "up to 13.8%" over its baselines. We will therefore rerun both from their released configurations. Both get the same cohort splits, the same pretrained encoders where their designs permit, and the same hyperparameter search budget in GPU-hours as our model. Beating them means a higher macro PR-AUC across the 25 phenotypes, with paired-bootstrap confidence intervals that exclude zero over five seeds. It also means no loss of AUROC or calibration.
For inter-patient modeling on MIMIC-III, we reimplement PM2F2N's Jaccard patient graph on its four tasks. That paper reports only relative gains (1.1–3.7% AUROC, 0.4–10.5% AUPRC). Beating it means matching or exceeding its AUROC while handling streamed admissions without rebuilding the graph.
Two capacity-matched controls isolate the key ingredient. The first is global-metric retrieval: our model with one expert, one metric, and the same memory bank. The second is a softmax mixture of experts with the same number and size of experts, a two-layer MLP gate, and per-expert parametric heads, with no retrieval. Ablations then remove one piece at a time: mask conditioning (set every $L_k^{j}$ to zero for $j \geq 1$), the trace constraint, soft gating (replace with hard nearest-anchor assignment), and retrieval (parametric heads only). The claim requires that removing mask conditioning or locality costs measurable rare-phenotype PR-AUC.
Why not just…?
Why not just use one learned global metric with nearest-neighbor retrieval? This is the most serious threat, because the clinical subtyping pipeline (paper) shows that a single deep metric already works well on clinical data. The general evidence for local metrics, PLML's ranking gains and DAML's lower PubFig error (12.89% versus 13.89% for ITML), comes from non-clinical features and may not transfer. The first-stage transfer-loss test exists to settle this before anything is built, and the one-expert ablation settles it in the full model. If one metric matches K local metrics, we drop the locality claim.
Why not just use a standard softmax mixture of experts with a deeper gate? An MLP gate can carve regions at least as flexible as ellipsoids, so gate shape alone is no argument. H-MoE's evidence that geometry-constrained experts avoid collapse under shift (paper) comes from embedding translation, not classification. The comparison that decides this is the capacity-matched softmax mixture. Its experts are parametric, so it cannot add patients without retraining and cannot cite neighbors. If it matches our accuracy, the remaining case for our model is streaming and interpretability, and we will report it that way.
Why not just add CRL-MMNAR's missingness embedding to any fusion model? CRL-MMNAR already uses missingness as signal, and it may capture most of the benefit of mask-conditioned metrics. The difference is where missingness acts. In CRL-MMNAR it gates a representation. In our model it changes how two patients' representations are compared, which matters only if the model predicts through similarity. The mask-conditioning ablation, together with a variant that feeds CRL-MMNAR's embedding into a global retriever, separates these two roles.
Why not just use a larger monolithic transformer over all modalities? Monolithic fusion baselines such as MedFuse and MMTM lose to modular designs under missing X-rays (DrFuse). Multi-task monolithic models are also known to latch onto spurious shortcuts (Zhao et al.). We include a transformer matched to our total parameter count as an additional reference, so this is tested rather than assumed.
Proposed Experiments
The primary benchmark is MIMIC-IV with MIMIC-CXR and notes. We use DrFuse's 25-phenotype task, where fewer than 20% of ICU stays have paired X-rays, and CRL-MMNAR's three outcome tasks. Cross-site robustness is tested on eICU, using CRL-MMNAR's construction of ten virtual tabular modalities. MIMIC-III's mortality and length-of-stay tasks provide the PM2F2N comparison. We will also report ICU diagnosis prediction under ICD-10, where Revisiting Clinical Outcome Prediction for MIMIC-IV gives the long-tail reference point of 17.24% PR-AUC for PubMedBERT on its emergency-department split. That split is not identical to ours, so we cite it to describe the long-tail regime, not as a direct target. Metrics are macro PR-AUC overall, PR-AUC within three label-frequency bins, AUROC, Brier score and expected calibration error, neighbor label agreement among the top-10 retrieved patients, and the wall-clock and memory cost of adding 1,000 new admissions.
The study turns on four checks. First, the subgroup transfer-loss test must show nonzero headroom. Second, the full model must beat both capacity-matched controls on the rarest-frequency bin, with gains concentrated in rare labels rather than spread uniformly. Uniform small gains would suggest added capacity rather than better similarity. Third, the advantage of mask conditioning must grow with the share of patients missing X-rays or notes. We will test this by training on subsets with the missingness rate fixed at different levels, preserving which patients lack data rather than deleting at random. Fourth, adding streamed patients to the memory bank must improve accuracy on later admissions at a cost far below rebuilding a cohort graph. If the second check fails while the fourth succeeds, the honest conclusion is that local metrics buy deployability but not accuracy. That would still be a useful finding, but a smaller one than the claim stated here.
References
- Revisiting Clinical Outcome Prediction for MIMIC-IV
- Discriminant Adaptive Nearest Neighbor Classification and Regression
- An Adaptive Metric Machine for Pattern Classification
- Parametric Local Metric Learning for Nearest Neighbor Classification
- Data-Adaptive Metric Learning with Scale Alignment
- Neighbourhood Components Analysis
- DrFuse: Learning Disentangled Representation for Clinical Multi-Modal Fusion with Missing Modality and Modal Inconsistency
- Causal Representation Learning from Multimodal EHRs under Non-Random Modality Missingness
- PM2F2N: Patient Multi-view Multi-modal Feature Fusion Networks for Clinical Outcome Prediction
- A Pipeline for Interpretable Clinical Subtyping with Deep Metric Learning
- Generalizable and Composable Multi-Model Embedding Translation
- Addressing Missing and Noisy Modalities in One Solution: Unified Modality-Quality Framework for Low-quality Multimodal Data
- LIFTED: Multimodal Mixture-of-Experts for Clinical Trial Outcome Prediction
- Improving Multi-Task Generalization via Regularizing Spurious Correlation