Care operations · Research feature

Cohort-Anchored Foundation Models for Electronic Health Records: From Risk Scores to Auditable Peer Cohorts

To address this gap, we propose CAFM, a Cohort-Anchored Foundation Model framework that elevates patient cohorts to a first-class object throughout the learning pipeline.

Adapted from research by Kaiping Zheng.

arXiv preprint revision · 2026-06-20 · Attribution & reuse
In this article
Editorial illustration of stack of documents.

Authors’ overview

Foundation models have achieved remarkable performance across medical question answering, imaging, and electronic health record (EHR) tasks, yet reliable clinical deployment remains challenging due to limited interpretability, vulnerability to distribution shift, and weak alignment with clinician reasoning. We argue that these limitations arise because existing approaches prioritize representation learning while treating patient comparison as an emergent property rather than a primary source of clinical evidence. To address this gap, we propose CAFM, a Cohort-Anchored Foundation Model framework that elevates patient cohorts to a first-class object throughout the learning pipeline. The framework consists of four stages: deviation-aware data curation, cohort-conditioned pretraining, multimodal cohort alignment, and clinician-in-the-loop refinement. Together, these stages improve data quality, organize representations around clinically meaningful cohort structure, preserve modality-specific relationships, and support auditable clinical decision-making. The framework is compositional and can augment existing EHR foundation models without modifying their underlying encoders. We illustrate CAFM through four clinical case studies spanning acute kidney injury prediction, cardiovascular risk stratification from electrocardiograms, optic neuropathy triage from orbital imaging, and electroretinogram-grounded report generation. We further present five empirically testable hypotheses and identify open challenges in data quality, irregular temporality, multimodal learning, distribution shift, and evaluation beyond predictive accuracy. We argue that explicitly anchoring foundation models to patient cohorts provides a principled path toward trustworthy clinical AI.

Introduction

The recent rise of foundation models has changed the surface of the problem without, we will argue, changing its core. The same self-supervised recipe that delivered breakthroughs in language and vision has produced clinical and biomedical backbones that, with minimal task-specific supervision, transfer well across questions ranging from medical examinations to imaging triage to physiological signal interpretation. A single backbone now plays the role that a fleet of bespoke classifiers used to play, and the economics of clinical machine learning have improved correspondingly. Yet the structural mismatch is unchanged: the model still produces a representation and a score, while the clinician still needs a comparison group with a documented trajectory.

The gap between benchmarks and the bedside manifests in three specific failure modes, each well documented in the literature and already visible in current systems. First, foundation models trained on web-scale text excel at examination-style question answering but are known to hallucinate plausible-yet-incorrect medical content with confidence. The hallucinations are particularly damaging in clinical contexts because surface fluency masks the substantive error: an answer that reads like a cardiology consultation can be incorrect in precisely the details that a real consultation would identify. Second, predictive performance degrades sharply under domain shift. Pneumonia detectors trained on one hospital’s chest radiographs fail to generalise to another; clinical risk models drift across patient demographics, sites, and protocols; and the behaviour of structured EHR encoders on novel patient subpopulations is poorly characterised. The pattern is consistent enough to be considered a property of the recipe, not a series of unfortunate implementation choices. Third, the explanations these models produce do not survive bedside scrutiny. Saliency maps, attention weights, and feature attributions answer questions clinicians did not ask: “which input tokens did the model weigh?” rather than “which prior patients support this decision, and what were their clinical outcomes?” The structured-EHR side of the field fares no better in this regard. Encoders such as BEHRT, Med-BERT, CEHR-BERT, and MOTOR achieve state-of-the-art predictive performance, yet their outputs are still risk scores over predefined outcomes, rather than the cohort-grounded justification that a clinician would document in the medical record. A recent review catalogues 84 such models and concludes that the majority are evaluated on tasks that do not provide meaningful insight into their usefulness to health systems; benchmarks such as EHRSHOT, MedHELM, and MedMCQA sharpen the picture in successive generations: on tasks where labels are scarce or where patient subgroups behave heterogeneously, the advantage of pretraining shrinks, and reliability concerns grow.

