Stanford’s AI spots hidden disease warnings that show up while you sleep
Stanford researchers have developed an AI that can predict future disease risk using data from just one night of sleep. The system analyzes detailed physiological signals, looking for hidden patterns across the brain, heart, and breathing. It successfully forecast risks for conditions like cancer, dementia, and heart disease. The results suggest sleep contains early health warnings doctors have largely overlooked.
A restless night often leads to fatigue the next day, but it may also signal health problems that emerge much later. Scientists at Stanford Medicine and their collaborators have developed an artificial intelligence system that can examine body signals from a single night of sleep and estimate a person's risk of developing more than 100 different medical conditions.
The system, called SleepFM, was trained using almost 600,000 hours of sleep recordings from 65,000 individuals. These recordings came from polysomnography, an in-depth sleep test that uses multiple sensors to track brain activity, heart function, breathing patterns, eye movement, leg motion, and other physical signals during sleep.
Sleep Studies Hold Untapped Health Data
Polysomnography is considered the gold standard for evaluating sleep and is typically performed overnight in a laboratory setting. While it is widely used to diagnose sleep disorders, researchers realized it also captures a vast amount of physiological information that has rarely been fully analyzed.
"We record an amazing number of signals when we study sleep," said Emmanual Mignot, MD, PhD, the Craig Reynolds Professor in Sleep Medicine and co-senior author of the new study, which will publish Jan. 6 in Nature Medicine. "It's a kind of general physiology that we study for eight hours in a subject who's completely captive. It's very data rich."
In routine clinical practice, only a small portion of this information is examined. Recent advances in artificial intelligence now allow researchers to analyze these large and complex datasets more thoroughly. According to the team, this work is the first to apply AI to sleep data on such a massive scale.
"From an AI perspective, sleep is relatively understudied. There's a lot of other AI work that's looking at pathology or cardiology, but relatively little looking at sleep, despite sleep being such an important part of life," said James Zou, PhD, associate professor of biomedical data science and co-senior author of the study.
Teaching AI the Patterns of Sleep
To unlock insights from the data, the researchers built a foundation model, a type of AI designed to learn broad patterns from very large datasets and then apply that knowledge to many tasks. Large language models like ChatGPT use a similar approach, though they are trained on text rather than biological signals.
SleepFM was trained on 585,000 hours of polysomnography data collected from patients evaluated at sleep clinics. Each sleep recording was divided into five-second segments, which function much like words used to train language-based AI systems.
"SleepFM is essentially learning the language of sleep," Zou said.
The model integrates multiple streams of information, including brain signals, heart rhythms, muscle activity, pulse measurements, and airflow during breathing, and learns how these signals interact. To help the system understand these relationships, the researchers developed a training method called leave-one-out contrastive learning. This approach removes one type of signal at a time and asks the model to reconstruct it using the remaining data.