Papers
Topics
Authors
Recent
Search
2000 character limit reached

SleepLM: Sleep Analysis with Language Modeling

Updated 4 July 2026
  • SleepLM is a set of research systems that connect sleep physiology with language modeling for enhanced sleep-stage prediction and interpretability.
  • It comprises methodologies ranging from sequence priors and LLM-augmented regression to prompt-based multimodal analysis and foundation models.
  • Practical implementations show improvements in low-sensor accuracy, synthetic data generation, and zero-shot transfer for sleep event detection and intervention.

SleepLM denotes a set of research systems that connect sleep analysis with language modeling, but the label is not used for a single standardized architecture. In the recent literature, it has referred to a sequence model that predicts the next sleep stage from prior stage labels, to a two-stage LLM-augmented framework for sleep-efficiency regression and interactive feedback, to GPT-based multimodal prompting over EEG, activity, and behavioral data, and to a family of sleep-language foundation models that align natural language with multimodal polysomnography (PSG) (Choi et al., 2023, Khaokaew et al., 2023, Sano et al., 2024, Xu et al., 27 Feb 2026). Across these usages, the unifying theme is the attempt to couple sleep physiology or sleep-related behavior with language-mediated inference, querying, explanation, or intervention.

1. Nomenclature and scope

The literature uses the term in several technically distinct ways. One usage treats SleepLM as a probabilistic prior over discrete sleep-stage sequences. A second usage applies the term to a sleep-oriented LLM that combines structured sensing features, synthetic data generation, and interactive GPT-based feedback. A third usage concerns LLM-based prompting pipelines that ingest EEG-derived representations, activity visualizations, and questionnaire text. A fourth usage, introduced by Xu et al., defines SleepLM as a family of sleep-language foundation models with unified pretraining over PSG and text (Xu et al., 27 Feb 2026).

Formulation Core data Principal function
Sequence SleepLM Sleep-stage label sequences Predict the next sleep stage and improve decoding
Two-stage sleep-oriented LLM Wearable/mobile sensing features plus LLM-derived latent factors Regress sleep efficiency and generate actionable feedback
GPT-based multimodal prompting EEG waveforms, spectrograms, activity data, PSQI text Estimate attention, sleep stages, sleep quality, and generate suggestions
Sleep-language foundation model Multimodal PSG paired with multilevel captions Zero-shot and few-shot sleep understanding, retrieval, captioning, and event localization

A common misconception is that SleepLM names a single model family. The published record instead shows a progression from discrete sequence modeling, to prompt-based interaction over engineered features, to multimodal foundation modeling over raw physiological data and natural-language supervision.

2. Sequence priors for sleep-stage decoding

In "Sleep Model -- A Sequence Model for Predicting the Next Sleep Stage" (Choi et al., 2023), SleepLM is a prior over stage sequences st{W,REM,N1,N2,N3}s_t \in \{W, REM, N1, N2, N3\}. The paper studies two variants. The first is an nn-gram model,

P(ststn+1,,st1)C(stn+1,,st1,st)C(stn+1,,st1),P(s_t \mid s_{t-n+1},\dots,s_{t-1}) \approx \frac{C(s_{t-n+1},\dots,s_{t-1},s_t)}{C(s_{t-n+1},\dots,s_{t-1})},

with smoothing and back-off as in KenLM, including Kneser–Ney back-off smoothing. The second is an LSTM-RNN sleep model in which the previous stage label is embedded into xt=Eonehot(st1)x_t = E\,\mathrm{onehot}(s_{t-1}), processed by a multi-layer LSTM, and mapped to

P(sts<t)=softmax(Vht(L)+b).P(s_t\mid s_{<t})=\mathrm{softmax}(V\,h_t^{(L)}+b).

