Mixed Signals: Weight-Space Programming for EEG and ECG

Dara Varam1, Taraneh Aminosharieh Najafi1, David Atienza1

1Embedded Systems Laboratory (ESL), École Polytechnique Fédérale de Lausanne (EPFL), Switzerland

Can a language model train a neural network by reasoning, instead of by gradient descent? We gave Claude Opus 5.5, GLM-5.3 and DeepSeek-V4.1-Flash the weights of EEG and ECG networks and five jobs: read a network, improve it, repair a known fault, find out why it fails on unseen data, and write one from zero. They could not read or improve networks. They did repair planted faults, found hidden recording artifacts without being told, and wrote working EEG networks from nothing. From 5 training samples, Opus matched gradient descent on 30. This page is the companion to the pre-print: every setup in detail, the exact prompts, and Opus's reasoning in its own words.

Date:
November 2026
Type:
Companion page to the pre-print
Correspondence:
dara.varam@epfl.ch
ESL
Embedded Systems Laboratory (ESL)
Video. The paper in under six minutes, narrated. Captions can be turned on in the player. Download the video (MP4, 35 MB).
System diagram: EEG recordings and the location of the electrodes on a 3-D head, a language model writing every weight of an empty TinyEEGNet by reasoning, and a chart where the written network, built from 5 training samples, scores 0.834 on 65 new samples, level with gradient descent on 30 training samples.
Figure 1. Experiment 5 in one picture: an empty network, written by Claude's reasoning from 5 training samples, matches gradient descent trained on 30.
Background

The open question

In weight-space programming (WSP), a language model reads a trained network's weights as text, reasons about what they compute, and writes new values, the way a programmer edits code (Takehi et al., 2026). The first demonstrations came from games and language models. GPT-6 Astra wrote a MinAtar Breakout network from zero that scored 517.4 points, against 15.8 for a PPO agent trained for 100 million steps, and Claude Opus 5.5 made a diffusion model obey "no X" in its prompts (Chhabria, 2026). The CSAIL work also found the limit: no edit improved a healthy Gemma 3 (Gemma Team, 2025). WSP works for specific failures with nameable causes, and for short, exact programs.

Biosignals are a natural next test:

  • The physics is known. Much of EEG and ECG processing is physiology and recording physics that a language model already knows, and that gradient descent has to rediscover from data.
  • Labels are scarce. Datasets are small, samples vary, and networks often fail on data from a new site because they learned a shortcut, such as a property of the recording (Geirhos et al., 2020).
  • The networks are small. Wearable monitors run compact networks, a scale at which every weight can be read.
The open question

Can a language model train a biosignal network by reasoning about physiology, instead of by gradient descent?

Given the weights of an EEG or ECG network, and little or no data, can it tell what the network does, make it better, repair it, find out why it fails on unseen data, and write a working model from nothing?


Setup

How the experiments were run

Five experiments, two networks, three language models and one shared harness. Every result was scored by us afterwards, on data the model never saw, against a success rule fixed before the run and against the standard training-based fixes a practitioner would use.

Data and networks

  • EEG: PhysioNet EEG Motor Movement/Imagery (Schalk et al., 2004), 64 electrodes at 160 Hz, 4 s windows. Three tasks: (A) eyes open vs. closed, (B) left vs. right fist, (C) both fists vs. both feet. 50 samples: 30 for training, 5 for validation, 5 practice samples (the only EEG the models ever see) and 10 for testing, 65 in experiment 5.
  • ECG: PTB-XL (Wagner et al., 2020), 21,388 clinical 12-lead ECGs, 10 s at 100 Hz, five diagnoses (NORM, MI, STTC, CD, HYP). Folds 1–8 for training, fold 9 as the models' practice set, fold 10 for testing.
  • Networks: TinyEEGNet, a reduced EEGNet (Lawhern et al., 2018) with 2,730 weights and batch norm folded in, and ECGResNet with 941,189 weights. Both are first trained by gradient descent (test balanced accuracy 0.68–0.83 for EEG, macro-AUC 0.917 for ECG).

A "sample" is the full set of recordings from one subject.

Layer-by-layer diagram of TinyEEGNet (EEG window, temporal filters, spatial filters, ELU and pooling, temporal filters, 1×1 mixing, ELU and pooling, two outputs) and ECGResNet (12-lead ECG, stem convolution, four residual blocks, mean and max pooling, five outputs), with the weight count of each layer.
Figure 2. The two architectures, with the output shape and number of weights of each layer. (a) TinyEEGNet, 2,730 weights. (b) ECGResNet, 941,189 trainable weights. Filter shapes and weight colors are schematic.

