Don't Train It, Write It: An AI Agent Writes New Capabilities into Language Model Weights
Organizations: EPFL
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.
Figures & tables
| Session | Host | Val. reads | Passes | Neurons | Heads | Layers | Entries (M) |
|---|---|---|---|---|---|---|---|
| of-15b-01 | Qwen2.5-1.5B | 1 | 5 | 6,358 | 74 | 6 | 68.7 |
| of-15b-02 | Qwen2.5-1.5B | 2 | 10 | 330 | 90 | 6 | 51.8 |
| of-15b-03 | Qwen2.5-1.5B | 1 | 7 | 1,312 | 141 | 6 | 81.5 |
| of-15b-04 | Qwen2.5-1.5B | 1 | 8 | 4,291 | 69 | 6 | 54.0 |
| of-15b-05 | Qwen2.5-1.5B | 1 | 8 | 574 | 87 | 7 | 52.6 |
| of-05b-01 | Qwen2.5-0.5B | 1 | 10 | 2,942 | 139 | 6 | 29.7 |
| Public set (250) | Sealed val. | |||||||
|---|---|---|---|---|---|---|---|---|
| Host | Subtask | Chance+5 | Direct | CoT std | CoT relax | CoT alg. | Direct | Class |
| Qwen2.5-1.5B | tracking 3 | 38.3 | 31.6 | 37.6 | 36.8 | 38.0 | 28.8 | absent |
| tracking 5 | 25.0 | 17.6 | 16.8 | 15.6 | 14.4 | 17.4 | absent | |
| tracking 7 | 19.3 | 13.6 | 17.6 | 18.4 | 15.2 | 14.0 | absent | |
| web_of_lies | 55.0 | 52.8 | 77.2 | 76.0 | 83.6 | 52.6 | compile | |
| navigate | 55.0 | 57.2 | 80.4 | 80.8 | 76.0 | 50.0 | improve | |
| Task | Host | Manual | Class | Sealed validation, 5 sessions (%) | Passes | Neurons | Heads |
|---|---|---|---|---|---|---|---|
| tracking | Qwen 1.5B | v3.3 | absent (3, 5, 7) | 100.0, 100.0, 95.0, 100.0, 100.0 | 12–28 | 1,955 | 33 |
| tracking | Gemma 1B | v3.3 | absent (5, 7), compile (3) | 100.0, failed (12 h limit, no export) , 100.0, 95.4, failed (12 h limit, no export) | 19–23 | 3,499 | 30 |
| web_of_lies | Qwen 1.5B | v3.1 | compile | 100.0, 100.0, 100.0, 100.0, 100.0 | 17–23 | 31 | 6 |
| web_of_lies | Gemma 1B | v3.3 | compile | 100.0, 100.0, 100.0, 100.0, 100.0 | 13–21 | 19 | 37 |
| product | Qwen 1.5B | v3 | absent | 100.0, 100.0, 100.0, 100.0, 100.0 | 7–20 | 6,696 | 100 |
| product | Gemma 1B | v3.2 | compile | 100.0, 100.0, 100.0, 100.0, 100.0 | 10–14 | 8,010 | 54 |
| Task | Host | Own test | Public BBH | Rewritten | LoRA (B1) |
| tracking | Qwen 1.5B | 99.1/99.4/99.2 | 99.3/99.6/99.7 | 95.7/93.7/92.7 | 100.0/86.4/80.9 |
| tracking | Gemma 1B | 99.8/99.8/99.2 (3/5) | 99.6/99.5/99.3 | 99.9/99.8/99.7 | 100.0/24.8/15.6 |
| web_of_lies | Qwen 1.5B | 100.0 | 100.0 | 100.0 | 99.9 |
| web_of_lies | Gemma 1B | 100.0 | 100.0 | 99.4 | 100.0 |
| navigate | Qwen 1.5B | 100.0 (4/5) | 100.0 | 100.0 | 95.1 |
| navigate | Gemma 1B | 100.0 | 100.0 | 91.7 | 92.3 |
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
| Session | Task | Host | Val. | Passes | Neurons | Heads | Layers | Entries (M) |
|---|---|---|---|---|---|---|---|---|
| of2-bbh-q01 | tracking | Qwen 1.5B | 100.0 | 28 | 1,955 | 33 | 21 | 35.9 |
| of2-bbh-q02 | tracking | Qwen 1.5B | 100.0 | 12 | 1,722 | 42 | 22 | 41.1 |
| of2-bbh-q03 | tracking | Qwen 1.5B | 95.0 | 21 | 10,207 | 32 | 23 | 72.5 |
| of2-bbh-q04 | tracking | Qwen 1.5B | 100.0 | 16 | 3,313 | 64 | 18 | 66.3 |
| of2-bbh-q05 | tracking | Qwen 1.5B | 100.0 | 21 | 826 | 30 | 18 | 28.2 |
| of2-bbh-g01 | tracking | Gemma 1B | 100.0 | 21 | 3,499 | 29 | 17 | 46.6 |
| Session | Task | Host | KL | p99.9 | Top-1 | Panel | H10 |
|---|---|---|---|---|---|---|---|
| cc-qwen15 | composite | Qwen 1.5B | 0.00 | no significant change (23 tests) | success (i–iii) | ||
| of-bool-q02 | boolean_expr | Qwen 1.5B | 0.00 | no significant change (23 tests) | success (i–iii) | ||
| of-bool-q03 | boolean_expr | Qwen 1.5B | 0.00 | no significant change (23 tests) | success (i–iii) | ||
| of-bool-q05 | boolean_expr | Qwen 1.5B | 0.00 | no significant change (23 tests) | success (i–iii) | ||
| of-bool-q01 | boolean_expr | Qwen 1.5B | – | – | – | not run (failed session) | not run |
| of-bool-q04 | boolean_expr | Qwen 1.5B | – | – | – | not run (failed session) | not run |
| Host | Subtask | M own | M rewr. | CC own | CC rewr. | B1 own | B1 rewr. |
|---|---|---|---|---|---|---|---|
| Qwen 1.5B | boolean_expr | 100.0 (3/5) | 100.0 | 100.0 | 100.0 | 99.3 | 97.3 |
| Qwen 1.5B | navigate | 100.0 (4/5) | 100.0 | 100.0 | 100.0 | 95.1 | 76.2 |
| Qwen 1.5B | product, absent | 100.0 | – | 100.0 | – | 1.3 | – |
| Qwen 1.5B | tracking 3 | 99.1 | 95.7 | 100.0 | 100.0 | 100.0 | 48.4 |
| Qwen 1.5B | tracking 5 | 99.4 | 93.7 | 100.0 | 100.0 | 86.4 | 35.0 |
| Qwen 1.5B | tracking 7 | 99.2 | 92.7 | 100.0 | 100.0 | 80.9 | 28.5 |
| Host | Factor | Accuracy per subtask |
|---|---|---|
| Qwen 1.5B | shuffled assignment = no | tracking 5 100.0; tracking 7 100.0; tracking 3 100.0 |
| Qwen 1.5B | shuffled assignment = yes | tracking 5 100.0; tracking 7 100.0; tracking 3 100.0 |
| Qwen 1.5B | shuffled sentences = no | web_of_lies 100.0 |
| Qwen 1.5B | shuffled sentences = yes | web_of_lies 100.0 |
| Qwen 1.5B | header = Answer choices: | tracking 5 100.0; tracking 7 100.0; tracking 3 100.0 |
| Qwen 1.5B | header = Options: | tracking 5 100.0; tracking 7 100.0; tracking 3 100.0 |
| Task (host) | Development | Manual | Official |
|---|---|---|---|
| addition (Qwen 1.5B) | 3.0 (2/4) | v2 | 2.0 (5/5) |
| addition (Qwen 0.5B) | 3.0 (1/1) | v1 | 3.0 (5/5) |
| product (Qwen 1.5B) | 4.5 (2/2) | v3 | 3.0 (5/5) |
| product (Gemma 1B) | 3.0 (1/1) | v3.2 | 2.0 (5/5) |
| tracking (Qwen 1.5B) | 6.0 (5/5) | v3.3 | 7.0 (3/5) |
| tracking (Gemma 1B) | 10.5 (4/4) | v3.3 | 11.5 (2/5) |
| GPU | Exam parts | Check against the L4 (development implants) |
|---|---|---|
| L4 (Google Cloud) | all | reference |
| L4 (RunPod Secure Cloud) | all | public BBH: 500 of 500 items with identical log-likelihoods; panel: 4 of 4 generations identical |
| H100 (RunPod Secure Cloud) | own test and product of the LoRA baseline (B1, all 10 cells) | Qwen implants, before use: 0 of 300 own-test and 0 of 400 product predictions differ; never checked with Gemma, whose 5 B1 cells also ran there |
| H200 (RunPod Secure Cloud) | own test and product; public BBH and KL; parts of the base model and the format control; format check of the Qwen composite; part of three panels on five H200 machines, each instance against an H200 format control | Qwen implants, before use: 0 of 300 own-test, 0 of 400 product and 0 of 240 public BBH predictions differ, and KL against the format control is identical (zero on both GPUs for the three implants tested). Panel instances: never compared with the L4; each was compared only with base-model trajectories computed on the same H200, with the tolerance calibrated there (E2-X23); H200s give identical base-model records on Qwen inputs. Gemma implants, after its parts had run: 0 of 300, 0 of 400 and 0 of 480; KL against the format control differs by at most per position, and top-token changes differ in 1 of 204,600 positions per implant (decision limits: mean KL 0.01 and 1 top-token change per 10,000 tokens) |
Language Model Editing
Language model editing changes a model’s knowledge or behavior, or revises its outputs, while aiming to preserve unrelated capabilities.
See all 98 papers