Source-linked AI summary
Foresight-England: Development of a National-Scale Generative AI Model of Electronic Health Records for Medical Event Prediction across the COVID-19 Pandemic
Simon Ellershaw, Christopher Tomlinson, Zeljko Kraljevic, Spiros Denaxas, Harry Hemingway, Cathie Sudlow, Angela M. Wood, Anoop D. Shah, Richard Dobson
TL;DR
Existing clinical prediction tools often address narrow outcomes and may not capture the wider effects of a pandemic. This paper presents Foresight-E, a national-scale generative EHR model and evaluation framework for zero-shot prediction of COVID-19 outcomes and 2023 healthcare events, but quantitative results are currently unavailable.
Problem
Existing clinical risk models often target single outcomes from limited static features, constraining assessment of broader pandemic-related health effects.
Method
The paper develops Foresight-E, a national-scale autoregressive EHR foundation model with zero-shot forecasting and an evaluation framework for COVID-19’s direct and indirect effects.
Results
Quantitative results for 30-day COVID-19 mortality and hospitalisation prediction are currently unavailable because access to the test-set data is withheld.
Takeaways & Limitations
The work provides a methodological template and case study for developing population-scale EHR foundation models within national secure-data infrastructure.
Takeaways & Limitations
The methodology cannot currently be extended beyond COVID-19 research because there is no lawful basis to use the national dataset for other purposes.
Abstract
from arXiv · showhide
Foresight-England (Foresight-E) is the first national-scale generative foundation model of electronic health records (EHRs), developed as a research pilot strictly for COVID-19 research. We evaluated its ability to model the direct and indirect effects of the pandemic. Trained from scratch entirely within the NHS England Secure Data Environment, Foresight-E is a 243-million-parameter transformer decoder. It was trained and evaluated on de-identified, longitudinal EHRs of approximately 61 million individuals, integrating primary/secondary care, death registrations, and COVID-19 data. Training and validation used a 90% subset (54.9 million) spanning November 2018 to December 2022; the remaining 10% (6.1 million) was held out for evaluation. Foresight-E models patient timelines autoregressively, predicting the next medical event given their prior history. At inference, it operates zero-shot, predicting any concept in its ~40,000-code vocabulary without task-specific training. Our tokenisation scheme retains the clinical granularity of ICD-10, OPCS-4, and SNOMED CT codes, jointly representing absolute and relative timing. We designed an evaluation framework for 30-day COVID-19 hospitalisation and mortality, including subgroup analyses by demographic factors and vaccination status. To assess generalisation to unseen future data and the pandemic's indirect effects, we tested the model on medical events from 2023 (beyond its training period), benchmarking against logistic regression and XGBoost. As detailed in the Project Status section, NHS England has paused access to data for the Foresight-E project, meaning quantitative results are currently unavailable. Instead, we share our strategy for tokenisation, architecture, training, inference, and evaluation as a methodological template and case study in the challenges of building population-scale EHR foundation models.
1 Lay summary
Foresight-England is an AI system designed to predict patients’ future medical events and their timing from past medical data. The project evaluated its ability to model direct and indirect health changes during the COVID-19 pandemic, but paused data access means initial results cannot be retrieved.
- System purpose: Foresight-E predicts a patient’s next medical events and when they might occur from their previous medical data.The system works like predictive text, using medical codes instead of words.
- Evaluation aims: The evaluation examined COVID-19 hospitalisation or death within 30 days of a positive test, pandemic changes, and fairness across demographic groups.The study considered shifting viral variants, vaccine rollout, and potential bias in predictions.
- Data: 54.9 million people’s de-identified records were used for training, and 6.1 million people formed a separate test group.The data represented almost the entire population of England and were accessed through the CVD-COVID-UK/COVID-IMPACT consortium.
- Secure implementation: The data, model, and predictions remained inside the NHS England Secure Data Environment under the Five Safes framework.AWS and Databricks supplied computing power and technical assistance but did not access the patient data.
- Project status: Paused NHS England data access prevented retrieval of the study’s initial results.The paper therefore provides a transparent design and testing overview with placeholder mock-ups of intended results tables.
2 Project Status
NHS England paused Foresight-E data access following governance concerns, leaving aggregate predictions unavailable for export. The paper therefore presents its methodology and evaluation strategy transparently, with placeholder results.
- Data access and governance: In May 2025, NHS England paused Foresight-E data access while reviewing concerns about primary-care data use and GDPR processes.The concerns were raised by the British Medical Association and the Royal College of General Practitioners’ Joint GP IT Committee.
- Data access and governance: In April 2026, the ICO closed its review, finding the project’s data use compatible with its original purpose and identifying no GDPR breach.Access to the NHS England Secure Data Environment nevertheless remains paused.
- Work completed: Before access was paused, researchers had trained multiple Foresight-E iterations, generated predictions for direct and indirect COVID-19 outcomes, and conducted initial quantitative evaluations.The work included training on the full training dataset and produced aggregated performance metrics.
- Reporting status: Because aggregate predictions had not been requested for export, quantitative results are unavailable; the paper instead documents methodology, evaluation strategy, and work completed.Placeholder results transparently represent the intended exported aggregate data, including tables and figures.
3 Introduction
The introduction motivates generative EHR models for capturing longitudinal, population-wide effects of COVID-19 and presents Foresight-E as a national-scale, zero-shot foundation model developed within the NHS England Secure Data Environment. Because quantitative results are unavailable, the paper reports its methodology and evaluation framework as a blueprint and case study for secure, population-scale EHR model development.
- Motivation and background: Traditional risk models use limited static features, whereas transformer-based generative EHR models can exploit temporal and longitudinal information and support zero-shot prediction.Autoregressive next-token prediction enables models to perform across diverse tasks without task-specific retraining.
- Model and data: Foresight-E is a 243-million-parameter transformer trained from scratch within the NHSE SDE on linked records from 54.9 million people.The linked national dataset covers approximately 61 million people and includes primary and secondary care data.
- COVID-19 scope and evaluation: Foresight-E was designed to predict COVID-19’s direct effects, such as hospitalisation and mortality, alongside indirect systemic impacts including disrupted care pathways and post-acute sequelae.The evaluation framework targets zero-shot prediction of direct and indirect effects using held-out and temporally held-out data.
- Rationale for national scale: Population-scale data are needed to represent ethnic minority groups, rare diseases, and COVID-related complications in statistically significant numbers and reduce risks of demographic performance gaps.Prior generative EHR models were often limited to single institutions, specific providers, or restricted population subsets.
- Study status and contribution: Quantitative results are unavailable, so the paper reports its data pipeline, tokenisation, architecture, training, inference, and evaluation framework under TRIPOD+AI and PROBAST-AI guidelines.The work is presented as a reproducible methodological blueprint and a case study in developing national-scale generative AI within secure health data environments.
4 Methods
Foresight-E was developed as a securely contained, national-scale EHR foundation model using linked longitudinal data, structured clinical timelines, and autoregressive next-token prediction. Its methods support zero-shot forecasting of diverse medical events while reserving 2023 data for temporal generalisation testing.
- Data governance: All data processing, model training, inference, and evaluation occurred within the NHS England Secure Data Environment under the ‘Five Safes’ framework.Neither model weights nor generated patient timelines could be exported; only aggregated, non-disclosive outputs were permitted.
- Cohort construction: Training used 48.8M patients, validation 6.1M patients, and testing 6.1M patients, with all 2023 events reserved for temporal generalisation.The splits were created through disjoint 10% patient samples to mimic prospective evaluation on future unseen data.
- Timeline representation: Patient histories were represented as chronological sequences of dated diagnoses, procedures, medications, healthcare interactions, and custom-coded events using ICD-10, OPCS-4, and SNOMED CT.Within-day events followed a consistent ordering because timestamps were available only at day-level precision.
- Tokenisation: Tokenisation added demographic tokens, clinical codes, and time-difference tokens, producing a lookup-based vocabulary of approximately 40,000 tokens.Timelines were left-truncated to a maximum of 1,024 tokens at the event level before re-tokenisation, preserving demographic and temporal tokens.
- Model training: Foresight-E is a 243-million-parameter transformer decoder trained from scratch to predict the next token in a tokenised EHR sequence.The model adapted the open-source Llama 2 architecture, used a single dataset pass with checkpointing, and selected the checkpoint with the lowest validation loss.
- Inference: At inference, Foresight-E autoregressively samples and appends tokens until a sentinel event, forecast horizon, or generated-token limit is reached, enabling probabilistic zero-shot predictions across diverse outcomes.The method produces probability estimates for all medical events observed during training without task-specific supervised fine-tuning.
5 Results
Results are presented as placeholders because NHS England’s pause on data access prevents exporting quantitative outputs from the Secure Data Environment. The planned evaluations covered direct COVID-19 outcomes, temporal generalisation, subgroup performance, historical-event effects, and broad 2023 phenotype prediction.
- Results availability: Quantitative results are unavailable for export, so tables and figures report placeholder values and figures where data cannot be shown.The initial quantitative evaluation was completed, but ongoing data-access restrictions prevent exporting results from the Secure Data Environment.
- Direct COVID-19 prediction: Foresight-E was evaluated zero-shot for 30-day mortality and hospitalisation after a positive SARS-CoV-2 test, with AUROC, Brier score, and DR10 comparisons against logistic regression and XGBoost.All reported values for Foresight-E and the supervised baselines are placeholders.
- Temporal generalisation: Across calendar-month strata, AUROC values ranged from _ to _, while the 2023 temporal holdout produced an AUROC of _.The temporal analysis assessed changing COVID-19 epidemiology across the pandemic and evaluated generalisation to data excluded from training and validation.
- Subgroup analysis: Performance disparities were assessed by ethnicity, sex, age, and vaccination status, with AUROC values reported for ethnic and sex groups and ranging _ to _ across age brackets.The corresponding crude mortality rates across age brackets ranged from _% to _%.
- 2023 prospective simulation: Using timelines truncated at 1 January 2023, Foresight-E was evaluated on unseen future events for emergency hospitalisation and mortality against logistic regression and XGBoost.AUROC and Brier-score outputs are placeholders.
- Broad phenotype prediction: Across over 1,400 Phecodes in 2023, AUROC values varied _-_, with an _ association between event prevalence and predictive performance.Phecodes were validated groupings of ICD codes representing clinically meaningful phenotypes.
6 Discussion
Foresight-E demonstrates the feasibility and breadth of a national-scale, zero-shot EHR foundation model for COVID-19 research, while highlighting substantial data, modelling, validation, and governance limitations. Future use depends on addressing these constraints, especially the lack of a lawful basis beyond COVID-19 emergency research.
- Contribution: Foresight-E is a 243-million-parameter model trained de novo on longitudinal EHRs from 54.9 million patients within the NHS England Secure Data Environment.It was developed as a COVID-19 research pilot and evaluated for direct SARS-CoV-2 outcomes and indirect pandemic effects.
- Contribution: National-scale integration of primary care, secondary care, COVID-19, and death-registration data supports population-representative modelling, rare-event prediction, and potential translational utility.The breadth of routinely collected EHR data is also intended to help mitigate algorithmic bias.
- Limitations: The data contain incomplete coding, historical care biases, recording-practice shifts, and exclusions that limit modelling of pre-COVID disease progression and long-term outcomes.GDPPR excludes individuals who died before 1 November 2019, while extending the temporal window would require efficient longer-sequence methods and could introduce immortal time-bias.
- Modelling limitations: Fine-grained tokenisation preserves diagnostic specificity and rare events but enlarges the vocabulary, lowers per-token training frequency, excludes unseen codes, and limits long-history representation.The model’s 1,024-token context length requires timeline truncation, and ontology-aware tokenisation could further improve performance.
- Governance: No lawful basis currently permits extending the national dataset beyond emergency COVID-19 pandemic research directions, making governance the fundamental barrier to future development.Any extension requires new legal permissions through transparent public consultation and a clear public benefit.
7 Conclusion
Foresight-E demonstrates the technical feasibility of developing a national-scale healthcare foundation model within NHS infrastructure, while providing a methodological blueprint for zero-shot healthcare AI. Quantitative results remain withheld, and safe clinical deployment requires broader data, transparent governance, engagement, and rigorous real-world evaluation.
- Contributions: 243-million-parameter Foresight-E was trained on data from 54.9 million NHS patients and evaluated zero-shot across ∼1.4k COVID-related outcomes in a 6.1-million-patient test set.The conclusion highlights the model’s national scale and its integrated framework for data processing, tokenisation, architecture, training, inference, and evaluation.
- Contributions: Quantitative results are currently withheld, but the project demonstrates that a healthcare foundation model can be developed entirely within existing NHS infrastructure.The model combines routinely collected population-scale EHRs with modern generative modelling.
- Future directions: Rebuilding beyond COVID-restricted datasets and expanding clinical modalities could support population-level planning and individualised care, contingent on safe deployment pathways.Realising this potential also requires transparent governance, sustained public and professional engagement, and rigorous evaluation in real-world clinical settings for regulatory approval.
9 Contributor Statement
S.E. and C.T. share joint first authorship and performed the core data, modelling, analysis, and evaluation work. Other contributors supported methodology, funding, resources, supervision, project administration, and manuscript review, with secure-data access restricted to C.T. and S.E.
- S.E. and C.T. contributed equally and share joint first authorship.
- S.E. led conceptualisation, data curation, formal analysis, investigation, methodology, software, validation, visualisation, and manuscript drafting and review.
- C.T. contributed across conceptualisation, data curation, formal analysis, funding, investigation, methodology, project administration, resources, software, supervision, validation, visualisation, and manuscript drafting and review.C.T. is the guarantor for this work.
- Z.K., S.D., H.H., A.M.W., and A.S. supported methodology or manuscript review, while C.S. and R.D. additionally contributed funding acquisition, resources, or supervision.
- Access to the NHS England Secure Data Environment datasets and Foresight cluster was restricted to C.T. and S.E., who exclusively conducted data curation, model training, analysis, software implementation, and quantitative evaluation.
10 Disclosures … A.2 Architecture
The paper discloses authors’ commercial and funding relationships while stating that these organisations had no involvement in the project or access to its resources. Methodologically, Foresight-E used autoregressive next-token prediction and a from-scratch, 243-million-parameter Llama 2-derived transformer architecture.
- 10 Disclosures: SE contracted part-time for Parexel International during the period this work was conducted.
- 10 Disclosures: CT was previously employed by LifeArc and received research funding via the UCL-GSK Phenomics Hub from GSK.
- 10 Disclosures: ZK is a co-founder of Nuraxi, while RD is a co-founder of CogStack and Onsentia.
- 10 Disclosures: ADS receives research funding from BMJ Publishing Group, and the remaining authors declare no competing interests.
- 10 Disclosures: None of these commercial organisations had involvement in funding, study design, data access, model training, evaluation, or execution, or access to the underlying data, code, or model weights.
- A.1 Objective: Foresight-E was trained with an autoregressive next-token prediction objective, using a binary mask to exclude padding and initial demographic tokens from loss calculation.Excluding the initial tokens aimed to mitigate bias from learning to predict them.
- A.2 Architecture: The model adapted the Llama 2 transformer-decoder architecture with Rotary Positional Embeddings and FlashAttention-2, trained from scratch because pretrained weights could not be imported.Governance restrictions and the custom vocabulary prevented importing pretrained weights.
- A.2 Architecture: The Llama decoder architecture was scaled down to 243 million parameters to facilitate efficient training on NVIDIA A10 GPUs.
A.3 Training Protocol · B Endpoint to Token Mapping
Training used a one-epoch, mixed-precision optimization protocol with specified regularization, scheduling, batching, and sequence-length settings. Evaluation endpoints were mapped to timeline tokens, including an example phecode definition.
- A.3 Training Protocol: The model was trained for one epoch with validation loss evaluated every 1,000 steps on 32k samples.
- A.3 Training Protocol: Training used bfloat16 mixed precision, attention dropout 0.1, gradient clipping at maximum norm 1.0, and weight decay 0.1.
- A.3 Training Protocol: The Adam optimizer used β1 = 0.9 and β2 = 0.95, with linear warm-up over 3% of steps to a peak learning rate of 5 × 10−4.Learning rate scheduling continued with cosine decay after warm-up.
- A.3 Training Protocol: The global batch size was 128, achieved through 8-way data parallelism and gradient accumulation with factor 2.
- A.3 Training Protocol: Sequences were right-padded to 1024 tokens for training.
- B Endpoint to Token Mapping: Evaluation endpoints and their associated figures were mapped to timeline tokens.The mapping table included an example phecode definition.
C TRIPOD+AI Checklist · Introduction
The paper is structured against TRIPOD+AI reporting criteria, covering the model’s healthcare context, objectives, data, outcomes, methods, and performance assessment. Several reporting elements remain pending, including model predictors and performance estimates.
- C TRIPOD+AI Checklist: TRIPOD+AI requires identifying the study as developing or evaluating a multivariable prediction model, its target population, and predicted outcome.
- C TRIPOD+AI Checklist: The checklist requires explaining the healthcare context and rationale for developing or evaluating the models.
- C TRIPOD+AI Checklist: The stated objectives should clarify whether the study develops, evaluates, or performs both activities for the prediction model.
- C TRIPOD+AI Checklist: Methods reporting should describe data sources, eligibility criteria, collection setting, predicted outcome and time horizon, model type, building steps, and internal validation.
- C TRIPOD+AI Checklist: Model performance assessment should specify measures such as discrimination, calibration, and clinical utility, alongside participant and outcome-event counts.
- C TRIPOD+AI Checklist: Predictors in the final model and performance estimates with confidence intervals are marked pending, while the discussion should interpret the main results overall.
- Introduction: The introduction should explain the diagnostic or prognostic context, rationale, target population, intended care-pathway purpose and users, health inequalities, and whether development or validation is reported.
Methods · Discussion
Foresight-E was designed as a national-scale generative EHR model with explicit development, evaluation, prediction, and fairness considerations. The study’s interpretation and future applicability remain constrained because quantitative results and the model are not publicly released.
- Methods: The methodological framework addressed model performance, fairness, and generalisation across development and evaluation data, including future unseen data.The model was evaluated on 2023 events to assess generalisation and indirect pandemic effects.
- Discussion: Quantitative results are currently unavailable because NHS England paused access to the Foresight-E project data, limiting interpretation of model performance.The supplied status also indicates that the work is currently not publicly released.
- Discussion: Future research should address the model’s applicability and generalisability, including implementation with poor-quality or unavailable input data and use in current care.The discussion should also clarify required user interaction and expertise.
D PROBAST+AI Assessment
The PROBAST+AI assessment found appropriate data sources and study design, but raised concerns about participant selection and applicability to the intended prediction-model use. Analysis quality was rated low concern, while predictor and outcome domains were assessed with multiple quality and applicability criteria.
- Participants and data sources: Appropriate data sources and study design were used, but participant selection raised concerns about dataset representativeness and alignment with the intended prediction-model use.The assessment answered yes for data sources and study design, while separately recording concerns regarding selection quality and participant-data matching.
- Predictors: Predictor assessment was evaluated for consistent definition, preprocessing, outcome blinding, and availability at intended use, with concerns recorded about predictor quality and applicability.The assessment framework explicitly examined predictor definition, preprocessing, assessment timing, and whether predictors were available when the model would be used.
- Outcome: Outcomes were defined and assessed appropriately, while the assessment also considered consistency, predictor blinding, timing, and concerns about outcome quality and applicability.The outcome domain covered outcome definition, assessment procedures, and the interval between predictor and outcome determination.
- Analysis: Analysis quality was rated low concern, with evidence that methods were used to address potential model overfitting.The analysis criteria also addressed sample size, predictor handling, missing or censored data, class imbalance, and model development and performance reporting.