Harnessing the power of longitudinal medical imaging for eye disease prognosis using Transformer-based sequence modeling

Gregory Holste, Mingquan Lin, Ruiwen Zhou, Fei Wang, Lei Liu, Qi Yan, Sarah Van Tassel, Kyle Kovacs, Emily Y. Chew, Zhiyong Lu, Zhangyang Wang, Yifan Peng

Introduction

In the field of ophthalmology, artificial intelligence has primarily focused on automated diagnosis—identifying the presence of disease in a single clinical snapshot. However, vision-threatening conditions such as age-related macular degeneration (AMD) and primary open-angle glaucoma (POAG) are inherently progressive. For clinicians, the critical question is often not "Does this patient have the disease?" but rather "When will this patient's condition worsen?"

Researchers have addressed this gap by developing the Longitudinal Transformer for Survival Analysis (LTSA). This deep learning framework shifts the paradigm from static diagnosis to dynamic prognosis by analyzing a patient's entire history of medical imaging. By treating sequences of fundus photographs as temporal data, the model significantly outperforms traditional single-image approaches in forecasting disease onset.

The Prognostic Challenge

The primary difficulty in eye disease prognosis lies in the slow-moving nature of the pathology. Clinical decisions are ideally based on the rate of change observed over multiple visits. However, standard AI models typically ignore historical data, focusing only on the most recent scan.

The progression of AMD across AREDS severity scales, highlighting the transition from normal retina to vision-threatening late-stage disease.

Furthermore, medical visits in the real world occur at irregular intervals—sometimes months apart, sometimes years. Traditional sequence models like Recurrent Neural Networks (RNNs) often struggle with these temporal gaps. To provide actionable insights, a model must be able to estimate the specific risk of progression over varying time horizons (e.g., 2 years vs. 8 years), a task known as survival analysis.

The Longitudinal Transformer for Survival Analysis (LTSA)

The LTSA framework integrates computer vision with survival analysis through a multi-stage pipeline.

The LTSA architecture: (a) Longitudinal data representation, (b) multi-horizon risk prediction, and (c) the transformer-based encoding pipeline.

1. Image and Temporal Encoding

The model utilizes a ResNet-18 backbone to extract high-dimensional features from each fundus image in a patient's history. To account for irregular visit timing, the authors implemented a Temporal Positional Encoding scheme. Instead of simply numbering visits (1, 2, 3), the model embeds the actual number of months elapsed since the baseline visit, allowing the Transformer to perceive the true passage of time.

2. Transformer Encoder and Causal Attention

A Transformer encoder processes the sequence of image features. By employing "causal" self-attention, the model ensures that the prediction for any given time point is only influenced by current and past images, preventing "data leakage" from the future. This mechanism allows the model to learn the associations between historical changes and future risk.

3. Survival Prediction and Auxiliary Tasks

Unlike standard classifiers that output a binary "yes/no" result, the LTSA outputs a discrete hazard distribution. This distribution represents the probability of the disease event occurring at specific future time steps, which can be aggregated into eye-specific survival curves. To further improve accuracy, the model includes an auxiliary "step-ahead" task, where it attempts to predict the features of the next image in the sequence, sharpening its understanding of disease progression.

Experimental Setup and Datasets

The model was rigorously validated using two landmark longitudinal clinical trial datasets:

  • AREDS (Age-Related Eye Disease Study): Comprising 49,452 images from 4,274 participants, focused on late-stage AMD.
  • OHTS (Ocular Hypertension Treatment Study): Comprising 30,932 images from 1,597 participants, focused on POAG.

These datasets provided the "ground truth" necessary for survival modeling, as they tracked patients over many years to record the exact timing of disease progression.

Results and Key Insights

The performance of the LTSA was measured using the time-dependent concordance index (C-index), which evaluates the model's ability to correctly rank patients by their risk level.

  • Superior Predictive Power: In AMD prognosis, LTSA outperformed single-image baselines in 19 out of 20 comparisons. For 2-year risk, it achieved a C-index of 0.923, significantly higher than the 0.886 achieved by the baseline.
  • Long-term Forecasting: The performance gap was even more pronounced in glaucoma (POAG) prognosis, especially when predicting risk up to 8 years into the future.
  • The Value of History: Analysis of the Transformer's attention weights revealed that while the most recent image is the most influential, historical images provide critical context. The model successfully identified "atypical" rapid progressors whose risk was not apparent from a single scan alone.

Conclusion

The LTSA demonstrates that "watching" the history of a disease provides a much clearer picture of its future than a single snapshot. By effectively handling irregular clinical timelines and leveraging the power of Transformers, this approach offers a robust tool for personalized prognosis. Future work will look toward incorporating 3D imaging (OCT) and binocular data to further refine these life-changing predictions.

Summary updated

BibTeX
@article{holste2024harnessing,
  author = {Gregory Holste and Mingquan Lin and Ruiwen Zhou and Fei Wang and Lei Liu and Qi Yan and Sarah Van Tassel and Kyle Kovacs and Emily Y. Chew and Zhiyong Lu and Zhangyang Wang and Yifan Peng},
  title = {{Harnessing the power of longitudinal medical imaging for eye disease prognosis using Transformer-based sequence modeling}},
  journal = {Npj Digit. Medicine},
  year = {2024},
  doi = {10.1038/s41746-024-01207-4},
}
Figure