Abstract
Automatic sleep staging relies on effective representation of physiological signals. Representative raw-signal sleep-staging encoders typically transform input waveforms while progressively compressing their temporal resolution within the same encoding path. However, explicit modality-specific, sample-aligned, and task-driven signal-domain transformation before epoch-level feature extraction remains comparatively underexplored. To investigate this design, we propose RefineSleepNet, an end-to-end sequence-to-sequence framework that explicitly separates these two stages. Separately parameterized Signal Refinement U-Net (SRU-Net) branches first transform EEG and EOG waveforms while preserving the original temporal length, after which Epoch Feature Extractors (EFEs) extract epoch-level representations from the refined signals. Fused Sequence Attention (FSA) then performs multimodal integration and cross-epoch contextual modeling before epoch-wise classification. All stages are jointly optimized using the final sleep-staging objective without a separate waveform reconstruction target. RefineSleepNet was evaluated on Sleep-EDF-39, Sleep-EDF-153, and ISRUC-3 using subject-independent 10-fold cross-validation, achieving accuracy/macro-F1 (MF1) scores of 84.5%/79.8%, 83.5%/78.1%, and 80.3%/78.1%, respectively. Ablation experiments supported the coordinated design, while statistical analysis and intermediate-representation evaluations further examined the robustness and characteristics of the learned transformation. The learned transformation retained broad temporal and spectral organization while introducing local waveform changes and modality-specific spectral redistribution. These results support the staged organization as a viable modeling strategy for EEG/EOG sleep staging.
1. Introduction
Sleep is a fundamental physiological process that contributes to neural information processing and memory-related organization [1]. Sleep staging provides a standardized description of overnight sleep organization by segmenting polysomnography (PSG) recordings into 30 s epochs and assigning each epoch to one of five stages: Wake (W), N1, N2, N3, and rapid eye movement (REM), according to the American Academy of Sleep Medicine (AASM) criteria [2]. Among PSG signals, electroencephalogram (EEG) and electrooculogram (EOG) are widely used because they provide complementary cortical and ocular information associated with sleep-stage transitions. However, manual sleep staging remains time-consuming, labor-intensive, and subject to inter-scorer variability. Therefore, automatic sleep staging has become an important approach for efficient analysis of overnight PSG recordings.
Early automatic sleep staging methods mainly relied on handcrafted time-domain, frequency-domain, and time–frequency features combined with conventional classifiers [3]. Although these approaches demonstrated the feasibility of automatic sleep staging, their performance depended strongly on manually designed feature representations. Deep learning methods subsequently reduced this dependence by learning sleep-related representations directly from raw or transformed signals. CNN-based approaches have been widely adopted to capture local and multiscale waveform patterns within individual epochs [4,5], while dual-view architectures further exploit complementary amplitude and temporal characteristics of EEG signals [6]. Fully convolutional encoder–decoder frameworks have also been introduced for dense temporal sleep-stage classification, such as U-Time, which performs end-to-end segmentation using an encoder–decoder architecture [7]. Although these approaches have achieved promising performance, most studies primarily focus on extracting discriminative representations from input signals, whereas the organization of signal transformation and subsequent representation compression remains less explicitly investigated.
Beyond epoch-level feature learning, sleep staging also requires modeling temporal dependencies across neighboring epochs because sleep stages evolve sequentially rather than independently. Existing studies have introduced recurrent architectures [8,9,10,11,12], attention-based approaches [13,14,15], and more recent Transformer-based or hybrid frameworks [16,17,18,19]. These developments have substantially improved the ability to capture cross-epoch contextual information. However, most sequence modeling methods operate on already extracted epoch-level features, and the interaction between signal-domain transformation and subsequent temporal dependency modeling remains insufficiently explored.
In parallel, multimodal approaches have leveraged complementary information from EEG, EOG, and other PSG signals to improve sleep-stage representation. Existing studies have investigated joint-input, feature-level fusion, multi-view learning, ensemble strategies, and learned fusion mechanisms [20,21,22,23,24]. These studies demonstrate the value of multimodal physiological information for automatic sleep staging. Nevertheless, EEG and EOG reflect different physiological processes, and many existing approaches mainly combine these modalities after feature extraction, leaving modality-specific signal refinement before fusion relatively underexplored.
Despite these advances, several challenges remain in learning robust representations for EEG/EOG-based sleep staging. First, in many raw-signal sleep-staging frameworks, waveform transformation and temporal compression are performed within the same encoding pathway. Although effective for classification, such coupled designs make it difficult to explicitly characterize how physiological signals are transformed before epoch-level representation learning. Second, EEG and EOG contain complementary but distinct information, while existing multimodal frameworks provide limited investigation into modality-specific signal-domain transformation before fusion. Third, although cross-epoch modeling has improved sleep-stage transition recognition, how to effectively integrate temporally aligned signal representations with sequence-level contextual modeling remains an open problem.
To address these challenges, this study investigates a staged representation-learning architecture in which modality-specific, sample-aligned signal-domain transformation is explicitly performed before epoch-level feature compression and sequence-level contextual modeling. Since EEG and EOG exhibit distinct signal characteristics while providing complementary sleep-stage information, separately parameterized transformation branches are designed for the two modalities. After signal refinement and epoch-level feature extraction, the resulting modality-specific representations are integrated and modeled across consecutive epochs to incorporate multimodal complementarity and temporal dependencies.
To implement this staged architecture, we propose RefineSleepNet, an end-to-end sequence-to-sequence framework for EEG/EOG sleep staging. For each epoch, separately parameterized Signal Refinement U-Net (SRU-Net) branches first generate modality-specific, sample-aligned signal representations while preserving the original temporal length. Epoch Feature Extractors (EFEs) then compress these representations into fixed-dimensional epoch-level features. The resulting EEG and EOG feature sequences are integrated and contextually modeled across consecutive epochs by the Fused Sequence Attention (FSA) module, followed by epoch-wise classification. The entire framework is optimized jointly using the final sleep-staging objective without requiring an explicit waveform reconstruction or denoising target.
The main contributions of this work are summarized as follows:
- 1.
- We investigate a staged representation-learning strategy that explicitly decouples modality-specific, sample-aligned signal-domain transformation from subsequent epoch-level feature compression. The transformation preserves the original temporal length and is optimized jointly through the final sleep-staging objective rather than a predefined waveform reconstruction target.
- 2.
- We develop RefineSleepNet to instantiate this strategy for multimodal EEG/EOG sleep staging. Separately parameterized SRU-Net branches learn modality-specific signal representations, followed by epoch-level feature extraction, multimodal feature integration, and cross-epoch contextual modeling within a unified sequence-to-sequence framework.
- 3.
- We conduct systematic evaluations on three public sleep datasets using subject-independent cross-validation, representative baseline comparisons, statistical analyses, and controlled ablation studies. Beyond classification performance, the learned intermediate representations and predicted sleep architecture are investigated through temporal consistency, spectral modulation, intra-epoch attention-response analysis, and agreement analysis between predicted and reference hypnograms.
2. Materials and Methods
2.1. Datasets and Preprocessing
Three public sleep datasets, including Sleep-EDF-39, Sleep-EDF-153, and ISRUC-3 [25,26,27], were used to evaluate the proposed RefineSleepNet framework. Sleep-EDF-39 comprises 20 healthy subjects, including 10 males and 10 females aged 25 to 34 years, yielding 42,308 epochs; except for subject 13 with one missing sleep record, the subjects each have two PSG recordings. Sleep-EDF-153 comprises 78 healthy subjects aged 25 to 101 years with 195,479 epochs; except for subjects 13, 36, and 52, each missing one sleep record, the remaining subjects each have two PSG recordings. ISRUC is a public sleep database with three subgroups, and Subgroup III provides PSG recordings from 10 healthy subjects, resulting in 8785 epochs. Table 1 summarizes the stage distributions of these datasets.
Table 1.
Summary of the datasets.
For consistency across datasets, the same preprocessing procedure was applied. Specifically, each 30 s epoch was originally annotated into one of six stages: Wake, N1, N2, N3, N4, and REM. Following the AASM standard, N3 and N4 were merged into a single stage N3 [28]. In addition, as recommended in prior work, we retained the 30 min before sleep onset and the 30 min after the end of sleep. For Sleep-EDF-39 and Sleep-EDF-153, the Fpz–Cz EEG channel and the ROC–LOC EOG derivation were used. For ISRUC-3, the F3–A2 EEG channel and the ROC–A1 EOG derivation were used. All signals were resampled to 100 Hz. No additional signal filtering or normalization was applied. Consecutive 30 s epochs were organized into sequences of 20 epochs, corresponding to a 10 min temporal context. For the training set, a sliding window with a stride of 10 epochs was used, resulting in a 50% overlap between adjacent sequences. Validation and test sequences were constructed without overlap. At the end of each recording, trailing segments containing fewer than 20 epochs were discarded.
2.2. Problem Formulation
Automatic sleep staging is formulated as a sequence-to-sequence classification problem, where a consecutive sequence of PSG epochs is used as input and each epoch within the sequence is assigned a corresponding sleep stage label. Unlike independent epoch-wise classification, this formulation allows the model to exploit contextual information from neighboring epochs, which is important because sleep stages exhibit temporal continuity and transition patterns.
Given paired EEG and EOG recordings, the input sequence can be represented as:
where T denotes the number of consecutive epochs in an input sequence, and and represent the EEG and EOG signals of the t-th epoch, respectively.
The objective is to learn a mapping function that predicts the sleep-stage sequence:
where denotes the predicted sleep-stage labels and represents the trainable parameters of RefineSleepNet.
2.3. Overview
As illustrated in Figure 1, RefineSleepNet is an end-to-end sequence-to-sequence architecture that organizes representation learning into three stages: modality-specific signal-domain transformation, epoch-level feature extraction, and multimodal sequence modeling. This staged design explicitly separates signal transformation from subsequent feature compression, addressing the limitation of conventional raw-signal encoders where these two operations are often coupled. EEG and EOG are processed independently during the first two stages to preserve modality-specific characteristics, while multimodal interaction and cross-epoch contextual modeling are performed after modality-specific epoch representations have been obtained.
Figure 1.
Architecture of RefineSleepNet. (a) Overall sequence-to-sequence framework. Consecutive EEG and EOG epochs are first processed by two separately parameterized signal transformation branches, each consisting of a signal encoder, a Bottleneck Self-Attention Module (BSAM), and a signal decoder. The transformed waveforms are then compressed by the Epoch Feature Extractor (EFE) into modality-specific epoch-level feature sequences. The Fused Sequence Attention (FSA) module integrates the EEG and EOG feature sequences and performs cross-epoch contextual modeling, after which a classifier produces one sleep-stage prediction for each input epoch. (b) Architecture of the EFE, which consists of successive BNBlocks and temporal max-pooling operations followed by adaptive average pooling.
For the i-th epoch of modality , the Signal Refinement U-Net (SRU-Net) maps the input signal to a sample-aligned intermediate representation . The Epoch Feature Extractor (EFE) then converts this sample-aligned intermediate representation into a compact epoch-level feature vector for subsequent sequence modeling. The EEG and EOG branches share the same architectural configuration but use separate parameters. Both SRU-Net and EFE operate independently on individual epochs and therefore introduce no cross-epoch interaction.
The resulting sequence representation is finally mapped to one sleep-stage prediction for each input epoch by the classification head. The complete framework is optimized jointly using the final sleep-staging objective, without an explicit waveform reconstruction target, allowing the intermediate signal representation to be learned according to the downstream sleep-staging task rather than a predefined reconstruction criterion.
2.4. Signal Refinement U-Net (SRU-Net)
As illustrated in Figure 2, SRU-Net implements the signal-domain transformation stage before epoch-level feature extraction. For each 30 s epoch, it learns a task-driven signal-domain representation while preserving the original temporal length and sample alignment. EEG and EOG are processed by architecturally identical but separately parameterized SRU-Net branches, allowing modality-specific transformations to be learned without parameter sharing.
Figure 2.
Architecture of a Signal Refinement U-Net (SRU-Net) branch. The encoder extracts multi-scale representations through convolutional blocks and temporal downsampling. At the bottleneck, BSAM applies positional encoding, stacked multi-head self-attention, and a feed-forward network to the compressed temporal representation. The decoder restores the original temporal resolution through upsampling and channel-wise concatenation with the corresponding encoder features. Finally, the decoder output is combined with the original input through a learnable scaled residual shortcut, yielding a sample-aligned intermediate waveform representation.
For the i-th epoch of modality , let denote the input signal. An initial channel projection is followed by a multi-level encoder composed of convolutional blocks and temporal downsampling:
where , and D is the number of encoder stages. denotes the initial channel projection, represents the convolution–batch-normalization–activation block at encoder stage r, and is retained for the corresponding decoder skip connection.
At the bottleneck, the Bottleneck Self-Attention Module (BSAM) is introduced to model dependencies across the compressed temporal positions within each epoch. After bottleneck feature transformation, the channel and temporal axes are transposed, and sinusoidal positional encoding is added:
where denotes the bottleneck convolutional block and denotes the sinusoidal positional encoding.
The resulting representation is processed by stacked multi-head self-attention layers. For compactness, denotes self-attention in which the query, key, and value are all derived from . Each attention layer is formulated as
where , and A is the number of self-attention layers. The attention stack is followed by a feed-forward network:
where , , and denote multi-head self-attention, the feed-forward network, and layer normalization, respectively. BSAM operates independently within each epoch and therefore captures intra-epoch temporal dependencies. Interactions across consecutive epochs are modeled subsequently by FSA.
The decoder progressively restores the temporal length of the representation. At each decoding stage, the decoder feature is linearly interpolated to the temporal length of the corresponding encoder feature and concatenated with it along the channel dimension:
where , , and denotes the transformation at decoder stage j. Moreover, denotes linear interpolation to the temporal length of the corresponding encoder feature, and denotes channel-wise concatenation. The final decoding stage produces a single-channel output with the same temporal length as the original input.
The decoder output is combined with the original waveform through a modality-specific adaptive residual shortcut:
where is a learnable scalar initialized to 0.5. This formulation provides an adaptive residual pathway that balances the original signal information and the learned representation, allowing the contribution of the transformed signal to be optimized jointly with the downstream sleep-staging objective. No separate reconstruction or denoising target is imposed; instead, the two SRU-Net branches are optimized jointly with the subsequent staging network using the final sleep-stage classification objective.
2.5. Epoch Feature Extractor (EFE)
As shown in Figure 1b, the Epoch Feature Extractor (EFE) converts the sample-aligned output of SRU-Net into a compact epoch-level representation. While SRU-Net produces an output with the same temporal length as its input, EFE progressively compresses the temporal dimension to obtain fixed-dimensional epoch-level features. The EEG and EOG streams employ the same EFE architecture but use separately learned parameters.
For the i-th epoch of modality , EFE takes as input, with . At each of the first convolutional stages, the feature is processed by a BNBlock followed by temporal max-pooling to obtain , where and K denotes the total number of convolutional stages. Each BNBlock consists of a one-dimensional convolution, batch normalization, and a ReLU activation.
After the final convolutional stage, adaptive average pooling aggregates the remaining temporal positions to produce a fixed-dimensional epoch representation:
where denotes adaptive average pooling and is the resulting epoch-level feature vector.
For L consecutive epochs, the resulting feature vectors are arranged chronologically as , where each row corresponds to one epoch. EFE processes each epoch independently and therefore introduces no cross-epoch interaction.
2.6. Fused Sequence Attention (FSA)
The Fused Sequence Attention (FSA) module combines the modality-specific epoch representations produced by EFE and aggregates contextual information across consecutive epochs. As illustrated in Figure 3, FSA first integrates the EEG and EOG representations through additive and element-wise interaction terms, and then applies self-attention to the resulting fused sequence.
Figure 3.
Architecture of the Fused Sequence Attention (FSA) module. The EEG and EOG epoch representations are combined through element-wise addition and multiplication. Sinusoidal positional encoding is added to the fused sequence before applying stacked multi-head self-attention layers. Each attention layer is followed by a residual connection and layer normalization. A feed-forward network with an additional residual connection and layer normalization produces the final sequence representation.
Let denote the EEG and EOG feature sequences output by EFE, where L is the number of consecutive epochs and is the epoch-feature dimension. Each row of these matrices represents one epoch in chronological order. The two modalities are fused as
where ⊙ denotes element-wise multiplication. The additive term combines the two modality representations directly, whereas the multiplicative term introduces element-wise interactions between their corresponding feature dimensions.
To preserve the temporal order of consecutive epochs, sinusoidal positional encoding is added to the fused sequence before applying self-attention:
where , and M is the number of self-attention layers. Because the query, key, and value are all derived from the same fused sequence, this operation performs self-attention rather than cross-attention. Each epoch representation can therefore aggregate content-dependent contextual information from the other epochs within the input sequence.
After the attention stack, a feed-forward network is applied with a residual connection and layer normalization:
where is the resulting sequence-level representation. This representation is subsequently passed to the convolutional classification head to generate one sleep-stage prediction for each input epoch.
2.7. Classification and Loss Function
The sequence representation is mapped to per-epoch five-class logits by a three-layer one-dimensional convolutional classification head, with a tanh activation applied after the first convolutional layer. The resulting logit matrix contains one five-class logit vector for each of the L input epochs.
Sleep staging datasets often suffer from severe class imbalance, where the N2 stage typically contains far more samples than other stages. Under standard cross-entropy loss, optimization is dominated by majority classes, which may degrade performance on minority classes. Therefore, we adopt Focal Loss as the training objective.
Focal Loss down-weights easy examples via a modulating factor, encouraging the model to focus on hard-to-classify samples:
where B is the batch size, L is the sequence length, denotes the predicted probability of the ground-truth class for the j-th epoch of the i-th sample, is the class weight, and is the class-specific focusing parameter.
2.8. Implementation Details
RefineSleepNet was implemented in PyTorch 2.5.1 and trained on a workstation equipped with an NVIDIA GeForce RTX 4090 GPU. As described above, the input sequence length was set to 20 consecutive epochs, corresponding to a 10-min temporal context.
The AdamW optimizer was used with an initial learning rate of 0.001 and a weight decay of 0.01. The learning rate was scheduled by ReduceLROnPlateau: when the validation accuracy did not improve for five consecutive epochs, the learning rate was multiplied by 0.3. The batch size was set to 32, and the maximum number of training epochs was 60. Early stopping was applied with a patience of 15.
To address class imbalance, Focal Loss was used as the training objective. The focusing parameter was set to 2.0 for W, N2, N3, and REM, and to 3.0 for N1 to further emphasize hard N1 samples. The class weights were set to [1.0, 1.8, 1.0, 1.2, 1.25] for W, N1, N2, N3, and REM, respectively. Label smoothing was applied with .
The hyperparameters of Focal Loss, including the class weights, focusing parameters, and label smoothing coefficient, were determined based on the validation performance of the training set. The same configuration was applied to all datasets without dataset-specific adjustment.
Unless otherwise specified, the following architectural configuration was used in all experiments. SRU-Net adopted encoder–decoder stages with channel widths [8, 16, 32, 48, 64]. In BSAM, self-attention layers were used with 4 attention heads, where the bottleneck feature dimension was and the feed-forward network dimension was set to . EFE produced -dimensional epoch representations. In FSA, stacked multi-head self-attention layers with 8 heads were used, followed by a feed-forward network for sequence-level temporal modeling.
2.9. Evaluation Metrics
We evaluated cross-subject performance using subject-independent 10-fold cross-validation. In each fold, the subjects were divided into training, validation, and test sets with an approximate ratio of 8:1:1. To avoid subject leakage, all records from the same subject were assigned to the same subset. The reported metrics included overall accuracy (Acc), macro-averaged F1-score (MF1), Cohen’s kappa, and F1-score for each class.
3. Results
3.1. Experimental Results
Table 2 compares the performance of RefineSleepNet with several representative sleep-staging approaches on Sleep-EDF-39, Sleep-EDF-153, and ISRUC-3. The compared methods include conventional machine-learning approaches, CNN/RNN-based models, and attention- or Transformer-based frameworks. For the compared baselines, the reported values are obtained from their original studies or reproduced implementations under the available configurations. For reproduced baselines, we followed the training settings described in the corresponding studies whenever sufficient details were provided. When the original studies did not explicitly specify the loss function, an unweighted cross-entropy loss was adopted for training. The performance of RefineSleepNet is reported as mean ± standard deviation over ten-fold cross-validation. Since sleep-stage distributions are imbalanced, macro-F1 (MF1), class-wise F1-scores, and accuracy are reported together.
Table 2.
Performance comparison of the approaches on three datasets.
Overall, RefineSleepNet achieves competitive performance across the three datasets. It obtains MF1/Acc values of 79.8 ± 2.76%/84.5 ± 3.38%, 78.1 ± 2.34%/83.5 ± 1.74%, and 78.1 ± 3.29%/80.3 ± 3.22% on Sleep-EDF-39, Sleep-EDF-153, and ISRUC-3, respectively. Compared with conventional machine-learning approaches, deep learning-based methods generally provide better macro-F1 performance by learning discriminative representations from raw physiological signals.
Compared with CNN/RNN-based models such as DeepSleepNet, TinySleepNet, and SleepEEGNet, RefineSleepNet shows improved overall performance across the three datasets. Recent sequence-, attention-, and Transformer-based models, including SeqSleepNet, TransSleep, SleepTransformer, and CausalAttenNet, are designed to capture inter-epoch temporal dependencies and achieve competitive performance under different evaluation settings. RefineSleepNet obtains consistently higher MF1 and Acc values under the current experimental setting, indicating the effectiveness of combining signal-domain representation learning and cross-epoch temporal modeling. Paired Wilcoxon signed-rank tests were further conducted between RefineSleepNet and the strongest reproduced baseline, CausalAttenNet, based on fold-level MF1 scores. The obtained p-values were 0.0640, 0.0445, and 0.0755 on Sleep-EDF-39, Sleep-EDF-153, and ISRUC-3, respectively. The performance difference reached statistical significance on Sleep-EDF-153.
For class-wise results, RefineSleepNet achieves the highest N1 F1-scores on all three datasets, with 52.2%, 52.3%, and 56.5% on Sleep-EDF-39, Sleep-EDF-153, and ISRUC-3, respectively. As shown in the normalized confusion matrices in Figure 4, Wake, N2, N3, and REM are generally well recognized, whereas N1 is still mainly confused with Wake, N2, and REM. Although RefineSleepNet achieves comparatively higher N1 F1-scores, N1 remains its most challenging sleep stage.
Figure 4.
Normalized confusion matrices obtained by RefineSleepNet on Sleep-EDF-39, Sleep-EDF-153, and ISRUC-3.
In terms of model size, RefineSleepNet contains approximately 0.8 M trainable parameters.
3.2. Ablation Experiment
3.2.1. Component-Wise Ablation
To evaluate the contribution of each component within RefineSleepNet, we designed the following variants:
- Add-Only: removes the multiplicative interaction term and the sequence-level self-attention module, retaining only additive EEG/EOG fusion.
- Fusion-Only: retains additive and multiplicative fusion operations but removes the sequence-level self-attention module.
- Add-only + FSA: removes the multiplicative fusion branch while retaining additive fusion and FSA.
- Multiply-only + FSA: removes the additive fusion branch while retaining multiplicative fusion and FSA.
- Concat fusion: replaces the proposed interaction-based fusion with feature concatenation.
- SRU-Net w/o BSAM: removes the bottleneck self-attention module while preserving the remaining SRU-Net architecture.
- w/o : removes the learnable residual connection coefficient in SRU-Net.
- CNN control: replaces SRU-Net with a CNN-based encoder-decoder while maintaining a comparable number of trainable parameters.
- FSA + w/o PE: removes positional encoding from the sequence-level self-attention module.
- EEG-only: removes the EOG branch and performs sleep staging using EEG representations only.
As shown in Table 3, the full RefineSleepNet achieves the highest MF1 among all tested variants on the three datasets, with scores of 79.8, 78.1, and 78.1 on Sleep-EDF-39, Sleep-EDF-153, and ISRUC-3, respectively, indicating that the proposed components provide complementary improvements when combined.
Table 3.
Ablation study of RefineSleepNet on three datasets. Each entry represents MF1/Acc/Kappa.
Regarding multimodal fusion, Add-Only and Fusion-Only evaluate the influence of fusion operations without sequence-level temporal modeling. Compared with the complete model, both variants show performance degradation, indicating that cross-epoch contextual modeling is important after multimodal fusion.
To further investigate the impact of different feature fusion strategies, we evaluated two variants, Add-only + FSA and Multiply-only + FSA, where the multi-head self-attention mechanism in FSA was retained while replacing the original fusion operation with addition-only or multiplication-only fusion. The results show that neither additive nor multiplicative interaction alone can achieve the performance of the complete fusion strategy, suggesting that complementary information is captured through the combination of both interaction mechanisms. Concat fusion obtains lower MF1 than the proposed fusion strategy on the evaluated datasets, indicating that explicitly modeling EEG/EOG interactions is beneficial for multimodal representation learning. For signal-domain representation learning, the CNN control variant was designed by replacing SRU-Net with a CNN-based encoder–decoder while maintaining a comparable parameter scale. Compared with CNN control, RefineSleepNet achieves higher MF1 performance, suggesting that the proposed SRU-Net provides more effective signal-domain representations under similar model capacity. Furthermore, removing BSAM decreases MF1 from 79.8% to 76.6% on Sleep-EDF-39, from 78.1% to 77.3% on Sleep-EDF-153, and from 78.1% to 76.4% on ISRUC-3. The w/o variant further evaluates the contribution of the learnable residual connection in SRU-Net. The performance variation after removing this adaptive residual coefficient suggests that the residual pathway contributes to signal-domain representation learning.
For sequence-level modeling, FSA + w/o PE produces lower performance than the full model, indicating that positional information contributes to modeling directional transitions across consecutive sleep epochs. For modality contribution, EEG-only shows reduced performance compared with the full model, demonstrating that EOG provides complementary information for sleep-stage discrimination.
3.2.2. Effect of Loss Function and Signal Processing Strategy
To investigate the influence of the training objective and front-end design, we further conducted two additional comparisons based on the complete RefineSleepNet. First, the original Focal Loss was replaced with a plain cross entropy (CE) loss while keeping the network architecture unchanged. Second, the proposed SRU-Net front-end was replaced with a fixed bandpass filtering strategy to evaluate the contribution of the learnable signal-domain representation. The results are summarized in Table 4.
Table 4.
Effect of training objective and front-end design. Each entry represents MF1/Acc/Kappa.
Compared with plain CE loss, the original Focal Loss configuration achieves higher MF1 and Kappa values across all three datasets. The improvement is consistent on both Sleep-EDF and ISRUC-3, indicating that the adopted loss function provides additional optimization benefits under the imbalanced distribution of sleep stages.
Compared with the Fixed Bandpass variant, the complete RefineSleepNet achieves higher MF1 performance on all datasets. The MF1 improvements are 3.6, 3.2, and 7.3 percentage points on Sleep-EDF-39, Sleep-EDF-153, and ISRUC-3, respectively. These results indicate that replacing manually designed filtering with the learnable SRU-Net front-end provides more adaptive signal representations for subsequent feature extraction and sequence-level modeling.
3.3. Signal-Domain Transformation Analysis
To understand how SRU-Net modifies the input signals under the sleep staging objective, we analyzed the SRU-Net outputs from three complementary perspectives: time-domain consistency and signal transformation, intra-epoch attention responses, and frequency-domain spectral modulation. The purpose of this analysis was not to treat SRU-Net as a conventional signal restoration module or to verify input replication. Instead, we examined whether the SRU-Net outputs before epoch-level feature extraction retain broad temporal and spectral structures of the inputs while exhibiting task-driven signal-domain transformations.
3.3.1. Time-Domain Consistency and Signal Transformation
The time-domain examples in Figure 5 show that the SRU-Net outputs generally preserve the overall waveform morphology and temporal trends of the raw EEG and EOG inputs, while changes can be observed in local amplitudes and fine-scale waveform details. These qualitative observations indicate that the SRU-Net outputs maintain the essential temporal structures of physiological signals while performing task-driven signal-domain transformation for sleep-stage discrimination.
Figure 5.
Time-domain examples of raw EEG/EOG inputs and the corresponding SRU-Net outputs for different sleep stages: (a) N1; (b) N2; (c) N3; and (d) REM. The examples illustrate broad input–output structural similarity together with local waveform modifications.
To quantitatively characterize the relationship between the raw inputs and the transformed outputs, Pearson correlation coefficient, mean squared error (MSE), mean absolute error (MAE), and Relative L2 change were calculated between the input signals and SRU-Net outputs. The results are summarized in Table 5. The Pearson correlations are 0.839 ± 0.061 for EEG and 0.792 ± 0.183 for EOG, indicating that the transformed signals maintain considerable similarity with the original physiological signals. Meanwhile, the non-zero MSE, MAE, and Relative L2 values indicate that SRU-Net introduces signal modifications rather than directly reproducing the input signals.
Table 5.
Input–output consistency between raw signals and SRU-Net transformed signals.
Overall, these results suggest that SRU-Net preserves the dominant temporal organization of EEG/EOG signals while modifying waveform characteristics relevant to sleep-stage classification.
3.3.2. Intra-Epoch Attention Responses
Figure 6 shows the intra-epoch BSAM response patterns extracted from the bottleneck self-attention module across different sleep stages. The response maps exhibit non-uniform distributions across temporal positions within each epoch, indicating that BSAM assigns different levels of attention to different temporal regions. Notably, relatively high attention responses are observed around locally distinctive waveform regions in EEG and EOG signals. These qualitative observations suggest that BSAM adaptively emphasizes temporally informative patterns during signal-domain transformation.
Figure 6.
Qualitative intra-epoch BSAM attention responses extracted from the bottleneck self-attention module across different sleep stages. The attention maps illustrate non-uniform temporal weighting over intra-epoch representations, where the color intensity represents the relative attention response at different temporal positions during signal-domain transformation.
3.3.3. Frequency-Domain Spectral Modulation
Figure 7 compares the FFT amplitude spectra of representative 30 s raw EEG/EOG inputs and their corresponding SRU-Net outputs. The dominant spectral profiles and major peak locations of the raw inputs remain broadly visible in the corresponding SRU-Net outputs. For EEG, the SRU-Net outputs exhibit spectral modulation mainly in low-frequency bands, whereas the differences at higher frequencies are relatively limited or show attenuation. The EOG spectra exhibit more moderate changes that are mainly concentrated in the lower-frequency range.
Figure 7.
FFT amplitude spectra of the raw EEG/EOG inputs and the corresponding SRU-Net outputs for N1, N2, N3, and REM.
To further characterize these changes, Figure 8 presents output-to-input band-power ratios calculated from the power spectral density estimates obtained using Welch’s method over delta (0.5–4 Hz), theta (4–8 Hz), alpha (8–12 Hz), beta (12–30 Hz), and gamma (30–50 Hz). For EEG, the output-to-input ratios indicate frequency-dependent redistribution, with relatively increased power mainly observed in low-frequency bands and reduced power in the gamma band. EOG shows more moderate spectral redistribution together with a consistent reduction in gamma-band power.
Figure 8.
Band-power ratios between the SRU-Net outputs and raw inputs for N1, N2, N3, and REM. The ratio is defined as the output band power divided by the input band power.
Overall, the FFT spectra and band-power ratios indicate that SRU-Net preserves the broad spectral organization of the input signals while introducing frequency-selective and modality-specific spectral modulation. These observations suggest that SRU-Net performs adaptive signal transformation rather than applying a fixed frequency filtering strategy.
3.4. Sleep Architecture Analysis
To evaluate whether the predicted hypnograms preserve the temporal organization of overnight sleep, we further analyzed global sleep statistics, stage composition, and temporal characteristics across all test subjects. Figure 9 shows an example sleep-window hypnogram comparison between the reference annotation and RefineSleepNet prediction. The predicted hypnogram generally follows the overall sleep-stage progression of the reference signal, while some short-duration stage transitions are not fully retained. The quantitative comparison across all test subjects is summarized in Table 6.
Figure 9.
Sleep-window hypnogram comparison for record SC4291G0. The upper panel shows the ground-truth hypnogram, and the lower panel shows the predicted hypnogram.
Table 6.
Comparison of predicted and reference sleep architecture parameters across all test subjects.
RefineSleepNet shows close agreement with the reference annotations for several global sleep parameters, particularly TST and SE. The mean signed errors of TST, SE, and REM latency are +1.54 min, +0.26%, and −1.68 min, respectively, indicating limited systematic bias in these global sleep parameters. In contrast, the number of sleep-stage transitions is underestimated, with 111.87 ± 28.52 transitions in the reference annotations and 96.39 ± 26.66 in the predictions, corresponding to a mean signed error of −15.47 ± 18.84. This discrepancy indicates that the predicted hypnograms tend to be smoother and may not fully preserve brief stage changes or fragmented sleep structures. Bland–Altman analyses were further performed for TST, SE, and REM latency, as shown in Figure 10. For TST, the bias was 1.54 min with limits of agreement from −12.08 to 15.16 min. For SE, the bias was 0.26% with limits of agreement from −2.32% to 2.84%. For REM latency, the bias was −1.68 min with limits of agreement from −35.65 to 32.30 min. Overall, these results indicate that RefineSleepNet preserves several major global sleep architecture characteristics beyond epoch-level classification performance, while transition-related temporal details remain less accurately reproduced.
Figure 10.
Bland–Altman analyses of predicted sleep architecture parameters: (a) total sleep time (TST); (b) sleep efficiency (SE); and (c) REM latency.
4. Discussion
The results across Sleep-EDF-39, Sleep-EDF-153, and ISRUC-3 support the effectiveness of the hierarchical modeling strategy adopted in RefineSleepNet. By introducing a modality-specific and sample-aligned signal-domain transformation before epoch-level feature compression, the model provides an explicit intermediate representation stage before subsequent multimodal integration and sequence-level contextual modeling. The consistent performance of the complete model, together with the ablation results, supports the contribution of this staged organization. In particular, the comparisons with the shallow convolutional front end and the model without sequence-level attention indicate that the complete SRU-Net front end and subsequent temporal contextualization both contribute to the final staging performance. Taken together, these findings highlight the value of coordinating signal-domain, epoch-level, and sequence-level representation learning within a unified framework.
The representation analyses further clarify the role of the signal-domain transformation. The SRU-Net outputs retained the broad temporal and spectral organization of the input signals while exhibiting local waveform modifications, non-uniform intra-epoch responses, and modality-specific spectral redistribution. These complementary observations support the interpretation that SRU-Net learns a task-driven intermediate waveform representation rather than simply reproducing the raw input. In the illustrative full-record case, the predicted hypnogram broadly followed the overnight sleep progression and showed relatively small deviations in total sleep time, sleep efficiency, and REM latency, although larger differences remained in stage composition. The reduced number of predicted stage transitions indicates that RefineSleepNet tends to generate smoother hypnograms, which may lead to underestimation of highly fragmented sleep patterns and short-duration stage fluctuations. This limitation suggests that further modeling of transition dynamics and event-level temporal variability may be beneficial for improving fine-grained sleep architecture reconstruction.
Despite the overall improvements, several limitations remain. First, although RefineSleepNet improves N1 recognition and overall macro-F1 performance, N1 remains a challenging stage due to its transitional characteristics and overlap with neighboring sleep stages. Second, the current sequence-level modeling focuses on contextual dependencies among consecutive epochs but does not explicitly model sleep-stage transition probabilities or physiological event timing. Therefore, future work could incorporate transition-aware objectives or event-level constraints to better preserve fragmented sleep structures. Finally, the current representation analysis mainly evaluates signal transformations and sleep architecture characteristics; broader validation on larger and more diverse cohorts will be necessary to further assess the generalizability of the learned representations.
5. Conclusions
In this paper, we propose RefineSleepNet, a hierarchical framework for automatic sleep staging from EEG/EOG recordings. Its central design explicitly separates modality-specific, sample-aligned, and task-driven signal-domain transformation from subsequent epoch-level feature extraction, while coordinating multimodal integration and cross-epoch contextual modeling. Results across three public datasets demonstrate the effectiveness of the proposed framework, while the ablation experiments provide component-level evidence for the contribution of the proposed modules. Complementary analyses of the intermediate waveform representations further indicate that the learned transformation retains broad temporal and spectral organization while introducing non-uniform temporal and spectral modulation rather than simply reproducing the input signals. Additional statistical analysis and sleep architecture evaluation further support the reliability of the obtained sleep staging results. Future work will investigate subject- and context-adaptive signal-domain transformation and transition-aware contextual modeling to better represent boundary epochs, fragmented sleep patterns, and brief stage transitions.
Author Contributions
Conceptualization, Z.Z.; methodology, Z.Z.; writing—original draft preparation, Z.Z.; writing—review and editing, Z.Z., B.Y., P.J. and Y.-T.S.; funding acquisition, B.Y.; supervision, B.Y., P.J. and Y.-T.S. All authors have read and agreed to the published version of the manuscript.
Funding
This work was supported by the Shandong Key R&D Program (Major Science and Technology Innovation Project) (2025CXGC020108).
Institutional Review Board Statement
Not applicable. This study used only publicly available, de-identified datasets and involved no new recruitment of human participants or collection of human-subject data.
Informed Consent Statement
Not applicable. This study involved secondary analysis of publicly available, de-identified datasets and did not involve direct recruitment of participants.
Data Availability Statement
The datasets analyzed in this study are publicly available. Sleep-EDF-39 and Sleep-EDF-153 were obtained from the Sleep-EDF Database Expanded available through PhysioNet, and ISRUC-3 was obtained from Subgroup III of the ISRUC-Sleep dataset.
Conflicts of Interest
The authors declare no conflicts of interest.
References
- McNaughton, B.L. Cortical Hierarchies, Sleep, and the Extraction of Knowledge from Memory. Artif. Intell. 2010, 174, 205–214. [Google Scholar] [CrossRef] [Scilit]
- Iber, C.; Ancoli-Israel, S.; Chesson, A.L.; Quan, S.F. The AASM Manual for the Scoring of Sleep and Associated Events: Rules, Terminology and Technical Specifications; American Academy of Sleep Medicine: Westchester, IL, USA, 2007; Volume 1. [Google Scholar]
- Aboalayon, K.A.I.; Faezipour, M.; Almuhammadi, W.S.; Moslehpour, S. Sleep Stage Classification Using EEG Signal Analysis: A Comprehensive Survey and New Investigation. Entropy 2016, 18, 272. [Google Scholar] [CrossRef] [Scilit]
- Phan, H.; Andreotti, F.; Cooray, N.; Chén, O.Y.; De Vos, M. Joint Classification and Prediction CNN Framework for Automatic Sleep Stage Classification. IEEE Trans. Biomed. Eng. 2019, 66, 1285–1296. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Sokolovsky, M.; Guerrero, F.; Paisarnsrisomsuk, S.; Ruiz, C.; Alvarez, S.A. Deep Learning for Automated Feature Discovery and Classification of Sleep Stages. IEEE/ACM Trans. Comput. Biol. Bioinform. 2020, 17, 1835–1845. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- An, P.; Zhao, J.; Du, B.; Zhao, W.; Zhang, T.; Yuan, Z. Amplitude–Time Dual-View Fused EEG Temporal Feature Learning for Automatic Sleep Staging. IEEE Trans. Neural Netw. Learn. Syst. 2024, 35, 6492–6506. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Perslev, M.; Jensen, M.; Darkner, S.; Jennum, P.J.; Igel, C. U-Time: A Fully Convolutional Network for Time Series Segmentation Applied to Sleep Staging. In Advances in Neural Information Processing Systems 32; Wallach, H., Larochelle, H., Beygelzimer, A., d’Alché-Buc, F., Fox, E., Garnett, R., Eds.; Curran Associates, Inc.: Red Hook, NY, USA, 2019; pp. 4415–4426. [Google Scholar]
- Supratak, A.; Dong, H.; Wu, C.; Guo, Y. DeepSleepNet: A Model for Automatic Sleep Stage Scoring Based on Raw Single-Channel EEG. IEEE Trans. Neural Syst. Rehabil. Eng. 2017, 25, 1998–2008. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Supratak, A.; Guo, Y. TinySleepNet: An Efficient Deep Learning Model for Sleep Stage Scoring Based on Raw Single-Channel EEG. In Proceedings of the 2020 42nd Annual International Conference of the IEEE Engineering in Medicine & Biology Society (EMBC); IEEE: New York, NY, USA, 2020; pp. 641–644. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Mousavi, S.; Afghah, F.; Acharya, U.R. SleepEEGNet: Automated Sleep Stage Scoring with Sequence to Sequence Deep Learning Approach. PLoS ONE 2019, 14, e0216456. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Phan, H.; Andreotti, F.; Cooray, N.; Chén, O.Y.; De Vos, M. SeqSleepNet: End-to-End Hierarchical Recurrent Neural Network for Sequence-to-Sequence Automatic Sleep Staging. IEEE Trans. Neural Syst. Rehabil. Eng. 2019, 27, 400–410. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Phan, H.; Lorenzen, K.P.; Heremans, E.; Chén, O.Y.; Tran, M.C.; Koch, P.; Mertins, A.; Baumert, M.; Mikkelsen, K.B.; De Vos, M. L-SeqSleepNet: Whole-cycle Long Sequence Modeling for Automatic Sleep Staging. IEEE J. Biomed. Health Inform. 2023, 27, 4748–4757. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Phan, H.; Andreotti, F.; Cooray, N.; Chén, O.Y.; Vos, M.D. Automatic Sleep Stage Classification Using Single-Channel EEG: Learning Sequential Features with Attention-Based Recurrent Neural Networks. In Proceedings of the 2018 40th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC); IEEE: New York, NY, USA, 2018; pp. 1452–1455. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Eldele, E.; Chen, Z.; Liu, C.; Wu, M.; Kwoh, C.K.; Li, X.; Guan, C. An Attention-Based Deep Learning Approach for Sleep Stage Classification With Single-Channel EEG. IEEE Trans. Neural Syst. Rehabil. Eng. 2021, 29, 809–818. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Seo, H.; Back, S.; Lee, S.; Park, D.; Kim, T.; Lee, K. Intra- and Inter-Epoch Temporal Context Network (IITNet) Using Sub-Epoch Features for Automatic Sleep Scoring on Raw Single-Channel EEG. Biomed. Signal Process. Control 2020, 61, 102037. [Google Scholar] [CrossRef] [Scilit]
- Phan, H.; Mikkelsen, K.; Chén, O.Y.; Koch, P.; Mertins, A.; De Vos, M. SleepTransformer: Automatic Sleep Staging With Interpretability and Uncertainty Quantification. IEEE Trans. Biomed. Eng. 2022, 69, 2456–2467. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Phyo, J.; Ko, W.; Jeon, E.; Suk, H.I. TransSleep: Transitioning-Aware Attention-Based Deep Neural Network for Sleep Staging. IEEE Trans. Cybern. 2023, 53, 4500–4510. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Pan, J.; Feng, Y.; Zhao, P.; Zou, X.; Hou, A.; Che, X. CausalAttenNet: A Fast and Long-Term-Temporal Network for Automatic Sleep Staging With Single-Channel EEG. IEEE Trans. Instrum. Meas. 2024, 73, 2529613. [Google Scholar] [CrossRef] [Scilit]
- Liu, C.; Guan, Q.; Zhang, W.; Sun, L.; Wang, M.; Dong, X.; Xu, S. MultiScaleSleepNet: A Hybrid CNN–BiLSTM–Transformer Architecture with Multi-Scale Feature Representation for Single-Channel EEG Sleep Stage Classification. Sensors 2025, 25, 6328. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Chambon, S.; Galtier, M.N.; Arnal, P.J.; Wainrib, G.; Gramfort, A. A Deep Learning Architecture for Temporal Sleep Stage Classification Using Multivariate and Multimodal Time Series. IEEE Trans. Neural Syst. Rehabil. Eng. 2018, 26, 758–769. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Wang, I.N.; Lee, C.H.; Kim, H.J.; Kim, H.; Kim, D.J. An Ensemble Deep Learning Approach for Sleep Stage Classification via Single-channel EEG and EOG. In Proceedings of the 2020 International Conference on Information and Communication Technology Convergence (ICTC); IEEE: New York, NY, USA, 2020; pp. 394–398. [Google Scholar] [CrossRef] [Scilit]
- Samaee, M.; Yazdi, M.; Massicotte, D. NeuroLingua: A Language-Inspired Hierarchical Framework for Multimodal Sleep Stage Classification Using EEG and EOG. arXiv 2025, arXiv:2511.09773. [Google Scholar] [CrossRef] [Scilit]
- Phan, H.; Chén, O.Y.; Tran, M.C.; Koch, P.; Mertins, A.; De Vos, M. XSleepNet: Multi-View Sequential Model for Automatic Sleep Staging. IEEE Trans. Pattern Anal. Mach. Intell. 2022, 44, 5903–5915. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Phan, H.; Chén, O.Y.; Koch, P.; Mertins, A.; De Vos, M. Fusion of End-to-End Deep Learning Models for Sequence-to-Sequence Sleep Staging. In Proceedings of the 2019 41st Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC); IEEE: New York, NY, USA, 2019; pp. 1829–1833. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Goldberger, A.L.; Amaral, L.A.; Glass, L.; Hausdorff, J.M.; Ivanov, P.C.; Mark, R.G.; Mietus, J.E.; Moody, G.B.; Peng, C.K.; Stanley, H.E. PhysioBank, PhysioToolkit, and PhysioNet: Components of a New Research Resource for Complex Physiologic Signals. Circulation 2000, 101, E215–E220. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Kemp, B.; Zwinderman, A.; Tuk, B.; Kamphuisen, H.; Oberye, J. Analysis of a Sleep-Dependent Neuronal Feedback Loop: The Slow-Wave Microcontinuity of the EEG. IEEE Trans. Biomed. Eng. 2000, 47, 1185–1194. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Khalighi, S.; Sousa, T.; Santos, J.M.; Nunes, U. ISRUC-Sleep: A Comprehensive Public Dataset for Sleep Researchers. Comput. Methods Programs Biomed. 2016, 124, 180–192. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Imtiaz, S.A.; Rodriguez-Villegas, E. Recommendations for Performance Assessment of Automatic Sleep Staging Algorithms. In Proceedings of the 2014 36th Annual International Conference of the IEEE Engineering in Medicine and Biology Society; IEEE: New York, NY, USA, 2014; pp. 5044–5047. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Hearst, M.; Dumais, S.; Osuna, E.; Platt, J.; Scholkopf, B. Support Vector Machines. IEEE Intell. Syst. 1998, 13, 18–28. [Google Scholar] [CrossRef] [Scilit]
- Breiman, L. Random Forests. Mach. Learn. 2001, 45, 5–32. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.









