Don't Train It, Write It: An AI Agent Writes New Capabilities into Language Model Weights

Santiago Rivadeneira QuinteroarXiv 2026

Instead of the messy, data-hungry process of training, what if an AI could just "reach in" and rewrite another model's brain? This paper demonstrates an AI agent acting as a "surgeon," manually designing and inserting new neural circuits into existing language models to grant them complex skills like 20-digit multiplication—all without a single gradient update or a single round of backpropagation.

TL;DR

Researchers have shown that an AI agent (Claude Code) can "write" new capabilities directly into the weights of a pre-trained model by adding gated attention heads and MLP neurons. This "surgical" approach allows a tiny 1.5B parameter model to outperform its 7B sibling on logic tasks while remaining perfectly unchanged on unrelated text (KL divergence of zero).

What Problem Does This Paper Address?

We usually improve Large Language Models (LLMs) through training: you feed them massive amounts of data, calculate errors (loss), and use backpropagation to nudge millions of weights. It’s a blunt instrument. It’s computationally expensive, often requires thousands of examples, and can lead to "catastrophic forgetting," where the model gains a new skill but loses an old one.

Furthermore, LLMs are notoriously bad at tasks requiring exact, multi-step logic—like multiplying two 20-digit numbers. Even with "Chain of Thought" prompting, they often stumble. The authors ask: Can we skip the training and just program the weights directly? Can an AI agent look at a model's internal activations, design a circuit to solve a problem, and "patch" it in?

Methods

The authors introduce the Surgeon’s Loop, a protocol where an autonomous AI agent (Claude Code) acts as a weight-space programmer.

The Surgeon's Loop: Read, Think, Write, Measure, Keep/Revert, Export.
  1. Read: The agent examines the host model's weights and activations on practice inputs.
  2. Think & Simulate: It designs new "implant" components (attention heads and MLP neurons) using NumPy to simulate how they will interact with the existing residual stream.
  3. Write a Patch: It inserts these new components into the model. Crucially, these are gated: they are designed to stay "silent" (output zero) unless they see a specific trigger (like a math prompt).
  4. Measure: The agent tests the "patched" model on a practice set. It has a strict budget of 50 model passes.
  5. Verify: To ensure the "surgery" didn't cause brain damage, it checks the KL Divergence—a measure of how much the model's output distribution changed on unrelated text (like WikiText). The goal is a KL of exactly 0.

Datasets

The agent was evaluated on several challenging benchmarks:

  • BIG-Bench Hard (BBH): Specifically six subtasks including tracking_shuffled_objects, web_of_lies, navigate, and boolean_expressions.
  • Exact Arithmetic: Addition up to 30 digits and multiplication up to 20 digits.
  • WikiText-103: Used to ensure the model's general knowledge remained untouched.
  • Sealed Test Sets: To prevent cheating, the authors used a "sealed" protocol where the test data and success criteria were timestamped on the Bitcoin blockchain before the agent ever started.

Key Insights and Ideas

  • Weight-Space Programming: This isn't fine-tuning; it's engineering. The agent isn't "learning" from examples in the traditional sense; it's reverse-engineering how the model represents tokens and then writing "code" in the form of weights to manipulate those representations.
  • Extrapolation is "Free": In the multiplication task, the agent only ran the model on up to 6-digit problems during development. However, because it wrote a general-purpose algorithm into the weights, the model achieved 100% accuracy on 20-digit problems.
  • The "Silent" Implant: By using gated neurons that only fire on specific task templates, the researchers achieved the "holy grail" of model editing: adding a massive new capability with zero side effects on the model's original behavior.
The "implant" architecture showing added heads and neurons across layers.

Key Results

The results are startling for models of this size:

  • Qwen2.5-1.5B-Instruct: Its normalized BBH score jumped from 19.95 to 41.05. For context, the much larger Qwen2.5-7B model only scores around 35.
  • Gemma-3-1B-it: Its score rose from 10.25 to 32.86.
  • Multiplication: The agent wrote a circuit that performs 20-digit multiplication with 100% accuracy. Standard training (LoRA) with the same computational budget reached at most 2.1% accuracy.
Comparison of BBH scores: 1.5B models with implants vs. original and 7B versions.

Limitations and Future Work

  • Template Sensitivity: The implants are "brittle." They fire based on specific prompt templates. If you change the wording of the math problem significantly, the "gate" might not open, and the model reverts to its original (incorrect) behavior.
  • The "Manual" Requirement: For the most complex tasks, the agent was given a "manual" of design patterns discovered in earlier development sessions. It isn't yet fully "inventing" complex algorithms from scratch without guidance.
  • Scaling: While this worked for 1B and 1.5B models, it remains to be seen if an agent can navigate the much larger and noisier weight spaces of 70B+ parameter models.

In short, this paper suggests that the future of AI might not just be about "more data and more compute," but about "smarter surgeons" who can precisely tune the engines we've already built.

Summary updated

Abstract

We show that an AI agent can write new capabilities into a pretrained language model by adding gated attention heads and MLP neurons inside its existing layers, without backpropagation and without fitting any weight to the answers of task examples. It has a budget of 50 model passes and sees no validation or test instance. Composed in one model, its modules for six BIG-Bench Hard (BBH) subtasks raise the normalized BBH score of Qwen2.5-1.5B-Instruct from 19.95 to 41.05 (Qwen2.5-7B-Instruct: at most 35.01) and that of Gemma-3-1B-it from 10.25 to 32.86. Against the unmodified model at the same precision, both composites leave the next-token distribution on 1,023,000 WikiText tokens unchanged (KL exactly 0), give identical answers on 15,845 items of five other Leaderboard tests and identical scores on the other 18 BBH subtasks. The agent also writes exact multiplication up to 20 digits, running the model only up to 6 (100.0% on the absent lengths of the sealed test in both models; a LoRA with the same budget: at most 2.1%). Sets, rules and report sentences were sealed in git before the first session (manifests timestamped in Bitcoin), with dated amendments listed in Appendix D; a frozen evaluator ran the sealed test once. Verdicts (H5: tracking; H6: composite; H8: one pass vs. chain of thought; H9: fresh and rewritten instances; H10: side effects; H12: multiplication), on the preregistered sealed test, Qwen2.5-1.5B-Instruct: H5 success, H6 success, H8 (web_of_lies) success, H9 success, H10 (composite) success on (i) to (iii), (iv) confirmed, H12 success; Gemma-3-1B-it (H7: H5, H6, H8 and H9 in this model): H5 success, H6 success, H8 (web_of_lies) success, H8 (tracking 3) success, H9 partial, H10 (composite) success on (i) to (iii), (iv) confirmed, H12 success. Not everything worked: 4 of 45 single modules show small side effects and 5 of 50 sessions hit the 12-hour limit without a module.
BibTeX
@misc{quintero2026don,
  author = {Santiago Rivadeneira Quintero},
  title = {{Don't Train It, Write It: An AI Agent Writes New Capabilities into Language Model Weights}},
  year = {2026},
  eprint = {2611.28483},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.28483},
}
Figure