Real-time sleep staging brings N2 and N3 detection into the stimulation loop
Closed-loop neuromodulation has always depended on a deceptively hard step: knowing exactly when the brain enters the sleep states most favorable to memory-related oscillations. In this preprint, investigators built a causal tracker for N2 and N3 sleep that updates every 2 seconds and relies only on the preceding 10 seconds of scalp or intracranial EEG. The design matters because conventional sleep scoring uses completed 30-second epochs and can look backward and forward at the same time, a luxury unavailable to any device meant to deliver stimulation in real time.
The study focused on the sleep stages where slow oscillations and spindles are concentrated, since those rhythms dominate N2 and N3 and are often the target of memory-enhancing stimulation. The biological rationale is straightforward: if stimulation is timed to the brain’s own sleep architecture, it can be delivered when the underlying network state is most permissive for synchronizing oscillatory activity. When the timing is wrong, the same stimulation can be wasted on wakefulness, REM sleep, or transitional periods that do not support the intended physiology.
Scalp EEG and thalamic recordings tracked offline scoring with high fidelity
The analysis included six adults with drug-resistant epilepsy who underwent simultaneous scalp EEG and stereo-EEG. Across those recordings, real-time discrimination of N2+N3 sleep stayed close to offline scoring of the same data, with scalp EEG achieving an AUC of 0.953 versus 0.958 offline. The gap is small, and it suggests that a causal algorithm can approximate conventional staging even when it is denied future context.
A striking result emerged from the intracranial recordings. Thalamic channels alone reached an AUC of 0.934 and outperformed mesial temporal channels in every patient, while the combination of scalp plus thalamus performed best at 0.967. The thalamus is a biologically sensible site for this kind of signal processing because sleep spindles and broader N2/N3 dynamics are tightly linked to thalamocortical circuits. A detector built from thalamic signals may therefore see the relevant state transitions earlier or more cleanly than one derived from mesial temporal activity.
The scalp-only model was also retrained in 28 healthy adults and reached an AUC of 0.976. In a noninvasive setting, that level of performance is encouraging for future systems that may not need implanted electrodes at all. The separation between epilepsy patients and healthy volunteers still matters, though, because the patient cohort included intracranial hardware and a clinical context that can distort sleep architecture in ways a healthy cohort cannot fully reproduce.
The enabling rule was fast, but false activations remained common outside N2 and N3
The investigators did not stop at classification accuracy. They also tested a simulated rule that allowed stimulation only after three consecutive estimates indicated N2+N3 sleep, a more realistic proxy for how a neuromodulation device would behave at the bedside or in an implantable system.
When patients entered N2+N3 sleep and stimulation was initially disabled, the rule permitted stimulation within 5 minutes in 63% to 73% of transitions. Among transitions that were detected, the median delay to enable stimulation was 42 to 64 seconds. Those are practical numbers, because a system that recognizes N2/N3 only after long delays could miss the windows when sleep spindles and slow oscillations are strongest. Here, the delay was short enough to matter physiologically, not just statistically.
The opposite transition was faster. After leaving N2+N3, stimulation was disabled after a median of 19 to 22 seconds. In closed-loop neuromodulation, rapid shutoff is not a cosmetic feature; it is the difference between staying aligned with the intended sleep state and continuing to stimulate while the cortex has already moved on.
The rule was not perfectly specific. It switched on incorrectly 1.4 to 1.8 times per hour outside N2+N3 and stayed active during 28% to 31% of REM sleep in patients. In healthy adults, by contrast, it remained active during only 2% of REM. REM exposure is especially relevant because REM carries a markedly different neurophysiologic signature from N2/N3, and persistent stimulation during REM could blunt the selectivity that closed-loop sleep interventions are trying to achieve.
Implanted thalamic leads could support sleep-dependent stimulation without scalp EEG
This preprint points toward two clinical pathways. In epilepsy patients who already have implanted thalamic leads, those channels could support sleep-stage-dependent stimulation without the need for scalp EEG. In noninvasive settings, scalp EEG may be sufficient to guide stimulation in patients or healthy volunteers where external electrodes are practical.
The translational appeal is clear, but the message is more specific than a generic call for more data. Closed-loop systems should be judged not only by classification accuracy, but also by how reliably and promptly they enable and disable stimulation. A detector that looks excellent on paper yet misses real-time transitions, delays activation, or keeps stimulating during REM is not serving the biology it was built to respect.
Several limitations are built into the dataset itself. The patient cohort was small, the work comes from a preprint that has not yet undergone peer review, and the epilepsy population may not reflect every sleep phenotype or neuromodulation use case. Even so, the study offers a concrete technical advance: a causal EEG framework that can recognize N2 and N3 sleep closely enough to support live decision-making, while also revealing where specificity still slips. The remaining challenge is not whether sleep staging can be automated, but whether a device can do it with the precision required to protect the sleep state it is trying to exploit.