Transformer-Based Deep Survival Analysis

Shi Hu, Egill A. Fridgeirsson, Guido van Wingen, Max WellingSPACA 2021

Abstract

Survival analysis traditionally focuses on ranking metrics like the C-index, often at the expense of precise duration prediction. This paper introduces a novel Transformer-based architecture for survival analysis that utilizes an ordinal regression loss. By treating time steps as sequential tokens and leveraging the attention mechanism, the model achieves significant improvements in Mean Absolute Error (MAE) on benchmark datasets, outperforming existing deep learning and statistical methods by months in predicting patient survival while maintaining competitive ranking performance.

Introduction

Survival analysis is a critical branch of statistics used to predict the time until an event occurs, such as patient recovery, mechanical failure, or economic shifts. Historically, the field has relied on linear models like the Cox Proportional Hazards model and evaluated performance using the Concordance Index (C-index).

While the C-index is effective for ranking relative risk (e.g., determining if Patient A will likely stay longer than Patient B), it fails to provide the absolute duration predictions necessary for practical resource planning, such as hospital bed management during a pandemic. This research addresses the need for precise duration estimates by adapting the Transformer architecture—the foundation of modern large language models—to the survival analysis domain.

Methodology

The proposed model treats survival prediction as a sequence-to-sequence problem. Each patient is represented as a "sentence," where each "word" corresponds to a discrete time step from $T_0$ to $T_{max}$.

Architecture

The core of the model is a Transformer encoder. As shown in Figure 1, the model combines static clinical features ($X$) with positional embeddings for each time step ($T_i$). This allows the Transformer to model the interaction between patient characteristics and the passage of time. The output is processed through a Multi-Layer Perceptron (MLP) with a sigmoid activation to predict survival probabilities.

Model Architecture: The Transformer encoder processes combined patient feature and time-step embeddings to produce survival predictions via an MLP.

Ordinal Regression and Loss Function

Unlike previous deep survival models that treat time steps as independent categories (softmax approach), this model employs ordinal regression. This approach respects the monotonic nature of time—if an individual is alive at year $N$, they were necessarily alive at year $N-1$.

To optimize both ranking and duration accuracy, the authors introduce a hybrid loss function. It combines ordinal regression loss with a "randomized discordant pair" penalty, ensuring the model maintains a high C-index while minimizing the absolute error in time prediction.

Datasets and Experimental Setup

The model was evaluated on two primary survival analysis benchmarks: METABRIC and SUPPORT. These datasets present the standard challenge of "censored" data, where the event of interest has not yet occurred for some subjects at the time of study conclusion.

Dataset Statistics: Summary of the METABRIC and SUPPORT datasets used for evaluation, highlighting the prevalence of censored data.
  • METABRIC: Contains records for 1,904 breast cancer patients with 9 clinical and genetic features.
  • SUPPORT: Includes 8,873 seriously ill hospitalized adults with 14 clinical features, such as vitals and lab results.

Key Results

The Transformer-based model demonstrated substantial improvements in Mean Absolute Error (MAE) compared to state-of-the-art (SOTA) baselines:

  • METABRIC: The model achieved an MAE of 54.33 months, an improvement of 14.6 months over the next best model, DeepHit.
  • SUPPORT: The model achieved an MAE of 8.52 days, outperforming the Random Survival Forest (RSF) baseline by 8.45 days.

Crucially, these gains in absolute time accuracy did not come at the cost of ranking performance. The model's C-index remained competitive with existing SOTA models, proving that Transformers can provide both precise duration estimates and reliable risk rankings.

Discussion and Conclusion

This work demonstrates that the Transformer architecture is highly effective for tabular survival data, particularly when absolute duration prediction is the goal. By leveraging ordinal regression, the model produces more biologically plausible survival curves than standard classifiers.

Future research directions include scaling the model to larger datasets, as Transformers typically benefit from higher data volumes. Additionally, the authors suggest exploring transfer learning—pre-training on massive medical databases before fine-tuning on specific diseases—and extending the architecture to handle longitudinal features (time-varying vitals) rather than static baseline data.

Summary updated

BibTeX
@inproceedings{hu2021transformer,
  author = {Shi Hu and Egill A. Fridgeirsson and Guido van Wingen and Max Welling},
  title = {{Transformer-Based Deep Survival Analysis}},
  booktitle = {SPACA},
  year = {2021},
}
Figure