Why has the surface progress not closed the gap? Because the prevailing recipe optimises for representation quality, that is, how informative the latent embedding is when probed by a classifier, and treats patient comparison as an emergent side-effect of that representation. The clinician, by contrast, does not reason over an embedding; she reasons over a cohort. A cohort is a structured set of clinically similar patients, defined explicitly enough that membership can be evaluated for any candidate patient. Unlike embeddings, cohorts support clinically meaningful operations such as counting, subgroup analysis, conditioning on outcomes, removing contaminated members, and mapping back to established phenotyping ontologies. Cohort-based reasoning is the lingua franca of evidence-based medicine: clinical trials are designed around cohorts, guidelines are written for cohorts, and treatment decisions are routinely framed in terms of “patients like this one tend to …”. The cohort is the unit of evidence because it is also the unit of clinical accountability.

The rise of healthcare foundation models

The current generation of healthcare foundation models can be broadly grouped into four families, mirroring the historical progression of foundation models in machine learning: from language models to vision models, to multimodal models, and ultimately to physiological-signal models. Each family has inherited the strengths and the structural limitations of its general-domain ancestor.

Clinical and biomedical language models began as in-domain extensions of BERT: Clinical BERT fine-tuned on MIMIC discharge notes, BioBERT on PubMed abstracts and PubMedBERT on biomedical text from scratch. The recipe scaled with the language model revolution: BioGPT brought autoregressive generation to biomedicine, GatorTron pretrained on tens of billions of clinical-text words at a single health system, and the Med-PaLM family achieved expert-level performance on USMLE-style questions. Reasoning-tuned and multimodal-aware variants followed quickly. This progression has been impressive on benchmark evaluations, yet two empirical findings complicate this otherwise encouraging trajectory. Cited researchers show that for many EHR-specific tasks, specialised clinical models still outperform much larger general-purpose ones in the few-shot regime, suggesting that scale does not compensate for distributional mismatch; and argue that the pace of capability gains is outstripping the pace of evaluation, leaving deployers with limited solid ground on which to base their trust in these systems.

Structured EHR encoders take a different shape, more interesting for our purposes. Rather than tokenising free text, they tokenise the longitudinal record itself (ICD codes, lab values, medication orders, vitals) into event sequences and apply masked or autoregressive pretraining over them. BEHRT pioneered the recipe; Med-BERT scaled it to 28 million patients; CEHR-BERT added explicit time encoding; MOTOR reframed the objective as time-to-event prediction across many outcomes simultaneously; and the most recent CEHR-GPT demonstrated that the chronological event stream can be generatively modelled with sufficient fidelity to support synthetic EHR generation. These models have absorbed the methodology of language modelling almost wholesale, and they inherit the same limitation: their output is a sequence-level probability rather than a grounding in any actual patient population.

Why foundation models miss the cohort

A pretrained EHR encoder produces a sequence of token embeddings; downstream tasks read a probability off a classification or generative head. Even when the encoder implicitly groups similar patients in the latent space (and it does, as a side-effect of the contrastive or masked objective ), the grouping is not exposed, not aligned to clinically meaningful axes, and not compatible with the data-quality discipline that medicine requires. We unpack three specific obstacles in the remainder of this section.

First, cohorts are not exposed. The model’s nearest neighbours in latent space are accessible only to those with direct access to the retrieval index. As a result, they are unnamed (lacking clinically interpretable labels), unsized (without local density of the neighbourhood), and unaudited (without mechanisms that allow clinicians to include or exclude members). Recent work on retrieval-augmented prediction in medicine mitigates this for text-centric outputs by retrieving evidence snippets at query time, but no analogous mechanism is standard for structured EHRs, and none retrieves patients as the unit of evidence. The distinction is not cosmetic: patients are structured objects that can be stratified by outcome, demographics, temporal window, treatments, and other clinically meaningful attributes, whereas documents can be retrieved and ranked but not partitioned along them.

