Language Model Weights Written by an AI Agent

AI agent writing new capabilities into language model weights inside a neural network

An AI agent can add new skills to a pretrained model by editing its internal structure directly, with no training run. A new study shows an agent changing language model weights by inserting extra attention heads and MLP neurons into existing layers, and the results on a hard reasoning benchmark are large for small models.

How the agent adds a skill

Standard fine-tuning adjusts weights through backpropagation, fitting them to the answers in a set of task examples. This method skips both. The agent builds small gated modules and places them inside the model’s current layers. It never fits a weight to example answers.

The agent works under a hard budget of 50 model passes. It never sees a validation or test instance while it works. Every module it produces has to come from what it can learn within those 50 runs.

What the benchmark numbers show

The team tested the approach on BIG-Bench Hard (BBH), a set of difficult reasoning tasks. Modules for six BBH subtasks were combined in a single model. The normalized BBH score of Qwen2.5-1.5B-Instruct rose from 19.95 to 41.05. The larger Qwen2.5-7B-Instruct scores at most 35.01 on the same measure, so the modified 1.5B model beats a sibling nearly five times its size.

Gemma-3-1B-it moved the same way, from 10.25 to 32.86.

The study also reports a multiplication result. The agent wrote a module for exact multiplication of numbers up to 20 digits while running the model only on lengths up to 6 digits. On the lengths it never ran, both models scored 100.0% on the sealed test. A LoRA adapter given the same budget reached at most 2.1%.

Why the rest of the model stays untouched

A common worry with any edit to language model weights is collateral damage: improve one skill and something else quietly breaks. The authors checked this against the unmodified model at the same precision. Their findings for both composite models:

  • The next-token distribution on 1,023,000 WikiText tokens was unchanged, with a KL divergence of exactly 0.
  • Answers matched on all 15,845 items across five other Leaderboard tests.
  • Scores were identical on the 18 BBH subtasks that had no module.

Since the added modules only act on the tasks they were written for, the base model behaves as before everywhere else.

How the tests were kept honest

Claims like these invite doubt, so the setup was locked down in advance. The test sets, rules and report sentences were sealed in git before the first session, and the manifests were timestamped in Bitcoin. Dated amendments are listed in an appendix. A frozen evaluator then ran the sealed test once.

Against the preregistered hypotheses, Qwen2.5-1.5B-Instruct succeeded on every verdict listed, covering state tracking, the composite model, one pass versus chain of thought, fresh and rewritten instances, side effects and multiplication. Gemma-3-1B-it did the same except on one hypothesis about fresh and rewritten instances, which came out as a partial success.

Where it fell short

The method has limits, and the study says so. Four of the 45 single modules showed small side effects. Five of 50 agent sessions hit the 12-hour limit without producing a module at all. The tests also cover small open models and a defined set of tasks, so the results say little yet about frontier-scale systems.

What this could mean for model builders

If the approach holds up elsewhere, teams could patch a specific weakness in a deployed model without retraining it or risking its other behavior. Because the base model’s outputs stay identical outside the target task, a module could be tested, added or removed independently. That is a different workflow from LoRA fine-tuning, where the adapter shifts weights globally.

The next questions are practical ones. Can the agent write modules for larger models, and for tasks less tidy than BBH subtasks? How many sessions fail as the targets get harder? The data so far comes from two small models, so independent replication will matter before anyone treats this as a general tool.

Source: arXiv.org

Written by

Saksham Bhargava

Saksham Bhargava runs Alteroid and has been writing about consumer technology for over five years, covering iPhone, Android, Windows, AI tools and gaming. With an MCA and six years of hands-on web development experience, he tests the features he writes about on his own devices and focuses on clear, practical guides that solve real problems. Away from the screen, he enjoys travelling to places most tourists skip.