The nn-gram models were built with KenLM on concatenated sleep-stage sequences, exploring n=29n=2\ldots9. The LSTM variants used L=2L=2 or $4$ layers, hidden dimension H{256,1024}H\in\{256,1024\}, and embedding dimension nn0. Training minimized cross-entropy and proceeded until validation perplexity plateau. Input data consisted of pure stage-label sequences from HMC, with 98 train, 24 val, and 29 test nights, and NCHSDB, with 3036 train, 379 val, and 380 test nights.

The sequence prior is combined with a sensor model through beam-search decoding. For each epoch nn1, the decoder combines the signal-model likelihood nn2 with the SleepLM prior nn3, using

nn4

Beam search keeps the top-nn5 partial hypotheses with nn6, expands them over the five candidate next stages, updates scores, and prunes back to the beam width.

Quantitatively, the paper reports that nn7-gram perplexity on HMC decreases up to nn8, then rises because of data sparsity, with best nn9. The LSTM SleepLM with P(ststn+1,,st1)C(stn+1,,st1,st)C(stn+1,,st1),P(s_t \mid s_{t-n+1},\dots,s_{t-1}) \approx \frac{C(s_{t-n+1},\dots,s_{t-1},s_t)}{C(s_{t-n+1},\dots,s_{t-1})},0 hidden units achieves validation/test perplexity P(ststn+1,,st1)C(stn+1,,st1,st)C(stn+1,,st1),P(s_t \mid s_{t-n+1},\dots,s_{t-1}) \approx \frac{C(s_{t-n+1},\dots,s_{t-1},s_t)}{C(s_{t-n+1},\dots,s_{t-1})},1 on HMC and P(ststn+1,,st1)C(stn+1,,st1,st)C(stn+1,,st1),P(s_t \mid s_{t-n+1},\dots,s_{t-1}) \approx \frac{C(s_{t-n+1},\dots,s_{t-1},s_t)}{C(s_{t-n+1},\dots,s_{t-1})},2 on NCHSDB. For sleep-stage classification, the 4-channel signal model with greedy decoding attains validation P(ststn+1,,st1)C(stn+1,,st1,st)C(stn+1,,st1),P(s_t \mid s_{t-n+1},\dots,s_{t-1}) \approx \frac{C(s_{t-n+1},\dots,s_{t-1},s_t)}{C(s_{t-n+1},\dots,s_{t-1})},3, accuracy P(ststn+1,,st1)C(stn+1,,st1,st)C(stn+1,,st1),P(s_t \mid s_{t-n+1},\dots,s_{t-1}) \approx \frac{C(s_{t-n+1},\dots,s_{t-1},s_t)}{C(s_{t-n+1},\dots,s_{t-1})},4, and test P(ststn+1,,st1)C(stn+1,,st1,st)C(stn+1,,st1),P(s_t \mid s_{t-n+1},\dots,s_{t-1}) \approx \frac{C(s_{t-n+1},\dots,s_{t-1},s_t)}{C(s_{t-n+1},\dots,s_{t-1})},5, accuracy P(ststn+1,,st1)C(stn+1,,st1,st)C(stn+1,,st1),P(s_t \mid s_{t-n+1},\dots,s_{t-1}) \approx \frac{C(s_{t-n+1},\dots,s_{t-1},s_t)}{C(s_{t-n+1},\dots,s_{t-1})},6; adding the LSTM SleepLM with P(ststn+1,,st1)C(stn+1,,st1,st)C(stn+1,,st1),P(s_t \mid s_{t-n+1},\dots,s_{t-1}) \approx \frac{C(s_{t-n+1},\dots,s_{t-1},s_t)}{C(s_{t-n+1},\dots,s_{t-1})},7 and beam P(ststn+1,,st1)C(stn+1,,st1,st)C(stn+1,,st1),P(s_t \mid s_{t-n+1},\dots,s_{t-1}) \approx \frac{C(s_{t-n+1},\dots,s_{t-1},s_t)}{C(s_{t-n+1},\dots,s_{t-1})},8 yields no appreciable change. By contrast, the 1-channel EOG-only signal model improves from validation P(ststn+1,,st1)C(stn+1,,st1,st)C(stn+1,,st1),P(s_t \mid s_{t-n+1},\dots,s_{t-1}) \approx \frac{C(s_{t-n+1},\dots,s_{t-1},s_t)}{C(s_{t-n+1},\dots,s_{t-1})},9, accuracy xt=Eonehot(st1)x_t = E\,\mathrm{onehot}(s_{t-1})0, and test xt=Eonehot(st1)x_t = E\,\mathrm{onehot}(s_{t-1})1, accuracy xt=Eonehot(st1)x_t = E\,\mathrm{onehot}(s_{t-1})2 to validation xt=Eonehot(st1)x_t = E\,\mathrm{onehot}(s_{t-1})3, accuracy xt=Eonehot(st1)x_t = E\,\mathrm{onehot}(s_{t-1})4, and test xt=Eonehot(st1)x_t = E\,\mathrm{onehot}(s_{t-1})5, accuracy xt=Eonehot(st1)x_t = E\,\mathrm{onehot}(s_{t-1})6 when fused with the LSTM prior at xt=Eonehot(st1)x_t = E\,\mathrm{onehot}(s_{t-1})7, beam xt=Eonehot(st1)x_t = E\,\mathrm{onehot}(s_{t-1})8. The paper’s central conclusion is that SleepLM priors significantly boost accuracy when only limited sensors are available, whereas strong multi-channel PSG models leave little room for additional gain.