Language models

Claude Opus 5.5
Proprietary, through the Anthropic API. All five experiments.
GLM-5.3
Open weights, served on EPFL's RCP cluster. All five experiments.
DeepSeek-V4.1-Flash
Open weights, served on EPFL's RCP cluster. All five experiments.
gpt-oss-120b
Grader only (Agarwal et al., 2025). It graded every model's written answers against rubrics written before the runs.

Every model gets the same prompts, tools and limits, and the same reasoning effort as Opus in each experiment: high in experiment 1, medium in experiments 2 and 3 (EEG), extra high in the rest. The open models' output-token budgets match what Opus could produce within its own limits.

Tools and rules

The model never takes a gradient step. It works in a sandboxed Python session that holds every weight tensor, and it can run the network only through the harness.

The language model
  • Opus 5.5, GLM-5.3 or DeepSeek-V4.1-Flash, with the same prompt, tools and limits
  • System prompt in experiments 3 (ECG) and 4: "Answer the user's request."
  • Replies up to 32k tokens in experiments 1 to 3 (EEG), 128k in the others
Tools
  • A persistent Python kernel (numpy, scipy) with load and save for every weight tensor
  • Experiments 2 and 3 (EEG): an evaluate call, the accuracy on a fresh batch of 128 practice trials (noise about ±4 points)
  • Experiments 3 (ECG), 4 and 5: passes that run the network on practice data and return scores, per-sample results and activations, or on probe signals the model writes itself
Rules
  • No gradient descent, optimizers or iterative fitting
  • One-shot linear algebra (least squares, linear discriminants) allowed in the ECG experiments
  • Experiment 5: designing filters and analyzing the practice recordings allowed, fitting any part of the network to recordings or labels not allowed
  • Explain every step in plain English, from experiment 3 (ECG) on
Out of the model's reach
  • The sandbox (Linux Landlock) cannot read our data folders, model files, test files or API keys
  • The test set is used only by us, after the run
  • The harness flags code that looks like fitting, for a check by hand

The five experiments

Ordered by how much they ask of the model: read a network, improve it, repair a known fault, debug an unknown one, and write a network from nothing.

Experiment 1, reading a network: the LLM gets a trained EEG network as text in five prompt versions, is asked what signal and task it handles, and hands back an open answer and probabilities over six candidate tasks. Experiment 2, improving a network: the LLM gets a healthy EEG network that scores 0.79 and is asked to raise its accuracy on new samples, with 0 or 30 evaluate calls. Experiment 3, repairing a known fault: four faults planted in EEG weights (two visible, two invisible) and swapped arm electrodes in ECG data. The LLM is told one fault was introduced and hands back repaired weights and a note. Experiment 4, debugging failure on unseen data: an ECG network trained where an artifact sits on 98% of MI ECGs fails on unseen data where it sits on half of all ECGs. The LLM is not told the cause and hands back a diagnosis and edited weights. Experiment 5, writing a network from zero: an empty TinyEEGNet, the layer formulas, electrode positions and 5 practice samples. The LLM writes every weight and is scored on 65 other samples. Shared setup: the same tools, rules and scoring for whichever language model plays the part.
Figure 3. The five experimental setups and what they share. Each box shows what the LLM receives, what it is asked, and what it hands back.

Table 1. The experiments at a glance. Runs and output-token budgets are per model. Success rules were fixed before each experiment was run.

ExperimentThe model getsFeedbackRunsBudgetSuccess rule
1 ReadTrained EEG network as textNone5257kTop-1 ≥ 60% with all weights and names (W1), ≤ 30% without weights and on controls
2 ImproveHealthy EEG network0 or 30 evaluate1242kMean gain ≥ 2 points, ≥ 2 above the placebo, no worse than bias recalibration
3 Repair (EEG)EEG network with one planted fault0 or 30 evaluate4294kRecovery ≥ 0.5, ≥ 0.25 above the placebo, mechanism right in ≥ 50% of runs
3 Repair (ECG)ECG network, arm-swap fault30 passes1541kSwapped macro-AUC above a textbook swap check (0.882), correct ECGs unchanged
4 DebugECG network with a hidden shortcut, or a clean one30 passes4190k–550kMI-AUC above the best baseline, other classes no worse
5 WriteEmpty EEG network100 passes2250k–461kCompared with gradient descent on 1–30 training samples
  • Scores: balanced accuracy for EEG, AUC for ECG, always on test data the model never saw. In experiment 3, recovery is the share of the accuracy lost to a fault that the repair wins back (1 means a full repair).
  • Baselines: the unchanged network, a random edit of the same size (a placebo), output-bias recalibration, fine-tuning on the practice data, and last-layer retraining (Kirichenko et al., 2023). Experiment 4 adds fine-tuning variants that need the diagnosis. Experiment 5 compares with gradient descent on 1, 2, 5, 10 and 30 training samples, and with two hand-crafted EEG pipelines fitted on the 5 practice samples.
  • Grading: the task a model names (experiment 1), the fault it finds (experiment 3) and its diagnosis (experiment 4) are graded by gpt-oss-120b against rubrics written before the runs.

