Learning transferable human physiology from two million hours of sleep with SleepFM-2
Authors: Rahul Thapa, Christopher Sun, William Theodor Lehn-Schioler, Sophia Claire Kivelson, Umaer Hanif, Hyatt Moore, Harrison G. Zhang, Hafsa Ahmed, +9 more
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
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
Figure 1: SleepFM-2 learns transferable physiology from clinical sleep through multimodal pretraining. a , Overview of SleepFM-2 and its applications. SleepFM-2 is pretrained on 235,865 clinical polysomnography recordings, comprising more than 2 million hours of data from 24 PSG cohorts. The resulting foundation model supports incident disease and mortality prediction, PSG sleep scoring, subjective sleep and symptom endpoints, and transfer beyond the sleep laboratory to headband and in-ear EEG, wrist PPG and actigraphy. b , SleepFM-2 pretraining architecture. Each recording is organized into four physiological modality streams representing brain and eye activity, cardiac activity, muscle activity and respiration. Every channel is partitioned temporally into non-overlapping one-second patches. A shared 1D CNN maps each patch to a token, and a channel-region embedding identifies its anatomical origin. During pretraining, a fraction r=0.55 of tokens is masked using a mixture of temporal-block, channel-block and random masking. A transformer encoder with weights shared across streams attends jointly across the visible channel-by-time token grid of each modality. Two complementary objectives operate on its outputs. In the leave-one-out contrastive pathway, tokens are pooled across channels, processed by a temporal encoder and pooled across time to obtain one summary per modality; each modality is contrasted against the mean representation of the other available modalities from the same recording. In the masked-autoencoding pathway, the full token grid is restored with learned mask tokens, transformer blocks reconstruct the missing context and the corresponding signal patches are recovered using an L1 loss applied only at masked positions. The two pretraining losses are weighted equally. The reconstruction pathway is used only during pretraining; at inference, masking is disabled and the frozen encoder supplies embedding representations to task-specific downstream heads.
Figure 2: SleepFM-2 predicts incident disease across the phenome, outperforms every interpretable baseline, and improves upon SleepFM-1 for disease prediction and sleep scoring. Disease panels cover the same 939 phecodes over a six-year horizon in SSC and HSP. Bars are not directly comparable between panels b and d, because each is scored on its own all-arms subject intersection. Demo is age, sex and BMI; Combined is the pooled bank of all 480 interpretable features. In the disease panels, error bars are 95% confidence intervals over conditions. a , Per-condition C -index in HSP, for the 15 phecode categories with at least 20 phecodes (908 of 939; congenital anomalies and pregnancy complications fall below the cutoff). Saturated points are significantly better than SleepFM-1. b , Mean C -index for SleepFM-2 and for baselines computed from the same recordings; parentheses give feature counts. c , Per-condition difference between SleepFM-2 and Combined + demo , with the fraction of conditions favoring the embedding. d , Mean C -index across the same phecodes for demographics, SleepFM-1 and SleepFM-2, in each cohort. e , Five-class sleep staging, macro F1 on held-out recordings. f , Cortical arousal, limb movement (LM) and respiratory event detection. Open circles, technologist scorers against a leave-one-out consensus of the others; orange bar, SleepFM-2 F1 against the same consensuses; filled diamond, mean.
Figure 3: SleepFM-2’s disease predictions organize around a shared axis of physiological risk. All panels cover the same 939 phecodes over a six-year horizon in SSC and HSP. a , Variance explained by each principal component of the per-disease risk scores, each residualized on age, sex and BMI. b , Gain in C -index from adding a condition’s own risk score to a model already operating on demographics and the general-risk axis. c , Partial Spearman correlation between the axis and six interpretable features, adjusted for age, sex, BMI and AHI; grey lines join the two cohorts.
Figure 4: SleepFM-2 transfers to wearable recordings and to EEG recorded outside sleep. In a – c , a grey dot is SleepFM-2’s architecture trained end to end from random initialization and an orange dot is the frozen SleepFM-2 encoder with only a task head trained on top; the value above each orange dot is SleepFM-2’s. a , Window-level AUROC on 23 EEG datasets recorded outside sleep, read out with an L2 -regularized LinearProbe and grouped into clinical and pathological detection (12 datasets), cognitive, affective and phenotyping tasks (7) and motor-imagery brain–computer interfaces (4); dotted line denotes chance. b , Macro F1 for five-class sleep staging from wearable (headband and in-ear) EEG and PPG. c , Window-level AUROC for five-class sleep staging from wrist accelerometry, across six cohorts; Newcastle contributes two rows, left and right wrist. d , Mean Harrell C -index across 388 outcomes (387 PheCodeX codes and all-cause mortality) in UK Biobank wrist accelerometry ( n=5,192 matched test participants), for a demographics-only Cox model, the ensemble of the two accelerometry foundation models reported by Dige et al. Dige et al. (2026) , and SleepFM-2. All carry age, sex and BMI, and the comparison uses their split, outcomes and scoring code. e , Per-outcome C -index for SleepFM-2 across the 212 phecodes with at least 20 test events, colored by phecode category; dashed line is C=0.70 . Six conditions are annotated with their C -index and 95% confidence interval. Error bars are ± 1 s.d. across five folds in a and c , and 95% bootstrap confidence intervals in b , d and e .
Figure 5: Per-endpoint AUROC across baselines in BioSerenity. Twenty-five endpoints grouped by category (rows): six Post-Sleep Questionnaire items assessing the study night, six topically matched Sleep-History Questionnaire items assessing habitual sleep, four comorbidities (from the medical-history flags), four symptom scores summed from questionnaire items (Insomnia, Fatigue, Parasomnia sum ordinal responses; Somatic sums binary indicators; see Methods and Supplementary Table 14 for item composition), two subjective–objective discrepancy magnitudes ( ∣ΔTST∣ and ∣ΔSOL∣ between subjective report and objective PSG), and three composite poor-sleep scores aggregating the questionnaire items and PSG criteria ( last-night = the six Post-Sleep items; habitual = the six Sleep-History items; objective = mean of three PSG sub-scores over nine criteria in continuity, architecture and events). Five methods (columns): SleepFM-2, demographics, the scored macro-sleep report, YASA microstructure features, and the union of the three ( Combined = Demographics + MacroSleep + Microstructure). Cell color is AUROC at the per-endpoint prespecified threshold (Methods, Supplementary Table 15 ); the best method in each row is in bold. Stars on the SleepFM-2 column mark paired subject-bootstrap significance vs Combined ( * p<0.05 , ** p<0.01 ; 1,000 iterations, so 0.001 is the smallest resolvable P value). Sixteen of the 25 endpoints reach p<0.05 , of which twelve remain significant after Benjamini–Hochberg correction across the endpoint family. The “Objective poor sleep” row’s Combined column uses Demographics + Microstructure only because the macro report is a definitional leak on this endpoint. Cells labeled n/a are omitted due to definitional overlap between the method’s features and the endpoint.
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
Appendix
Supplementary Table 1: Recordings per site. The encoder is pretrained jointly on all 235,865 recordings in the upper block and then frozen; for each downstream task a separate prediction head is trained on top of the frozen encoder, with no encoder weights updated during downstream training. All downstream tasks on the cohorts listed here use the same train, validation and test split, fixed in advance; the evaluation-only wearable, wakeful-EEG and accelerometry cohorts are instead assessed by task-specific cross-validation, described with the analyses that use them. Each task then selects the cohorts eligible for that task from this shared split, so recordings counted for head training at a given site need not contribute to every downstream task. The pretraining set includes the prediction head training set, so those two columns double-count the same recordings; validation and test recordings are held out of pretraining across every site. “Unique” is the number of distinct recordings per site pooled across all splits, and all counts are recordings rather than subjects. Splits are assigned at the participant level, so where a participant contributes more than one night every recording from that participant falls in the same split and no test participant contributes any recording to pretraining. Because each downstream analysis then applies its own inclusion criteria, the number of subjects or recordings it reports is smaller than the test column here: the disease analyses keep only subjects for whom every compared arm is available, and the scoring analyses keep only recordings carrying the relevant expert annotations. The lower block lists cohorts held out of pretraining and used downstream only. Cohorts used for evaluation alone are documented alongside the analyses that use them: DREEM in the sleep-scoring subsection, the six wrist-accelerometry staging cohorts (TBI, DREAMT, STAGES, Newcastle, Amazfit and SleepAccel) and the wearable-EEG cohorts (BOAS, Wearanize+ and EESM19) in the wearable-transfer subsections, and the 23 non-sleep EEG datasets in Supplementary Table 10 . All cohorts are overnight polysomnography (PSG) except UK Biobank, which is wrist actigraphy. †
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
Appendix
Supplementary Table 2: Recordings per site for sleep scoring. Every split here contains a strict subset of patients from the corresponding split in Supplementary Table 1 .
Hyperparameter
Value
Input
Sampling rate fs
128 Hz
Context window
300 s
Patch size P
1 s (128 samples)
Modality streams M
4 (BAS, CARDIAC, EMG, RESP)
Channel-region vocabulary
28
Appendix
Supplementary Table 3: SleepFM-2 configuration. Values of the hyperparameters written generically in the text. The MAE decoder is used only during pretraining and is discarded at downstream inference, so its parameters are listed separately from the encoder’s. The three masking budgets sum to the mask ratio r by construction.
(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
Appendix
Supplementary Table 4: Architectural summary of the SleepFM-1 → SleepFM-2 ablation chain. Columns (a)–(d) are cumulative, each adding one change to the previous. Columns (d) and (e) share the same architecture and differ only in the pretraining objective – contrastive versus masked autoencoding – and (f) SleepFM-2 combines both. Channel emb. = 28-way channel-region position embedding. Pretrain loss: CL = contrastive only, MAE = masked autoencoding only, MAE+CL = SleepFM-2’s joint objective. Parameter counts are encoder-only. The MAE decoder used by (e) and (f) adds 0.96M parameters that are discarded at inference.
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 ( R2 )
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]
Appendix
Supplementary Table 5: Downstream performance across the SleepFM-1 → SleepFM-2 ablation chain. Columns (a)–(f) are defined in Supplementary Table 4 . Disease: mean Harrell’s C -index across seven incident outcomes in SSC (atrial fibrillation, chronic kidney disease, all-cause mortality, dementia, heart failure, myocardial infarction and stroke), over a six-year horizon. Sleep staging: mean F1 macro across four held-out datasets (SSC, MESA, MrOS, SHHS). Age: linear-probe R2 in SSC. Every column is evaluated under an identical protocol with the pretrained encoder frozen: disease and age are read out with a LinearProbe head and sleep staging with an LSTMHead on 30-second-bin embeddings. No demographic features are supplied to any head, so the reported values reflect information recovered from the PSG embedding alone. Values are point estimates with 95% bootstrap confidence intervals (1000 replicates) as subscripts; disease and age resample subjects, and sleep staging resamples recordings within each dataset before averaging across the four datasets. Best value per row in bold. Column (f) is the SleepFM-2 architecture on the ablation chain’s shared 48,093-recording, 5-second-token protocol, not the released model. Retokenizing to 1 second and scaling the corpus to 235,865 recordings raises staging F1 to the values in Supplementary Table 8 (Methods).
Phecode
Condition
Category
SSC
HSP
n
Cdemo
C
ΔC
n
Cdemo
C
ΔC
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
Appendix
Supplementary Table 6: PheCodes SleepFM-2 predicts in both cohorts. The 133 phecodes on which SleepFM-2 attains a Harrell’s C -index of at least 0.75 in both cohorts, a marginal Bonferroni-corrected P<0.01 in both cohorts and a PSG-only likelihood-ratio-test q<0.05 in both cohorts (Benjamini–Hochberg within cohort). Rows are ordered by the mean gain over demographics across the two cohorts, highest first, with the phecode category shown as a column. n is the number of test subjects who developed the condition during follow-up. For each condition and cohort, Cdemo is a demographics-only model on age, sex and BMI; C is SleepFM-2; and ΔC=C−Cdemo . Subscripts on Cdemo and C are 95% confidence intervals from a 1,000-replicate paired subject bootstrap. Rows in which ΔC prints as + 0.000 have a gain that is positive but below the three-decimal display (under + 0.001).
Phecode
Condition
Category
SSC
HSP
n
Cdemo
C
ΔC
n
Cdemo
C
ΔC
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
Appendix
Supplementary Table 7: Conditions where SleepFM-2 adds most over demographics. The 119 phecodes meeting all of: SleepFM-2 Harrell’s C -index at least 0.65 in both cohorts; C -index below 0.75 in at least one cohort; SleepFM-2 exceeds the demographics-only model by at least 0.03 in both cohorts; and a PSG-only likelihood-ratio-test q<0.05 against age, sex and BMI in both cohorts (Benjamini–Hochberg across phecodes within cohort), where the LRT alternative uses a SleepFM-2 head trained on the PSG embedding alone so significance reflects PSG-specific incremental signal. Rows are ordered by the mean gain across the two cohorts, highest first, with the phecode category shown as a column. n is the number of test subjects who developed the condition during follow-up. For each condition and cohort, Cdemo is a demographics-only model on age, sex and BMI, C is SleepFM-2, and ΔC=C−Cdemo . Subscripts on Cdemo and C are 95% confidence intervals from a 1,000-replicate paired subject bootstrap.
Supplementary Figure 1: The SleepFM-2 advantage over SleepFM-1 by disease category. Orange is SSC, blue is HSP. a , Mean paired difference in Harrell’s C -index (SleepFM-2 − SleepFM-1) within each phecode category, with 95% confidence intervals bootstrapped over conditions. Category size is given in parentheses. b , Percentage of conditions in each category for which SleepFM-2 is significantly better than SleepFM-1 (paired subject bootstrap on the difference in C -index, Benjamini–Hochberg q<0.05 ). Categories are ordered by the HSP effect.
SleepFM-1
SleepFM-2
Cohort
n
Macro F1
n
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)
Appendix
Supplementary Table 8: Sleep-staging performance by cohort. Macro-averaged F1 for five-class staging at 30-second resolution on held-out test recordings. SleepFM-1 is the published architecture retrained under this paper’s data and training pipeline, as in column (a) of Supplementary Table 5 ; both models are read out with an LSTMHead on frozen embeddings. The upper block lists the four cohorts of the ablation comparison, where both models are available; the lower block lists three additional test cohorts evaluated for SleepFM-2 only. n is the number of test recordings.
Dataset
Category
C
N
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
Appendix
Supplementary Table 9: SleepFM-2 transfers to EEG recorded outside sleep. Window-level AUROC on 23 EEG datasets recorded outside sleep, for the same architecture trained end to end from random initialization and for the frozen pretrained encoder read out with an L2 -regularized LinearProbe . Mean ± s.d. across five recording-grouped folds at a single seed. C is number of classes, N is number of windows, and chance is 0.5. For datasets with more than two classes the AUROC is computed one versus rest and averaged over classes, which is why chance is 0.5 rather than 1/C . These are the values plotted in Fig. 4 a.
Supplementary Table 10: Sources and descriptions of the 23 EEG datasets used in Supplementary Table 9 . Per dataset, we list the recording setting, cohort size, task definition and original publication. – indicates that the count is not reported by the source publication.
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]
Appendix
Supplementary Table 11: Sleep staging from wearable EEG and PPG. Five-class staging for the same architecture trained end to end from random initialization ( E2E-Supervised ) and for a frozen SleepFM-2 encoder with a staging head trained on top. Cohen’s κ and macro F1, as point estimates with 95% bootstrap confidence intervals (1000 replicates) as subscripts; the better value of each pair is in bold. The macro F1 columns are those plotted in Fig. 4 b.
Dataset
C
N
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
Appendix
Supplementary Table 12: Sleep staging from wrist accelerometry. Window-level AUROC for five-class staging, mean ± s.d. across five subject-level folds at a single seed, for the same architecture trained end to end from random initialization and for a frozen SleepFM-2 encoder with a staging head trained on top. C , number of classes; N , number of windows. Newcastle contributes two rows, left and right wrist, from one cohort. These are the values plotted in Fig. 4 c.
Outcome
Category
n
SleepFM-2
Accel
Δ
Obesity
Endocrine/metabolic
222
0.877 [0.86,0.90]
0.879 [0.86,0.90]
−0.001 [-0.006,+0.004]
Benign prostatic hyperplasia
Genitourinary
168
0.865 [0.85,0.88]
0.866 [0.85,0.88]
−0.001 [-0.005,+0.002]
Repeated falls
Neurological
95
0.807 [0.76,0.85]
0.824 [0.78,0.87]
−0.017 [-0.035,+0.001]
Inguinal hernia
Gastrointestinal
128
0.807 [0.78,0.84]
0.806 [0.77,0.84]
+0.001 [-0.005,+0.008]
Pneumonia
Respiratory
59
0.806 [0.75,0.86]
0.803 [0.75,0.85]
+0.003 [-0.018,+0.025]
Appendix
Supplementary Table 13: All 101 UK Biobank outcomes with at least 50 events. Every outcome with at least 50 events in the accelerometry-models’ full test split (Dige et al. [ 31 ] ), ordered by SleepFM-2’s Harrell’s C on the matched test cohort ( n=5,192 ), highest first, with the PheCodeX category shown as a column. C -index is reported for SleepFM-2 and for the same accelerometry models (Accel), both carrying age, sex and BMI, with Δ = SleepFM-2 − Accel from a paired participant bootstrap (1,000 replicates). Subscripts are 95% confidence intervals from the same 1,000 replicates: marginal for SleepFM-2 and Accel, paired for Δ . After Benjamini–Hochberg correction across the 101 outcomes, no individual difference reached significance in either direction. n is the number of events on the matched cohort.
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
Appendix
Supplementary Table 14: Composition of the BioSerenity-derived scores. Each ordinal item is scored on a 0–4 scale (none, slight or few times, moderate or sometimes, often, severe or always), and subjects missing any component item are excluded from that score. The “Somatic” score combines native binary items with ordinal items binarized at moderate or worse, so that every item contributes equally. Item thresholds for the “Last-night” and “Habitual” scores are set individually so that roughly 20 to 30% of recordings endorse each item. All criteria of the “Objective” score are defined in the poor-sleep direction. The overall score is the mean of the three sub-scores, rather than the nine individual criteria, so that the three domains contribute equally.
Endpoint
AUROC threshold
Test n
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]
+0.026 [ +0.016 , +0.034 ] **
Difficulty falling asleep
binary ≥ 1
6,590
32.0%
0.793 [0.782, 0.804]
+0.034 [ +0.026 , +0.042 ] **
Woke during night
binary ≥ 1
6,597
34.2%
0.772 [0.761, 0.783]
+0.032 [ +0.023 , +0.042 ] **
Trouble returning
binary ≥ 1
6,584
35.1%
0.775 [0.764, 0.786]
+0.033 [ +0.025 , +0.043 ] **
Not refreshing
binary ≥ 1
6,259
26.2%
0.703 [0.687, 0.716]
+0.011 [ +0.000 , +0.023 ] *
Appendix
Supplementary Table 15: Per-endpoint thresholds and SleepFM-2 performance (BioSerenity). Test-set n , positive rate at the AUROC binarization threshold, SleepFM-2 AUROC (with 95% subject-bootstrap CI), and paired Δ AUROC vs the Combined baseline (with 95% CI and two-sided bootstrap p -value: * p<0.05 , ** p<0.01 ). For binary chart items the label is already 0/1, so no threshold is required; for fractional endpoints the threshold is the prespecified cutoff used in the main figure. On the “Objective poor sleep” row the Combined baseline is Demographics + Microstructure only, since the macro report is a definitional leak. Endpoint definitions and item compositions are in the Methods.
Component
LLaMA block
Vanilla block
Normalization
RMSNorm (pre-norm)
LayerNorm (pre-norm)
FFN activation
SwiGLU
GELU
FFN structure
3 linears ( w1,w2,w3 )
2 linears ( w1,w2 )
FFN hidden dim
38d , rounded
2048 (fixed) or 4d
Linear bias
No
Yes
Positional encoding
RoPE (rotary, in attention)
Sinusoidal (additive, pre-encoder)
Appendix
Supplementary Table 16: The two transformer block designs. The LLaMA-style block, used by SleepFM-2 and by columns (d) to (f) of the ablation chain, against the vanilla block used by SleepFM-1 and by columns (a) to (c).
Supplementary Figure 2: Disease prediction by input modality in SSC and HSP. All panels show results across the same 939 phecodes over a six-year horizon; orange denotes SSC and blue denotes HSP. a , b , Disease prediction using each modality individually, with one physical channel selected per modality and performance reported as the gain over demographics. The analysis includes 2,798 SSC and 6,884 HSP subjects. Dashed lines and bands show the corresponding performance of the multimodal encoder using one channel from each modality at once. PPG is included only in SSC because it was not recorded in HSP. c , Comparison of three strategies for combining the same channels: a single joint encoder pass over all channels, an unweighted mean of the single-modality risk scores, and a ridge-penalized Cox model combining those scores. The joint encoder result is plotted on the same axis as a and b ; percentages indicate the fraction of its performance recovered by each score-combination strategy. Filled diamonds denote the joint encoder and open circles denote post hoc score combination.
Supplementary Figure 3: Per-modality disease-prediction gain over demographics, broken down by phecode category. Same runs as Supplementary Fig. 2 a, b, aggregated within each of the 15 phecode categories used in Fig. 2 a. Each subpanel shows the mean ΔC -index over demographics with 95% bootstrap intervals over conditions, for the multimodal encoder pass (“All modalities”, top row) and for one physical channel of each modality (rows below, grouped by physiological family). Orange denotes SSC and blue denotes HSP. n in each title is the number of conditions in that category. The per-category n is smaller than in Fig. 2 a because this experiment is restricted to the subjects with all modalities recorded, and some phecodes fall below the twenty-event minimum on the smaller subject set. The leading single modality varies across categories and across cohorts, and no single channel consistently outperforms the multimodal encoder across categories.
Supplementary Figure 4: SleepFM-Interface, a demonstration webpage for SleepFM-2. A conceptual prototype shown to illustrate how SleepFM-2’s outputs could be surfaced to a reader. It is research software, is not clinical software, and has not been evaluated in a reader, usability or workflow study. a , Summary tab. Macro-sleep summary, findings against reference ranges, per-condition disease scores and subjective-experience predictions, all read out from one frozen embedding by task-specific heads. The prototype renders each condition’s model score as a percentage beside the cohort average. These are uncalibrated relative scores, not calibrated absolute risks. b , Recording tab. Whole-night hypnogram and model-inferred arousals, limb movements and respiratory events overlaid on the raw signals, which the physician can filter and audit. Supplementary Figs. 5 and 6 show the details and report tabs.
Supplementary Figure 5: SleepFM-Interface, details tab. The measurements that support the summary in Supplementary Fig. 4 a, exposed in full: sleep continuity (total sleep time, efficiency, WASO, awakenings, stage shifts, latencies), sleep architecture (minutes and percentage of TST for each stage), and respiratory, oximetry and cardiac indices. The physician uses this tab when a summary finding calls for verification of the underlying values, and the assistant on the right can be asked to explain, requery or export any of them.
Supplementary Figure 6: SleepFM-Interface, report tab. Assistant-drafted study report, laid out as a clinical document with the study identity across the top, followed by an impression, recommendations, and the measured sections beneath. Only the impression is shown here for space; the recommendations and measured sections follow below within the interface. The impression and recommendations are drafted from the pipeline’s outputs and remain fully editable; the physician revises and signs before the report leaves the interface.
Supplementary Figure 7: Concept emergence across encoder depth. Held-out encoding strength of a LinearProbe on the frozen SleepFM-2 encoder, at seven read-out depths (shallow → deep: Enc1-0, Enc1-1 are blocks of the encoder’s first transformer stack, Pool the spatial pooling step, Enc2-0–Enc2-3 blocks of the second stack). Sleep-scoring and microstructure concepts are AUROC; age is a C -index (rank-AUROC), sharing the same [0.5, 1] chance-anchored scale. Demographic attributes are shown for context only: these probes read individual one-second tokens, so they are not comparable to the subject-level age R2 of Supplementary Table 5 , which is fitted on the pooled embedding of a whole recording. Probes are split by subject; bands are 95% bootstrap CIs over held-out subjects. Dotted line marks chance. Five-class staging reaches an AUROC of 0.94 and cortical arousal 0.92, with spindles, slow waves and eye movements between 0.90 and 0.92; respiratory apnea is weaker, rising from 0.70 to 0.80 with depth. All of these concepts are encoded more sharply at the deeper encoder layers than the shallow ones.
Supplementary Figure 8: The representation is organized like sleep biology. Linear-discriminant projection of the five sleep stages at Enc2-0, the first block of the encoder’s second transformer stack; shaded regions are per-stage kernel densities at 40% of peak, dots are stage centroids, and the dashed grey line is the Wake → N3 depth axis. Panels 2–5 overlay the density of event-positive tokens (dashed contours at 40% / 70% of peak) for cortical arousal, N2 spindle, N2/N3 slow wave and REM eye movement, in the same coordinate frame. The five stages lie along a continuous Wake to N3 depth axis with REM offset as a separate mode, and each event falls where it occurs clinically: spindle and slow-wave density over N2 and N3, eye movements over REM, and arousals over the lighter transitional territory.
Supplementary Figure 9: SAE-feature monosemanticity taxonomy across expansion and depth. Top-k SAEs over expansion ratios E∈{1,2,4,8,16,32,64} (plus the raw embedding, dashed row) × the seven encoder depths. Left tier, as a percentage of all features: coverage (aligns with ≥1 concept domain), active-but-unaligned (fires, matches no labelled domain), dead (silent). Right tier, as a percentage of concept-encoding features only: separable (exactly one domain) and entangled ( ≥2 ). Domains are macro sleep stage, microstructure, demographics, pathophysiology and disease. Read-out depths run shallow → deep (Enc1-* = first transformer stack, Pool = spatial pooling, Enc2-* = second stack); the dashed vertical line separates the two stacks, the dashed horizontal line the raw embedding from the trained SAEs. Among features that align with at least one domain, the entangled fraction is substantial at the narrowest dictionaries and falls steadily as the dictionary widens, so entanglement at small widths reflects dictionary capacity rather than a property of the encoder. Across all widths, however, most features align with no labeled domain at all.
Supplementary Figure 10: Concept-direction entanglement. Lower triangle of the pairwise cosine similarity between SAE steering directions, dC=normalize(zˉC+−zˉpool) . Magnitude is entanglement strength (0 independent, 1 collinear); sign separates co-activated pairs (red) from mutually exclusive ones (blue). Black staircase separates the concept groups (sleep stage, microstructure, demographics, disease), which are also color-coded in the tick labels. Pairs drawn from the same group are more entangled than pairs drawn from different groups, at a mean cosine of 0.20 against 0.04, so the encoder keeps sleep stages, microstructure, demographics and disease in broadly distinct directions. Within the sleep concepts the expected pairings appear, with slow wave aligned to N3 at + 0.90 and N2 anti-aligned with wake at − 0.70. The seven disease labels are co-directed with one another at a mean cosine of 0.55, with atrial fibrillation and heart failure at + 0.82 and stroke and hypertension at + 0.79. These labels record disease presence rather than incidence and are far fewer than the phecodes analyzed in the main text, so this is a coarser view of the shared structure reported there, measured in the encoder rather than in models fitted on top of it.
Polysomnography (PSG) provides the gold standard for sleep assessment but suffers from substantial heterogeneity across recording devices and cohorts. There have been growing efforts to build general-purpose foundation models (FMs) for sleep physiology, but lack an in-depth understanding of the pre-training process and scaling patterns that lead to more generalizable sleep FMs. To fill this gap, we curate a massive corpus of 166,500 hours of sleep recordings from nine public sources and establish SleepBench, a comprehensive, fully open-source benchmark. Leveraging SleepBench, we systematically evaluate four families of self-supervised pre-training objectives and uncover three critical findings: (1) existing FMs fail to generalize to missing channels at inference; (2) channel-invariant feature learning is essential for pre-training; and (3) scaling sample size, model capacity, and multi-source data mixture consistently improves downstream performance.With an enhanced pre-training and scaling recipe, we introduce OSF, a family of sleep FMs that achieves state-of-the-art performance across nine datasets on diverse sleep and disease prediction tasks. Further analysis of OSF also reveals intriguing properties in sample efficiency, hierarchical aggregation, and cross-dataset scaling.
Zitao Shuai, Zongzhe Xu, David Yang +2
University of California, Los Angeles · Emory University
Sleep foundation models have recently demonstrated strong performance on in-domain polysomnography tasks, including sleep staging, apnea detection, and disease risk prediction. In this work, we investigate whether sleep biosignals can serve as an effective pretraining distribution for learning representations that transfer beyond sleep to adjacent domains. Following sleep foundation models, we perform sleep-only multimodal contrastive pretraining (with a leave-one-out objective) and evaluate transfer to non-sleep EEG and ECG, two well-benchmarked biosignal modalities with heterogeneous datasets and clinically meaningful downstream tasks. Across eight downstream tasks spanning multiple EEG and ECG datasets, sleep pretraining consistently improves performance relative to training from scratch. Moreover, on several tasks, we achieve performance competitive with or surpassing prior specialized state-of-the-art and foundation models.
William Lehn-Schiøler, Magnus Ruud Kjær, Phillip Hempel +7
BrainCapture ApS, Kongens Lyngby, Denmark · DTU Health Tech, Technical University of Denmark, Kongens Lyngby, Denmark · DTU Compute, Technical University of Denmark, Kongens Lyngby, Denmark +4
Foundation models offer a promising route to compress multi-modal physiological signals into compact representations of human health, with broad applications across sleep medicine, cardiology, neurology and other healthcare domains. Existing models have typically been trained with masked-reconstruction or contrastive objectives. However, masked reconstruction may be poorly suited to the stochastic nature of these signals, while contrastive approaches rely on positive-pair definitions despite the semantic invariances of physiological signals being poorly understood. In this work, we show that next-token prediction is a simple and scalable alternative. We develop Hypnos, a multi-modal sleep foundation model trained using eight different sensing modalities (e.g. EEG, ECG, respiratory signals) drawn from over 20,000 overnight polysomnography recordings. We tokenize each modality into streams of discrete tokens using residual vector quantization, then train a large auto-regressive RQ-Transformer to jointly predict the next token across all modalities in parallel. After training, Hypnos can be applied to continuous streams of sensor data from any subset of supported modalities, generating embeddings for downstream tasks. Across a range of benchmarks, Hypnos significantly outperforms existing foundation models. In sleep stage classification, we match the performance of strong supervised baselines on held-out test sets whilst using 100× less labelled data. Hypnos even generalises to daytime physiology, surpassing a dedicated ECG foundation model at detecting atrial fibrillation. Our results demonstrate that next-token prediction is a strong self-supervised objective for representation learning from multi-modal physiological signals.
Jonathan F. Carter, Lionel Tarassenko
Institute of Biomedical Engineering University of Oxford