3. Sleep-efficiency regression and interactive GPT feedback

"ZzzGPT: An Interactive GPT Approach to Enhance Sleep Quality" describes a two-stage framework that its technical narrative explicitly organizes as a Sleep-oriented LLM, or SleepLM (Khaokaew et al., 2023). Stage 1 is a predictive engine for regression of sleep efficiency xt=Eonehot(st1)x_t = E\,\mathrm{onehot}(s_{t-1})9 from raw wearable and mobile sensing features P(sts<t)=softmax(Vht(L)+b).P(s_t\mid s_{<t})=\mathrm{softmax}(V\,h_t^{(L)}+b).0 plus LLM-derived latent factors P(sts<t)=softmax(Vht(L)+b).P(s_t\mid s_{<t})=\mathrm{softmax}(V\,h_t^{(L)}+b).1, formalized as

P(sts<t)=softmax(Vht(L)+b).P(s_t\mid s_{<t})=\mathrm{softmax}(V\,h_t^{(L)}+b).2

Stage 2 is a user-centric feedback layer in which a chat interface powered by an LLM API clarifies ambiguous questions, fetches the predicted P(sts<t)=softmax(Vht(L)+b).P(s_t\mid s_{<t})=\mathrm{softmax}(V\,h_t^{(L)}+b).3, renders an interactive graph of key features, and produces natural-language recommendations.

The Stage 1 model family includes CatBoost, Random Forest, XGBoost, and a stacked ensemble that feeds each model’s prediction into a ridge regressor. The loss is mean squared error with ridge penalty,

P(sts<t)=softmax(Vht(L)+b).P(s_t\mid s_{<t})=\mathrm{softmax}(V\,h_t^{(L)}+b).4

and evaluation uses RMSE, MAE, and P(sts<t)=softmax(Vht(L)+b).P(s_t\mid s_{<t})=\mathrm{softmax}(V\,h_t^{(L)}+b).5. Input features include heart rate, step count, screen time, Bluetooth device count, and location. The paper addresses the natural skew in GLOBEM, described as a P(sts<t)=softmax(Vht(L)+b).P(s_t\mid s_{<t})=\mathrm{softmax}(V\,h_t^{(L)}+b).6 cluster, by generating synthetic low-efficiency samples with an LLM.