Second, similarity is monolithic. A single embedding conflates demographics, laboratory measurements, medications, vital signs, and free-text clinical notes. In practice, however, the cohort most informative for predicting AKI in a 75-year-old patient receiving diuretics is not necessarily the cohort most informative for predicting heart failure in that same patient, despite the underlying individual being identical. Prior work on adaptive interaction modelling and dynamic networks partially addresses this issue at the predictor level by routing patients through task-specific substructures, while progression-aware and temporally adaptive encoders tailor similarity to disease dynamics over time. Yet these mechanisms remain largely absent from the pretraining objective itself. Consequently, the resulting backbone inherits a fixed notion of patient similarity determined during pretraining, even though that notion may be poorly aligned with many downstream clinical tasks encountered during real-world deployment.

Data deviation, missingness, and bias

Large-scale pretraining implicitly assumes that the underlying corpus constitutes, on average, a faithful representation of the target population. EHR corpora violate this assumption in multiple well-documented ways. Demographic and socioeconomic factors influence what clinical information is recorded, when it is recorded, and the degree to which it is recorded accurately. Pretraining objectives that ignore these biases risk encoding documentation artefacts as if they were genuine clinical signal. Recent analyses further demonstrate how often the resulting models are evaluated on tasks that obscure rather than expose this failure mode. Addressing this issue is substantially more difficult than it may initially appear because bias enters the data-generation pipeline at multiple stages, including data collection, clinical coding, care delivery, ordering behaviour, and billing practices. Moreover, the effects introduced at each stage are often partially confounded with one another, making individual sources of bias difficult to isolate or correct.

Three specific gaps remain. First, the deviation-detection mechanism introduced in Stage 1 addresses only one aspect of the problem: records whose distribution is statistically anomalous, but does not directly address records whose distribution appears consistent with a biased process. A more complete solution therefore requires augmenting deviation detection with mechanism-aware filtering strategies capable of distinguishing “rare but clinically valid” observations from “common but biased” ones. Second, tighter integration with data-quality and standardisation frameworks is necessary to enable reproducible construction of pretraining curricula across institutions. In the absence of standardised curation protocols, inter-institutional comparisons remain fragile and difficult to interpret. Third, fairness-aware training objectives have thus far been studied primarily at the downstream task level, with relatively limited attention paid to the pretraining-corpus level. In particular, we believe there is substantial value in protocols that declaratively specify what constitutes a clinically meaningful deviation versus an artefact of data collection or documentation, so that clinicians can audit the curation rules before any pretraining begins. Ad-hoc curation procedures, by contrast, are neither reproducible nor institutionally auditable, making them difficult to validate, compare, or govern.

Evaluation beyond accuracy

Recent calls for clinically grounded evaluation converge on the same underlying need. Cohort anchoring provides a particularly natural evaluation unit because each metric described above corresponds directly to a specific stage of the framework. Prospective deployment studies, although still relatively rare, are becoming increasingly common and should ultimately serve as the primary standard for evaluation. Reporting frameworks such as TRIPOD+AI and TRIPOD-LLM establish a minimum standard for what constitutes publishable evidence in this setting. We further anticipate that the next generation of EHR benchmarks will incorporate cohort coverage and cohort calibration as mandatory auxiliary metrics, on the grounds that calibration claims cannot be meaningfully assessed when the coverage properties of the retrieved cohorts remain unknown.

What Cohort Anchoring Is and Is Not

Cohort anchoring sits adjacent to several active lines of work and a perspective paper must clearly delineate its scope to avoid the impression that it merely repackages ideas already familiar to the community. We therefore devote this section to the boundaries themselves, examining each adjacent technique as a potential alternative to cohort anchoring and explaining why we view it as complementary rather than substitutive. The intended audience is the experienced reader inclined to ask a natural question: “Why is this problem not already solved?”

