Learning transferable human physiology from two million hours of sleep with SleepFM-2
Organizations: Department of Biomedical Data Science, Stanford University, Stanford, CA, USA · Department of Computer Science, Stanford University, Stanford, CA, USA · BrainCapture, Kongens Lyngby, Denmark · Department of Health Technology, Technical University of Denmark, Kongens Lyngby, Denmark · Danish Center for Sleep Medicine, Department of Clinical Neurophysiology, Glostrup, Denmark · Department of Psychiatry and Behavioral Sciences, Stanford University, Stanford, CA, USA · Pioneer Center for SMARTbiomed, National Research Center for the Working Environment, Copenhagen, Denmark · Institute for Computational and Mathematical Engineering, Stanford University, Stanford, CA, USA · Data Science, BioSerenity, Paris, France
Abstract
Sleep provides a nightly window into health by capturing coordinated activity across the brain, heart, muscles and respiratory system. We introduce SleepFM-2, a sleep foundation model developed and evaluated on 282,511 polysomnography recordings from 26 cohorts, including 235,865 used for pretraining. These data span more than two million hours of multimodal physiology. Compared with SleepFM, SleepFM-2 improves disease prediction and sleep scoring, supports arousal, limb movement and respiratory event detection, and transfers to wearable sensing and subjective sleep phenotypes. A model combining its PSG representation with age, sex and BMI met a prespecified discrimination and significance criterion for 188 subsequently recorded EHR phenotypes in two held-out cohorts, including one health system unseen during pretraining. SleepFM-2 also outperformed a 480-feature baseline derived from the same recordings. Its disease scores revealed a reproducible principal component associated with reduced sigma-band spatial coupling and increased hypnodensity entropy. The frozen encoder performed within the observed range of expert scorers for sleep events and transferred to wakeful EEG, headband and in-ear EEG, wrist PPG and wrist accelerometry. It improved sleep staging across six accelerometry cohorts and achieved disease-prediction performance in UK Biobank similar to models pretrained directly on accelerometry. Finally, SleepFM-2 captured aspects of subjective sleep not recovered by conventional PSG summaries, particularly reports of the recorded night. These results show that multimodal sleep physiology can provide a transferable representation of human health across diseases, clinical tasks, sensors and subjective experience.
Figures & tables
Appendix figures & tables26 assets
Supplementary material from the paper’s appendix.
Appendix
| Site | Pretrain | Prediction head training | Validation | Test | Unique |
|---|---|---|---|---|---|
| Pretraining corpus (PSG) | |||||
| ABC | 132 | 0 | 0 | 0 | 132 |
| AHC | 273 | 273 | 22 | 45 | 340 |
| BestAIR | 518 | 0 | 0 | 0 | 518 |
| BioSerenity | 188,853 | 100,000 | 2,000 | 10,000 | 200,853 |
| CCSHS | 417 | 417 | 26 | 72 | 515 |
| Site | Train | Validation | Test | Total |
|---|---|---|---|---|
| SSC | 2,500 | 364 | 2,343 | 5,207 |
| WSC | 2,168 | 133 | 379 | 2,680 |
| CFS | 592 | 36 | 102 | 730 |
| HSP | 2,500 | 500 | 2,000 | 5,000 |
| MESA | 1,747 | 10 | 299 | 2,056 |
| SHHS | 3,293 | 500 | 2,000 | 5,793 |
| Hyperparameter | Value |
|---|---|
| Input | |
| Sampling rate | 128 Hz |
| Context window | 300 s |
| Patch size | 1 s (128 samples) |
| Modality streams | 4 (BAS, CARDIAC, EMG, RESP) |
| Channel-region vocabulary | 28 |
| (a) SleepFM-1 | (b) + AdamW | (c) + ChanEmb | (d) LLaMA (CL) | (e) LLaMA (MAE) | (f) SleepFM-2 | |
| Optimizer | SGD | AdamW | AdamW | AdamW | AdamW | AdamW |
| Encoder block | vanilla | vanilla | vanilla | LLaMA | LLaMA | LLaMA |
| Position enc. | sin | sin | sin | RoPE | RoPE | RoPE |
| Channel emb. | – | – | yes | yes | yes | yes |
| Layers | 6 | 6 | 6 | 6 | 6 | 6 |
| MAE branch | – | – | – | – | yes | yes |
| Task | (a) SleepFM-1 | (b) + AdamW | (c) + ChanEmb | (d) LLaMA (CL) | (e) LLaMA (MAE) | (f) SleepFM-2 |
|---|---|---|---|---|---|---|
| Disease (Harrell’s C) | 0.752 [0.734,0.770] | 0.770 [0.752,0.787] | 0.772 [0.753,0.788] | 0.785 [0.767,0.802] | 0.743 [0.725,0.761] | 0.799 [0.783,0.815] |
| Sleep staging (F1) | 0.748 [0.744,0.751] | 0.753 [0.750,0.757] | 0.751 [0.747,0.754] | 0.764 [0.760,0.767] | 0.771 [0.768,0.775] | 0.771 [0.767,0.774] |
| Age ( ) | 0.586 [0.567,0.605] | 0.643 [0.626,0.660] | 0.595 [0.576,0.614] | 0.675 [0.659,0.690] | 0.539 [0.519,0.559] | 0.796 [0.783,0.807] |
| Phecode | Condition | Category | SSC | HSP | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 962.3 | Hormones and synthetic substitutes causing adverse effects in therapeutic use | injuries &poisonings | 21 | 0.603 [0.49,0.73] | 0.812 [0.72,0.90] | 0.209 | 39 | 0.604 [0.53,0.68] | 0.844 [0.78,0.90] | 0.240 |
| 427.4 | Cardiac arrest and ventricular fibrillation | circulatory system | 26 | 0.728 [0.65,0.81] | 0.815 [0.75,0.88] | 0.087 | 48 | 0.560 [0.48,0.63] | 0.798 [0.73,0.86] | 0.238 |
| 585.32 | End stage renal disease | genitourinary | 32 | 0.606 [0.49,0.70] | 0.753 [0.66,0.83] | 0.147 | 58 | 0.727 [0.67,0.78] | 0.834 [0.79,0.88] | 0.107 |
| 458.2 | Iatrogenic hypotension | circulatory system | 24 | 0.660 [0.56,0.76] | 0.811 [0.72,0.89] | 0.150 | 62 | 0.735 [0.68,0.79] | 0.835 [0.80,0.87] | 0.099 |
| 348.7 | Coma | neurological | 27 | 0.630 [0.52,0.74] | 0.756 [0.64,0.87] | 0.126 | 62 | 0.663 [0.59,0.73] | 0.786 [0.72,0.85] | 0.123 |
| Phecode | Condition | Category | SSC | HSP | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 536.3 | Gastroparesis | digestive | 40 | 0.595 [0.50,0.68] | 0.785 [0.73,0.83] | 0.190 | 51 | 0.595 [0.53,0.66] | 0.672 [0.60,0.74] | 0.077 |
| 279.1 | Immunity deficiency | endocrine/metabolic | 54 | 0.554 [0.47,0.62] | 0.703 [0.64,0.77] | 0.148 | 148 | 0.573 [0.53,0.62] | 0.691 [0.65,0.73] | 0.118 |
| 797.0 | Shock | symptoms | 21 | 0.658 [0.54,0.76] | 0.740 [0.61,0.86] | 0.081 | 75 | 0.643 [0.59,0.70] | 0.821 [0.78,0.86] | 0.178 |
| 316.0 | Substance addiction and disorders | mental disorders | 100 | 0.544 [0.49,0.61] | 0.667 [0.61,0.72] | 0.123 | 227 | 0.547 [0.51,0.59] | 0.679 [0.65,0.71] | 0.131 |
| 41.11 | Methicillin sensitive Staphylococcus aureus | infectious diseases | 27 | 0.661 [0.55,0.76] | 0.767 [0.67,0.84] | 0.106 | 28 | 0.593 [0.48,0.69] | 0.735 [0.64,0.82] | 0.142 |
| SleepFM-1 | SleepFM-2 | |||
| Cohort | Macro F1 | Macro F1 | ||
| SSC | 2343 | 0.679 [0.674,0.685] | 2343 | 0.716 [0.711,0.721] |
| MESA | 299 | 0.783 [0.773,0.793] | 299 | 0.811 [0.802,0.819] |
| MrOS | 409 | 0.752 [0.745,0.758] | 409 | 0.782 [0.775,0.790] |
| SHHS | 2000 | 0.775 [0.771,0.779] | 2000 | 0.803 [0.800,0.807] |
| Additional test cohorts (SleepFM-2 only) | ||||
| Dataset | Category | E2E-Supervised | SleepFM-2 | ||
| BrainCapture | Interictal | 2 | 33,561 | 0.653 0.057 | 0.945 0.009 |
| vEpiSet | Interictal | 2 | 25,264 | 0.508 0.023 | 0.860 0.039 |
| TUH-Slowing | Interictal | 4 | 1,677 | 0.609 0.060 | 0.763 0.037 |
| TUH-Abnormal | Interictal | 2 | 400,872 | 0.691 0.014 | 0.834 0.013 |
| TUH-Events | Interictal | 6 | 88,396 | 0.647 0.032 | 0.914 0.036 |
| CHB-MIT | Seizure | 2 | 1,016 | 0.731 0.010 | 0.978 0.010 |
| Dataset | Recording setting | Subj. | Rec. | Task | Ref. |
| Interictal / abnormality | |||||
| BrainCapture | Routine clinical EEG | 3,018 | 3,036 | Normal vs. abnormal record (2-class) | [ 102 ] |
| vEpiSet | Routine clinical EEG | 84 | 84 | IED vs. Background (2-class) | [ 103 ] |
| TUH-Slowing | Clinical EEG archive (TUH) | – | 38 | Slowing type (4-class) | [ 104 ] |
| TUH-Abnormal (TUAB) | Clinical EEG archive (TUH) | – | 2,317 | Normal vs. abnormal record (2-class) | [ 105 ] |
| TUH-Events (TUEV) | Clinical EEG archive (TUH) | – | 81 | Event type: SPSW / GPED / PLED / EYEM / ARTF / BCKG (6-class) | [ 104 ] |
| Dataset | Wearable | (E2E-Sup.) | (SleepFM-2) | F1 (E2E-Sup.) | F1 (SleepFM-2) |
|---|---|---|---|---|---|
| BOAS | Headband EEG | 0.566 [0.524,0.608] | 0.759 [0.730,0.785] | 0.514 [0.484,0.545] | 0.721 [0.696,0.742] |
| Wearanize+ EEG | Headband EEG | 0.396 [0.328,0.464] | 0.614 [0.573,0.655] | 0.463 [0.415,0.511] | 0.645 [0.611,0.679] |
| EESM19 | Ear EEG | 0.150 [0.118,0.182] | 0.712 [0.685,0.739] | 0.239 [0.217,0.260] | 0.746 [0.725,0.766] |
| Wearanize+ PPG | Wrist PPG | 0.038 [0.020,0.057] | 0.423 [0.331,0.515] | 0.175 [0.153,0.196] | 0.531 [0.461,0.602] |
| Dataset | E2E-Supervised | SleepFM-2 | ||
|---|---|---|---|---|
| TBI | 5 | 159,692 | 0.687 0.010 | 0.793 0.020 |
| DREAMT | 5 | 78,876 | 0.676 0.015 | 0.784 0.016 |
| STAGES | 5 | 33,202 | 0.690 0.025 | 0.797 0.016 |
| Newcastle (L) | 5 | 30,290 | 0.590 0.034 | 0.708 0.018 |
| Newcastle (R) | 5 | 29,240 | 0.621 0.025 | 0.744 0.028 |
| Amazfit | 5 | 37,392 | 0.675 0.025 | 0.801 0.046 |
| Outcome | Category | SleepFM-2 | Accel | ||
|---|---|---|---|---|---|
| Obesity | Endocrine/metabolic | 222 | 0.877 [0.86,0.90] | 0.879 [0.86,0.90] | [-0.006,+0.004] |
| Benign prostatic hyperplasia | Genitourinary | 168 | 0.865 [0.85,0.88] | 0.866 [0.85,0.88] | [-0.005,+0.002] |
| Repeated falls | Neurological | 95 | 0.807 [0.76,0.85] | 0.824 [0.78,0.87] | [-0.035,+0.001] |
| Inguinal hernia | Gastrointestinal | 128 | 0.807 [0.78,0.84] | 0.806 [0.77,0.84] | [-0.005,+0.008] |
| Pneumonia | Respiratory | 59 | 0.806 [0.75,0.86] | 0.803 [0.75,0.85] | [-0.018,+0.025] |
| Score | Range | Items |
| Insomnia | 0–12 | 3 ordinal items: problem going to sleep at night; problem waking during the night; restless sleep |
| Fatigue | 0–12 | 3 ordinal items: problem not feeling rested; problem with tiredness; problem with sleepiness |
| Parasomnia | 0–20 | 5 ordinal items: sleep talking; sleep eating; sleep walking; dreaming while falling asleep; paralysis while falling asleep |
| Somatic | 0–16 | 11 binary items: frequent cough; shortness of breath; smothering spells at night; swollen legs; chest pain; difficulty swallowing; voice changes; muscle weakness; difficulty controlling the body; body shaking; difficulty speaking. Plus 5 ordinal items binarized at moderate or worse: muscular tension while falling asleep; jerks while falling asleep; heart pain during sleep; chest pain during sleep; shortness of breath during sleep |
| Last-night | 0–1 | Fraction of six Post-Sleep Questionnaire items endorsed. Subjective sleep latency 60 min; reported difficulty falling asleep together with subjective latency 30 min; woke during the night together with difficulty returning to sleep; difficulty returning to sleep; sleep not at all refreshing; quite or extremely sleepy now |
| Habitual | 0–1 | Fraction of six Sleep-History Questionnaire items endorsed. Problem going to sleep at night, often or always; waking during the night, always; not feeling rested however much sleep, always; daytime sleepiness, always; restless, disturbed sleep, always; takes 30 min to get going in the morning |
| Endpoint | AUROC threshold | Test | Pos.% | SleepFM-2 AUROC (95% CI) | AUROC vs Combined |
| Post-Sleep Questionnaire | |||||
| Long latency | binary 1 | 6,590 | 22.9% | 0.785 [0.772, 0.796] | [ , ] ** |
| Difficulty falling asleep | binary 1 | 6,590 | 32.0% | 0.793 [0.782, 0.804] | [ , ] ** |
| Woke during night | binary 1 | 6,597 | 34.2% | 0.772 [0.761, 0.783] | [ , ] ** |
| Trouble returning | binary 1 | 6,584 | 35.1% | 0.775 [0.764, 0.786] | [ , ] ** |
| Not refreshing | binary 1 | 6,259 | 26.2% | 0.703 [0.687, 0.716] | [ , ] * |
| Component | LLaMA block | Vanilla block |
|---|---|---|
| Normalization | RMSNorm (pre-norm) | LayerNorm (pre-norm) |
| FFN activation | SwiGLU | GELU |
| FFN structure | 3 linears ( ) | 2 linears ( ) |
| FFN hidden dim | , rounded | 2048 (fixed) or |
| Linear bias | No | Yes |
| Positional encoding | RoPE (rotary, in attention) | Sinusoidal (additive, pre-encoder) |