Results

What the models did

No model could read or improve a network. All three did much better whenever there was something concrete to find.

Table 2. The results at a glance. Numbers in brackets are the main score of each experiment. †Number of training samples that gradient descent needs to do as well, for eyes open versus closed / left versus right fist. ‡Alpha power and CSP + LDA fitted on the same 5 practice samples, eyes / fist, added after the experiment.

Opus 5.5GLM-5.3DeepSeek-V4.1-Flash
1 · Read the task from the weightsNoNoNo
2 · Improve a healthy networkNoNoNo
3 · Repair a planted EEG faultYes (0.99)Partly (0.58)Yes (0.96)
3 · Repair the ECG arm swapPartly (0.870)No (0.788)No (0.780)
4 · Name the hidden causeYes (3 of 3)Yes (3 of 3)Mostly (2 of 3)
4 · Beat the best standard fixNoNoNo
5 · Write a network from zero†30 / 10–305–10 / 210 / 2–5
5 · Above hand-crafted pipelines‡Yes / YesNo / YesNo / Yes
Experiment 1

Reading a network: the models guess, they do not read

EEG52 runs per modeleffort highno tools

The model gets a trained TinyEEGNet as text, every weight rounded to 3 significant figures. It first says what signal the network reads and what its task is, then gives a probability to each of six candidate tasks. Five prompt versions separate reading from what the model already knows.

Networks
The nine trained TinyEEGNets (tasks A, B and C, three seeds each) and four controls: two with random weights and two trained on shuffled task-B labels.
Prompt versions
P0 architecture only, P1 plus recording details and electrode names, W0 architecture and weights, W1 everything plus weights, C1 W1 on the control networks.
Candidates
Our three tasks plus three decoys: imagined left/right movement, seizure and sleep.
Scoring
Top-1 correct, the probability on the true task, and a blind grade of the open answer by gpt-oss-120b.

Table 3. Share of runs whose top pick out of six candidate tasks is the right one (chance is 17%).

What the model sawRunsOpus 5.5GLM-5.3DeepSeek-V4.1-Flash
A description only, no weights80%4%0%
Weights, no electrode names180%22%11%
Weights and electrode names1822%33%0%
Control networks (random or shuffled labels)80%29%12%
Runs with no answer within the reply limit520512

How Opus reasoned

This matches the PhysioNet EEG Motor Movement/Imagery dataset (BCI2000, 10-10 montage).Opus, turn 1, fists/feet network: it identified the public dataset from the electrode order and sampling rate
Filter 5: C3 = 1.2, C5 = 0.74, C4 = 0.65, with Cz negative.Opus, turn 1, same run: real reading of a spatial filter (hand areas against the foot area)
The classifier instead puts its largest weights on the first ~0.4 s, which points to cue-locked task trials rather than continuous rest.Opus, turn 2, same run: it used the weights to rule out eyes open/closed, and picked the right task
I lean slightly towards imagery because it is the more common benchmark framing for this dataset. That is a prior, not evidence from the weights.Opus, turn 2, left/right fist network: the typical failure

What we conclude

No model read the task from the weights. GLM's best score, 33% with electrode names, is no better than its 29% on control networks that were never trained on anything. Opus did find real structure, such as left-versus-right motor filters, but the recording details gave the public dataset away, and it mostly picked that dataset's best-known task.

Experiment 2

Improving a network: a healthy network has little left to give

EEG12 runs per modeleffort medium

The model gets a healthy network and one job: raise its balanced accuracy on unseen samples by editing the weights. Leaving it unchanged is allowed. Each network is run with no feedback and with 30 evaluate calls.