Not retrieval-augmented generation. Retrieval-augmented generation retrieves documents or knowledge snippets to ground the output of a language model. The retrieved unit is textual, such as a clinical guideline passage, textbook excerpt, or section of a discharge summary, and is incorporated into the model’s context during generation. Cohort anchoring, by contrast, retrieves patient cohorts. These retrieved objects are structured rather than textual, summarise clinically relevant outcome distributions rather than passages, and remain auditable through their underlying diagnoses, laboratory measurements, treatments, and outcomes. The distinction is substantive rather than cosmetic. A document cannot be partitioned by outcome; a cohort can. A document cannot answer “how many of those patients also had stage 3 CKD?”; a cohort can. A document cannot be edited by a clinician mid-consultation in a way that changes the model’s prediction; a cohort can. The two techniques are complementary: cohort retrieval can itself serve as the grounding mechanism for a capable medical language model, which converts the retrieved structured cohort evidence into a clinician-readable narrative, as illustrated in the ERG case study (Section 5.4).

Not in-context learning. Few-shot prompting with patient examples can mimic cohort-based reasoning within the context window of a large language model. By providing several clinically similar patient summaries together with their outcomes and asking the model to reason about an index patient, one can achieve behaviour that superficially resembles cohort retrieval. The appeal of this approach is obvious: it requires neither model retraining nor dedicated retrieval infrastructure. However, we believe this is structurally limited for three reasons. First, context windows remain finite. Even large-context models can accommodate only a modest number of patient examples, far fewer than the cohort sizes typically required to support reliable calibration and outcome estimation. Second, in-context learning lacks an explicit mechanism for modelling near-miss examples. The prompt is presented as a flat collection of demonstrations, and the model is not naturally informed that certain examples are intentionally included as clinically similar yet outcome-divergent contrasts. Third, in-context learning offers no inherent support for lifecycle monitoring. When deployment-time distributions shift, the system produces no corresponding drift signal unless the prompts themselves are revised, and there is no principled mechanism through which the system can indicate that retraining or recalibration is required. By contrast, cohort anchoring offers a structural commitment that survives context resets and remains addressable for the auditing and drift-monitoring capabilities described in Stage 4 (Section 3.5). The two approaches are complementary rather than competing. A cohort-anchored system may still employ in-context learning within its language-model layer, but the underlying commitment to cohort structure must reside at the system level rather than the prompt level.

Conclusion

The next step for EHR foundation models is a structural commitment to cohort anchoring: the explicit, end-to-end treatment of patient cohorts as representational primitives, alignment targets, retrieval objects, and evaluation units. The central argument is methodological. The cafm framework brings together four research directions that have largely matured in parallel (deviation-aware cohort construction, cohort-conditioned pretraining, multimodal cohort alignment, and clinician-in-the-loop refinement) within a unified design. This integration enables a qualitatively different deployment paradigm: one that shifts from opaque risk scores to auditable cohort-based evidence, and from task-specific optimisation to population-grounded foundations that can support a broad range of clinical applications across healthcare systems.

Operationally, the most practical path to adoption is to augment an existing pretrained EHR backbone with a cohort module and release the resulting cohort assignments alongside the model card and deployment documentation. The benefits of auditing emerge immediately: once a cohort retrieval index is constructed, cohort summaries become directly inspectable, providing a transparent view of the populations that underpin model behaviour. Furthermore, deployment reports can move beyond aggregate performance metrics to include cohort-resolved evidence, which we argue should become a standard component of future benchmark and evaluation protocols. In our experience, the primary challenge is not the encoder architecture itself, but the organisational process required to curate, validate, and maintain cohort definitions as clinical populations and practices evolve over time.

Realising this vision requires a community-wide commitment to treating cohorts as first-class objects that are designed, evaluated, documented, and maintained alongside the models that learn from them. The next phase of progress in EHR foundation models may therefore come less from developing new backbone architectures and more from equipping existing models with the population-grounded substrate on which clinical reasoning has traditionally relied. Equally important is the systems and organisational effort required to integrate this substrate into routine clinical and institutional workflows. From this perspective, the principal barriers to cohort anchoring are not conceptual. The necessary modelling components already exist. The remaining challenge lies in engineering, deployment, governance, and the long-term maintenance required to translate the framework from a research proposal into a sustainable clinical capability.