riften

ResearchCodeData

Direct Weight Authoring with Scored Feedback in Tiny Transformers

Language models can write every weight of a tiny transformer from a task description, without gradient training. When first attempts failed, revising against a practice score solved all 30 held-out trajectories. Retrying from scratch solved none.

Riften Team

Illustration: a slab of pale translucent stone with a small landscape of terraced jade pools and waterfalls in its layers.

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

The program writes 32.0 into one query weight per position, so position i attends to key (i + 3) mod 8. The resulting network is exact on 4,000 test inputs. Redrawn from the first figure of the paper.

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.

Illustration: an offcut of the same pale stone, holding two terraced pools.

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
Held-out family, 10 tasks that failed one-shot, 3 seeds each, at most 11 submissions
ConditionTrajectories solved
Scored feedback30 of 30 (10 of 10 tasks)
Self-revision, no score4 of 30 (2 of 10 tasks)
Independent retries0 of 30 (0 of 10 tasks, 0 of 330 attempts)
Score only30 of 30
Examples only30 of 30
Plain Python30 of 30 (27 of 30 without revision)
Scored feedback solved all 30 trajectories, and so did each restricted form of feedback. Self-revision without a score solved 4. Independent retries solved none. Redrawn from the feedback figure of the paper.

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.

  1. 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])
  2. 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.”

  3. 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.”

  4. 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.”

  5. 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 / eps

    Test: 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
Task lompar, scored feedback, first seed: practice exact match per submission
SubmissionPractice inputs exactPractice accuracy
Submission 10 of 2560.0
Submission 2167 of 2560.65234375
Submission 3176 of 2560.6875
Submission 4185 of 2560.72265625
Submission 5256 of 2561.0
Final test4,000 of 4,0001.0
Practice scores and the editor’s notes are quoted from the run log. Attention maps are computed by rebuilding the logged first and final programs and running them on one test input; they are not part of the log. The final program spreads attention almost evenly by design and reads the digits from small differences in the weights. Code and data are linked at the top of the page.

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
Attempts (editors) or seeds (fair Adam) out of 3 that reach 0.99, at 16×1
TaskEditor AEditor BFair Adam
copy333
sort333
parity333
histogram333
mode333
max333
distinct333
glorp333
quell333
frim333
reverse323
mod-7330
prefix-mod-10220
add2003
Dyck-1003
add3003
mul003
compare3003
Dyck-2003
longest run002
brask000
Solved at least once13 of 2113 of 2118 of 21
Editor A and Editor B solve the same 13 tasks, so they share one row. Each editor gets 3 attempts with no feedback, and fair Adam gets 3 seeds. Hover or focus a column for its task, or open the data table. Redrawn from the per-task figure of the paper.

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/}}
}