Neural networks usually get their weights from gradient training. We tested whether a language model can write them directly. In our setup, a model we call the editor reads a description of a task and writes every weight of a small transformer. The network is then evaluated on 4,000 test inputs. There is no task-specific gradient training.
We measured this ability under preregistered controls on short algorithmic tasks, including sorting, parity and invented rules. This post summarizes the results.
Writing weights from a task description
The figure below shows one example. The task is an invented rule. Each output digit depends on the input at the same position and on the input three positions ahead. The editor wrote a program for this task with no feedback. The program writes one large value into the query weights for each position, which makes that position attend to the key three places ahead. The network built from those weights is exact on 4,000 test inputs.
An editor’s program and the attention pattern it produces
Task
yi = (xi + 3·x(i+3) mod 8) mod 10
Excerpt from the editor’s program
for i in range(N):
W["Wq0"][1 + i, (i + 3) % N] = 32.0
W["Wk0"][1 + i, i] = 32.0
Attention, head 0
At standard network size, editors solve 187 of 189 program-mode runs across 21 short algorithmic tasks. That total includes 36 of 36 attempts on invented rules. In literal mode, editors solve 42 of 42 runs.

Recovering from a failed first attempt
One-shot authoring does not always succeed. In a preregistered held-out family of 23 tasks, 10 failed on the first attempt. We used those 10 tasks to compare ways of trying again, each limited to 11 submissions.
With scored feedback, the editor submits its weights and the network is run on 256 practice inputs. The editor sees the result and can revise up to 10 times, stopping early if practice accuracy reaches 1.0. Self-revision follows the same procedure, except that the editor never sees a score. Independent retries are 11 fresh one-shot attempts per seed.
With scored feedback, editors solved all 10 tasks and all 30 trajectories. Independent retries solved none of the 10 tasks, and none of the 330 individual attempts succeeded. Self-revision without a score solved 2 of 10 tasks and 4 of 30 trajectories.
The second figure below follows one of those trajectories, submission by submission.
Trajectories solved after a failed first attempt
10 held-out tasks, 3 seeds each, at most 11 submissions per trajectory. Each dot is one trajectory.
- Scored feedback30 of 30
- Self-revision, no score4 of 30
- Independent retries0 of 330 attempts0 of 30
Restricted feedback
- Score only30 of 30
- Examples only30 of 30
- Plain Python27 without revision30 of 30
Data table
| Condition | Trajectories solved |
|---|---|
| Scored feedback | 30 of 30 (10 of 10 tasks) |
| Self-revision, no score | 4 of 30 (2 of 10 tasks) |
| Independent retries | 0 of 30 (0 of 10 tasks, 0 of 330 attempts) |
| Score only | 30 of 30 |
| Examples only | 30 of 30 |
| Plain Python | 30 of 30 (27 of 30 without revision) |
One failed task, revised against its practice score until it was exact
Task lompar from the held-out family: yi = x(5i + x7) mod 8. Scored feedback, first seed. Each submission is scored on 256 practice inputs.
Submission 1Practice: 0 of 256 inputs exact
“This is a partial construction, not a full exact solution. One head packs 100x7 + x(5i+3) mod 8; three heads retrieve other candidates, and the MLP multiplexes them. It handles x7 ∈ {0,1,2,3,4,8,9}, giving approximately 70% exact-match accuracy on uniform inputs.”
Excerpt from the first program
# Four scalar-valued attention heads. for head in range(4): base = 4 * head for j in range(8): W["Wk0"][1 + j, base] = math.cos(angles[j]) W["Wk0"][1 + j, base + 1] = math.sin(angles[j])Submission 2Practice: 167 of 256 inputs exact
“The failure pattern is consistent with two 8-dimensional heads, rather than four 4-dimensional heads. This revision uses that layout. One head packs the controller and a candidate; the other packs two candidates bitwise. The analytic decoder handles six controller values, targeting approximately 60% exact match.”
Submission 3Practice: 176 of 256 inputs exact
“This construction packs four candidates into the two heads. A reordered digit encoding lets the 32-unit MLP decode seven selector values: 0,1,2,3,4,8,9, targeting 70% exact-match accuracy.”
Submission 4Practice: 185 of 256 inputs exact
“The failures shown are the three unsupported selectors, 5,6,7. This revision keeps the 70% exact-coverage construction while reducing numerical packing magnitudes. It remains a partial solution.”
Submission 5Practice: 256 of 256 inputs exact
“This redesign covers all selectors. Near-uniform attention broadcasts all eight digit codes, with a second head supplying their mean. The 32 ReLUs then implement eight interval-gated selections. Softmax approximation errors stay well below the decoding margin.”
Excerpt from the final program
# Two 8-dimensional heads, matching the preceding working passes. ... for i in range(8): W["Wq0"][i, 0] = 1.0 W["Wv0"][i, i] = 1.0 W["Wk0"][8, 0] = math.sqrt(8.0) * eps / embedding_scale for j in range(8): W["Wo0"][j, 8 + j] = 8.0 / epsTest: exact on 4,000 of 4,000 inputs (accuracy 1.0).
Before: submission 1
Head 0
Head 1
After: submission 5
Head 0
Head 1
Data table
| Submission | Practice inputs exact | Practice accuracy |
|---|---|---|
| Submission 1 | 0 of 256 | 0.0 |
| Submission 2 | 167 of 256 | 0.65234375 |
| Submission 3 | 176 of 256 | 0.6875 |
| Submission 4 | 185 of 256 | 0.72265625 |
| Submission 5 | 256 of 256 | 1.0 |
| Final test | 4,000 of 4,000 | 1.0 |
Restricted forms of feedback
We ran restricted versions of the feedback on the same 10 tasks. Feedback that contained only the score solved 30 of 30 trajectories. Feedback that contained only examples also solved 30 of 30. A plain-Python variant reached 30 of 30, with 27 of 30 solved without revision.
On these tasks and budgets, scored evaluation feedback improves recovery. The restricted-feedback arms match the full package’s observed solve count, and no weight-space-specific advantage is established.
All 90 winning weight programs on this family pass a local static, determinism, and fresh-seed audit.
Comparison with gradient training
We compared editors, working without feedback, against a gradient-trained baseline that the paper calls fair Adam. Editors solve fewer tasks as the network shrinks. At the smallest size, 16×1, each editor solves 13 of 21 tasks in at least one of 3 attempts. Fair Adam solves 18 of 21 in at least one of 3 seeds, and 17 of 21 in all 3.
The two methods solve different sets of tasks. Both solve 11 of them. Fair Adam alone solves 7. The editors alone solve 2, mod-7 and prefix-mod-10. One task, brask, is solved by neither.
Fair Adam solves more tasks at 16×1, but the editors solve two that it does not
21 tasks at the smallest network size. Each block is one task, filled if it was solved at least once.
Fair AdamGradient training
18 of 21
EditorsEditor A and Editor B each
13 of 21
mod-7 and prefix-mod-10Solved only by the editors
Data table
| Task | Editor A | Editor B | Fair Adam |
|---|---|---|---|
| copy | 3 | 3 | 3 |
| sort | 3 | 3 | 3 |
| parity | 3 | 3 | 3 |
| histogram | 3 | 3 | 3 |
| mode | 3 | 3 | 3 |
| max | 3 | 3 | 3 |
| distinct | 3 | 3 | 3 |
| glorp | 3 | 3 | 3 |
| quell | 3 | 3 | 3 |
| frim | 3 | 3 | 3 |
| reverse | 3 | 2 | 3 |
| mod-7 | 3 | 3 | 0 |
| prefix-mod-10 | 2 | 2 | 0 |
| add2 | 0 | 0 | 3 |
| Dyck-1 | 0 | 0 | 3 |
| add3 | 0 | 0 | 3 |
| mul | 0 | 0 | 3 |
| compare3 | 0 | 0 | 3 |
| Dyck-2 | 0 | 0 | 3 |
| longest run | 0 | 0 | 2 |
| brask | 0 | 0 | 0 |
| Solved at least once | 13 of 21 | 13 of 21 | 18 of 21 |
Reading weights
We also tested the reverse direction. A reader model is shown the full weight text of a network and picks its task from a menu of 21. Readers named the task correctly for 68 of 90 networks. When the weight text was obfuscated, they were correct for 64 of 90. Chance is 1 in 21. This is task recognition, not circuit understanding.
Limitations
These results cover tiny transformers, short algorithmic tasks and a budget of at most 11 submissions. Feedback helped on the tasks where one-shot authoring failed. The restricted forms of feedback did as well as the full package, so we cannot attribute the gain to anything specific to weights. Without feedback, editors solve fewer tasks than gradient training at the smallest network size. The reading experiment measures only whether a task can be identified from weight text.
Cite
@misc{riften2026directweight,
title={Direct Weight Authoring with Scored Feedback in Tiny Transformers},
author={{Riften Team}},
year={2026},
howpublished={\url{https://riften.ai/research/direct-weight-authoring/}}
}
