SleepLM: Sleep Analysis with Language Modeling
- 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 . The paper studies two variants. The first is an -gram model,
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 , processed by a multi-layer LSTM, and mapped to
The -gram models were built with KenLM on concatenated sleep-stage sequences, exploring . The LSTM variants used or $4$ layers, hidden dimension , and embedding dimension 0. 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 1, the decoder combines the signal-model likelihood 2 with the SleepLM prior 3, using
4
Beam search keeps the top-5 partial hypotheses with 6, expands them over the five candidate next stages, updates scores, and prunes back to the beam width.
Quantitatively, the paper reports that 7-gram perplexity on HMC decreases up to 8, then rises because of data sparsity, with best 9. The LSTM SleepLM with 0 hidden units achieves validation/test perplexity 1 on HMC and 2 on NCHSDB. For sleep-stage classification, the 4-channel signal model with greedy decoding attains validation 3, accuracy 4, and test 5, accuracy 6; adding the LSTM SleepLM with 7 and beam 8 yields no appreciable change. By contrast, the 1-channel EOG-only signal model improves from validation 9, accuracy 0, and test 1, accuracy 2 to validation 3, accuracy 4, and test 5, accuracy 6 when fused with the LSTM prior at 7, beam 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 9 from raw wearable and mobile sensing features 0 plus LLM-derived latent factors 1, formalized as
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 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,
4
and evaluation uses RMSE, MAE, and 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 6 cluster, by generating synthetic low-efficiency samples with an LLM.
The data pipeline begins by excluding entries with missing 7 or more than 8 missing features, imputing outliers via the Tukey method with participant means, discarding features with 9 to 0, removing one of any pair with 1, adding day_of_week and is_weekend flags, dropping the first week per participant to allow historical features, standardizing via 2-score, and applying an 3 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 4, 5, and 6 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 7, suggest three actionable tips, ranked by expected sleep-efficiency gain.” GPT also returns JSON containing feature names, current values, and sensitivity slopes 8 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 9 value.
The reported performance on the INS-W0 cohort shows that with hand-picked 72 features, the stacked model attains RMSE 1, MAE 2, and 3. With top-4 20 features plus LLM-generated data, CatBoost reaches RMSE 5, MAE 6, and 7, identified in the paper as the best overall result for that configuration. Incorporating LLM-generated data improves 8 from 9 to 0 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 1 in RMSE reduction and 2 in 3 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 4 Hz, band-pass filtered with a Butterworth filter 5, 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 6 contains band power PSD in 7, amplitude, standard deviation, kurtosis, band ratios 8, 9, $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 0, 1; and the majority-vote baseline gives accuracy 2, 3. On Sleep EDF Expanded for five-class sleep staging, fine-tuned GPT-3.5 on features reaches accuracy 4, 5; in-context GPT-4 Vision on waveform images reaches accuracy 6, 7, with 8 failures; zero-shot GPT-4 on features yields accuracy 9, 00; XGBoost reaches accuracy 01, 02; and the baseline gives accuracy 03, 04. On sleep quality detection from PSQI for 05, 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 06 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, 07, 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 08. A lightweight transformer reconstruction decoder predicts signal patches 09 from encoder latents. A modality-conditioned text decoder prepends a learnable modality token 10 and generates the multilevel caption 11 conditioned on 12 and 13. By toggling loss weights 14, 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: 15 with 16, 17, and 18. Here 19 is an InfoNCE objective over sleep embeddings 20 and text embeddings 21, 22 is an MSE loss over 23 and 24, and 25 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 26, stage balanced accuracy 27, event IoU 28, event balanced accuracy 29, HR MAE 30, HR trend recall 31, 32 MAE 33, 34 trend recall 35, and channel sMAPE 36. The paper reports gains over the best baseline of 37 in stage AUC, 38 in stage balanced accuracy, 39 in event IoU, 40 in event balanced accuracy, approximately zero in HR MAE, 41 in HR recall, 42 in 43 recall, and 44 in channel-statistics sMAPE. In zero-shot retrieval on CFS, SleepLM (ReCoCa) obtains text-to-signal 45, 46, and signal-to-text 47, 48; on SHHS it reaches 49, 50, 51, and 52, respectively. For unseen apnea classification, with mixed apnea and obstructive apnea absent from training, SleepLM reports mixed apnea 53, balanced accuracy 54, and obstructive apnea 55, balanced accuracy 56. 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.