Weight-Space Programming Writes In-Context Learning and Matches Fine-Tuning in Language Models
Organizations: Department of Computer Science and Engineering, University of Ioannina
Abstract
Weight-space programming is a frontier language model's recently reported ability to read another network's weights and edit them without gradient descent. We investigate how examples can provide a weight update so that a weaker language model performs the task with nothing in the prompt, and study what the updates are. Our experiments cover six tasks, four frontier editors and three families of weaker language models, without the editors being told anything about in-context learning (ICL). In most runs, the editors measure the ICL task vector, the shift the examples cause in the residual stream at the final prompt token, and write it into the weights, at its sparsest into near-silent MLP units keyed to the prompt format. Results reach the accuracy of ICL and fine-tuning on the same examples, LoRA included, usually leaving perplexity untouched, with worse performance under changes of wording. We also qualify the comparison by counting unfinished runs, observing that one editor falls below fine-tuning; held only to the seen examples, without task pairs of their own, only the strongest editor has similar performance. Given a task and unlabelled inputs, that editor writes its own examples and does nearly as well on unseen items as with labels.
Figures & tables
| Method | Antonym | Capital | Past | En Fr | Mean | ||
|---|---|---|---|---|---|---|---|
| Zero-shot, unedited | 0.0 0.0 | 1.9 0.5 | 0.0 0.0 | 0.0 0.0 | 0.0 0.0 | 0.0 0.0 | 0.3 0.8 |
| 16-shot ICL, unedited | 93.6 1.4 | 97.0 0.8 | 93.8 2.2 | 86.8 0.4 | 80.6 3.5 | 83.9 3.2 | 89.3 6.4 |
| LLM editors | |||||||
| Fable 5.1 edit | 84.2 4.7 3 | 87.7 5.3 3 | 91.4 1.7 3 | 82.2 5.9 3 | 99.5 0.4 3 | 80.6 | 88.5 7.3 |
| Opus 5.5 edit | 90.5 3.7 3 | 92.4 4.3 3 | 90.7 0.6 2 | 84.2 0.9 3 | 96.2 0.5 2 | 91.0 | 90.4 4.5 |
| Gemini 4 edit (80 turns) | 92.1 | – | – | – | – | – | 92.1 |
| Method | Runs | Entries changed | % of model | Acc. |
|---|---|---|---|---|
| LLM editors | ||||
| Fable 5.1 edit | 16 | 8,512 | 0.002 | 88.5 |
| Opus 5.5 edit | 14 | 4,358,075 | 0.882 | 90.4 |
| Gemini 4 edit (150 turns) | 16 | 374,080 | 0.076 | 93.0 |
| GPT-6 Astra edit | 18 | 545,664 | 0.110 | 92.6 |
| GPT-6 Astra, wording-agnostic | 18 | 8,715,983 | 1.764 | 83.8 |
| Condition | Antonym | Capital | Past | En Fr | Mean | ||
|---|---|---|---|---|---|---|---|
| Unedited, zero-shot | 0.0 | 2.6 | 0.0 | 0.0 | 0.0 | 0.0 | 0.4 |
| 16-shot ICL, unedited | 94.2 | 96.5 | 93.8 | 86.6 | 80.0 | 80.6 | 88.6 |
| 16 labelled examples, test items unseen (5 runs) | |||||||
| test items | 90.5 | 96.5 | 96.0 | 85.3 | 99.3 | – | 93.5 |
| held-out items | 96.7 | 96.7 | 93.3 | 83.3 | 100.0 | – | 94.0 |
| No labels, task stated, test inputs shown (6 runs) | |||||||
| Editor | Runs | Finished | Acc. | Acc., all | Agree | Cos. sim. | Weights | Turns | Coded strategies (task vector / format rewrite / other; gated) |
|---|---|---|---|---|---|---|---|---|---|
| Fable 5.1 | 18 | 16 | 88.5 7.3 | 89.7 | 83.2 6.6 | 0.70 0.25 | 8,512 | 51 | 12 / 5 / 1; gated 17/18 |
| Opus 5.5 | 18 | 14 | 90.4 4.5 | 80.5 | 84.8 7.0 | 0.67 0.25 | 4,358,075 | 69 | 10 / 5 / 3; gated 16/18 |
| Gemini 4 (80 turns) | 6 | 1 | 92.1 | 32.5 | 88.4 | 0.89 | 34,944 | 78 | 5 / 0 / 1; gated 4/6 |
| Gemini 4 (150 turns) | 18 | 16 | 93.0 6.4 | 87.6 | 86.9 6.6 | 0.71 0.23 | 374,080 | 98 | 13 / 5 / 0; gated 16/18 |
| GPT-6 Astra | 18 | 18 | 92.6 6.1 | 92.6 | 84.7 5.4 | 0.51 0.27 | 545,664 | 16 | 9 / 8 / 1; gated 10/18 |
| Model | Condition | antonym | camelCase | Roman | SST-2 | length | last letter | Pig Latin |
|---|---|---|---|---|---|---|---|---|
| Qwen2.5-7B | zero-shot, unedited | 11.6 | 0.0 | 61.7 | 0.0 | 0.0 | 0.0 | 0.0 |
| 16-shot ICL, unedited | 99.8 | 99.8 | 98.9 | 96.0 | 85.7 | 68.5 | 43.7 | |
| weight-space program | 94.2 | 90.9 (turn cap) | 100.0 | 93.1 | 100.0 | 99.3 | 51.4 | |
| LoRA on the 16 pairs | 94.2 | 100.0 | 98.7 | 89.7 | 52.8 | 77.5 | 25.4 | |
| rank-1 update on the 16 pairs | 95.3 | 100.0 | 86.4 | 93.1 | 85.2 | 84.5 | 29.6 | |
| agreement / cos. sim. | 89 / 0.85 | 91 / 0.66 | 99 / 0.85 | 93 / 0.38 | 83 / 0.07 | 68 / 0.17 | 37 / 0.95 |
Appendix figures & tables17 assets
Supplementary material from the paper’s appendix.
Appendix
| Task | Items | Test | Decode | Example pairs (first three of the seed-0 examples) |
|---|---|---|---|---|
| Antonym | 236 | 190 | 6 | birth death; rare common; death life |
| Country capital | 160 | 114 | 8 | Uruguay Montevideo; Brazil Brasilia; Belarus Minsk |
| Present past | 170 | 124 | 6 | dance danced; feel felt; smile smiled |
| English French | 175 | 129 | 7 | cold froid; school école; head tête |
| 189 | 143 | 6 | 177 354; 62 124; 104 208 | |
| 190 | 144 | 6 | 177 184; 61 68; 105 112 |
| Editor and condition | Edited model | Runs | Finished | Turns | Passes | Min/run | Input tok/run | Output tok/run | USD/run |
|---|---|---|---|---|---|---|---|---|---|
| Fable 5.1, 80 turns | Qwen2.5-0.5B | 18 | 16 | 51 | 42 | 25 | 3.7M | 87K | 6.94 |
| Fable 5.1, 80 turns | Qwen2.5-1.5B | 3 | 3 | 45 | 47 | 19 | 2.4M | 65K | 5.00 |
| Fable 5.1, 80 turns | Qwen2.5-7B | 3 | 3 | 48 | 47 | 19 | 2.6M | 71K | 5.36 |
| Fable 5.1, 80 turns, the 16 pairs only | Qwen2.5-0.5B | 6 | 6 | 46 | 42 | 40 | 3.6M | 84K | 6.79 |
| Opus 5.5, 80 turns | Qwen2.5-0.5B | 18 | 14 | 69 | 41 | 34 | 7.6M | 155K | 5.83 |
| GPT-6 Astra, 80 turns | Qwen2.5-0.5B | 18 | 18 | 16 | 38 | 9 | 0.2M | 15K | 1.15 |
| Method | Agree | KL | cos. sim. | cos. sim. | Q/A | word/ans. | ICL other | PPL / ARC |
|---|---|---|---|---|---|---|---|---|
| ICL itself, unedited | 100 | 0 | – | – | 89.1 9.3 | 87.9 11.5 | 0 | 17.34 0.00 / 66.5 0.0 |
| Fable 5.1 edit 16 | 83.2 6.6 | 0.34 0.20 | 0.70 0.25 | 0.04 0.09 | 13.4 25.9 | 21.2 30.4 | 6.3 11.1 | 17.38 0.06 / 66.7 1.2 |
| Opus 5.5 edit 14 | 84.8 7.0 | 0.26 0.16 | 0.67 0.25 | 0.11 0.13 | 31.1 35.4 | 34.0 36.6 | 5.8 6.2 | 17.36 0.03 / 66.8 1.2 |
| Gemini 4 edit (80 turns) 1 | 88.4 | 0.26 | 0.89 | 0.15 | 1.1 | 20.0 | -0.7 | 17.34 / 67.0 |
| Gemini 4 edit (150 turns) 16 | 86.9 6.6 | 0.23 0.16 | 0.71 0.23 | 0.12 0.10 | 16.0 22.7 | 22.9 32.6 | 12.9 10.1 | 17.83 1.19 / 66.7 2.4 |
| GPT-6 Astra, wording-agnostic 18 | 77.2 13.2 | 0.48 0.42 | 0.60 0.34 | 0.08 0.12 | 84.7 12.8 | 84.3 15.4 | 6.2 7.4 | 19.93 4.43 / 64.9 4.6 |
| Model | Antonym | Capital | En Fr | Cos. sim. | Q/A |
|---|---|---|---|---|---|
| Qwen2.5-0.5B | 84.2 4.7 / 93.6 1.4 | 87.7 5.3 / 97.0 0.8 | 82.2 5.9 / 86.8 0.4 | 0.70 0.25 | 13.4 25.9 |
| Qwen2.5-1.5B | 93.7 / 98.4 | 94.7 / 100.0 | 79.8 / 96.4 | 0.83 0.06 | 58.6 33.1 |
| Qwen2.5-7B | 94.2 / 99.8 | 98.2 / 100.0 | 99.2 / 99.2 | 0.76 0.16 | 1.9 2.9 |
| Trained on the 16 pairs | Trained on the 16 pairs and the editors’ own | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Editor | Splits | 16-shot ICL | Adam | LoRA | Context dist. | Rank-1 | Adam | Rank-1 | LoRA |
| Fable 5.1 | 16 | [ , ] | [ , ] | [ , ] | [ , ] | [ , ] | [ , ] ∗ | [ , ] | [ , ] ∗ |
| Opus 5.5 | 14 | [ , ] | [ , ] | [ , ] | [ , ] | [ , ] | [ , ] | [ , ] | [ , ] |
| Gemini 4 Argon | 16 | [ , ] | [ , ] ∗ | [ , ] ∗ | [ , ] ∗ | [ , ] ∗ | [ , ] | [ , ] ∗ | [ , ] |
| GPT-6 Astra | 18 | [ , ] | [ , ] | [ , ] ∗ | [ , ] ∗ | [ , ] ∗ | [ , ] | [ , ] | [ , ] |
| Mean of the editors | 18 | [ , ] | [ , ] | [ , ] ∗ | [ , ] ∗ | [ , ] ∗ | [ , ] | [ , ] | [ , ] |
| Accuracy is carried by | Accuracy of | ||||||
| Editor | Runs | whole | part | rest | neither | update | part |
| Key–value units | |||||||
| Fable 5.1 | 14 | 13 | 0 | 0 | 1 | 88.3 | 81.9 |
| Opus 5.5 | 5 | 3 | 0 | 0 | 2 | 91.1 | 56.5 |
| Gemini 4 Argon | 12 | 4 | 3 | 5 | 0 | 91.9 | 52.7 |
| Value-only updates | |||||||
| Condition | Input/Output | Q/A | arrow | word/answer | Mean |
|---|---|---|---|---|---|
| 16-shot ICL, unedited | 89.3 6.4 | 88.6 8.9 | 86.0 14.4 | 87.7 10.8 | 87.9 9.6 |
| GPT-6 Astra, told one wording (18 runs) | 92.6 6.1 | 12.8 27.5 | 4.7 10.0 | 19.0 31.6 | 32.3 16.7 |
| GPT-6 Astra, told four (18 runs) | 83.8 16.0 | 84.7 12.8 | 59.0 32.4 | 84.3 15.4 | 77.9 18.3 |
| Parameters modified (median) | 545,664 (one) | 8,715,983 (four) | |||
| Perplexity after the update | 17.52 0.31 | 19.93 4.43 | |||
| Task | Base, examples | Edit 0 + examples | Hybrid edit | ICL-16 | PPL / ARC | |
|---|---|---|---|---|---|---|
| Antonym | 2 | 68.9 | 89.8 | 92.1 | 94.2 | 17.8 / 63.5 |
| Antonym | 4 | 85.3 | 91.4 | 91.6 | 94.2 | 17.6 / 68.0 |
| Antonym | 8 | 92.1 | 93.0 | 95.8 | 94.2 | 18.2 / 61.0 |
| Capital | 4 | 98.2 | – | 100.0 | 96.5 | 17.4 / 67.0 |
| Past | 4 | 94.4 | – | 95.2 | 93.8 | 17.7 / 66.0 |
| Model (editor) | Condition | Antonym | Capital | Past | En Fr | Mean | ||
|---|---|---|---|---|---|---|---|---|
| Qwen3.5-0.8B (Astra) | zero-shot, unedited | 5.1 0.3 | 3.2 0.5 | 0.0 0.0 | 0.8 0.0 | 0.0 0.0 | 0.0 0.0 | 1.5 |
| 16-shot ICL, unedited | 92.5 0.1 | 93.8 1.2 | 96.1 1.8 | 93.7 0.4 | 100.0 0.0 | 97.7 2.2 | 95.6 | |
| weight-space program | 86.0 4.0 | 91.5 2.2 | 89.5 2.9 | 81.7 10.8 | 99.1 1.1 | 98.1 3.2 | 91.0 | |
| agreement / cos. sim. | 79 / 0.71 | 90 / 0.65 | 87 / 0.89 | 80 / 0.71 | 99 / 0.43 | 96 / 0.26 | ||
| parameters modified | 3.7M | 2K | 3.7M | 3.7M | 1K | 135K | ||
| Llama-3.2-1B (Gemini) | zero-shot, unedited | 30.5 | 2.6 | 0.0 | 1.6 | 0.0 | 0.0 | 5.8 |
| Examples | 0 | 1 | 2 | 4 | 8 | 16 | 32 |
|---|---|---|---|---|---|---|---|
| In-context examples, unedited model | |||||||
| Antonym | 0.0 | 30.8 | 58.5 | 83.2 | 90.4 | 93.8 | 95.5 |
| Capital | 2.7 | 60.2 | 92.4 | 96.7 | 96.8 | 96.5 | 96.9 |
| Past | 0.0 | 67.9 | 89.4 | 92.2 | 95.5 | 93.9 | 94.1 |
| En Fr | 0.0 | 72.0 | 86.7 | 86.6 | 87.2 | 88.0 | 87.3 |
| 0.0 | 9.4 | 24.0 | 50.3 | 72.4 | 79.8 | 81.0 | |
| Pairs | Test inputs | Labels | Outside | |
|---|---|---|---|---|
| Task | written | covered (%) | correct (%) | all splits |
| Antonym | 219 | 51 (32–80) | 100 | 314 |
| Capital | 93 | 60 (34–95) | 100 | 23 |
| Past | 302 | 97 (94–98) | 100 | 458 |
| En Fr | 127 | 62 (53–73) | 100 | 83 |
| 29 | 12 (0–18) | 100 | 24 |
| Method | Antonym | Capital | Past | En Fr | Mean | ||
|---|---|---|---|---|---|---|---|
| 16-shot ICL, unedited | 94.2 | 96.5 | 93.8 | 86.6 | 80.0 | 80.6 | 88.6 |
| Fine-tuning on the 16 pairs | |||||||
| Adam | 91.6 | 86.8 | 91.9 | 78.3 | 100.0 | 71.5 | 86.7 |
| LoRA | 88.9 | 87.7 | 91.9 | 69.0 | 99.3 | 81.2 | 86.4 |
| Context dist. | 87.9 | 87.7 | 89.5 | 79.8 | 97.9 | 70.1 | 85.5 |
| Rank-1 | 90.0 | 88.6 | 91.9 | 70.5 | 99.3 | 84.7 | 87.5 |
| Condition | Astra s0 | Astra s1 | Astra s2 | Gemini s0 | Mean |
|---|---|---|---|---|---|
| Unedited, bare prompt | 41.0 | 41.0 | 40.0 | 41.0 | 40.8 |
| + “Let’s think step by step.” | 60.0 | 57.0 | 59.0 | 60.0 | 59.0 |
| + 16 worked solutions | 70.0 | 67.5 | 62.0 | 70.0 | 67.4 |
| Updated, bare prompt | 64.0 | 57.0 | 58.5 | 57.0 | 59.1 |
| + “Let’s think step by step.” | 59.0 | 58.0 | 57.0 | 59.5 | 58.4 |
| Outputs that reason | 98.5 | 100.0 | 100.0 | 100.0 | 99.6 |
| Method | Antonym / capital | Past / | En Fr / | Mean | Weaker | PPL |
|---|---|---|---|---|---|---|
| Unedited, the 32 pairs in context | 93.9 / 93.6 | 91.9 / 94.9 | 84.2 / 87.3 | 91.0 | 89.9 | 17.3 |
| Two single-task models, each scored on its own task | ||||||
| Adam | 91.6 / 86.8 | 91.9 / 100.0 | 78.3 / 71.5 | 86.7 | 83.4 | – |
| LoRA | 88.9 / 87.7 | 91.9 / 99.3 | 69.0 / 81.2 | 86.4 | 82.9 | – |
| Rank-1 | 90.0 / 88.6 | 91.9 / 99.3 | 70.5 / 84.7 | 87.5 | 83.7 | – |
| Fable 5.1 | 79.5 / 81.6 | 92.7 / 99.3 | 82.9 / 80.6 | 86.1 | 84.3 | – |
| Editor | Antonym | Capital | Past | En Fr | Mean | Done | Turns | ||
| 16-shot ICL, unedited | 94.2 | 96.5 | 93.8 | 86.6 | 80.0 | 80.6 | 88.6 | ||
| Adam, all weights | 91.6 | 86.8 | 91.9 | 78.3 | 100.0 | 71.5 | 86.7 | ||
| Editors of the main study | |||||||||
| Fable 5.1 | 79.5 | 81.6 | 92.7 | 82.9 | 99.3 | 80.6 | 86.1 | 6/6 | 51 |
| Opus 5.5 | 87.9 | 89.5 | 90.3 | 83.7 | 96.5 | 91.0 | 89.8 | 6/6 | 64 |
| Gemini 4 Argon | 90.5 | 96.5 | 96.0 | 85.3 | 99.3 | 0.0 † | 77.9 | 5/6 | 91 |
| Editor | Model | Task | Seed | Ending | Turns | Acc. left | ICL | PPL after |
|---|---|---|---|---|---|---|---|---|
| Fable 5.1 | Qwen2.5-0.5B | 1 | turn cap | 80 | 99.3 | 84.0 | 873.5 | |
| Fable 5.1 | Qwen2.5-0.5B | 2 | turn cap | 80 | 100.0 | 87.0 | 24.7 | |
| Opus 5.5 | Qwen2.5-0.5B | 1 | turn cap | 80 | 88.2 | 84.0 | 17.3 | |
| Opus 5.5 | Qwen2.5-0.5B | 2 | turn cap | 80 | 0.0 | 87.0 | 17.4 | |
| Opus 5.5 | Qwen2.5-0.5B | Past | 1 | turn cap | 80 | 94.4 | 91.7 | 17.3 |
| Opus 5.5 | Qwen2.5-0.5B | 2 | turn cap | 80 | 0.0 | 77.4 | 17.3 |