AI Can Detect Up to 130 Diseases from Your Sleep, Stanford Scientists Find

AI Can Detect Up to 130 Diseases from Your Sleep, Stanford Scientists Find

Ondřej Barták
Ondřej Barták
Entrepreneur and Programmer
8. 1. 2026
3 minutes reading
AI Can Detect Up to 130 Diseases from Your Sleep, Stanford Scientists Find

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.

Diagram of the SleepFM model using polysomnography: EEG, ECG, EMG, and breathing predict diseases
Diagram of the SleepFM model using polysomnography: EEG, ECG, EMG, and breathing predict diseases.

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.

Category:AI
Did you enjoy this article?
Discover more interesting posts on our blog
Back to blog

Related posts

Altman Announced the Singularity Days After His Models Escaped the Lab on Their OwnAltman Announced the Singularity Days After His Models Escaped the Lab on Their Own
OpenAI chief Sam Altman declared on the Relentless podcast that humanity has already entered the singularity. “We’re like, in the singularity now,” he said verbatim. For decades, the term belonged more to science-fiction literature
6 min read
28. 7. 2026
AI Remixed a Madonna Song—and Now It Tops the Charts in Australia. Musicians Are Furious.AI Remixed a Madonna Song—and Now It Tops the Charts in Australia. Musicians Are Furious.
Since April, Australian radio has been playing a dance remake of Madonna’s hit Like a Prayer on repeat. Released by Queensland DJ Josh Fawaz, it tops the radio airplay chart and has 35 million Spotify streams.
6 min read
28. 7. 2026
Claude Opus 5 Built a Shooter from Scratch. What Can Claude of Duty Do?Claude Opus 5 Built a Shooter from Scratch. What Can Claude of Duty Do?
A first-person shooter that runs directly in the browser, with its own physics and eleven separate code modules. Around 55,000 lines in total, split across eleven subsystems and built on Thr
4 min read
28. 7. 2026
Přihlaste se k odběru našeho newsletteru
Zůstaňte informováni o nejnovějších příspěvcích, exkluzivních nabídkách, a aktualizacích.
CodedTrip

Operated by CodedTrip LLC, USA.

YouTube
TikTok