Sleep Brain and Cardiac Activity Predict Cognitive Flexibility and Conceptual Reasoning Using Deep Learning *

Boshra Khajehpiri, Éric Granger, Massimiliano de Zambotti, Fiona C. Baker, Mohamad Forouzanfar

Introduction: Beyond Sleep Duration

Traditional sleep research has long relied on "macro" metrics—such as total sleep time or sleep efficiency—to assess the relationship between rest and cognitive health. However, these aggregate numbers often fail to capture the "microstructure" of sleep: the complex, non-linear oscillations in brain waves and heart rate variability that occur throughout the night. While previous studies have linked sleep to memory consolidation and age-related decline, there remains a significant gap in understanding how these physiological signatures relate to executive functions, such as cognitive flexibility and conceptual reasoning.

To address this, researchers developed CogPSGFormer, a hybrid deep learning model designed to predict high-level cognitive performance using a single night’s polysomnography (PSG) data. By analyzing raw brain (EEG) and heart (ECG) signals, the model demonstrates that sleep microstructure contains rich, predictive biomarkers of daytime mental agility.

The CogPSGFormer Architecture: A Multi-Modal Approach

The CogPSGFormer architecture represents a novel integration of Convolutional Neural Networks (CNNs) and Transformers, specifically optimized for the long-range temporal dependencies inherent in sleep data.

Multi-Modal and Hybrid Features

Unlike models that rely solely on raw data or manual feature engineering, CogPSGFormer utilizes a hybrid approach. It processes raw EEG (C3-M2) and ECG-I channels alongside "hand-crafted" features, including EEG power bands (Alpha, Beta, Delta, etc.) and Heart Rate Variability (HRV) parameters. This combination allows the model to leverage both the raw physiological nuances and established clinical metrics.

Multi-Scale CNNs with Weight-Sharing

Sleep events occur at varying frequencies and durations—from rapid sleep spindles to slower K-complexes. To capture these diverse signals, the model employs a multi-scale CNN. A unique "weight-sharing" mechanism is used where a single large kernel is dynamically sliced to handle different scales, ensuring computational efficiency while maintaining high sensitivity to multi-frequency patterns.

Transformer Backbone

Given that sleep recordings are extensive (the study utilized 5-hour windows), the model uses a Transformer backbone. The self-attention mechanism of the Transformer allows the model to weigh the importance of different sleep stages and events across the entire night, identifying long-range relationships that traditional Recurrent Neural Networks (like LSTMs) often miss.

Experimental Setup and Dataset

The study utilized the STAGES (Stanford Technology Analytics and Genomics in Sleep) dataset, comprising 817 individuals (average age 44). The primary objective was binary classification: predicting whether a participant would score in the "high" or "low" performance group on the Penn Conditional Exclusion Test (PCET). The PCET is a rigorous assessment of executive function that requires participants to identify and adapt to abstract rules that change without warning.

Key Insights and Results

The Heart-Brain Connection

A central finding of the research is the importance of the autonomic nervous system in cognitive prediction. By integrating ECG data with EEG signals, the model achieved a more holistic view of the sleeper's state. The results suggest that autonomic regulation during sleep is as informative for predicting cognitive flexibility as cortical activity itself.

Performance Benchmarks

The CogPSGFormer significantly outperformed traditional architectures:

  • Top Accuracy: 80.30%
  • F1-Score: 0.89
  • Comparison: The model surpassed vanilla Transformers (76.16%) and stacked LSTMs (73.10%).

Notably, the hybrid approach was essential for this performance. While deep learning is often praised for its ability to learn features from scratch, raw signals alone yielded only ~64% accuracy. The jump to 80% occurred only when raw signals were combined with engineered features, highlighting the continued value of domain-specific knowledge in medical AI.

Limitations and Future Outlook

While CogPSGFormer marks a significant step forward in sleep-based cognitive assessment, several areas for future work remain. The current model operates on a binary classification (high vs. low performance); future iterations aim to employ regression to predict exact cognitive scores on a continuous scale. Additionally, while Transformers offer attention maps, the model remains largely a "black box." Mapping specific "attention peaks" back to recognizable clinical sleep events—such as specific REM patterns—will be crucial for clinical adoption.

Furthermore, the study was limited to single EEG and ECG channels. Expanding the input to include frontal EEG channels may capture more localized brain activity specifically related to the prefrontal cortex and executive function. Despite these limitations, the study proves that the "hidden" signals in our sleep are powerful predictors of how we think, reason, and adapt the following day.

Summary updated

Abstract

Despite extensive research on the relationship between sleep and cognition, the connection between sleep microstructure and human performance across specific cognitive domains remains underexplored. This study investigates whether deep learning models can predict executive functions, particularly cognitive adaptability and conceptual reasoning from physiological processes during a night's sleep. To address this, we introduce CogPSGFormer, a multi-scale convolutional-transformer model designed to process multi-modal polysomnographic data. This model integrates one-channel ECG and EEG signals along with extracted features, including EEG power bands and heart rate variability parameters, to capture complementary information across modalities. A thorough evaluation of the CogPSGFormer architecture was conducted to optimize the processing of extended sleep signals and identify the most effective configuration. The proposed framework was evaluated on 817 individuals from the STAGES dataset using cross-validation. The model achieved 80.3% accuracy in classifying individuals into low vs. high cognitive performance groups on unseen data based on Penn Conditional Exclusion Test (PCET) scores. These findings highlight the effectiveness of our multi-scale feature extraction and multi-modal learning approach in leveraging sleep-derived signals for cognitive performance prediction. To facilitate reproducibility, our code is publicly accessible<sup>1</sup>.
BibTeX
@misc{khajehpiri2025sleep,
  author = {Boshra Khajehpiri and Éric Granger and Massimiliano de Zambotti and Fiona C. Baker and Mohamad Forouzanfar},
  title = {{Sleep Brain and Cardiac Activity Predict Cognitive Flexibility and Conceptual Reasoning Using Deep Learning <sup>*</sup>}},
  year = {2025},
  eprint = {2506.00279},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.00279},
}
Figure