Networks
TinyEEGNet for tasks B (left/right fist) and C (fists/feet), 3 seeds each: 6 networks.
Feedback
Each evaluate call is the accuracy on a fresh random batch of 128 trials from the 5 practice samples, so it moves by about ±4 points between calls.
Scored on
Balanced accuracy on the 10 test samples, against the unchanged network.
Dot and interval chart: for each model, the change in balanced accuracy with no feedback and with 30 evaluate calls. Every interval crosses zero. Opus edited 0 and 2 of 6 networks, GLM 1 and 3, DeepSeek 5 and 4. Bias recalibration scores −0.009 and fine-tuning 0.
Figure 4. Change in balanced accuracy on unseen samples after each model's edit, with no feedback (open marks) and with 30 evaluate calls (filled marks). On the right, how many of the six networks the model chose to edit. Gray diamonds are the standard training-based fixes.

How Opus reasoned

Untested edits are more likely to hurt than help on unseen subjects, so I kept the original weights.Opus, no feedback (all six such runs ended this way)
Smoothing is a mild regulariser and fits no parameters to data. […] That gain is within batch noise (±4 points).Opus, fists/feet seed 1, 30 calls: it submitted anyway, and test accuracy fell 3.1 points

What we conclude

A clean null for all three models. Every change is within a point of zero, and the standard fixes found nothing either (bias recalibration −0.009, fine-tuning +0.000). These networks had already learned what the data could teach them, as Takehi et al. (2026) found with Gemma 3.

Experiment 3

Repairing a known fault: visible faults are understood, invisible ones are worked around

EEG: 42 runs per model, effort mediumECG: 1 run per model, effort extra high

The model is told that one fault was introduced, but not where. In the EEG networks we plant one of four faults: two visible in the weights (one spatial filter ×20, the "hot filter", or one output bias +3) and two that leave every weight looking normal (swapped outputs, mirrored electrodes). In the ECG network, the fault is in the data: swapped arm electrodes.

EEG networks
The six healthy networks from experiment 2. Mirrored electrodes only applies to the left/right task.
Inclusion
A network and fault pair was kept if the fault cost at least 0.05 validation accuracy: 21 pairs, each run with no feedback and with 30 evaluate calls.
Told
"After it was trained successfully, a single fault was deliberately introduced into its weights. Find the fault and repair it." Plus the validation accuracy before the fault.
Graded
Recovery on the test samples, and whether the stated location and mechanism were right.
Bar charts of recovery by fault, without feedback and with 30 feedback calls, for each model, with the best gradient-trained fix as a dashed line. Without feedback, Opus and DeepSeek fully repair the hot filter and shifted bias, and no model recovers the swapped outputs or mirrored electrodes. With feedback, Opus and DeepSeek recover close to 1 on every fault.
Figure 5. Share of the accuracy lost to each planted EEG fault that the model won back (1 means fully repaired). The dashed line is the best gradient-trained fix for that fault, using the same practice data.

How Opus reasoned

its std was about 16, while the other 15 rows sit around 0.42–0.77, so it was roughly 28x too big.Opus, hot filter, no feedback: found and reversed from the weights alone
(a) Fault location: not found.Opus, swapped outputs, no feedback: it listed what it had ruled out and said the rest cannot be seen in the weights
I believe the left and right hemispheres were swapped, meaning each odd-numbered electrode traded places with its even-numbered mirror (C3<->C4, FC5<->FC6, Fp1<->Fp2, O1<->O2, and so on), while midline (z) channels stayed put.Opus, swapped outputs, 30 calls: a wrong diagnosis that still fixed the behavior
the class outputs were swapped, so the network's left/right decisions were flipped.Opus, mirrored electrodes, 30 calls: the opposite confusion

The ECG part: swapped arm electrodes

Swapping the arm electrodes turns lead I into −I and exchanges lead II with III and aVR with aVL. Of the recording faults we screened (a flat lead, electrode-motion and muscle noise, baseline wander, the arm swap), it did by far the most damage: macro-AUC fell by 0.15–0.22, and 99% of normal ECGs were called abnormal.

Table 4. ECGResNet before and after each model's edit for swapped arm electrodes. To pass, swapped ECGs must score above the textbook swap check while correct ECGs stay as they were.