The data pipeline begins by excluding entries with missing P(sts<t)=softmax(Vht(L)+b).P(s_t\mid s_{<t})=\mathrm{softmax}(V\,h_t^{(L)}+b).7 or more than P(sts<t)=softmax(Vht(L)+b).P(s_t\mid s_{<t})=\mathrm{softmax}(V\,h_t^{(L)}+b).8 missing features, imputing outliers via the Tukey method with participant means, discarding features with P(sts<t)=softmax(Vht(L)+b).P(s_t\mid s_{<t})=\mathrm{softmax}(V\,h_t^{(L)}+b).9 to nn0, removing one of any pair with nn1, adding day_of_week and is_weekend flags, dropping the first week per participant to allow historical features, standardizing via nn2-score, and applying an nn3 train/test split. Synthetic data generation repeatedly samples 20-day windows, formats them as Markdown-style tables, asks the LLM to generate five additional days with the same columns while preserving temporal correlations, and runs a verification loop that rejects outputs missing required columns. Temperature is set to nn4, nn5, and nn6 to capture all 72 features. The combined training set is the original GLOBEM train set union the LLM-generated samples.

The interactive layer is organized by prompt templates. A system prompt instructs the model to act as a sleep coach. Few-shot prompt templates cover clarification, prediction, and recommendation turns, including the instruction, “Given nn7, suggest three actionable tips, ranked by expected sleep-efficiency gain.” GPT also returns JSON containing feature names, current values, and sensitivity slopes nn8 for JavaScript-driven sliders. Example interactive elements include sliders for screen_time_last_2h, steps_daytime, bedtime_variability, and surrounding_BT_devices, each paired with a predicted nn9 value.

The reported performance on the INS-Wn=29n=2\ldots90 cohort shows that with hand-picked 72 features, the stacked model attains RMSE n=29n=2\ldots91, MAE n=29n=2\ldots92, and n=29n=2\ldots93. With top-n=29n=2\ldots94 20 features plus LLM-generated data, CatBoost reaches RMSE n=29n=2\ldots95, MAE n=29n=2\ldots96, and n=29n=2\ldots97, identified in the paper as the best overall result for that configuration. Incorporating LLM-generated data improves n=29n=2\ldots98 from n=29n=2\ldots99 to L=2L=20 for CatBoost and yields small gains in RMSE and MAE across all models. Figure 1 further reports that “CatBoost 20+G” outperforms three baseline depression-prediction pipelines by a margin of L=2L=21 in RMSE reduction and L=2L=22 in L=2L=23 gain. The feedback layer then translates prediction into intervention through recommendations such as reducing screen time before bed, increasing daytime steps, adjusting bedtime routine, and optional push notifications.

4. Prompt-based LLMs over EEG, activity, and behavioral data

"Exploration of LLMs, EEG, and behavioral data to measure and support attention and sleep" studies a broader prompt-based SleepLM formulation in which each modality is treated as prompt material for GPT-4 or GPT-3.5 Turbo (Sano et al., 2024). EEG waveforms are sampled at L=2L=24 Hz, band-pass filtered with a Butterworth filter L=2L=25, and segmented into fixed windows: 10 s for attention and 30 s for sleep. Time-frequency spectrograms are computed via Daubechies wavelet transforms. The numerical EEG representation L=2L=26 contains band power PSD in L=2L=27, amplitude, standard deviation, kurtosis, band ratios L=2L=28, L=2L=29, $4$0, and 90th percentile amplitude. Additional modalities are actogram images, hourly-averaged activity graphs, and free-text PSQI responses.

The paper expresses the approach conceptually as

$4$1

followed by task-specific outputs for attention, sleep stage, and sleep quality. In practice, these heads are not separate Transformer layers but prompt instructions asking the LLM to return JSON with label, confidence, and explanation. Numerical features are converted into short JSON-like text or fed via fine-tuning as tabular tokens; images are passed to GPT-4 Vision; PSQI text is used directly as natural-language input.

