A dynamic risk prediction framework for Alzheimer's disease and related dementias with interpretability Authors: Xiaoyang Ruan, Shuyu Lu, Sunyang Fu, Jaerong Ahn, Fang Chen, Rui Li, Andrew Wen, Liwei Wang, Ezenwa Onyema, Victoria Tang, Hongfang Liu Published: 2026 ABSTRACT Alzheimer’s disease and related dementias (ADRD) develop years before symptoms emerge, making early prediction critical. Electronic health records (EHR) offer a scalable alternative to neuroimaging but are challenged by irregular encounters, data sparsity, and limited interpretability. We propose Gated Recurrent Unit with Decay & Attention (GRU-DA), which integrates GRU-D missingness modeling with RETAIN-style attention for interpretable risk monitoring. The model was trained on the University of Texas Physicians EHR (15,172 ADRD cases with 1:10 matched controls) and externally validated in the All of Us cohort. EHR data up to 10 years before diagnosis were used, with random follow-up initiation to reflect real-world encounters. Both GRU-DA and GRU-D outperformed competing models, particularly beyond 5 years of follow-up and achieved AUROC ~ 0.7 after 8.5 years. Prediction performance depended more on data availability than follow-up length: 1 year with 15% data availability (AUROC 0.75, Average Precision 0.5) was comparable to 7.5 years with 10% availability. For individual cases, GRU-DA produced stable risk predictions with some variability in timestep and feature-level attributions across folds. These results demonstrate EHR data can support dynamic ADRD risk monitoring up to 10 years before diagnosis, with effectiveness strongly influenced by data completeness. Introduction Alzheimer’s Disease Related Dementias (ADRD) impact tens of millions globally1, an estimated 6.9 millions Americans age 65 and older today, and is the fifth leading cause of death among this age group2. The brain changes associated with Alzheimer’s—such as amyloid-β accumulation and tau protein tangles—can begin more than a decade before noticeable dementia symptoms appear3. During this early phase, individuals may remain cognitively normal but have increased risk of dementia progression. Currently all forms of AD/ADRD are considered incurable, and advanced stages often lead to life-threatening complications4. Early detection of AD/ADRD offers an opportunity for timely therapeutic intervention, which may help slow disease progression and guide personalized care planning. To date, numerous studies have been conducted on AD/ADRD prediction, either using Electronic Health Record (EHR) data alone5, neuroimaging data alone6, or both7. While features from neuroimaging data greatly improve model performance6, their limited availability8, especially at the asymptomatic stage of ADRD, largely limited their application in the general population. As a comparison, routinely collected health data in EHR and clinical notes in the general population is a promising data repertoire. On this perspective, a large body of work has been revolving around EHR-based ADRD prediction5, with various machine learning or deep learning models that take either static or temporal features to model various endpoints like probability of ADRD at a fixed future horizon9 or next visit10. However, almost none of the existing studies tapped simultaneously on three major challenges to the broader applicability of ADRD predictive models: 1) the extreme feature sparsity, particularly at asymptomatic stage of the disease, 2) an elegant ante-hoc interpretable model framework that can attribute the predicted ADRD risk to specific feature(s) at individual level to aid clinical interpretation, and 3) random clinical encounters that undermine validity of models assuming fixed time to endpoint. On the data missingness side, existing studies primarily resorted to mean/median/mode imputation10,11, semi complete-cases-only study9, or not mentioned at all 12–15. While these methods are easy to implement, they break the integrity of the model, wipe out informative missing16 and introduce unmeasurable bias. This raises particular concern when asynchronicity and associated high volume of missing data are prevalent in the prolonged asymptomatic stage of ADRD. In terms of model interpretability, most existing works did not provide direct model interpretation10,17. or resorted to post-hoc methods like SHAPLEY18 or SHAP value9,14. While widely used, these methods estimate feature contributions through marginalization procedures implicitly assume feature independence, unable to fully estimate feature sets, having coherent assumptions about the prior training distribution, do not correct for confounding, colliders, or suppressor variables, and can produce inconsistent explanations19. It is also mathematically challenging and computationally prohibitive to calculate SHAP value on every time step for high dimensional longitudinal EHR with massive missingness. To this end, we propose a novel deep learning architecture named GRU-DA (Gated Recurrent Unit with Decay & Attention) to tackle the challenges associated with dynamic ADRD risk assessment. The proposed architecture combines the advantage of GRU-D20, which has proved robustness in automated missing parameterization and real-time risk monitoring by incorporating new measurements21–23, and reverse time attention architecture (RETAIN)24 alike interpretability architecture, which can potentially provide model-specific inherent interpretations at both timestep and feature levels. By integrating the strengths of both models, we prove that GRU-DA provides clinically meaningful attention-based interpretations while preserving GRU-D’s robust handling of missing data, with overall marginal trade-off in predictive performance. Results Study population The UT Physicians cohort included 14,937 individuals with an ADRD diagnosis and 145,443 age- and sex-matched controls. Participants ranged in age from 50 to 107 years, with females comprising 56% of the ADRD case group. In comparison, the All of Us cohort was slightly younger and had a higher proportion of males, White individuals, and non-Hispanic participants. After 1:10 case to control matching, the ADRD case and control groups showed comparable distributions of age, sex, race, and ethnicity within both the UT Physicians and All of Us cohorts. (Table 1).Table 1Demographics of the ADRD case and matched control cohortsUT Physician (2000–2024)All of Us (2010–2023) External ValidationADRD CaseControlADRD CaseControlCount14937145443158415169Age Median78787373 Min50505050 1st Quartile72716666 3rd Quartile84847878 Max1061079696Gender Female8293(56%)81517(56%)753(48%)7202(47%) Male5825(39%)57399(39%)804(51%)7827(52%) Unknown819(5%)6527(4%)27(2%)140(1%)Race White7951(53%)78630(54%)1023(65%)10168(67%) Black2528(17%)24145(17%)188(12%)1756(12%) Asian a553(4%)4958(3%)27(2%)193(1%) Others b28(0.2%)55(0.0%)9(0.6%)69(0.5%) Unknown3877(26%)37655(26%)337(21%)2983(20%)Ethnicity Non Hispanic9427(63%)92732(64%)1292(82%)12612(83%) Hispanic1294(9%)11852(8%)229(14%)1974(13%) Unknown4216(28%)40859(28%)63(4%)583(4%)a Includes Chinese, Japanese, Korean, Filipino, Vietnamese, Asian Indian.b Includes American Indian or Alaska native, Other pacific islander, and Polynesian. Table 1Demographics of the ADRD case and matched control cohortsUT Physician (2000–2024)All of Us (2010–2023) External ValidationADRD CaseControlADRD CaseControlCount14937145443158415169Age Median78787373 Min50505050 1st Quartile72716666 3rd Quartile84847878 Max1061079696Gender Female8293(56%)81517(56%)753(48%)7202(47%) Male5825(39%)57399(39%)804(51%)7827(52%) Unknown819(5%)6527(4%)27(2%)140(1%)Race White7951(53%)78630(54%)1023(65%)10168(67%) Black2528(17%)24145(17%)188(12%)1756(12%) Asian a553(4%)4958(3%)27(2%)193(1%) Others b28(0.2%)55(0.0%)9(0.6%)69(0.5%) Unknown3877(26%)37655(26%)337(21%)2983(20%)Ethnicity Non Hispanic9427(63%)92732(64%)1292(82%)12612(83%) Hispanic1294(9%)11852(8%)229(14%)1974(13%) Unknown4216(28%)40859(28%)63(4%)583(4%)a Includes Chinese, Japanese, Korean, Filipino, Vietnamese, Asian Indian.b Includes American Indian or Alaska native, Other pacific islander, and Polynesian. Demographics of the ADRD case and matched control cohorts a Includes Chinese, Japanese, Korean, Filipino, Vietnamese, Asian Indian. b Includes American Indian or Alaska native, Other pacific islander, and Polynesian. Data availability before ADRD diagnosis Analysis of the five modalities from the UT Physician cohort revealed very limited data availability, measured as yearly feature presence rate, prior to 10 years before ADRD diagnosis. For instance, among the 756 types of vital signs and lab tests recorded in the EHR for current ADRD cases, the highest yearly presence rate before the 10-year mark was below 0.52% (i.e., only about one in 200 patients had a measurement recorded in a year). After applying a feature presence rate threshold, we retained 64 out of 756 vital and lab features, and 81 out of 281 CCS diagnosis codes, each with at least a 5% yearly presence rate, for use in model training and prediction. Along with the FSA score, risk medications, and procedures, the final list of features used by the models and their presence rate over time are visualized in Supplementary Fig. 1 and tabulated in Supplementary Data 1. In general, the presence rates of all features increased over time, peaking at the time of ADRD diagnosis. Performance of GRU-DA in dynamic ADRD risk assessment To simulate real-world conditions in which patients may initiate ADRD risk assessment at varying time points, we randomly assigned a follow-up initiation date to each individual in the study cohort, and masked the data prior to the initiation date (Fig. 7). The feature presence rate after random shift is visualized in Supplementary Fig. 2. As illustrated in Fig. 1, GRU-D, GRU-DA, and RETAIN topped the competing models and demonstrated improved predictive accuracy on longer follow-up time. The three models performed comparably within 5 years of follow-up, beyond which RETAIN degraded slightly (Supplementary Data 2). Brutal-force transfer of the three models to the All of Us cohort showed generally improved performance on major benchmark metrics except for average precision (Supplementary Figs. 3–5). Notably, a minimum of 4 years of follow-up was needed to reach an AUROC of 0.6, whereas 8.5 years were required to achieve an AUROC of 0.7. Over the 10-year follow-up period, 60% to 75% of individuals with above-median predicted ADRD risk were diagnosed with ADRD within the subsequent six months. In contrast, the LSTM and SeFT models remarkably underperformed on major metrics throughout the 10-year follow-up. Atemporal logistic regression models were unable to demonstrate clinical utility, with AUROC values remaining near 0.5 and flag rates around 0.6 throughout the follow-up period. For GRU-DA, predicted probabilities were aligned with observed ADRD probabilities by applying a single post-process calibration function across different follow-up timesteps (Supplementary Fig. 6).Fig. 1ADRD risk prediction performance throughout 10-year follow-up. Predictions made on the UT Physician held-out dataset.Flag rate the lower the better. Error bars represent 95% CI based on 6-fold models. ADRD risk prediction performance throughout 10-year follow-up. Predictions made on the UT Physician held-out dataset. Flag rate the lower the better. Error bars represent 95% CI based on 6-fold models. Impact of data availability on prediction performance At various follow-up durations, greater data availability is associated with improved prediction performance (Fig. 2). A significant performance gain was observed when data availability—measured by the average yearly feature presence rate within the 10 years preceding ADRD diagnosis—exceeds 10%. Notably, model performance can be enhanced either by extending the follow-up period or by increasing data availability, with the latter playing a major role. For instance, in terms of AUROC and average precision (i.e., the proportion of true positives among predicted positives), 1 year of follow-up with 15% data availability yields performance (AUROC of 0.75 and average precision of 0.5) comparable to 7.5 years of follow-up with 10% data availability. At a 10% data availability threshold, 34% of ADRD cases remain after random shifting of follow-up initiation dates (Supplementary Fig. 7), approximating real-world clinical data availability.Fig. 2Prediction performance of GRU-DA across varying data availability thresholds and follow-up durations.Results based on the UT Physician held-out dataset. For each threshold, ADRD cases with data availability exceeding the specified level were included, along with their matched controls (regardless of the controls’ data availability). Metrics calculated for a minimum of 30 ADRD cases. Error bars represent 95% CI based on 6-fold models. Prediction performance of GRU-DA across varying data availability thresholds and follow-up durations. Results based on the UT Physician held-out dataset. For each threshold, ADRD cases with data availability exceeding the specified level were included, along with their matched controls (regardless of the controls’ data availability). Metrics calculated for a minimum of 30 ADRD cases. Error bars represent 95% CI based on 6-fold models. Permutation modality and feature importance At the modality level, CCS codes showed the greatest impact, with permutation leading to an average AUROC decrease of 12.4% (95% CI: [11.7–13.2%]). The remaining modalities, ranked by decreasing impact, were demographics (2.8%; [2.3–3.4%]), lab and vital measurements (1.0%; [0.8–1.2%]), risk medications (0.9%; [0.5–1.3%]), FSA (0.2%; [0.1–0.3%]), and procedure length (0.03%; [–0.003% to 0.1%]). Figure 3 presents the top 20 features that led to the greatest AUROC reduction following permutation. Among the 81 CCS codes entered in the model, the most influential one was the diagnosis of delirium, dementia, and other cognitive disorders, which caused a 3.1% (95% CI: [2.7–3.5%]) decrease in AUROC. The second important CCS code was unclassified residual codes (0.8%; [0.3–1.2%]). Significant or marginally significant effects were also observed for diagnoses such as other nervous system disorders, hyperlipidemia25, mood disorders26, Parkinson’s disease27, spondylosis/intervertebral disc disorders/other back problems28, osteoarthritis29, and hypertension30 among other CCS codes (Supplementary Fig. 8). Most demographic factors showed significant influence, with gender, race, and ethnicity showing more contribution than age (Fig. 3). The use of antipsychotic31, anticonvulsant/antiepileptic32,33, and antihistamine34 medications showed significant effect (Supplementary Fig. 9). In contrast, antidepressant35 and anticholinergic36 only have marginal impacts. Labs and vital measurements generally have < 0.1% impact, with factors like alanine aminotransferase37,38, mean corpuscular volume39,40, respiratory rate41, thyrotropin42, and urea nitrogen43 showed significance (Supplementary Fig. 10). For FSA scores, only difficulty in self managing medication showed significance (Supplementary Fig. 11). Among the seven procedure types, joint procedure44 has the largest effect size (< 0.05%) but failed to show significance. Notably, no features were found to improve AUROC after permutation, suggesting an absence of confounding or misleading signals in the model.Fig. 3Top 20 features contributing to AUROC.Error bars represent 95% CI based on 6-fold models. Top 20 features contributing to AUROC. Error bars represent 95% CI based on 6-fold models. Partial dependence plot Partial dependence plots for laboratory and vital measurements, CCS codes, and risk medications are shown in Supplementary Figs. 12–14. Visual inspection reveals complex, nonlinear relationships between perturbations in many features and predicted ADRD risk. For lab and vital measurements, changes in serum anion gap, folate, mean corpuscular volume, and systolic blood pressure levels generally lead to increased risk, with increments showing a slightly greater impact than decrements. Conversely, changes in body mass index, body surface area, body weight, glomerular filtration rate, and triglycerides tend to reduce predicted risk, with increments showing slightly stronger protective effects. Clear positive correlation (i.e., increment leads to higher risk, decrement leads to lower risk) were observed for serum basophils volume, calcium, cholesterol (mass), and neutrophils per 100 leukocytes, while clear negative correlation (i.e. increment leads to lower risk, decrement leads to higher risk) were seen for hematocrit volume, hemoglobin (mass), lymphocytes volume, and neutrophils (absolute count). Among CCS codes, the strongest risk-increasing diagnoses included Parkinson’s disease and conditions related to delirium, dementia, and other cognitive disorders. For risk medications, antipsychotics, antiparkinsonian agents, and antidepressants were the top three categories most strongly associated with changes in ADRD risk. Model interpretability at individual level In this section, we present two ADRD patients from the UT Physician held-out dataset as illustrative examples to demonstrate how GRU-DA interprets the contributions of input features over time during follow-up. The predicted ADRD risks for these two patients are shown in Supplementary Figs. 15 and 16. Patients A and B received ADRD diagnoses in the 7.5th and 9.5th year of follow-up, with notable increases in predicted risk occurring at 4 and 7 years, respectively. The figures also highlight the consistent prediction generated by both the GRU-DA and GRU-D models across all six cross-validation folds. Figure 4 presents GRU-DA interpretations for Patient A at 4.5 and 8 years of follow-up. Over time, the model’s timestep-level attention (Alpha panel) evolved from focusing solely on the 4.5-year mark to a broader distribution across 4.5, 6, and 8 years. At the modality level (Context by modality panel), the early rise in predicted risk at 4.5 years was primarily driven by demographic information, CCS codes, and lab/vital measurements. At the feature level (Beta, X, Context panel), key contributors included female gender (DEMO: gender_1), non-Hispanic ethnicity (DEMO: ethn_1), age 69, diagnoses such as hyperlipidemia, spondylosis, mood disorders, and other female genital disorders, along with functional impairment in food preparation (FSA: foodpreparing). Most of the top CCS-related features identified at 4.5 years continued to rank highly at 8 years, with their influence generally increasing over time.Fig. 4Interpretation for patient A with ADRD diagnosis at the 7.5th year of follow-up.a Interpretation at 4 years, where the predicted risk significantly increases above the previous time interval. b Interpretation at 7.5 years, where the patient had an ADRD diagnosis. Alpha: timestep level attention; Beta: feature level attention; X: values of input features; Context: Alpha*Beta*X. For input features (X), cells in black border indicate actual observed values, while others indicate missing observations imputed by GRU-D on the fly. Data shown for the top 20 features with largest contribution to the predicted risk at corresponding timestep. How to read this figure: first identify the timestep with high timestep attention (Alpha panel), then examine the corresponding feature-level attention weights (Beta), and finally inspect the feature values (X) and their contributions (Context) at those timesteps. Interpretation for patient A with ADRD diagnosis at the 7.5th year of follow-up. a Interpretation at 4 years, where the predicted risk significantly increases above the previous time interval. b Interpretation at 7.5 years, where the patient had an ADRD diagnosis. Alpha: timestep level attention; Beta: feature level attention; X: values of input features; Context: Alpha*Beta*X. For input features (X), cells in black border indicate actual observed values, while others indicate missing observations imputed by GRU-D on the fly. Data shown for the top 20 features with largest contribution to the predicted risk at corresponding timestep. How to read this figure: first identify the timestep with high timestep attention (Alpha panel), then examine the corresponding feature-level attention weights (Beta), and finally inspect the feature values (X) and their contributions (Context) at those timesteps. Supplementary Fig. 17 displays the GRU-DA interpretations for Patient B. The top contributing features at 7.5 years of follow-up include demographic variables and diagnoses such as delirium, dementia, and other cognitive disorders, as well as essential hypertension and hyperlipidemia. Unlike Patient A, whose timestep-level attention shifted toward the 8th year near the endpoint, Patient B’s attention remained primarily focused on the 7.5-year mark, which carried the highest attention weight. Interpretations across training folds Feature rank correlation analysis (Supplementary Fig. 18) showed Kendall’s τ values ranging from 0.15 to 0.2 across timesteps for the GRU-DA models. In comparison, RETAIN exhibited larger variation across timesteps, with rank correlation peaking at approximately 3 years of follow-up (Kendall’s τ ≈ 0.3) before declining to around 0.15 at 9.5 years. Overall, the two models showed comparable performance after five years of follow-up. Figure 5 illustrates for GRU-DA how feature contribution interpretations can vary across different training folds for Patients A and B. For Patient A at 4 years of follow-up (Fig. 5a), model folds 1, 3, and 5 produced generally consistent interpretations, particularly regarding contributing CCS codes. In contrast, folds 2, 4, and 6 yielded differing interpretations. By the 7.5th year (Fig. 5b) —when Patient A received an ADRD diagnosis—folds 1, 3, 4, 5, and 6 consistently highlighted CCS codes such as delirium, dementia, and other cognitive disorders, along with essential hypertension, as key contributors besides demographic factors. However, fold 2 provided a markedly different interpretation, as it assigned most of the timestep-level attention to the 5.5-year mark instead.Fig. 5Context of the top 20 contributing features across the 6 training folds.a patient A at 4 years, b patient A at 7.5 years, c patient B at 7 years, d patient B at 9.5 years of follow-up. Context of the top 20 contributing features across the 6 training folds. a patient A at 4 years, b patient A at 7.5 years, c patient B at 7 years, d patient B at 9.5 years of follow-up. For Patient B at the 7-year mark, all model folds produced generally consistent interpretations, with only minor variations in specific CCS codes. However, at 9.5 years, five out of six model folds continued to assign the highest timestep-level attention to the 7th year. As a result, only the fifth fold provided a visually distinct interpretation specific to the 9.5-year timepoint. Discussion In this study, we proposed and evaluated GRU-DA, an interpretable longitudinal deep learning architecture for dynamic risk modeling of ADRD. Despite substantial data sparsity introduced by random time shifting to better reflect real-world clinical practice, GRU-DA achieved predictive performance closely approximating GRU-D model over a 10-year follow-up period, with both showing robust transferability in an independent external ADRD cohort. The marginal reduction in performance observed with GRU-DA likely reflects the trade-off between interpretability and predictive flexibility45, as the attention mechanism imposes structural constraints on how temporal contributions are aggregated. Beyond simple post-process calibration aligning predicted and observed probabilities, GRU-DA also offered clinically meaningful interpretations, with feature importance and dependence patterns largely consistent with established ADRD risk factors. To our knowledge, this work is among the first to explicitly address ADRD risk prediction under random clinical encounters, reflecting real-world healthcare utilization patterns. Further improvement may incorporate more sophisticated missing imputation46,47, enhanced attention mechanism48, continuous-time modeling approaches49, and in-process calibrations21,50. A major challenge in EHR-based dynamic risk modeling for ADRD is the limited data availability during the period when prevention remains feasible—typically more than five years before diagnosis18,51. Although cerebrospinal fluid (CSF)-derived biomarkers such as p-tau, t-tau, and Aβ42 have demonstrated predictive value as early as 20 years before diagnosis52, none of these biomarkers were recorded in current ADRD cases and controls. Other CSF-related measurements, such as CSF glucose, CSF IgG, and CSF color, appear with extremely low presence rates—typically below 4 per 10,000 patients per year—which renders them unsuitable for training predictive models. Given these limitations, we propose that while EHR-based methods can establish ADRD risk profile up to 10 years prior to clinical diagnosis, additional clinical evaluation and specialized ADRD biomarker testing are necessary for narrowing down high-risk patients. Our findings suggest that traditional logistic regression models, while reported effective in detecting existing ADRD cases53, are inadequate for risk monitoring using EHR data. In our experiments, training logistic models on either dynamically sampled timepoint-specific data or cross-sectional data anchored at the index date resulted in poor predictive performance. This is primarily due to data sparsity across much of the pre-diagnosis period and the randomization of patients’ clinical encounters. We also emphasize that approaches that train and evaluate models using a fixed-length prediction window before clinical ADRD diagnosis12,14, which assumes prior knowledge of the ADRD diagnosis date (an unrealistic condition in real-world clinical settings), may lead to overly optimistic performance estimates and limit clinical applicability. Notably, even with a simpler imputation method, the LSTM model's performance improves over time, easily outperforming the logistic models. This suggests that critical predictive information is embedded within the longitudinal progression of the ADRD, underscoring the necessity of temporal modeling for the ADRD risk prediction. Permutation feature importance and PDP analysis suggest that the logic behind GRU-DA model’s predictions are largely consistent with established knowledge of ADRD risk factors. Here, we highlight several observations that warrant further discussion. First, the unclassified residual code emerges as a key factor, second only to the diagnosis of cognitive disorders. This category encompasses over 300 diverse ICD-9 codes, including conditions such as sleep disorders, memory loss, and family history of disease. Further analysis would be valuable to identify the top contributing factors within this group. Second, demographic features consistently dominate the attention-based interpretations and show contribution at specific timesteps together with new CCS diagnosis. As demographic variables such as age, gender, and race are well-established ADRD risk factors, and are also more stable inputs than temporally sparse CCS codes, they may be exploited by the model as statistical shortcuts. For example, if ADRD diagnoses frequently co-occur with older, non-Hispanic female patients, the model may attribute more weights to demographics than the diagnostic codes. One potential mitigation strategy is to algorithmically regularize the contribution of demographic variables, given that these factors are non-intervenable and may otherwise dominate risk attribution. Third, PDP revealed most of the risk medications, such as antipsychotic drugs, when tuned to either present or absent, increase the ADRD risk compared to original predictions. As the research in this space primarily covers the adverse outcome of using such medications54 or among people already have dementia diagnosis55, further research is helpful to validate the current observation and clarify the clinical context for safe initiation and withdrawal. Finally, the performance improvement observed in the All of Us cohort after brute-force transfer suggests that GRU-DA captured canonical contributing factors to ADRD and also partly reflect the healthier control population in the All of Us dataset, compared with UT Physicians, where most controls are also care-seeking patients. While the predicted ADRD risks remain relatively consistent across training folds, the specific contributing timesteps and features potentially vary. Given the multifactorial nature of ADRD, randomized follow-up initiation, and the extreme sparsity of the input feature space, the level of variation across training folds is anticipated, as no dominant feature or set of features determines the outcome. Consequently, the model retains substantial flexibility to arrive at similar predictions through different interpretation pathways. These findings highlight a broader concern about the reliability of attention mechanisms as interpretation/explanation tools—a topic that has been the subject of ongoing debate56,57. In the context of complex phenotypes like ADRD, we suggest that attention-based frameworks may be useful in narrowing the range of plausible interpretations, but the ultimate interpretive authority should rest with clinicians. It also underscores the value of training multiple model folds—akin to consulting a panel of clinical experts—to yield a more comprehensive set of potential interpretations. Our study indicates that EHR can serve as a valuable data source for ADRD risk monitoring up to 10 years prior to clinical diagnosis. The practical utility of such models is highly dependent on the availability and completeness of patient data, which can vary significantly across individuals. The GRU-DA framework offers a distinct advantage by enabling real-time risk monitoring while providing interpretability at both the timestep and feature levels. This makes it a powerful tool for assisting healthcare providers in identifying high-risk patients and uncovering potential relevant risk factors—not only for ADRD, but also for other conditions where dynamic risk assessment and transparent model outputs are essential for clinical decision-making. For illustration purposes, this experiment was designed by masking data prior to the initiation of follow-up and predicting the risk of ADRD within 10 years from that point forward. As a result, the prediction horizon dynamically decreases from 10 to 0 years as patients progress along the follow-up timeline. In real-world applications, it is possible to estimate risk at any desired prediction horizon between 0 and 10 years using one of several strategies: (1) truncate or pad the input sequence to match the desired horizon without altering the current data sampling method, (2) revise the data sampling approach to incorporate information from before follow-up initiation, or (3) develop separate models tailored to each prediction horizon. These strategies can be applied individually or in combination. A dedicated benchmarking process is needed to determine the optimal approach and to assess how data availability and the length of follow-up affect model performance. Death as a competing risk was not modeled in the present study, prioritizing risk screening rather than estimating lifetime ADRD incidence. For the latter, ADRD and death should be jointly modeled to avoid potential overestimation of ADRD risk. A uniform distribution was adopted to emulate heterogeneous entry into clinical follow-up; however, the timing of clinical encounters in real-world practice is likely more complex. Future work may explore alternative encounter-generation schemes informed by empirical healthcare utilization patterns. Methods Ethics approval The UT Institutional Review Board (IRB) approved the study (IRB Number: HSC-SBMI-24-0403), and the Ethics Committee waived the need for written informed consent from participants because this study involved secondary analysis of de-identified data and posed minimal risk to participants. The research was conducted in accordance with the Declaration of Helsinki and relevant institutional guidelines. (Clinical trial number: not applicable). EHR databases This study leveraged two independent electronic health record (EHR) databases: University of Texas (UT) Physicians (~6 M patients as of 2025/01/01) and All of Us (~633 K participants as of 2026/02/10). The UT Physicians EHR system documented EHRs from routine healthcare service in the greater Houston area. The system was served by Allscripts before 2020, and then switched to EPIC. All UT Physician records were mapped to the (Observational Medical Outcomes Partnership) OMOP common data model (CDM)58 before further analysis. All of Us59 is an OMOP CDM based large, nationwide NIH cohort integrating EHR, genomic, and survey data to support precision medicine research. Definition of ADRD diagnosis We define ADRD diagnosis as the presence of concept code of ADRD or any other neurodegenerative cognitive diseases (Supplementary Data 3) along with either (1) use two or more records of dementia medication (Supplementary Table 1), or (2) at least one dementia medication record within 365 days of the diagnosis60. Specifically for the second scenario, only the very first recorded dementia-related diagnosis in each patient’s history was considered. So patients with a standalone dementia-related diagnosis unaccompanied by any dementia-related medication within 365 days were considered ambiguous and excluded from analysis. Study design Model development employed a 6-fold leave-one-fold-out cross-validation approach on the UT Physicians training set. Performance of all competing models was assessed on a held-out UT Physicians dataset, and the three best-performing models were externally validated in the All of Us cohort with brutal-force transfer. Study cohorts UT Physician: We identified 14,937 ADRD cases between January 1, 2000 and December 31, 2024 among individuals aged ≥ 50 years at the time of ADRD diagnosis. Each case was matched to approximately 10 controls with no dementia-related diagnosis, no mild cognitive impairment, and no exposure to dementia-related medications, further matched on sex, race, ethnicity, and date of birth within 30 days of the corresponding case (Fig. 6).Fig. 6Construction flow of the UT Physicians cohort.ADRD cases were matched 1:10 with controls on gender and date of birth. Construction flow of the UT Physicians cohort. ADRD cases were matched 1:10 with controls on gender and date of birth. All of Us: We applied the same inclusion and exclusion criteria used for UT Physicians to the All of Us database and identified 1584 ADRD cases and 15,169 controls between January 1, 2010 and September 30, 2023 (Supplementary Fig. 19). The demographics information of both cohorts is shown in Table 1. Definition of index date and endpoint The index date for ADRD diagnosis was defined as the earliest occurrence of either a dementia-related diagnosis or the first exposure to a dementia medication, whichever first. For control subjects, the index date was aligned with the index date of their matched case. In the remaining text, we refer to an endpoint (or end of follow-up) as when an ADRD case or control reached his/her index date. Definition of follow-up initiation date In real-world clinical settings, the exact date of ADRD diagnosis (i.e., the index date) is unknown in advance. Therefore, using “10 years before the index date” as the start of follow-up is not feasible. To better reflect real-world conditions-where patients may begin clinical follow-up at heterogeneous time points-we assigned each individual in both the case and control groups a randomly selected follow-up initiation date sampled from a uniform distribution within the available observation window. The model is only allowed access to data from the start of follow-up until just before the index date; any data prior to the follow-up initiation or after the index date remains hidden (Fig. 7).Fig. 7Illustration of random shifting and follow-up initiation date.Red and green tiles indicate data from cases and controls, respectively, during the 10-year period leading up to the index date. Following the shift, grey tiles represent temporal data hidden from the model during both training and prediction. In this example, the ADRD case and control have 7.5 and 8.5 years of follow-up, respectively, prior to reaching the index date. Illustration of random shifting and follow-up initiation date. Red and green tiles indicate data from cases and controls, respectively, during the 10-year period leading up to the index date. Following the shift, grey tiles represent temporal data hidden from the model during both training and prediction. In this example, the ADRD case and control have 7.5 and 8.5 years of follow-up, respectively, prior to reaching the index date. Definition of outcome Outcome is defined as the probability of ADRD diagnosis within 10 years from follow-up initiation. Death as a competing risk was not modeled in the present study. Input features and data preprocessing All dynamic features were retrieved from corresponding OMOP CDM databases up to 10 years before the index date of corresponding ADRD case or control. Diagnosis code A total of 4645 unique ICD-9 diagnosis codes were grouped into 265 Clinical Classifications Software (CCS) categories, as defined by the Healthcare Cost and Utilization Project (HCUP)61. All ICD-10 diagnosis codes were mapped to ICD-9 codes using the General Equivalence Mapping provided by the Centers for Medicare & Medicaid Services. CCS provides a framework for aggregating ICD-9 diagnoses and procedures into a smaller number of clinically meaningful categories to facilitate interpretation and statistical analysis. The resulting CCS codes were one-hot encoded for input into the machine learning models. Lab and vital measurements To reduce input feature sparsity, we selected only those lab and vital measurements with a yearly presence rate greater than 5% in the case group during any of the 10 years. Measurement values were standardized using z-score normalization, with the mean and standard deviation calculated from the training set after outer fence (Lower: Q1 - 3*IQR, Upper: Q3 + 3*IQR) winsorization. These parameters were then applied to the validation, testing, and held-out datasets. Normalized z-scores were clipped to a range between -5 and 5 before being input to the machine learning models. Procedures Concept codes were mapped to seven major SNOMED procedure categories: abdomen, cardiac, intracranial, joint, skin, spine, and thoracic (Supplementary Data 4). For each patient, the total procedure duration (in hours) within each time interval was calculated separately for each of the seven categories and used as input features. Since the All of Us cohort did not record procedure end datetime, the procedure duration was replaced with the median value of corresponding procedure category derived from UT Physician. Risk medications Risk medications refer to drugs that have been reported to potentially increase the risk of developing dementia. We included 187 such medications, categorized into 12 major classes, including anticholinergics, anticonvulsants, antidepressants, among others (Supplementary Data 5). Only records with 30-days or longer exposure length were considered. Exposure to these medications was encoded for machine learning models as binary values—1 indicating exposure and 0 indicating no exposure—across defined time intervals. Functional Status Ascertainment (FSA) FSA was conducted with FedFSA, a hybrid federated AI framework designed to extract functional status information from longitudinal EHRs. It identifies impairment using six categories for basic activities of daily living (ADL) and nine for instrumental ADLs (IADL), based on the International Classification of Functioning, Disability and Health (ICF) standard62–64. The framework includes open-source components: an information extraction pipeline built on Apache Unstructured Information Management Architecture (UIMA), a federated learning engine, and a large language model. Its design separates knowledge sources (e.g., keywords, rules) from NLP processes, improving portability. FedFSA is compatible with the Open Health NLP (OHNLP) Backbone65, allowing scalable Extract-Transform-Load (ETL) workflows for easier adoption. Local evaluation on 68 patients from a geriatric osteoporosis clinic showed strong performance across 15 ADL/IADL categories: precision 0.868, sensitivity 0.828, specificity 0.937, NPV 0.949, and F1 score 0.816. FSA was available for the UT Physician cohort only, and was marked as missing when applied to the All of Us cohort. Demographics Static demographic variables—such as gender, race, and ethnicity—were one-hot encoded and replicated across all time intervals. Age was treated as a dynamic variable that increases over time and was normalized by dividing by 100. Sampling scheme of dynamic variables Based on a systematic review of the time intervals between measurements and considering a clinically practical frequency for ADRD risk assessment, we selected a six-month interval for sampling dynamic variables (i.e., variables that change over time). For each patient, before random follow-up initialization, this resulted in 21 time steps for a total of 186 features covering the 10-year period prior to the index date. Deep learning models GRU-D model: The basic architecture of the GRU-D model has been systematically described by ref. 20, here we recapitulate the equations for handling missing values. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\hat{x}}_{t}^{d}={m}_{t}^{d}{x}_{t}^{d}+\left(1-{m}_{t}^{d}\right){\gamma }_{{x}_{t}}^{d}{x}_{{t}^{{\prime} }}^{d}+\left(1-{\gamma }_{{x}_{t}}^{d}\right){\widetilde{x}}^{d}$$\end{document}xˆtd=mtdxtd+1−mtdγxtdxt′d+1−γxtdx~d where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${m}_{t}^{d}$$\end{document}mtd is the missing value indicator for feature \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$d$$\end{document}d at timestep \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$t$$\end{document}t. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${m}_{t}^{d}$$\end{document}mtd takes value 1 when \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${x}_{t}^{d}$$\end{document}xtd is observed, or 0 otherwise, in which case the function resorts to weighted sum of the last observed value \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${x}_{{t}^{{\prime} }}^{d}$$\end{document}xt′d and empirical mean \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\widetilde{x}}^{d}$$\end{document}x~d calculated from the training data for the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$d$$\end{document}d th feature. Furthermore, the weighting factor \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\gamma }_{{x}_{t}}^{d}$$\end{document}γxtd is determined by \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\gamma }_{t}=\exp \left\{-\max \left(0,{W}_{\gamma }{\delta }_{t}+{b}_{\gamma }\right)\right\}$$\end{document}γt=exp−max0,Wγδt+bγ where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${W}_{\gamma }$$\end{document}Wγ is a trainable weights matrix and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\delta }_{t}$$\end{document}δt is the time interval from the last observation to the current timestep. When \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\delta }_{t}$$\end{document}δt is large (i.e., the last observation is far away from current timestep), \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\gamma }_{t}$$\end{document}γt is small, results in smaller weights on the last observed value \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${x}_{{t}^{{\prime} }}^{d}$$\end{document}xt′d, and higher weights on the empirical mean \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\widetilde{x}}^{d}$$\end{document}x~d (i.e., decay to mean). GRU-DA model: The GRU-DA model architecture (Fig. 8) is rooted on GRU-D, which provides automated missing imputation, and extended with an architecture adapted from the interpretable reverse-time attention architecture (RETAIN)24 by simplifying the two independent Recurrent Neural Networks (RNN) (for visit- and variable-level attention) with GRU-D’s built-in hidden representation. In GRU-DA, the actual observation or otherwise imputed value \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\hat{x}}_{t}$$\end{document}xˆt is multiplied with \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\beta }_{t}$$\end{document}βt and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\alpha }_{t}$$\end{document}αt, the feature-wise and time step-wise partial coefficient at time step t to obtain context vector \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${c}_{j}$$\end{document}cj. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${c}_{j}$$\end{document}cj from arbitrary number of historical timesteps \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$b$$\end{document}b are then summed up to form \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${c}_{t}$$\end{document}ct and casted to output \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\hat{y}$$\end{document}yˆ through output vector weights matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${W}^{o,\phi }$$\end{document}Wo,ϕ. For each output dimension, the interpretability for a specific timestep \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$t$$\end{document}t comes from \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\alpha }_{t}{\beta }_{t}{W}^{.,\phi }$$\end{document}αtβtW.,ϕ as partial coefficient of \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\hat{x}}_{t}$$\end{document}xˆt. In this study, the output weight matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${W}^{1,\phi }$$\end{document}W1,ϕ is a one-dimensional tensor equal to the all-ones vector \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${1}_{\phi }\in {{\mathbb{R}}}^{\phi }$$\end{document}1ϕ∈Rϕ, thus maintain direct interpretability for contribution of \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\hat{x}}_{t}$$\end{document}xˆt.Fig. 8GRU-DA architecture.The GRU-DA architecture combines GRU-D’s automated missing imputation with RETAIN’s feature and timestep level interpretation. GRU-DA architecture. The GRU-DA architecture combines GRU-D’s automated missing imputation with RETAIN’s feature and timestep level interpretation. For GRU-D and GRU-DA, the hyperparameters and training schemes were selected through iterative tuning on the validation set by exploring candidate ranges of hidden neuron size (selected: 20; explored range: 10–200), learning rate (0.001; 0.001–0.1), batch size (256; 10–256), dropout ratio (0.3; 0–0.5), optimizer (Adam; SGD, RMSprop, Adam), and training epochs (30; 10–50). For GRU-DA, additional parameters including the beta coefficient smoothing threshold (5; 1, 5, 10) and regularization scheme (L1; L1, L2) were also evaluated. Given the computational cost of training GRU-D/GRU-DA on large longitudinal EHR datasets, an exhaustive hyperparameter search was not performed. The selected parameters achieved stable training and strong validation performance, suggesting the model is not highly sensitive to small variations within these ranges. SEFT-ATTN model: We implemented the SEFT-ATTN model66 following its original architecture and training strategy, utilizing the default hyperparameters specified by the authors. We additionally explored alternative hyperparameter configurations but did not observe meaningful performance improvements. SEFT-ATTN treats time series as sets of tuples (time, value, feature) and avoids the need for imputation. We partitioned our sequences into multiple sub-segments of varying lengths. Each segment is processed independently to generate a single output, ensuring that predictions at any given time are not influenced by future observations. RETAIN model: The RETAIN model was implemented using two independent Gated Recurrent Unit (GRU) networks to model reverse-time attention at the visit-level and variable-level, respectively. The dimensions of the input embedding layer, as well as the hidden sizes for the visit-level and variable-level attention networks, were all set to 30. This configuration was selected after evaluating sizes ranging from 20 to 50, balancing improvements in validation loss against computer memory constraints, and observing no meaningful performance gains beyond a size of 30. Long Short-Term Memory (LSTM) model: The LSTM model consists of a single LSTM layer with a hidden size of 128, followed by fully connected layers. The hidden size was determined after evaluating sizes from 64 to 512, balancing improvements in validation loss against computer memory constraints, and observing no meaningful performance gains beyond a size of 128. For both RETAIN and LSTM models, missing values were handled with the LVCF method followed by simple mean imputation. Logistic regression Logistic regression models with L1 regularization (Lasso) were trained using the same six training folds as the deep learning models and applied to the held-out fold at each of the 21 timesteps. At each timestep, records that had already reached the endpoint were excluded. For the remaining records, missing values were first handled using the LVCF method. Any remaining missing values were then imputed using an iterative imputation method with a decision tree regressor, allowing up to 20 iterations. Two modeling strategies (Supplementary Fig. 20) were evaluated at each timestep: Logit Dynamic and Logit Static. The Logit Dynamic approach trained 21 separate logistic regression models, each using the available data at the respective timestep after applying random shifting. In contrast, the Logit Static approach followed a conventional case-control design, training a single logistic regression model using data from ADRD cases and matched controls at the endpoint. Six-fold training and held-out evaluation schemes All competing models were trained using the same six-fold cross-validation framework. Predictions for held-out samples were produced at each of the 21 timesteps, and then performance metrics were computed after excluding records reached the endpoint. To prevent information leakage, at each timestep the model was trained and evaluated strictly using only features observed up to that timestep, and all records occurring after the prediction timestep were excluded from model inputs. Evaluation metrics We assessed model performance using established metrics, including the area under the receiver operating characteristic curve (AUROC), average precision (defined as the weighted average precision across all sensitivity levels), and the F-score (computed at the optimal threshold that maximizes the geometric mean of sensitivity and specificity). In addition, we incorporated two clinically relevant metrics: flag rate, defined as the proportion of patients flagged to achieve 60% sensitivity across all remaining ADRD cases within 10 years following follow-up initiation; and the percentage of cases identified in the next half year, defined as the proportion of true ADRD cases—among those predicted to be in the 3rd and 4th risk quartiles—that have ADRD diagnosis within the subsequent six months. All metrics were computed at each of the 21 timesteps, excluding patients who had already reached the endpoint prior to the timestep of interest. Permutation feature/modality importance Permutation feature importance was assessed at both the feature and modality levels using the UT Physician held-out dataset. For each targeted feature or modality, sample IDs were randomly shuffled to disrupt the original associations. The AUROC was calculated at each of the 21 timesteps before and after permutation, and the average percentage change—computed as (before − after) / before × 100%—was used to quantify the model's reliance on that feature or modality. One permutation was conducted per training fold, yielding six data points per feature/modality to support confidence interval estimation. Partial Dependence Plot Partial dependence plot (PDP) was conducted to assess how predicted ADRD risk changes as input feature value was manually tuned, thus estimating the direction of impact for reference in clinical intervention. The tuning was conducted by incrementing or decrementing each feature of each of the 2,070 ADRD cases in the UT Physician held-out dataset for the following modalities. Lab and vital measurements (increase/decrease 1 standard deviation after z-score normalization), CCS codes (present/absent), risk medications (present/absent). At each follow‑up timestep, we recorded the changes in ADRD risk probabilities induced by these tunings (versus no tuning), then averaged the differences across all valid timesteps for each feature of each ADRD case. FSA, procedures, and demographics were excluded from this analysis due to either extremely low data availability or being considered not amenable to intervention. Feature rank correlation test Feature rank correlation analysis was performed using permutation feature importance rankings from six-fold models. Pairwise rank correlations between folds were computed at each timestep using Kendall’s τ to assess the consistency of rankings among features with positive contributions. Calibration Post-process model calibration was evaluated by comparing predicted probabilities with observed event rates in the UT Physician held-out dataset across six probability intervals selected to ensure sufficient sample size. A quadratic calibration function was fitted using linear regression between predicted and observed probabilities, and the estimated intercept and polynomial coefficients were then applied to calibrate the predicted probabilities. Computing platform Data analysis was conducted on a Unix system equipped with 96 CPU cores (Intel® Xeon® Gold 6442Y) and 1.0 TB of memory. Data curation and visualization were carried out using R version 4.3.1. Deep learning tasks were implemented in Python 3.12.3 with PyTorch 2.5.1. Lasso regression was performed using the Lasso module from scikit-learn 1.7.0, and missing data imputation for the Lasso models was handled using the DecisionTreeRegressor module from the same scikit-learn version. Supplementary information Supplementary figure and tables. Supplementary data. Supplementary figure and tables. Supplementary data.