BeforePass ifOpus 5.5GLM-5.3DeepSeek-V4.1-Flash
Swapped ECGs, macro-AUC0.766> 0.8820.8700.7880.780
Correct ECGs, macro-AUC0.9169≥ 0.91490.91670.91480.9167
Correct ECGs whose output changed0%≤ 2%0.9%6.2%1.0%
Swapped normal ECGs called abnormal99%21%98%98%
What the swap does to lead I
A normal PTB-XL ECG on ECG-paper scale (25 mm/s, 10 mm/mV). Gray: as recorded. Dark: with the arm electrodes swapped.
Network
ECGResNet, test macro-AUC 0.917 on correct ECGs.
The model got
The weights, the network's code, the exact description of the swap, the 2,146 practice ECGs with labels, and 30 passes that could run either version of each ECG.
Pass rule
On the test fold: swapped macro-AUC above the textbook check (0.882), correct ECGs' AUC within 0.002, and at most 2% of correct ECGs changing diagnosis.

How Opus reasoned, step by step

Twelve of the run's 175 steps. Click a step to see what Opus did and why. Titles and summaries are ours. Quoted text is Opus's own explanation at that step, verbatim.

The circuit Opus wrote into the network
An "if swapped, correct" switch built from a handful of existing units. Shaded boxes are units Opus repurposed.
12-lead ECGmaybe recorded swapped First layer, block 0untouched Blocks 1–3normal work continues 1 · Swap detectorblock 1, channel 3 2 · Relay and averageblock 2 #126 → block 3 #121 3 · Switch + corrections6 output channels of block 3 Five diagnosesNORM, MI, STTC, CD, HYP the head adds each correction channel minus the switch channel to its diagnosis. When the switch is off, all are zero
Opus also handed the old jobs of every repurposed unit to their neighbors by one-shot least-squares fits, so correct ECGs behave as before. 39 tensors in blocks 1–3 and the output layer changed. The first layer and block 0 were left alone.
Opus's edit against fixes outside the network
Swapped-electrode ECGs, test fold (2,158 ECGs): macro-AUC. 0.5 is chance, 1.0 is perfect. Correct ECGs whose diagnosis changed are listed beside each bar.
Opus's weight editfix outside the networkreference
The learned input check is 8 numbers fitted by least squares on the practice ECGs: predict lead I from aVF and the chest leads, which the swap leaves alone, and call a recording swapped when the flipped lead I fits better. It catches 99.1% of swaps with 0.9% false alarms. Opus noted this idea in its own notes. A random edit of the same size as Opus's scores 0.50.

What we conclude

