Transformer modeling meets the long arc of diabetic kidney decline

A transformer-based model built from longitudinal electronic health records has shown it can track future kidney outcomes in people with diabetes and normal kidney function, but the performance picture was uneven. In a cohort of 8,772 patients treated at Seoul National University Bundang Hospital between 2003 and 2014, investigators set out to predict two clinically important endpoints: a ≥30% estimated glomerular filtration rate decline and progression to advanced chronic kidney disease stage at 1, 3, 5, and 10 years. Event rates were low, ranging from 1.2% to 8.4%, which is exactly the kind of setting where model calibration and false-positive control become as important as raw discrimination. Kidney injury in diabetes often unfolds silently over years, and the appeal of sequence models is obvious: they can, in principle, digest repeated laboratory signals, medication exposures, and time-ordered changes in a way that static risk scores cannot.

The study compared the transformer with logistic regression, support vector machine, LightGBM, and XGBoost. For eGFR decline, the tree-based approaches were stronger at every prediction horizon, posting AUROC values from 0.68 to 0.80 versus 0.56 to 0.75 for the transformer. The gap matters because declining filtration rate is one of the clearest markers of progressive nephron loss, and a model that misses early deterioration loses much of its practical value in routine nephrology care. In this analysis, better pattern recognition did not automatically translate into better prediction. A sequence model can learn relationships across time, yet if those relationships are unstable or sparse, the extra complexity can become a liability rather than an advantage.

Calibration held the transformer back even when discrimination looked acceptable

For advanced CKD stage prediction, the transformer fared better. Its AUROC ranged from 0.77 to 0.85, placing it in the same general range as the tree-based models. At a matched operating point with recall fixed at 0.8, F1 scores were broadly comparable across models, which suggests similar balance between sensitivity and precision when the threshold was tuned to catch most events. In other words, the transformer could separate higher-risk from lower-risk patients reasonably well for this endpoint, even if it did not dominate the comparison set.

The harder problem was confidence. The transformer was overconfident, and decision-curve analysis showed it did not exceed treat-all net benefit, unlike the tree-based models. That finding carries direct clinical weight. A risk model that assigns overly certain probabilities can push clinicians toward unnecessary surveillance, alarm, or treatment intensification, especially when the outcome is uncommon. In diabetic kidney disease, where management decisions may involve tighter blood pressure control, medication selection, and closer laboratory follow-up, poor calibration can distort how risk is translated into action at the bedside.

Sparse data, temporal drift, and what the model could still tolerate

A striking strength emerged when the inputs were degraded. Retaining only 25% of laboratory values reduced the transformer’s AUROC by just 0.03, while the tree-based models fell by 0.23 to 0.30. That resilience suggests the sequence architecture may be better able to preserve signal when records are incomplete, irregular, or fragmented, which is a familiar reality in real-world EHR data. Patients do not present on neat schedules, lab testing is uneven, and longitudinal datasets often contain missingness that reflects both care patterns and patient behavior. A model that can survive that kind of loss has obvious technical appeal.

Still, the study also exposed a common failure mode of predictive systems trained on historical health records: they weaken when moved forward in time. Under temporal validation, with training limited to data from 2009 or earlier and testing applied to 2009 through 2016, AUROC fell by an average of 0.09. Temporal drift can reflect changing practice patterns, lab ordering behavior, treatment standards, and the underlying risk profile of the population itself. For a kidney model, even modest changes in prescribing, diabetes control, or referral thresholds can alter the shape of future trajectories enough to reduce accuracy. This is exactly why internal performance alone is not enough for deployment claims.

The most defensible interpretation is narrow but important. Sequence models are technically feasible for kidney trajectory prediction and may offer robustness when laboratory data are incomplete. Even so, the transformer did not consistently outperform simpler machine learning methods, and it required recalibration before any realistic clinical use. External validation was not part of the evidence presented here, and the study design leaves open how the model would behave across hospitals, health systems, and populations with different testing intensity or diabetes severity. For now, the result is less a green light for deployment than a clear signal that model architecture, calibration, and transportability all need to be solved at once before prediction tools can reliably guide care in diabetic kidney disease.


Reporting by Dr. A. Nikhil Krishnan, MBBS for Medicine World Foundation, with additional data provided by Nature Medical Research.