Editor’s introduction
The study evaluates a multimodal machine learning approach that combines longitudinal diagnosis codes and laboratory measurements from electronic health records to detect pancreatic ductal adenocarcinoma (PDAC) up to one year before clinical diagnosis. The model uses neural controlled differential equations to handle irregular lab time series and cross-attention mechanisms to capture interactions between diagnosis codes and lab data. Performance is measured using AUC and AUPRC, with results showing improvements over existing methods. The model also identifies specific diagnosis codes and laboratory panels linked to elevated PDAC risk. Findings are based on a dataset of nearly 4,700 patients and include both known and newly highlighted biomarkers.
Introduction
Pancreatic ductal adenocarcinoma (PDAC) is one of the deadliest cancers, with a five-year survival rate of approximately 10%. Despite its relatively low incidence, PDAC is expected to become the second leading cause of cancer-related deaths in the U.S. by 2030. Most patients are diagnosed at advanced or metastatic stages because symptoms do not manifest in the early stages. Existing screening protocols are limited to high-risk individuals, excluding a substantial portion of the affected population.
The increasing availability of longitudinal electronic health records (EHRs) provides an opportunity to improve PDAC detection in broader populations. Our goal is to develop a multimodal approach that integrates sequential laboratory measurements and disease code histories for early PDAC detection. We address this goal by modeling laboratory trajectories as irregular time series using neural differential equations, encoding diagnosis codes sequence with a bidirectional recurrent model, and apply a cross-attention fusion mechanism to capture complementary information across modalities.
Prior studies demonstrated that machine learning (ML) can identify predictive patterns for early detection of PDAC from EHRs. However, existing approaches rely on a single modality, either using diagnostic codes or laboratory tests, failing to capture the cross-modal interactions. Labs provide high-resolution, continuous signals that reveal early physiological changes such as rising glucose levels months before PDAC symptoms appear. In contrast, diagnostic codes capture clinically validated events, including comorbidities, symptoms, and imaging findings, that labs may miss. Thus, integrating these modalities provides complementary information on patient history, resulting in a comprehensive multimodal representation of disease progression.
However, simple fusion of lab measurements and diagnosis codes (e.g, concatenation) presents two key challenges. First, the modalities differ in temporal resolution and structure: lab tests constitute continuous irregular time series, while diagnosis codes capture sparse, discrete clinical events. This mismatch necessitates modality-specific temporal encoding prior to fusion. Second, frequently ordered lab tests are collected at varying frequencies and reflect distinct physiological systems, such as hepatic and metabolic functions, that evolve on different timescales over the disease trajectory. Consequently, the model must learn time-varying lab representations while incorporating mechanism to capture cross-modal dependencies.
Machine Learning for Early Detection of PDAC
There has been growing interest in applying ML methods to different types of EHR data for pancreatic cancer risk assessment at scale in recent years. Early studies leveraged the occurrence of specific diagnosis codes in a large EHR database and developed shallow ML models, including Extreme Gradient Boosting and regularized logistic regression, to infer cancer risk. However, these approaches did not account for the temporal dynamics in patients’ longitudinal histories. To address that, represented patients’ disease trajectories as a longitudinal sequence of clinical events and introduced a transformer architecture with an updated positional encoding, improving predictive performance for cancer risk recurrence. While these diagnosis code-based methods capture broad disease trends, they overlook fine-grained changes in patients’ histories, which are better reflected in laboratory measurements. To address this limitation, proposed a group-based neural network in which labs are grouped based on related organ function, a dedicated neural network processes the inputs of each group, and a final layer concatenates the feature representations of the different groups and projects them into a shared space for PDAC risk prediction six months in advance. However, this approach achieved limited performance due to its reliance on cross-sectional lab measurements at a single encounter, missing crucial longitudinal trends in patient data. A cited study introduced a group-based neural network in which individual small networks model the longitudinal measurements of each lab as irregular time series data, employing a Poisson-based masking algorithm to account for random missingness in measurements, thus achieving significant improvements in early PDAC prediction. Despite those advancements, no prior work has proposed a multimodal approach that integrates both clinical trajectories from diagnosis codes and longitudinal laboratory measurements for the early detection of PDAC. Our work addresses this gap by combining these two complementary data sources, leveraging their interactions to improve predictive performance.
Modeling of Irregular Health Time Series
Several methods have been proposed to model irregular time series within healthcare applications. GRU-D incorporates exponential decay in hidden states to capture temporal patterns. SeFT models each observation individually using a set function approach and then aggregates their representations. RAINDROP represents data as distinct sensor graphs to handle irregular temporal dependencies. mTAND utilizes a multi-time attention mechanism to learn from irregularly sampled data. For continuous-time modeling, neural ODEs employ neural networks to approximate complex differential equations, enabling effective interpolation and extrapolation. ODE-RNN expands on neural ODEs by incorporating new observations to update the hidden states of an RNN. Neural CDEs extend the concept of neural ODEs by incorporating control paths to model irregular time series data. This approach has demonstrated state-of-the-art performance in handling irregular time series functions compared to the other methods. In our work, we leverage Neural CDEs within a new clinically informed model architecture that focuses on grouping lab measurements into functional panels and learning interactions between panels.
Methods
Our approach is motivated by four key observations: 1) Pancreatic cancer often remains asymptomatic until advanced stages, resulting in sparse and irregular clinical measurements for majority of patients. 2) Patients engage with the healthcare system at varying frequencies based on disease severity, comorbidities and individual behaviour, resulting in variable-length clinical histories. 3) Routine lab tests are ordered in panels that reflect distinct physiological systems (e.g., hepatic or metabolic). Modeling these panels separately aligns with diagnostic workflows and enables learning function-specific patterns. 4) Capturing interactions between lab trajectories and diagnostic codes would allow the model to integrate complementary signals - labs often indicate early physiological changes during cancer progression, while diagnoses reflect clinically significant events.
Cross-Attention Fusion Module
Simple multimodal fusion via concatenation fails to account for the structural and temporal differences between laboratory trajectories and diagnosis codes. To address this, we introduce a cross-attention fusion mechanism that explicitly models inter-modal dependencies and enables feature-level alignment across modalities.
Datasets
We collected a dataset of 9,950 patients from a private hospital, including 2,015 patients diagnosed with PDAC and 7,935 control patients. The dataset spans up to 14 years of patient trajectories and includes demographics, laboratory results, and diagnosis codes. The cancer cohort was identified using ICD-10 codes. The ICD system is structured hierarchically, ranging from broad categories such as C: “Neoplasms” to more specific disease codes like C25.0 “Malignant neoplasm of head of pancreas”. We considered patients with at least one diagnosis code under C25 category (excluding C25.4: “Malignant neoplasm of endocrine pancreas”) as PDAC cases. For the control group, we sampled patients from the hospital’s EHR system, matching them to PDAC patients by sex and age at diagnosis while ensuring that they had no history of any C25 diagnosis. Our analyses focused on longitudinal laboratory measurements and the chronological sequence of clinical events represented by diagnosis codes. All diagnosis-code-based analyses were conducted using the first three characters of the ICD codes to reduce sparse representations of diagnoses and focus on broader categories.
Tasks and Data Processing
In this work, we develop models for the early detection of PDAC at three different prediction windows: 6 months, 9 months, and 12 months prior to diagnosis. We focus on the 6-month detection task as our primary evaluation and use the 9- and 12-month windows to further assess the efficacy of our multimodal pipeline.
CancerRiskNet
: CancerRiskNet is a transformer-based architecture trained on long disease trajectories derived from diagnosis codes. It employs a modified positional encoding scheme that computes the position of each disease code token based on the time interval between the diagnosis date and the date of pancreatic cancer diagnosis.
Grouped Neural Network (GrpNN)
: GrpNN is a grouped neural network architecture designed to handle irregular, multivariate laboratory time series data. It independently embeds each variable’s time-series into a lower-dimensional space. A Poisson-based random masking strategy is applied to the input during training to model the effects of information missingness.
Composite Neural Network (CompositeNN)
: CompositeNN is a structured deep embedding framework that groups laboratory features into organ-specific composites. Each group is processed through a dedicated neural network, and the resulting embeddings are concatenated to form the final representation used for early PDAC prediction.
Evaluation Metrics
To evaluate predictive performance for early PDAC detection, we use the Area Under the Curve (AUC) and the Area Under the Precision-Recall Curve (AUPRC) as metrics. To assess model interpretability, we leverage Integrated Gradients (IG) to analyze the contribution of individual diagnosis codes in identifying PDAC cases. Additionally, we study the attention weights from the Self-Attention layer in the labs processing module to evaluate the relative importance of different laboratory panels on the predictions.
Results
In this section, we present a comprehensive evaluation of our approach against the proposed baselines for early detection of PDAC at 6 months in advance (Section 5.1) and at 9 and 12 months in advance (Section 5.2). We further include an ablation study to assess the contribution of each component of our approach (Section 5.3). Lastly, we analyze the interpretability of our model (Section 5.4) by identifying key diagnosis-code-based and laboratory-based features associated with early PDAC detection.
Discussion
We presented a novel approach for the early detection of PDAC using routinely collected laboratory measurements and diagnosis code histories. We proposed a multimodal formulation that captrues the interplay between laboratory data and diagnosis codes to learn more informative representations of disease history. Additionally, we introduced a new module to encode longitudinal laboratory data as irregular time series at the panel level by grouping labs into functional panels, learning panel-specific representation through NCDEs and inter-panel representations by a self-attention mechanism. We also introduced a module to learn rich feature representations from the temporal trajectories of diagnosis codes by generating compressed BioGPT embeddings of the codes and learning their sequence representation with a bidirectional recurrent network.
The findings show that our framework significantly improves early detection of PDAC at different prediction times up to one year in advance. Our method consistently outperforms several competitive baselines across five-fold cross-validation. The ablation study further highlights the contribution of each component in our architecture. First, modeling laboratory time series using continuous-time dynamics, along with panel-level and patient-level representations, outperforms approaches that impose priors on missingness or rely on fixed-length sequences. Second, incorporating pretrained language models with recurrent networks yields better diagnosis trajectory representations than training from scratch. Third, learning rich cross-modal representations between labs and diagnosis codes further boosts predictive performance.
From an interpretability standpoint, our analysis showed that the model’s behavior aligns well with clinical knowledge. Specifically, the top contributing diagnosis codes for early detection include “Acute Pancreatitis” and “Chronic Pancreatitis”, both are clinically recognized risk factors for PDAC. Other codes, such as R32 (“Unspecified urinary incontinence”), are indirectly linked to PDAC through associations with aging and diabetes-related complications. The model also highlights additional codes that could serve as potential biomarkers for identifying high-risk patients, including J20 (”Acute bronchitis”), R89 (”Abnormal findings in specimens from other organs, systems, and tissues”), L57 (“exposure to UV radiation”), and other skin-related codes (L82, L73). Although these codes are not directly linked to PDAC, existing clinical studies have reported associations between their underlying conditions and specific aspects of pancreatic cancer. Finally, our analysis revealed that combining the two modalities during training enables the model to assign greater importance to panels more closely associated with PDAC, such as the liver and metabolic panels. We hope these insights encourage further focused clinical research to explore these potential links.
Limitations and Future Work
Our method has several limitations that will inform the direction of future work. First, the cross-attention fusion mechanism is currently applied at the aggregated representation level of labs and diagnosis code trajectories. However, different lab panels may have distinct relationships with specific diagnosis codes, and capturing these fine-grained interactions could improve performance and interpretability. Second, in building our diagnosis code processing module, we leverage BioGPT to generate feature embeddings. While BioGPT can produce clinically meaningful representations, it is not explicitly trained on sequences of structured diagnosis codes, which may limit its ability to capture disease trajectory representations fully. Third, our approach has been trained and evaluated on a single dataset, which may limit the generalizability of our findings. Pancreatic cancer is a rare disease, and publicly available datasets with sufficient temporal resolution and diagnostic detail are scarce, which constrained our ability to perform external validation.
In future work, we plan to address these limitations. We will extend our model to better capture fine-grained interactions between specific lab panels and related diagnosis codes. We also aim to develop a dedicated approach for learning representations of disease trajectories that takes the temporal and hierarchical properties of diagnosis sequences into account. Finally, we are actively collaborating with multiple hospitals to acquire more diverse datasets and evaluate our models across different clinical settings, with the goal of improving robustness and generalizability.
Conclusion
Our work demonstrates that routinely collected laboratory measurements and diagnosis codes can be effectively used for the early detection of PDAC, enabling scalable risk screening across a broader population. Our model substantially improves predictive accuracy by learning a cross-modal representation for sequences of diagnosis codes and longitudinal lab data. The model builds on clinically established risk factors to generate the predictions while also uncovering novel diagnostic signals that may serve as potential early biomarkers. Furthermore, it leverages relevant lab panels to capture physiologically meaningful patterns, enhancing predictive performance.


