Scientists set out to investigate how sleep is related to various diseases. They focused on polysomnography (PSG), a standard method that records signals from the brain, heart, muscles, and breathing during the night. The goal was to create a model called SleepFM that could predict future diseases from these data. They used an enormous amount of data—more than 585,000 hours of recordings from roughly 65,000 people at research centers such as the Stanford Sleep Clinic (SSC), BioSerenity, and others. These data covered people ranging in age from 1 to 100 years.
To investigate this, they collected PSG recordings from various centers. Each recording contained signals such as electroencephalogram (EEG), electrocardiogram (ECG), electromyogram (EMG), and respiratory signals. They preprocessed the data by converting all signals to a frequency of 128 Hz for consistency. They then divided them into 5-second windows, which served as the basic units for the model.
They trained the SleepFM model using a method called leave-one-out contrastive learning (LOO-CL). This technique compares signals from different modalities (brain, heart, or breathing) and teaches the model to identify shared patterns even when some channels are missing. The architecture included one-dimensional convolutional layers for feature extraction, followed by attention pooling, which processes varying numbers of channels, and a transformer block to capture temporal dependencies within 5-minute windows. They pretrained it on data from SSC, BioSerenity, MESA, and MrOS, while setting aside the Sleep Heart Health Study (SHHS) to test generalization.
To predict diseases, they linked PSG data with electronic health records (EHR) from SSC. They mapped diagnoses to 1,868 phecode categories and selected those with a prevalence above 1.5%. Positive cases were defined as those in which the disease occurred more than 7 days after the PSG study. They fine-tuned the model with a two-layer LSTM (long short-term memory) network on frozen embeddings, added age and sex, and used a multilabel Cox proportional hazards loss for prediction.
Results
The results showed that the SleepFM model can predict 130 different diseases with high accuracy—at least 75% performance on a scale from 0 to 100%, where 50% would mean a random guess and 100% perfection (and these results are statistically reliable, with a very low probability of occurring by chance). For example, it predicts the risk of all-cause mortality with 84% accuracy, dementia with 85%, myocardial infarction with 81%, heart failure with 80%, chronic kidney disease with 79%, stroke with 78%, and atrial fibrillation with 78%. And all of this is based solely on data from a single night of sleep. The model also performed extremely well on data from another study called SHHS, where it predicted stroke with 82% accuracy, heart failure with 85%, and death from cardiovascular disease with 88%
This model outperforms baseline models, such as one based only on demographic data (age, sex, BMI, race) or an end-to-end model using raw PSG data. For example, in predicting mortality, the model achieved 85% accuracy, while the baseline comparison model achieved only 78%. The improvement in this metric ranged from 5% to 17% across various disease categories, such as neurological, cardiovascular, or endocrine diseases.
Modality analysis showed that brain signals (BAS) are best for mental and neurological diseases, respiratory signals for respiratory and metabolic diseases, and ECG for cardiac diseases. However, combining all modalities produced the best results. The model also generalized to data collected after 2020 and to SHHS, on which it had not been trained.
SleepFM paves the way for better use of sleep data in disease prediction, emphasizing scalability and accuracy without the need for manual data annotations.



