neuroencoder-sleep-2026-11. It combines our EEG encoder’s embeddings of each EEG region with standard hand-crafted sleep features from YASA 0.7.0 (of one EEG and one EOG channel) and the signal amplitude. It normalises the features by the night’s own average and reads the night as a sequence. That is why it needs the whole night. See How it was trained and the benchmark.
What to send
Channel names are matched as in the embeddings API: referential channels (
C4-M1, C4-A1, C4-REF) map to their electrode, and bipolar pairs (Fpz-Cz) to the region of the first electrode. Labels written without a dash, as many PSG systems export them (C4A1, O2M1, F3:A2), are recognised the same way and map to the first electrode. EMG, ECG and channels with other names are ignored. Rename numbered or non-standard channels with channel_names.
Which channels are used. Every EEG channel feeds the embedding part. One EEG channel feeds the YASA features: the first central channel, else the first frontal one, else the first EEG channel. One EOG channel is used: a left-eye channel (E1, LOC, LEFT, EOGL) if there is one, else the first EOG channel. EEG or EOG channels below 100 Hz are skipped. The submit response shows the choice in input.plan before anything runs.
Units check. The worker reads the file in volts using the physical dimension in the EDF header. If the median standard deviation of the chosen EEG channel over 30 s epochs is outside 1 to 500 uV (EEG is usually 5 to 50 uV), the job fails with invalid_input and the night is refunded. A wrong or empty unit field in the header, an uncalibrated export, or a flat channel causes this. The API does not guess a scale. If the header’s unit field is empty or wrong, say what unit the stored values are in with the units option ("uV", "mV" or "V"); it replaces the header’s unit for the channels used. The error’s fix points to this option and to eeg_channel for a flat channel.
Epochs. Epoch i starts 30 * i seconds after the first sample of the file. A partial epoch at the end is dropped. The whole file is scored: if your recording starts well before lights off, crop it first, or the wake before lights off counts in the metrics.
Run it
You need an API key (see Quickstart). The steps are the job steps with"task": "sleep_staging".
POST /v1/fileswith the file name and size returns an upload URL. PUT the file there within 10 minutes, without theAuthorizationheader.POST /v1/jobswith"task": "sleep_staging"reads the file header, checks it, and queues the job. Most input errors come back here, before a night is counted.input.planshows the channels that will be used.- Poll
GET /v1/jobs/{id}everyRetry-Afterseconds (5) untilstatusissucceeded,failed,cancelledorexpired. - On
succeeded,result.summaryholds the metrics.result.urlis the hypnogram JSON andresult.csv_urlthe CSV. The links are valid 5 minutes; get the job again for fresh ones.
ST7011J0-PSG.edf (9.97 h, 100 Hz; Sleep-EDF Expanded, ODC-By 1.0). The plan at submit (it depends only on the file header, not on the model):
neuroencoder-sleep-2026-11) on 16 November 2026. It took 34 s from the start of the upload to the result, with the worker already running; an earlier run that day, with a cold worker, took 78 s.
The summary gave:
- time in bed 598 min;
- total sleep time 437 min;
- sleep efficiency 73.1%;
- sleep onset latency 29.0 min;
- REM latency 115.5 min;
- WASO 132 min.
Options
Pass them as"options" in POST /v1/jobs. All are optional.
Other options are rejected with
invalid_input. There is no option to crop the night; crop the file before upload.
What you get
Job result
result of a succeeded job:
usage shows nights (1), week (the ISO week charged, such as 2026-W46), week_nights (the account’s nights that week at submit) and billed.
Hypnogram JSON
The same fields as the result (without the links), plusepochs, one object per 30 s epoch. The examples here and in the CSV below come from a run of an earlier model; the format is the same:
t_start is in seconds from the start of the file. confidence is the highest probability. low_confidence is true when it is below 0.5. Probabilities are rounded to 4 decimals.
CSV
The first line is the notice, then a header and one row per epoch:pandas.read_csv("night_hypnogram.csv", comment="#").
Summary metrics
All times are in minutes, rounded to 0.1. They are computed from the predicted stages of the whole file. The recording start stands in for lights off, and the end for lights on.
The latencies and WASO count every epoch. There is no minimum duration for an awakening and no smoothing.
Probabilities and the low-confidence flag
The probabilities are the averaged outputs of three trained copies of the model. They were not calibrated, so 0.8 does not mean 80% correct. The flag has not been validated for the current model. With an earlier model (v1), on night ST7011 the 29 flagged epochs that have a human score were right 21% of the time, the others 75%. A wrong stage given with high confidence is not flagged. Review flagged epochs first, but do not treat unflagged epochs as checked.Python and command line
Client 2.5.0 and later (not yet on PyPI, which has 2.2.0; until then use the HTTP steps above):eeg_channel, eog_channel, picks and channel_names (--eeg-channel, --eog-channel, --picks, --channels). Earlier versions do not have sleep staging; use the HTTP steps above.
Quota
Sleep staging counts nights, not hours of EEG. Each job is one night, whatever its length. It does not use the account’s monthly EEG quota.- Weeks start Monday 00:00 UTC.
- The night is reserved at submit. It is given back if the job fails, is cancelled before it finishes staging, expires before it starts, or is deleted before it finishes. Deleting a finished job does not give it back.
- Over the limit,
POST /v1/jobsreturns 429sleep_quota_exceededwithRetry-Afteruntil Monday. GET /v1/meshowslimits.sleep_nights_per_weekandusage.sleep_staging:week,nights,nights_remainingandresets_at(Unix time).- An instant key’s 120-window cap does not apply to sleep jobs; its night may be at most 12 h long (403
agent_key_limitat submit, nothing counted) in a file of at most 128 MB. - A cancel stops the job at the worker’s next check and gives the night back. If the night was already staged when the cancel arrived, the job finishes as
succeededwith its result and the night counts. - Queue and active-job limits are those of other jobs. Results are kept 7 days. The upload is deleted when the job ends; a contributed copy of the signal is separate (Data use).
Errors
Errors have the usual shape,{"error": {"message", "type", "code", "param", "fix"}}; follow fix. Errors at submit do not count a night.
Two examples from the live API:
Accuracy
These numbers are for the current model,neuroencoder-sleep-2026-11. They come only from nights the model did not train on. The sleep staging benchmark has the full tables, confidence intervals, per-stage results and method.
Agreement with human scorers. Cohen’s kappa, pooled over epochs. The reference is YASA’s pretrained classifier on the same nights and channels.
- Held-out sets. With EOG, we are better than the reference on 36 of 44 Sleep-EDF telemetry nights and on 88 of 128 BOAS nights.
- Leave-one-site-out. Each of the eight training sources was held out in turn. The recipe was trained on the other seven and tested on the held-out source.
- With EOG, we are behind the reference on CAP and ANPHY, and slightly below on DOD (0.731 vs 0.742, within the confidence intervals).
- Without EOG, we are below the reference’s EEG-only classifier on one site: CAP.
- For comparison: two human scorers agree at about kappa 0.76 under AASM rules (Danker-Hopfe et al. 2009).
- Weak spots.
- N1 is the least reliable stage.
- N3 depends on how the lab scores deep sleep. Compared with the human scorers, the model calls too much N3 at some labs (Sleep-EDF SC, DOD, CinC 2018, BOAS) and too little at others (CAP, HMC).
- Single nights can be much worse than the averages.
Two example nights
Both nights ran through the live API with the current model on 16 November 2026. Neither is in the training data. The YASA reference used the same channels.
Notes on these nights:
- ST7011 is from the Sleep-EDF telemetry study. Training used only the sleep cassette study.
- CAP n13 was left out of training because its scoring file has malformed rows. Its summary: time in bed 485 min, total sleep time 392.5 min, sleep efficiency 80.9%, sleep onset latency 6.5 min, REM latency 59.5 min, WASO 81.5 min.
- Both times are with the worker already running. A cold start adds about 45 s.
- Two nights are not a benchmark.
How it was trained
Data. 1,629 nights, 1,538,460 scored epochs, from eight public sources. All eight are licensed for commercial use of derived models. They cover:- lab and home PSG;
- healthy adults and patients with sleep disorders;
- R&K and AASM scoring.
How the data were prepared:
- R&K stages 3 and 4 are merged into N3.
- Unscored, movement and artefact epochs are left out of training.
- Some nights were excluded because their files could not be used, for example broken scoring files or no usable EEG channel.
- The training labels are the human expert scores, mixed during training with labels from our own teacher models.
- A teacher never saw the site whose nights it labels.
- No third-party model weights or labels are used.
- YASA’s pretrained classifier serves only as the benchmark reference. The model uses YASA’s open-source feature code (BSD-3-Clause), not its trained classifier.
- It scores deep sleep (N3) far more sparingly than the other labs.
- Adding it to training made N3 worse at the other sites.
- It is now one of the two fully held-out test sets.
- The served output is the average of three copies of the model, trained with different seeds.
- One variant uses EEG and EOG. The other uses EEG only, for recordings without EOG.
- Montages: Fpz-Cz with Pz-Oz (Sleep-EDF); AASM F/C/O mastoid sets; C3-A2 and C4-A1; CAP’s bipolar chains; the EESM home PSG cap.
- Sampling rates: 100, 128, 200, 250, 256 and 512 Hz.
- Not validated: children, and wearable, forehead or ear EEG.