The empirical results are explicitly mixed. On the Mental Attention State dataset, fine-tuned GPT-3.5 on features yields accuracy $4$2, $4$3; in-context GPT-4 Vision on spectrograms yields accuracy $4$4, $4$5, with $4$6 “cannot assist”; zero-shot GPT-4 Vision yields accuracy $4$7, $4$8, with $4$9 failures; XGBoost on numerical features attains accuracy H{256,1024}H\in\{256,1024\}0, H{256,1024}H\in\{256,1024\}1; and the majority-vote baseline gives accuracy H{256,1024}H\in\{256,1024\}2, H{256,1024}H\in\{256,1024\}3. On Sleep EDF Expanded for five-class sleep staging, fine-tuned GPT-3.5 on features reaches accuracy H{256,1024}H\in\{256,1024\}4, H{256,1024}H\in\{256,1024\}5; in-context GPT-4 Vision on waveform images reaches accuracy H{256,1024}H\in\{256,1024\}6, H{256,1024}H\in\{256,1024\}7, with H{256,1024}H\in\{256,1024\}8 failures; zero-shot GPT-4 on features yields accuracy H{256,1024}H\in\{256,1024\}9, nn00; XGBoost reaches accuracy nn01, nn02; and the baseline gives accuracy nn03, nn04. On sleep quality detection from PSQI for nn05, ground truth is 39 good and 38 poor sleepers, and GPT-4 correctly identifies 39 good and 27 poor, with 11 poor-to-good errors, for overall nn06 accuracy.

The same study also uses the LLM as an intervention generator. The prompt context can include habitual EEG feature summaries, PSQI responses, actogram visuals, demographics, health issues such as anxiety, PTSD, insomnia, pain, or shift work, and personal preferences such as beach, forest, favorite animals, or hobbies. Prompts instruct the model to produce sleep hygiene suggestions aligned with CBT-i best practices and a guided imagery script tailored to user preferences. The paper notes that initial scripts included raw EEG ratios, which later prompts explicitly disallowed. It also records several failure modes: GPT-4 Vision often refuses to process raw spectrogram or actogram images; high-dimensional numeric features prompt “I can’t assist” responses or superficial heuristic reasoning; and infrequent night-time movements in actograms may be misread as poor sleep. The stated implication is that improved performance would require more labeled data, domain-specific pretraining or fine-tuning, or retrieval of external sleep-science knowledge.

5. Sleep-language foundation models

The 2026 paper "SleepLM: Natural-Language Intelligence for Human Sleep" formalizes SleepLM as a family of sleep-language foundation models built on the ReCoCa architecture (Xu et al., 27 Feb 2026). Its stated goal is to bridge natural language and multimodal polysomnography so that sleep analysis is no longer confined to closed label spaces such as predefined stages or events. To support this alignment, the authors curate what they describe as the first large-scale sleep-text dataset, comprising five NSRR cohorts—SHHS, MrOS, CCSHS, CFS, and WSC—with more than 10,000 participants, 12,000 nights, and more than 100,000 hours of PSG. The data contain 12 channels at 64 Hz: EEG, EOG, EMG, ECG, heart rate, nn07, respiration, and body position, segmented into non-overlapping 30 s windows.

Text supervision is generated through a multilevel caption pipeline. Channel captions convert numeric statistics such as EEG band power, HRV, and respiration rate into language templates. Local captions describe event onsets and offsets, including hypopnea, desaturation, and arousal, via peak or trend detection. Global captions summarize sleep stage and autonomic state. The result is dense, hierarchically structured text supervision for every 30 s epoch.

ReCoCa consists of four components. The channel-specific sleep encoder performs patch embedding per channel, followed by interleaved temporal attention with RoPE along time and channel attention with RoPE along the sensor dimension, producing a CLS token embedding nn08. A lightweight transformer reconstruction decoder predicts signal patches nn09 from encoder latents. A modality-conditioned text decoder prepends a learnable modality token nn10 and generates the multilevel caption nn11 conditioned on nn12 and nn13. By toggling loss weights nn14, the framework yields CLIP-style, Cap-style, CoCa-style, or full ReCoCa training variants.

