Mixed Signals: Weight-Space Programming for EEG and ECG

Dara Varam, Taraneh Aminosharieh Najafi, David AtienzaarXiv 2026 · arXiv

TL;DR

Weight-Space Programming (WSP) allows Large Language Models (LLMs) to "train" neural networks by reading and writing weights directly through reasoning, rather than gradient descent. This study shows that for biosignals like EEG and ECG, LLMs can debug hidden recording artifacts and even write small classifiers from scratch that outperform traditional gradient descent in low-data regimes.

What Problem Does This Paper Address?

Training neural networks typically requires thousands of gradient descent steps and massive labeled datasets. In fields like biosignal processing (EEG/ECG), data is often scarce, labels are expensive, and models frequently fail when encountering new subjects or recording environments due to "shortcut learning"—relying on artifacts rather than actual physiology.

The authors explore whether the vast "prior knowledge" of physics and physiology embedded in LLMs can be used to bypass these hurdles. Instead of letting an optimizer discover signal patterns from scratch, can an LLM simply "program" the weights of a network based on its understanding of how a heart or brain works?

Methods

The researchers evaluated three LLMs (Claude Opus 5.5, GLM-5.3, and DeepSeek-V4.1-Flash) across five experiments of increasing difficulty:

  1. Reading a network: Can the LLM identify a task just by looking at the weights?
  2. Improving a network: Can it make a "healthy" model even better?
  3. Repairing a known fault: Can it fix a planted error (e.g., swapped leads)?
  4. Debugging a hidden failure: Can it find and fix an unknown artifact (e.g., mains hum) causing a model to fail?
  5. Writing from zero: Can it write all weights for a new task given only the architecture and a tiny "calibration" dataset?

Crucially, the LLMs were forbidden from using gradient descent. They interacted with the weights via a Python sandbox, performing analysis and one-shot edits based on reasoning traces.

The five experiments used to test Weight-Space Programming, ranging from simple reading to writing a full network from scratch.

Datasets

  • EEG: The PhysioNet EEG Motor Movement/Imagery dataset (64-electrode recordings from 109 subjects).
  • ECG: The PTB-XL dataset (over 21,000 clinical 12-lead ECG recordings).

Key Insights and Ideas

  • Physiology as a Structural Prior: LLMs succeed not by "fitting" data in the traditional sense, but by recalling what a classifier should look like. For example, when writing an EEG classifier for "eyes open vs. closed," Claude Opus 5.5 manually designed weights that functioned as alpha-band (8–12 Hz) filters over the occipital lobe—exactly what a human expert would do.
  • The "Debugger" Advantage: LLMs proved remarkably effective at identifying why a model was failing. In Experiment 4, without being told the cause, Claude correctly identified hidden muscle filters and calibration pulses in the data and "switched off" the network's reliance on these shortcuts.
  • Limits of "Reading" Weights: Interestingly, models could not identify a task from raw weights alone. They relied on metadata (like electrode names) to guess the task, suggesting they aren't yet "native speakers" of weight space but rather high-level architects.

Key Results

  • Reasoning Beats Small-Data Gradient Descent: In the "writing from zero" task, Claude Opus 5.5 wrote a 2,730-weight EEG classifier that achieved 0.834 accuracy using data from only 5 subjects. To match this performance, traditional gradient descent required 30 subjects—a 6× improvement in data efficiency.
  • Superior to Hand-Crafted Pipelines: The LLM-written networks outperformed classic signal processing baselines like Common Spatial Patterns (CSP) + LDA when both were limited to the same small subject pool.
  • Effective Fault Recovery: For planted ECG lead swaps, Claude improved the detection of myocardial infarction (MI) from a failing AUC of ~0.68 to ~0.85 by reasoning about lead mathematics.
Fig. 1. System diagram, showing experiment 5 in this study. A TinyEEGNet network, with all its weights initialized to 0, is written through the reasoning of Claude Opus 5.5 using only 5 training subjects, and matches the same network trained by gradient descent on 30 training subjects.

Limitations and Future Work

  • Interpretability vs. Scale: WSP currently works best on small, "shallow" networks (like the 2,730-weight TinyEEGNet). Applying this to billion-parameter models remains a massive challenge.
  • Computational Cost: While inference is identical to a trained model, "writing" the weights is slow and expensive, taking nearly 40 minutes of LLM reasoning compared to seconds for gradient descent.
  • Data Contamination: The authors acknowledge that the LLMs likely saw these public datasets during their pre-training, which might contribute to their "prior knowledge."
  • Future Direction: The most promising path may be using WSP as a "warm start" or initialization phase, providing a physically grounded starting point for traditional gradient descent to fine-tune.

Summary updated

Abstract

Weight-space programming allows language models to read a trained neural network's weights and edit them. This opens the door to ``training'' by reasoning rather than through gradient descent. Prior work has demonstrated its functionality and promise for game-playing networks and fixing specific failures in language models, even extending to diffusion models. In this work, we present its applicability to models trained on biosignal data, specifically EEG and ECG data. We show that frontier models are not only able to debug specific faults planted in biosignal-based models without being told what these faults are, but are even capable of writing all the weights of a network from scratch, given only the architecture, the task, and a minimal set of training subjects. In particular, in one set of experiments, a language model was able to match standard gradient-descent training using $6\times$ fewer training subjects, through reasoning alone and without any gradient descent step. Networks written by Claude Opus 5.5 also scored higher than classic hand-crafted EEG pipelines (alpha band power, and common spatial patterns with linear discriminant analysis) when built from the same 5 subjects. We also highlight some of the limitations, which include the inability of language models to improve already well-trained classification models, and their incapacity to reliably recognize, from the weights alone, the task a network was trained on. Overall, our results indicate that weight-space programming can be useful for small networks, such as those deployed on edge devices and wearables, but the concept still requires further investigation before it can be used in practice.
BibTeX
@misc{varam2026mixed,
  author = {Dara Varam and Taraneh Aminosharieh Najafi and David Atienza},
  title = {{Mixed Signals: Weight-Space Programming for EEG and ECG}},
  year = {2026},
  eprint = {2611.13758},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.13758},
}
Figure