Visible damage is found and reversed from the weights alone by Opus and DeepSeek, better than any data-trained fix for the scaled filter. Invisible damage is undone only with feedback, and by compensation: no model named it correctly in more than 17% of runs. With 30 feedback calls Opus and DeepSeek recovered 0.99 and 0.96, against 0.40 for the best gradient-trained fix. On the ECG swap only Opus made headway, with a working "if swapped, correct" circuit (0.870, just short of the textbook check's 0.882). A simple check before the network does better (0.916): when a fault can be fixed in the input, fixing the input is the better tool.

Experiment 4

Debugging failure on unseen data: the models find the hidden cause

ECG4 runs per model, 30 passes eacheffort extra high

This time the model is not told the cause. Each network learned a shortcut: a recording artifact on 98% of MI ECGs in its training data. In the unseen data the artifact sits on half of all ECGs at random, so the shortcut fails. Three artifacts (mains hum, a calibration pulse and a 25 Hz "muscle filter"), plus a control with no artifact at all. The model gets 500 labeled practice ECGs and 30 passes, and hands back a diagnosis and edited weights.

Table 5. Left: diagnosis points (cause, which recordings carry it, causal evidence, location in the network). Right: share of MI calls that the artifact can still flip, before and after each model's edit.

DiagnosisMI calls flipped by the artifact
OpusGLMDeepSeekBeforeOpusGLMDeepSeek
Mains hum4/44/43/481%0%1%0%
Calibration pulse4/44/44/491%0%0%6%
Muscle filter4/44/42/475%2%3%14%
Control (no artifact)correctpartlypartly––––
Dumbbell chart of MI-AUC before and after each model's edit for mains hum, calibration pulse, muscle filter and the control. Every edit lifts MI-AUC from about 0.67 to about 0.84, except DeepSeek on the muscle filter (0.79). Every edit stays just below the pass mark.
Figure 6. MI-AUC on new ECGs from the second hospital, before and after each model's edit. The gray tick is the pass mark, the best of the standard training-based fixes using the same 500 labeled ECGs.

Building the test bed

All ECGs come from PTB-XL. Only the artifact differs between the training data and the unseen data.

Training data
MI ECGs
98%
Other ECGs
2%
Share carrying the artifact. The network can learn "artifact means MI".
Unseen data · practice and test sets
MI ECGs
50%
Other ECGs
50%
The artifact is unrelated to the diagnosis.
Artifacts
Mains hum: 60 Hz interference, seen at 40 Hz when sampled at 100 Hz, 0.01–0.03 mV. Calibration pulse: 1 mV for 200 ms on all 12 leads in the first 0.3 s. Muscle filter: a 25 Hz low-pass (flat to 20 Hz, zero from 30 Hz), added later as a subtler fault.
Reference
The same network trained with the artifact on 50% of all ECGs (uninformative): the network one would want. MI-AUC on the unseen data about 0.91.
Standard fixes
Measured on the unseen data with 50 to 2,146 labeled practice ECGs: remove the artifact from the input, retrain the last layer (with or without removal), or fine-tune the whole network.
Decision rule
Use a construction only if it costs at least 0.05 MI-AUC against the reference, the artifact changes at least 10% of MI calls, and removing the artifact from the input recovers less than 80% of the loss. The label budget given to the models is the largest number at which every standard fix still recovers less than 80% (500 ECGs here).
MI-AUC on the unseen data for the standard fixes, by number of labeled ECGs
Artifact
retrain last layerremove artifact, then retrain last layerfine-tune whole network
Means of two networks. Horizontal lines: the shortcut network as is, the same network with the artifact removed from every ECG, and the reference network. With the strong shortcut, the network never properly learned what a heart attack looks like: removing the artifact only reaches 0.82 (mains hum), so the defect is in the weights. The best fix on the exact 500 labeled ECGs the models got set each case's pass mark (0.866–0.871).

The four cases in detail

Told
The network does well on its training data (the model got those scores, including an MI-AUC of 0.99+ for the shortcut networks) and "works clearly worse" on new data, "above all for MI". It should diagnose from the heart's electrical activity, and any dependence on non-cardiac recording properties is a defect. Not told the cause. The prompts call the two sources "hospital A" and "hospital B".
The model got
The weights and code, practice ECGs from the unseen data (fold 9) with 500 of them labeled (the same 500 the standard fixes used), 30 passes, and the usual rules.
Leak check
Each prompt was checked by script for words naming its cause (hum, mains, 40 Hz, pulse, calibration, filtering, smooth, case mix, prevalence, and others).
Diagnosis grade
Set before the runs: names the cause, says which recordings carry it and that it is unrelated to the diagnosis, proves cause and effect, and locates it in the network. A confident wrong cause counts as a false alarm.

The case explorer follows Opus's runs: its reasoning, its fix and its probe measurements. The results chart in each case also shows GLM's and DeepSeek's edits.

Opus on all four cases side by side

What we conclude

Not told the cause, Opus and GLM named all three artifacts, DeepSeek named two, and no model invented a cause in the control. Opus described the muscle filter as "a steep 25 Hz low-pass filter (a machine filter setting)". The edits then switched each shortcut off: the artifact flipped 75–91% of MI calls before, and at most 3% (Opus, GLM) or 14% (DeepSeek) after. In the three artifact cases the best edit still fell 0.007–0.029 short of the best standard fix, a fix that needs the very diagnosis the models found on their own.

Experiment 5

Writing a network from zero

EEG1 run per task and modeleffort extra highup to 100 passes

An empty TinyEEGNet, all 2,730 weights at zero. The prompt gives every layer's formula, the 3D positions of the 64 electrodes, the preprocessing and the input statistics, plus recordings from the 5 practice samples. The model writes every weight, with up to 100 passes and 400 code runs, and hands back the network and what each unit does. Two tasks: (A) eyes open vs. closed and (B) left vs. right fist.

Practice data
5 practice samples: 290 windows for task A, 225 for task B.
Budget
Output-token budgets of 461k (task A) and 250k (task B) per run, with a budget meter after every step.
Finishing
In task A, the harness turned down the first two requests to finish while less than 90% of the budget was used, and accepted the third. In task B, it turned down every request to finish until 90% was used.
Test
65 unseen samples (3,770 windows for task A, 2,932 for task B), balanced accuracy with a 95% interval from a bootstrap over samples.
Hand-crafted baselines
Fitted on the same 5 practice samples: relative alpha power (8–13 Hz, 8 electrodes over the back of the head) with one threshold, and common spatial patterns (CSP, 8–30 Hz, 6 filters) with a shrinkage linear discriminant (LDA). Added after the experiment, with recipes fixed before they were run and not tuned.
Two learning-curve charts, eyes open versus closed and left versus right fist. A gray line shows gradient descent on 1 to 30 training samples. Dashed lines show the networks written from zero: for eyes, Opus 0.834 above gradient descent on 30 samples, DeepSeek 0.733 and GLM 0.719. For fists, Opus 0.769, DeepSeek 0.705 and GLM 0.655. Open markers at 5 samples show the hand-crafted baselines: for eyes, alpha power 0.746 and CSP with LDA 0.779, for fists, CSP with LDA 0.509, at chance.
Figure 7. Balanced accuracy on 65 unseen test samples of networks written from zero by each model (dashed lines), using recordings from 5 practice samples, against the same network trained by gradient descent on 1–30 training samples (gray line, mean over seeds, with each seed as a light dot), and two hand-crafted baselines fitted on the same 5 practice samples (open markers, with 95% intervals; dotted line: chance).
Balanced accuracy on 65 unseen test samplesOpus 5.5GLM-5.3DeepSeek-V4.1-FlashGradient descent on 5 / 10 / 30
(A) Eyes open vs. closed0.834[0.794, 0.872]0.719[0.680, 0.759]0.733[0.692, 0.777]0.704 / 0.740 / 0.806
(B) Left vs. right fist0.769[0.739, 0.798]0.655[0.628, 0.680]0.705[0.674, 0.734]0.724 / 0.738 / 0.793
Share of the budget used, A / B46% / 91%91% / 97%31% / 94%

Against hand-crafted EEG pipelines

Fitted on the 5 practice samples, 65 unseen test samplesAlpha power + thresholdCSP + LDA
(A) Eyes open vs. closed0.746[0.708, 0.783]0.779[0.729, 0.827]
(B) Left vs. right fist–0.509[0.496, 0.522]

Both baselines on eyes fall below Opus (0.834) and above GLM (0.719) and DeepSeek (0.733). On fists, CSP with LDA stays at chance: three of the five practice samples show little left/right CSP signal even on their own. Fitted on all 30 training samples, it reaches 0.640, still below every written network.

Cost

Writing a network costs far more than training one, but only once, when the network is designed. Opus's two runs cost $8.50 (eyes) and $9.08 (fist) in API fees and took 38 and 39 minutes. GLM and DeepSeek ran on our own GPU cluster and used 143k to 420k output tokens per network. Gradient descent trains the same network in 2 to 5 seconds (5 samples) or 13 to 31 seconds (30 samples) on one NVIDIA A100 GPU. Both kinds of network have the same 2,730 weights, so they cost the same to run on a wearable device.

What Opus wrote, unit by unit

From Opus's own description of each network, which every run had to hand back. Summaries are ours.

(A) Eyes open vs. closed 0.834
  • Temporal filters: band filters for alpha (8–12.5 Hz), theta (3–6 Hz), beta (21–30 Hz) and a slow band below 2.5 Hz for eye movements.
  • Spatial filters: short bipolar pairs, the occipital row against the parieto-occipital row and that row against the parietal row, plus a vertical and a horizontal eye channel.
  • Amplitude detectors: each pair feeds a plus and a minus unit, so after the activation their sum tracks the size of the signal.
  • Decision: alpha amplitude minus a weighted mix of theta and beta, plus a small eye-movement term, averaged over the 4 s window. Strong alpha means eyes closed.
  • Checked with probe signals: blinks push the output toward "open", slow sideways eye movements toward "closed", and 2 µV of muscle noise over the back of the head changes nothing.
  • 1,032 of the 2,730 weights are nonzero. 47 of 100 passes used. 57 of the 65 test samples score above 0.6, and none below 0.5.
(B) Left vs. right fist 0.769
  • Mirror-symmetric: every spatial filter sums to zero, and swapping the left and right electrodes flips the decision in 98% of windows.
  • Gaze: a horizontal eye channel picks up the eyes moving toward the cued side.
  • Slow motor potential: central electrodes over the right hemisphere against their mirrors on the left.
  • Beta drop: 15–30 Hz votes from the motor cortex, against a reference band that removes each sample's own left/right offset, summed over 1.2–3.6 s.
  • Neutral by design: biases set so that a window with no left/right activity scores zero. On practice data, removing the beta votes cost 6.2 points and the slow potential 3.6.
  • 1,090 of the 2,730 weights are nonzero. 54 of 100 passes used. 58 of the 65 test samples score above 0.6.

What we conclude

Every model wrote a working network from zero, with no gradient step. Opus's eyes network reached 0.834 on 65 unseen samples, level with gradient descent on 30 training samples (0.806) and well above 5 (0.704). Its fist network (0.769) sat between 10 and 30. GLM and DeepSeek reached the level of 2 to 10 training samples. Opus also scored above two classic hand-crafted EEG pipelines fitted on the same 5 practice samples. Opus was not the best judge of its own work: it expected 0.97 for the eyes network from the practice recordings it designed it on, though its fist estimate (0.774) was almost exact.


Takeaways

What we learned

  • It helps when the model brings knowledge the optimizer lacked. In experiment 4 that was recording physics: how limb leads relate, mains frequencies and aliasing, machine filter settings. In experiment 5 it was EEG physiology: alpha over the back of the head, eye movements, motor rhythms. In experiment 2 there was nothing to add.
  • Removing is easier than building. Switching off a shortcut is a precise, local change in the first layer. Rebuilding diagnostic knowledge spread over 941k weights is what gradient descent is good at.
  • Diagnosis needs the right tools. With one accuracy number per call (experiment 3, EEG), no model could diagnose an invisible fault. With practice data, self-built probes, activations and paired comparisons (experiment 4), the diagnoses were right.
  • The comparison decides the verdict. The ECG electrode swap looked promising against the textbook check and failed against a learned input check. In experiment 4, every result was judged against the strongest standard fixes we could build.
  • The open models are close behind on diagnosis. GLM matched Opus on every diagnosis in experiment 4. Both open models fell further behind on the long, careful tasks: writing a network from zero and repairing the electrode swap.

Limits of the evidence

  • One run per model in experiment 3 (ECG), experiment 4 and experiment 5. Differences of a few hundredths there cannot be told apart from run-to-run variation, which we have not measured yet.
  • The three recording artifacts in experiment 4 were planted by us, at a strong 98% association. Real shortcuts are weaker and messier.
  • The practice ECGs (fold 9) were also used to choose each network's training epoch. The overlap is the same for every method compared.

Where this could go

Writing small networks by reasoning could, in principle, make training them unnecessary, which matters most on the extreme edge, such as wearable devices. A language model could also reason through a network first and leave the polishing to gradient descent, for biosignals and beyond. And within this study at least, the open-weight models are catching up.


Appendix

Data and references

The datasets and the works cited on this page. Click to open or close.

Datasets

Data setContentUsed for
PhysioNet EEG Motor Movement/Imagery109 samples, 64 electrodes, 160 Hz. 50 samples drawn: 30 training, 5 validation, 5 practice, 10 test. Experiment 5 tests on the other 55 eligible samples as well (65 in all)Experiments 1, 2, 3 (EEG) and 5
PTB-XL 1.0.3 (Wagner et al., 2020, CC BY 4.0)Clinical 12-lead ECGs, 10 s, 100 Hz version, 5 diagnostic superclasses, recommended folds. 21,388 with a diagnostic labelExperiments 3 (ECG) and 4
MIT-BIH Noise Stress TestRecorded electrode-motion, muscle and baseline-wander noiseScreening of recording faults for experiment 3 (ECG)

References

  1. Agarwal, S., Ahmad, L., Ai, J., et al. (2025). gpt-oss-120b & gpt-oss-20b model card. arXiv:2508.10925.
  2. Chhabria, S. (2026). Can Opus 5.5 teach an image model what "no" means? Blog post (work in progress).
  3. Gemma Team (2025). Gemma 3 technical report. arXiv:2503.19786.
  4. Geirhos, R., Jacobsen, J.-H., Michaelis, C., et al. (2020). Shortcut learning in deep neural networks. Nature Machine Intelligence, 2(11), 665–673.
  5. Kirichenko, P., Izmailov, P., Wilson, A. G. (2023). Last layer re-training is sufficient for robustness to spurious correlations. ICLR.
  6. Lawhern, V. J., Solon, A. J., Waytowich, N. R., et al. (2018). EEGNet: a compact convolutional neural network for EEG-based brain–computer interfaces. Journal of Neural Engineering, 15(5), 056013.
  7. Schalk, G., McFarland, D. J., Hinterberger, T., Birbaumer, N., Wolpaw, J. R. (2004). BCI2000: a general-purpose brain-computer interface (BCI) system. IEEE Transactions on Biomedical Engineering, 51(6), 1034–1043.
  8. Takehi, R., Teoh, J., Zhang, A., Khattab, O. (2026). Sparks of weight-space programming: LLMs can natively read & write neural network weights. Blog post, MIT CSAIL.
  9. Wagner, P., Strodthoff, N., Bousseljot, R.-D., et al. (2020). PTB-XL, a large publicly available electrocardiography dataset. Scientific Data, 7, 154.