Instructions to use Neuralace-AI/eeg-encoder-41ch-120hz-raw with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Neuralace-AI/eeg-encoder-41ch-120hz-raw with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="Neuralace-AI/eeg-encoder-41ch-120hz-raw", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Neuralace-AI/eeg-encoder-41ch-120hz-raw", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
EEG Encoder 41ch-120Hz (raw)
A 114M-parameter EEG foundation model that reads raw EEG directly. It has the same architecture, objective and pretraining data as EEG Encoder 41ch-120Hz, but it reads the signal itself, cut into 4-sample patches, instead of the EEG Codec 41ch-120Hz latent. It was pretrained HuBERT-style on 5,996 hours from 172 public datasets, with no labels. Because it sees the uncompressed signal, it makes different errors from the codec-based encoder (see the per-task table).
Highlights
| Frozen features | .717 mean over 8 tasks, against .677 for REVE-large (390M), .629 EEGPT, .618 CBraMod, .617 LaBraM |
| Fine-tuned | .752 against .724 for REVE-base and .720 for REVE-large, with one recipe for every model |
| People unseen in pretraining | .730 (6 tasks) against .706 for REVE-large |
| A second view of the same data | Same pretraining as the codec-based encoder, different input: better on oddball ERPs, the 13-way task and age; worse on motor execution and sex |
| Weaker with missing sites | .482 with 40% of a scalp region missing, against .652 for the codec-based encoder. Use that one for incomplete caps |
| Input | [B, 41, T] Β΅V at 120 Hz (EEGFeatureExtractor makes it from any recording) |
| Front end | divide by 23.2 Β΅V, clip at Β±8, cut each site into non-overlapping 4-sample patches β [B, 164, T/4]; no codec, nothing learned |
| Output | [B, T/4, 768] per frame (30 frames/s); hidden_states: embeddings + 16 layers |
| Parameters | 113.9M |
| Window | trained on 4β12 s crops; longer inputs are encoded in ~10 s chunks and joined in time |
Usage
import mne
import torch
from transformers import AutoFeatureExtractor, AutoModel
repo = "Neuralace-AI/eeg-encoder-41ch-120hz-raw"
fe = AutoFeatureExtractor.from_pretrained(repo, trust_remote_code=True)
model = AutoModel.from_pretrained(repo, trust_remote_code=True).eval()
raw = mne.io.read_raw_edf(mne.datasets.eegbci.load_data(1, [4])[0], preload=True)
inputs = fe(raw, return_tensors="pt") # input_values [1, 41, T] Β΅V @ 120 Hz
with torch.no_grad():
out = model(inputs["input_values"][..., : 120 * 10], output_hidden_states=True) # a 10 s window
feats = out.last_hidden_state # [1, 300, 768]
layers = torch.stack(out.hidden_states[1:]) # [16, 1, 300, 768]: the middle-to-late layers are usually best for tasks
patches = model.get_latent(inputs["input_values"][..., : 120 * 10]) # [1, 164, 300]: what the transformer reads
Classification head
AutoModelForSequenceClassification adds a learned softmax mix of the 16 layers, mean pooling over frames, LayerNorm, dropout and a
linear layer. Use num_labels=1 for regression (MSE).
from transformers import AutoModelForSequenceClassification
clf = AutoModelForSequenceClassification.from_pretrained(repo, num_labels=4, trust_remote_code=True)
clf.freeze_encoder() # frozen probe; skip this line to fine-tune end to end
out = clf(inputs["input_values"][..., : 120 * 10], labels=torch.tensor([2]))
out.loss.backward()
For end-to-end fine-tuning we used a small encoder learning rate (5e-5 at the top layer, decaying to 0.1Γ at the bottom) and 3e-4 for the head.
The feature extractor is the codec's: notch 50/60 Hz, band-pass 0.1β75 Hz, resample to 120 Hz, map channel names onto 41 sites (see the EEG Codec 41ch-120Hz card for the site list and details). No re-referencing or normalization is needed. Sites a recording lacks are left at zero.
Results
Against EEG foundation models (one protocol for every model)
Eight tasks: motor execution, oddball ERPs, reward, SSVEP, 13-way task paradigm, eyes open/closed, age and sex. Each model gets a small head trained per task. Frozen and fine-tuned use one recipe for every model. External models get microvolts at their own input rate, and for frozen features we report each one's better feature variant, chosen on the test set, which favours them.
| Model | Params | Frozen | Fine-tuned | People unseen in our pretraining (6 tasks) |
|---|---|---|---|---|
| EEG Encoder 41ch-120Hz (raw) | 114M | .717 | .752 | .730 |
| EEG Encoder 41ch-120Hz (on the codec) | 114M | .722 | .755 | .733 |
| REVE-large | 390M | .677 | .720 | .706 |
| REVE-base | 69M | .661 | .724 | .687 |
| LaBraM-Base | 5.8M | .617 | .706 | .642 |
| EEGPT (large) | 25M | .629 | .639 | .675 |
| CBraMod | 4.9M | .618 | .621 | .650 |
| BIOT | 3.2M | .561 | .555 | .606 |
Per-task frozen scores
Balanced accuracy (age: Pearson r); SE over test people in brackets.
| Model | Params | Motor exec. (HGD, 4) | Oddball (3) | Reward (2) | SSVEP (9) | M3CV task (13) | Eyes open/closed | Age (r) | Sex | Mean (8) |
|---|---|---|---|---|---|---|---|---|---|---|
| EEG Encoder 41ch-120Hz (raw) | 114M | .811 (.018) | .704 | .715 | .282 | .669 | .846 | .846 | .862 | .717 |
| EEG Encoder 41ch-120Hz (on the codec) | 114M | .829 (.016) | .696 | .724 | .284 | .662 | .849 | .838 | .895 | .722 |
| REVE-large | 390M | .780 (.017) | .612 | .696 | .324 | .546 | .821 | .744 | .892 | .677 |
| REVE-base | 69M | .778 (.021) | .606 | .693 | .259 | .510 | .819 | .726 | .900 | .661 |
| EEGPT (large) | 25M | .637 (.019) | .577 | .665 | .300 | .491 | .813 | .758 | .789 | .629 |
| CBraMod | 4.9M | .691 (.015) | .568 | .668 | .301 | .426 | .754 | .682 | .855 | .618 |
| LaBraM-Base | 5.8M | .643 (.016) | .553 | .638 | .280 | .402 | .780 | .750 | .886 | .617 |
| BIOT | 3.2M | .412 (.011) | .407 | .556 | .462 | .405 | .809 | .674 | .762 | .561 |
| chance | .250 | .333 | .500 | .111 | .077 | .500 | 0 | .500 | ||
| test people | 14 | 146 | 282 | 100 | 95 | 608 | 608 | 608 |
BCI decoding: PROTEUS mental commands
Three cued commands (motor imagery, mental subtraction, word generation) from the 41-channel PROTEUS dataset
(NEMAR nm000290). 10 people held out in turn; the score is balanced accuracy averaged over
participant Γ session cells (chance .333). Fine-tuned: first 8 layers plus a small transformer head, causal per-session
standardisation; 3 fine-tuning seeds.
Data separation. PROTEUS was not used in pretraining: the codec and encoders were pretrained without labels on 172 other
public EEG datasets; PROTEUS (NEMAR nm000290) is excluded by name in the data pipeline and absent from the corpus manifest, and none
of its 112 recordings matches any corpus recording on length and amplitude. The numbers below are downstream results: the pretrained
encoder is fine-tuned on PROTEUS and scored on people held out from that fine-tuning.
| Model | Unseen people |
|---|---|
| EEG Encoder 41ch-120Hz (on the codec), fine-tuned | .694 |
| EEG Encoder 41ch-120Hz (raw), fine-tuned | .654 |
| FBCNet | .614 |
| Riemannian tangent space + Euclidean alignment | .569 |
| REVE-base, fine-tuned | .497 |
| EEGNet | .406 |
With the whole-encoder fine-tuning recipe of the 8-task benchmark instead, the order on PROTEUS reverses: .733 for this model against .721 for the codec-based encoder.
Missing sites
Heads trained on the full montage, then scored with sites removed at test time (mean of 4 tasks):
| Model | Clean | 40% of a region removed | 40% scattered |
|---|---|---|---|
| EEG Encoder 41ch-120Hz (on the codec) | .729 | .652 | .671 |
| EEG Encoder 41ch-120Hz (raw) | .722 | .482 | .593 |
| REVE-large | .629 | .509 | .555 |
This model was pretrained without site hiding and without the codec, and it loses far more when sites are missing. For recordings with missing or unreliable channels, use the codec-based encoder.
Training
| Data | 172 public scalp-EEG datasets (CC0, CC BY 4.0, ODC-By 1.0), 5,996 h for training, all at 41 sites / 120 Hz; no labels |
| Input | raw signal in 4-sample patches over all 41 sites: 164 values per frame, 30 frames/s |
| Objective | HuBERT-style masked prediction with the same targets as EEG Encoder 41ch-120Hz: 50% of frames hidden in 15-frame spans; predict 500 k-means cluster IDs of the layer-6 features of a first-iteration model (trained only to make these targets; not released) at hidden frames. No site hiding |
| Architecture | 768-d, 16 layers, 12 heads, FF 3072, bidirectional, learned positions (512 frames) |
| Optimisation | 200k steps on 8 GPUs, batch 32 crops of 4, 8 or 12 s, 4 masked clones per crop; AdamW 3e-4, 8k warm-up |
| Checkpoint | last (step 200k) |
Limitations
- Seeds. One pretraining seed and no hyperparameter search.
- Exposure. Pretraining saw, unlabelled, recordings of some people in the 8-task benchmark; the unseen-people column removes them.
- Missing sites. Much less robust than the codec-based encoder (see above).
- Montage and band. 41 central sites (no Fp, F7/8, T7/8, P7/8, O1/2) and 0.1β75 Hz, from the shared input chain.
- Person identity. The features identify people well. Treat them as identifying data.
- Precision. With TF32 off (
torch.backends.cudnn.allow_tf32 = False,torch.backends.cuda.matmul.allow_tf32 = False) outputs match the training code to 1e-4 relative; with TF32 they differ slightly.
Responsible use
EEG is sensitive personal data: it can reveal who a person is and information about their health. This model is released for research.
Intended use. Research on EEG representation learning, brain-computer interfaces and EEG benchmarks, on recordings made with the participants' informed consent and handled under the applicable data-protection law.
Not a medical device. The model has not been clinically validated. Do not use it for medical diagnosis, screening, treatment or any other clinical decision. Benchmark results on labels such as age or sex are research measurements, not medical assessments.
Do not use it to identify people. Its outputs identify individuals well (see Limitations). Do not use the model to identify, re-identify, track or profile people, to link EEG recordings to identities, or to infer health conditions or other sensitive attributes of a person without their explicit consent.
Other uses we do not support. Monitoring or surveillance of people without their informed consent; decisions about employment, education, insurance, credit or access to services; law enforcement, interrogation or lie detection.
Outputs are personal data. Features, codes and reconstructions computed from a person's EEG remain that person's data; protect them as you would the recording.
Files
| File | What it is |
|---|---|
model.safetensors, config.json, preprocessor_config.json, *.py |
The model in transformers format (AutoModel, AutoFeatureExtractor, AutoModelForSequenceClassification) for inference and fine-tuning. The masked-prediction heads used only in pretraining are removed |
original/checkpoint.pt |
The same model as saved by our training code, for continuing training with it. It keeps the masked-prediction heads |
training_checkpoint.json |
Training step and the sha256 of original/checkpoint.pt |
pretraining_datasets.csv |
Every pretraining dataset with its source and licence |
original/checkpoint.pt is a PyTorch dictionary with model (the state dict), conf (the training configuration) and step:
ck = torch.load("original/checkpoint.pt", map_location="cpu", weights_only=True)
Code and paper
The pretraining code is available on request. We will open-source all of our models, training and evaluation code, benchmarks and a research paper.
Licence
The model weights and code in this repository are licensed under
CC BY-NC 4.0 (attribution, non-commercial); the full text is in LICENSE.
Copyright 2026 Sabi. For commercial licensing, contact Sabi (sabi.com). The pretraining data are public datasets licensed CC0, CC BY 4.0
or ODC-By 1.0; every dataset, its source and licence are listed in pretraining_datasets.csv.
- Downloads last month
- 33