Trained on millions of health records and chest X-rays, Oncoformer detected signals spanning cancer risk, stage, treatment response, and recurrence.

Study: Advancing cancer detection and treatment using longitudinal routine clinical data. Image Credit: Lightspring / Shutterstock

In a recent study published in the journal Cell, researchers developed Oncoformer, an artificial intelligence (AI)-based transformer model to advance cancer detection and management using longitudinal electronic health records (EHRs) and chest X-rays.

Developed using data from 2.81 million individuals with 11.9 million clinical visits and evaluated in independent cohorts, the framework can classify existing cancer, distinguish individuals who would receive a cancer diagnosis up to one year later, predict the tumor stage that would be assigned at diagnosis, forecast observed responses to treatment, and stratify recurrence-free survival (RFS) risk for 10 cancer types. If validated in large, prospective, randomized controlled trials across diverse populations, the model could support risk-adapted cancer monitoring and improve personalized cancer care.

Many cancers are still diagnosed only after they have progressed, missing the window when treatment is often most effective. As the disease advances and spreads to other organs, prognosis worsens, and survival rates decline. Treatment selection is also often empirical, with limited personalized risk assessment and surveillance. Organ-specific imaging can be costly, involve radiation exposure, and cannot provide pan-cancer risk assessment, while emerging multi-cancer blood tests remain expensive and have variable sensitivity for early-stage disease. Existing AI frameworks also often address a single clinical task or depend on specialized data that are not routinely available. Novel methods are needed to provide more comprehensive assessments for holistic care using readily accessible data.

About the study

In the present study, researchers introduced Oncoformer, a multimodal AI framework for cancer detection using routinely available longitudinal EHR data, including vital signs and laboratory values, together with opportunistically collected chest X-rays.

The team developed the model using COMPASS-Main, which included 2,810,742 individuals and 11,934,576 clinical visits. Across COMPASS-Main and COMPASS-Replication, the curated dataset included approximately 3.67 million individuals and 17.75 million healthcare encounters, including 347,940 patients with cancer across clinical stages I-IV and more than 3.32 million non-cancer controls.

The non-cancer controls included people with comorbidities and known cancer risk factors. The researchers validated the findings using the COMPASS-Replication cohort (862,247 participants) and conducted cross-population analyses using data from the United Kingdom Biobank (UKB), a resource containing 502,665 participants. From this resource, they identified 44,275 participants with cancer and constructed a matched case-control cohort.

Oncoformer learns an integrated picture of an individual’s health by reconstructing masked clinical information while reducing the influence of missing data and differences across cohorts. By analyzing longitudinal clinical data, the model captures latent signals associated with cancer evolution. Using this learned patient profile, Oncoformer classifies current cancer status, predicts a future cancer diagnosis up to 1 year in advance, infers the stage that will be assigned at diagnosis from pre-diagnostic data, forecasts post-treatment tumor or biomarker trajectories across 6 cancer-therapy settings, and stratifies patients by RFS across 10 cancer types. For the one-year prediction task, the model excluded all clinical data recorded during the 90 days immediately preceding diagnosis.

To determine how well Oncoformer performed, the researchers calculated the area under the receiver operating characteristic curve (AUROC) for cancer diagnosis, future prediction, and stage inference. AUROC measures how well a model distinguishes between groups, with values closer to one indicating better discrimination. They assessed treatment-response trajectories using R² values, which measure how closely predictions match observed outcomes, and evaluated RFS, defined as the time to recurrence or death from any cause, using hazard ratios, Kaplan-Meier analyses, and Harrell’s concordance index. They then compared model performance with task-appropriate baseline models, including XGBoost and DINO v2. They also used Cox regression and UMAP, a technique for visualizing how similar patient profiles group together. They additionally conducted pathway analyses using genomic profiling data and validated model predictions using postoperative pathological findings.

Results

The model showed strong discrimination for cancer diagnosis, prediction up to one year before diagnosis, and stage inference. The AUROC values for pan-cancer diagnosis, prediction of cancer onset up to a year before clinical diagnosis, and tumor stage inference were 0.956, 0.869, and more than 0.90 on average, respectively. The model also forecast treatment-response trajectories with R² values ranging from 0.573 to 0.721 and significantly stratified patients into groups with different RFS risks across 10 cancer types.

The predicted tumor stage scores correlated with mutation burdens in established genomic pathways associated with cancer progression. Albumin levels and neutrophil percentage were most important for pan-cancer diagnosis, while alkaline phosphatase (ALP) and lactate dehydrogenase (LDH) were most influential for tumor staging. Different biomarkers also contributed to treatment-response predictions, consistent with established cancer biology. The model identified mean platelet volume (MPV) and indirect bilirubin as key factors associated with response to epidermal growth factor receptor (EGFR) inhibitors.

Oncoformer placed biologically related cancers near one another in its computational patient map. Breast, ovarian, and cervical cancers were concentrated in nearby regions of this map, and Cox regression confirmed that clusters enriched for cancers of the female reproductive system were associated with higher future risks of breast and ovarian cancer. These findings suggest that the model captured biologically related patterns associated with future cancer risk.

Oncoformer also outperformed XGBoost and DINO v2 in cancer risk estimation. In a prospective colorectal cancer screening pilot involving 3,025 asymptomatic individuals selected as being at high risk from 38,059 consenting health-check participants, the model identified 54 of 60 cancer cases, with 90% sensitivity, 86.8% specificity, and an AUROC of 0.927, supporting further evaluation of its clinical relevance. In the UKB dataset, the researchers evaluated both direct application without additional UKB training and a version adapted using a UKB training partition. The adapted version consistently improved baseline model predictions across cancer types, especially for lung and pancreatic cancers. Oncoformer also achieved the highest Harrell’s concordance (C-index) values, indicating how well predicted risk rankings correspond with patient outcomes, across all cancer types, compared with Cox proportional hazards, random survival forests, and DeepHit survival models.

Study limitations

However, most analyses were retrospective, and treatment-response predictions were derived from observational data that could not eliminate unmeasured differences affecting treatment assignment. The COMPASS population was more than 99% Asian, whereas UKB participants were predominantly White Europeans and subject to volunteer selection bias. Performance in unselected, average-risk screening populations, therefore, remains unknown, and differences in missing data or clinical testing practices could affect results in other healthcare systems.

Conclusions

The findings highlight the development of a transformer model that can assess cancer evolution by integrating EHRs, laboratory investigations, and chest X-rays. Together, the results suggest that routinely collected clinical data may contain signals relevant to multiple stages of cancer detection, treatment, and follow-up. Looking ahead, large prospective trials across multiple cancer types and diverse clinical settings are required before clinical deployment. Radiogenomic analyses and experimental biological validation could help clarify the molecular mechanisms associated with the latent predictive signals. Such efforts could accelerate clinical translation of these models and may eventually improve risk stratification, facilitate early diagnosis, and guide treatment decisions.