Technical Report on RUNE: Beyond Alignment in MEG-to-Text Decoding Yiqian Yang and Yiqun Duan
RUNE combines corrected MEG-XL training, brain–text alignment, a class-balanced word readout and target-word T5 fusion. On LibriBrain100, it reaches 64.12% mean Top-10 balanced accuracy across four corpora, compared with 47.20% for published MEG-XL. The task ranks 50 candidate words from MEG recorded during speech listening, using given word onsets.
Commands below use Bash from the repository root. Score replay needs Python 3.10+ with NumPy/SciPy; training uses Linux, Python 3.12 and a CUDA GPU (BF16 for T5).
git clone https://github.com/OpenUploading/RUNE.git
cd RUNE
python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e ".[readout]"
python tools/recompute_corpus_means.py
rune score experiments/joint_versions/primary/e3/joint_all/test-scores.npzThe recomputation checks all 20 paper experiments and source hashes. E3 score replay should print 63.97751471%; the full-system E15 mean in the results is 64.12167161%. These commands use saved results; training and new TEST inference are below.
python -m pip install torch==2.7.1 --index-url https://download.pytorch.org/whl/cu126
python -m pip install -r reproduction/requirements.resolved.txt
python -m reproduction.prepare_assets --output assets
python -m reproduction.prepare_targets --config reproduction/backbone.yaml \
--weights assets/t5-large --output assets/target_embeddings.npzRun these commands in the same environment and repository root. The asset command
downloads Subject 0 recordings from both public LibriBrain repositories, the
Subjects 1–32 training release, MEG-XL, BioCodec and T5-large. It extracts sensor
positions and orientations from a checksum-verified public FIF header and creates the compatible MEG-XL checkpoint
without changing its weights. Repeat the command to resume interrupted downloads.
The target command preprocesses recordings into a local cache and generates the
full annotation vocabulary and layer-12 T5 targets; this step also uses the GPU.
Recording selection uses the pinned official LibriBrain100 manifest in
vendor/PNPL. MEG windows and event-level splits use the
vendored MEG-XL implementation; RUNE adds its training corrections, readout and fusion.
| Input | Local location used below |
|---|---|
| Subject 0 and Subjects 1–32 recordings | assets/subject0/raw_data/, assets/broad/raw_data/ |
| Compatible MEG-XL and BioCodec checkpoints | assets/meg-xl-med-v2-compatible.ckpt, assets/biocodec_ckpt.pt |
| Complete official vocabulary and T5 target embeddings | assets/target_embeddings.npz |
| T5-large tokenizer, configuration and weights | assets/t5-large/ |
The default YAML already points to these locations. Keep the same data roots, configuration and target file for training and every export. Assets and generated outputs are ignored by Git. All output directories below must be new; choose a new run directory when rerunning a completed stage.
Public model and broad-data revisions are pinned. Subject 0 is resolved on first
use and recorded in assets/public-inputs.json; pass that SHA as
--subject0-revision to reuse the same snapshot elsewhere.
See Reproduction for the protocol.
python -m reproduction.backbone --config reproduction/backbone.yaml \
--targets assets/target_embeddings.npz --output outputs/backbone
for split in train val test; do
python -m reproduction.backbone --config reproduction/backbone.yaml \
--targets assets/target_embeddings.npz \
--export-checkpoint outputs/backbone/checkpoint_epoch02.pt \
--split "$split" --output "outputs/$split-export"
python -m reproduction.prepare_features \
--features "outputs/$split-export/features.npz" \
--output "outputs/$split-linear"
doneTraining saves checkpoint_epoch02.pt, the checkpoint-A training point used for
the primary readout comparison. Use this same checkpoint for every feature split.
Each export produces features.npz and group_offsets.npy; preparation produces
readout.npz with features, labels and corpus names. TEST is used only for feature
export and final evaluation, not for fitting or checkpoint selection.
python -m reproduction.train_readout \
--train outputs/train-linear/readout.npz \
--validation outputs/val-linear/readout.npz --output outputs/e3
python -m reproduction.evaluate --method e3 \
--test outputs/test-linear/readout.npz \
--checkpoint outputs/e3/selected.npz --output outputs/e3-test
rune score outputs/e3-test/test-scores.npzTraining selects regularization on VAL and writes selected.npz. Evaluation
prints all four corpus accuracies and their mean, and saves metrics.json
(fractions) and test-scores.npz for independent replay.
Prepare grouped features with the same selected E3 head for all splits:
for split in train val test; do
python -m reproduction.prepare_features \
--features "outputs/$split-export/features.npz" \
--offsets "outputs/$split-export/group_offsets.npy" \
--head outputs/e3/selected.npz --output "outputs/$split-t5"
done
python -m reproduction.train_t5 \
--train outputs/train-t5 --validation outputs/val-t5 \
--weights assets/t5-large --arm self --output outputs/e15
python -m reproduction.evaluate --method t5 \
--test outputs/test-t5 --checkpoint outputs/e15/selected.pt \
--weights assets/t5-large --output outputs/e15-test
rune score outputs/e15-test/test-scores.npzself is target-only memory (E15, the complete system). For group memory (E14),
use --arm context and separate output directories. Training fits fusion on TRAIN,
selects the adapter checkpoint on VAL and saves both in selected.pt. TEST
uses that frozen checkpoint and coefficient; it does not refit them.
The numbers above are the replay targets for the included results. For ablations, confidence intervals and candidate diagnostics, see Reproduction.
| Directory | Purpose |
|---|---|
meg2text/ |
Metrics, balanced linear readout, score fusion and CLI |
reproduction/ |
Training/export entry points, model implementations and configurations |
vendor/MEG-XL/ |
Corrected MEG-XL implementation and upstream MIT license |
vendor/PNPL/ |
Official LibriBrain100 recording inventory and upstream license |
experiments/ |
Only the paper's results and small score/head assets required for replay |
tools/, tests/ |
Recompute results, analyze scores and verify implementations |
paper/ |
Paper PDF |
The Python import is meg2text; the installed CLI is rune.
@misc{yang2026rune,
title = {Technical Report on {RUNE}: Beyond Alignment in {MEG}-to-Text Decoding},
author = {Yang, Yiqian and Duan, Yiqun},
year = {2026},
url = {https://github.com/OpenUploading/RUNE}
}MIT. Vendored upstream code keeps its own license. LibriBrain recordings are CC BY-NC 4.0; they and the pretrained weights are downloaded from their public sources, not redistributed here.
Built on MEG-XL, LibriBrain100, and T5.