AI analyzes sleep and predicts over 100 diseases
Scientists from Stanford Medicine have developed a revolutionary artificial intelligence (AI) that can use data from a single night’s sleep to predict the risk of developing over 100 different health conditions, including serious chronic diseases and neurodegenerative disorders.
The model, named SleepFM, was trained on nearly 600,000 hours of sleep data collected from 65,000 participants. The sleep data was obtained through polysomnography—a comprehensive sleep study that uses various sensors to record brain activity, heart activity, respiratory signals, leg movements, eye movements, and other indicators.
Polysomnography is the gold standard in sleep research, where patients are monitored overnight in a laboratory setting. It is also, as researchers have realized, a previously untapped gold mine of physiological data.
“We record an astonishing number of signals when we study sleep,” says Dr. Emmanuel Mignot, MD, PhD, the Craig Reynolds Professor of Sleep Medicine. “It is a type of general physiology that we study for eight hours in a person who is completely still. The data is extremely rich,” he adds.
Only a small fraction of this data is used in modern research and clinical sleep medicine. With the advancement of artificial intelligence, it is now possible to analyze a much larger portion of it. The new study is the first to use AI to analyze sleep data on such a large scale.
“From an artificial intelligence perspective, sleep is a relatively under-researched area. There are many AI developments in pathology or cardiology, but relatively few in the field of sleep, even though it is such an important part of life,” says Dr. James Zou, associate professor of biomedical data science and co-senior author of the study.
To take advantage of the vast amount of sleep data, researchers created a foundation model—a type of AI model that can independently learn from massive datasets and apply that knowledge to a wide range of tasks. Large language models like ChatGPT are examples of such foundation models trained on vast amounts of text.
The 585,000 hours of polysomnographic data on which SleepFM was trained come from patients who underwent sleep studies in various clinics. The data is divided into five-second segments—analogous to the “words” that language models use during their training.
“SleepFM essentially learns the language of sleep,” says Zou. The model succeeds in integrating multiple data streams—electroencephalography, electrocardiography, electromyography, pulse, and respiratory airflow—and understanding how they are interconnected.
To this end, researchers developed a new training technique called leave-one-out contrastive learning, where one type of data is temporarily hidden, and the model must reconstruct the missing information based on the remaining signals.
“One of the technical breakthroughs in this work was understanding how to harmonize all these different data types so they could come together and ‘learn’ the same language,” explains Dr. James Zou.
Following the training phase, researchers fine-tuned the model for various tasks. They first tested SleepFM on standard sleep analyses, such as sleep stage classification and diagnosing the severity of sleep apnea. The model performs as well as or better than the state-of-the-art models used today.
The team then set a more ambitious goal: to predict the future development of diseases based on sleep data. To determine which conditions could be predicted, they linked polysomnographic data with the long-term health outcomes of the same patients. Fortunately, they had access to more than half a century of health records from a sleep medicine clinic.
The Stanford Sleep Medicine Center was founded in 1970 by the late Dr. William Dement, considered the father of sleep medicine. The largest group of patients used to train SleepFM—about 35,000 people aged 2 to 96—underwent polysomnography at the clinic between 1999 and 2024. The sleep data was cross-referenced with electronic health records, which for some patients provide up to 25 years of follow-up.
SleepFM analyzed over 1,000 disease categories and found that 130 of them could be predicted with reasonable accuracy based on sleep data. The model achieved the best results for oncological diseases, pregnancy complications, circulatory diseases, and mental disorders, with a C-index above 0.8. The C-index (concordance index) measures the model’s ability to predict which of two people will experience a given event sooner.
“For all possible pairs of people, the model ranks who is more likely to experience an event—such as a heart attack—sooner. A C-index of 0.8 means that in 80% of cases, the prediction matches the actual outcome,” explains Dr. Zou.
SleepFM shows excellent results in predicting Parkinson’s disease (0.89), dementia (0.85), hypertensive heart disease (0.84), heart attack (0.81), prostate cancer (0.89), breast cancer (0.87), and mortality (0.84).
“We were pleasantly surprised that the model could provide informative predictions for such a diverse set of diseases,” says Dr. James Zou.
The team is working on further improving SleepFM’s predictions, including by adding data from wearable devices, as well as understanding exactly what the model is interpreting. “It doesn’t explain it to us in human language,” says Dr. Zou. “But we have developed various interpretation techniques that help us understand what the model is looking at when it makes a specific prediction.”
Researchers note that while cardiac signals are more important for predicting heart disease and brain signals for mental disorders, the most accurate predictions are achieved by combining all data types. “We obtained the most information for disease prediction through the contrast between different channels,” says Dr. Mignot. Discrepancies between systems—for example, a brain that appears asleep but a heart that appears awake—are often a signal of a problem.