The unified pretraining objective combines contrastive alignment, reconstruction, and caption generation: nn15 with nn16, nn17, and nn18. Here nn19 is an InfoNCE objective over sleep embeddings nn20 and text embeddings nn21, nn22 is an MSE loss over nn23 and nn24, and nn25 is an autoregressive cross-entropy loss over caption tokens.

The quantitative results define the foundation-model usage of SleepLM. Averaged over SHHS, MrOS, and CFS, zero-shot SleepLM (ReCoCa) reaches stage AUC nn26, stage balanced accuracy nn27, event IoU nn28, event balanced accuracy nn29, HR MAE nn30, HR trend recall nn31, nn32 MAE nn33, nn34 trend recall nn35, and channel sMAPE nn36. The paper reports gains over the best baseline of nn37 in stage AUC, nn38 in stage balanced accuracy, nn39 in event IoU, nn40 in event balanced accuracy, approximately zero in HR MAE, nn41 in HR recall, nn42 in nn43 recall, and nn44 in channel-statistics sMAPE. In zero-shot retrieval on CFS, SleepLM (ReCoCa) obtains text-to-signal nn45, nn46, and signal-to-text nn47, nn48; on SHHS it reaches nn49, nn50, nn51, and nn52, respectively. For unseen apnea classification, with mixed apnea and obstructive apnea absent from training, SleepLM reports mixed apnea nn53, balanced accuracy nn54, and obstructive apnea nn55, balanced accuracy nn56. The paper also describes qualitative and perturbation evidence for language-guided event localization, noting that cosine similarity correlates linearly with temporal IoU even without explicit localization supervision.

6. Methodological themes, limitations, and interpretive issues

Taken together, these papers suggest three methodological axes for SleepLM research. The first is sequential prior modeling over discrete stage labels, where language-model techniques function as transition regularizers for sensor-based classifiers (Choi et al., 2023). The second is prompt-mediated interaction over engineered or tabular sleep features, where the LLM acts as a conversational interface, explanation layer, or synthetic-data generator rather than as the primary physiological encoder (Khaokaew et al., 2023, Sano et al., 2024). The third is joint representation learning over raw PSG and text, where SleepLM becomes a multimodal foundation model with open-vocabulary capabilities (Xu et al., 27 Feb 2026).

A second recurring issue is that the benefit of language-model components is task- and modality-dependent. In the sequence-model formulation, the prior provides substantial gains for EOG-only sleep staging but no appreciable change for a 4-channel signal model. In the GPT-based prompting study, LLM-based detection performs substantially worse than classical ML on low-dimensional EEG features and activity-derived inputs, even though the same systems can produce plausible sleep hygiene suggestions and guided imagery. In the two-stage sleep-efficiency framework, LLM involvement yields measurable but modest predictive gains through synthetic augmentation and supports actionable feedback. In the foundation-model setting, by contrast, natural-language supervision is integral to zero-shot classification, retrieval, captioning, and unseen-task transfer. This suggests that SleepLM is most effective when language is structurally aligned with the task, rather than merely appended to a weak physiological representation.

The limitations reported in the literature are likewise heterogeneous but consistent in emphasis. The foundation-model work notes that cohort diversity is limited to five NSRR datasets, that clinical validation and regulatory approval remain outstanding, and that the 30 s context window leaves longer-range dependencies to sliding and aggregation. The GPT-based prompting study highlights multimodal fusion limits, privacy concerns for EEG, latency, and reliability under drift. The interactive GPT framework depends on prompt engineering, verification loops for synthetic data, and interface design choices such as clarification turns and optional push notifications. None of the papers presents SleepLM as a completed clinical diagnostic system.

The resulting state of the field is technically plural rather than terminologically unified. "SleepLM" can denote a next-stage sequence prior, an interactive sleep-efficiency assistant, a prompt-based multimodal GPT pipeline, or a sleep-language foundation model. The strongest common denominator is the use of language modeling to extend sleep analysis beyond isolated per-epoch classification, whether by enforcing sequence consistency, generating actionable advice, enabling natural-language querying, or learning language-grounded representations of sleep physiology.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to SleepLM.