Weight-space programming
Can forward passes alone turn a small model into a router?
An AI agent spends much of its day on small, repeated decisions. It sorts a ticket. It picks a tool. It routes a request. A large model makes these decisions well and slowly. A small model is fast and cheap. It usually gets them wrong.
We asked whether a small model can be shaped for one such job without training. There are no gradients and no optimiser. There are only forward passes and a least-squares solve. We call the result a minion.
The model is Qwen3.5-0.8B. The task comes from MASSIVE. Each request to a voice assistant belongs to one of 18 scenarios, such as alarm, music or weather. We scored 600 test requests.
The short answer is yes. With 20 examples a scenario, the minion routes 83.2% of the requests correctly. The unedited model routes 8.7%.
of 600 requests routed
The minion routes most requests
The unedited model routes 8.7%. With one example a scenario in its prompt, it routes 55.5%.
Read how we measured itof ordinary text unchanged
A gate keeps the rest of the model
Without the gate, the edit routes as well and breaks everything else. It gets 0 of 30 capitals right.
Read how we measured itwith random neurons
The fitted neurons are what matter
Random neurons of the same size route 5.5% and get 7 of 30 capitals right.
Read how we measured itof forward passes
Shaping takes seconds on one small GPU
1,430 forward passes and a search over 63 candidate edits. The patch is 108 KB.
Read how we measured itThe method
Each label becomes one neuron in the last layer
Every layer of the model ends with an MLP. Its neurons read the residual stream, and each writes one direction back into it. A new neuron can be added by appending one row to two input matrices and one column to the output matrix.
We add one neuron per label to the last MLP. The neuron is meant to fire only where the model is about to answer which label a request belongs to. When it fires, it writes toward the label’s first token.
Every part of the neuron comes from a least-squares solve. Shaping takes four steps.
1. Read
One forward pass per example. We keep the last MLP's input at the position where the answer goes.
2. Gate
Least squares finds a direction that is +1 at that position and -1 on every other position and on ordinary text.
3. Keys
Least squares maps the same input to the right label. One key per label.
4. Write
Each label becomes one new neuron. Its gate row is the gate, its up row is the key, and its down column writes the label's first token.
Three numbers remain to choose: the ridge penalty, the sharpness of the gate and the strength of the output. We tried 63 combinations on a separate set of 360 requests and kept the best one. Every combination had to leave at least 99% of next-token guesses unchanged on ordinary text.
The neurons sit in the last layer, and the label is read at the last position. So each candidate’s answer follows exactly from numbers already collected. The search needs no further forward passes.
The result
Twenty examples a scenario take the model from 8.7% to 83.2%
We gave the model the 18 scenario names in its prompt, then the request. The unedited model routes 8.7% of the requests correctly.
One labelled example per scenario in the prompt helps a great deal. It raises the score to 55.5%. The prompt then carries 18 extra requests and their answers.
The minion keeps the short prompt and routes 83.2%. Five examples a scenario already give 74%. Fifty give 84.7%.
27 of 30 capitals right, 99.4% of ordinary text unchanged
27 of 30 capitals right, 99.51% of ordinary text unchanged
26 of 30 capitals right, 99.25% of ordinary text unchanged
27 of 30 capitals right, 99.48% of ordinary text unchanged
The gate
Without a gate, the edit routes well and breaks everything else
Our first edit had no gate. It was a plain low-rank change to the last MLP’s output matrix, with the same keys and the same label directions.
It routed 76.5% of the test requests. It also fired at every position of every text. The model got 0 of 30 capitals right, and 0.16% of next-token guesses on ordinary text stayed the same.
We then fitted the same edit to stay at zero on 7,920 positions of ordinary text. No strength gave both jobs. A weak edit kept 89% of the text and routed 57%. A strong one routed 81% and kept almost none of it.
The gate fixes this. Its average value is 0.994 where a routing answer goes and -0.001 on ordinary text. It never rises above 0.5 on ordinary text.
With the gate, the minion gets 26 of 30 capitals right. The unedited model gets 27. Of 16,906 next-token guesses on Wikipedia text that the search never saw, 99.25% stay the same.
The control
Random neurons of the same size do not route
A gain can come from the size of an edit rather than its content. So we added 18 random neurons, each row and column scaled to the size of the fitted ones.
They route 5.5% of the requests, less than the unedited model. They also do harm. The model then gets 7 of 30 capitals right, and 80.14% of next-token guesses on ordinary text stay the same.
The fitted neurons route because of what they read and what they write.
The cost
Shaping a minion takes seconds on one small GPU
All of the work is forward passes and matrix solves. There is no backward pass, and there is no optimiser state. The memory needed is what the model needs to run.
On one NVIDIA L4, all 1,430 forward passes took 9.2 seconds. They read the fitted examples twice, the held-aside requests and the ordinary text. The search over 63 candidate edits took 4 seconds.
The minion is the base model and a patch of 108 KB. Many minions can therefore share one copy of the base model, with each patch applied when its request arrives.
What it means
An agent can shape its own minions
The method needs only examples and a few seconds. An agent already has both. It can collect the decisions it makes again and again, shape a minion from them, and hand the job over.
We built the shaper as a program an agent can call. It takes labels and examples, and it returns a scorecard and the patch. The scorecard always includes the unedited model and random neurons, scored on examples the fit never saw. So an agent cannot fool itself about how good its minion is.
Two limits matter. The minion’s probabilities are not calibrated. They sit near 1, even when it is wrong. An agent cannot yet use them to decide when to answer a request itself. We also tested routing only. A label is a choice the model can already express. We did not test skills the model lacks.
Try it yourself
Can your labels become a minion?
- Two tasks recorded and free to look at, a support inbox and home-assistant requests
- Your own labels and examples, five or more a label
- A scorecard against the unedited model and random neurons, and the patch to download
Three runs free, then 5 cents a run.
Shape a minion- Qwen3.5-0.8B is revision 2fc06364 on Hugging Face, in bf16. The neurons are added to layer 23, the last of its 24 layers.
- MASSIVE is the English part of Amazon’s MASSIVE dataset (CC BY 4.0), in its scenario form. The 600 test requests are a fixed random sample of the test split. The fitted examples come from the train split and the 360 held-aside requests from the validation split.
- The prompt lists the scenario names, then gives the request and asks for the scenario. Routing is scored by greedy generation: the answer is right if it starts with the scenario’s name. The 18 names start with 18 different tokens.
- The gate is fitted on 7,920 positions that are not answers. These are other positions of the same prompts, the answer’s own tokens, and 300 Wikipedia paragraphs from WikiText-2. The text check uses 100 other paragraphs from WikiText-2. The 30 capitals are asked as “The capital of France is”.
- The few-shot prompt has one example per scenario, drawn from the fitted examples. Its score is the share of requests whose most likely first token, among the 18, is the right one. Scored that way, the unedited model with no examples routes 7.7%. Each count in this post is from one run with seed 0.
More head-to-head evals
| Measure | GLM-5.3 | DeepSeek V4.1 Flash |
|---|---|---|
| Right, of 75 | 75 | 71 |
| Seconds a question, median | 3.9 | 1.8 |
| Measure | First run | Best since |
|---|---|---|
| Landscape, seconds | 937 | 233 |
| Memo, seconds | 759 | 602 |
| Measure | Qwen3 235B | GLM-5.2 | Gemini 3.8 Flash | Claude Opus 5 |
|---|---|---|---|---|
| Seconds to the plan, median | 27 | 48 | 57 | 94 |
| Plans written, of three runs | 2 | 3 | 3 | 3 |
| Measure | SubQ | jev | Decider | Nimble |
|---|---|---|---|---|
| Found, mean of five columns at section length | 64% | 65% | 66% | 68% |
| Mechanism of action, found at section length | 57% | 51% | 61% | 54% |
| Measure | ask | Apollo | treg |
|---|---|---|---|
| Usable leads | 13 of 40 | 7 of 40 | 6 of 28 |
| Cost per usable lead | $0.037 | $0.27 | $0.23 |
| Measure | ask with jev | ask with Decider |
|---|---|---|
| Questions right, of 92 | 89 | 89 |
| Wrong answers | 1 | 2 |
| Measure | jev | ask |
|---|---|---|
| Our 370 clinical decisions, right | 94.6% | 93.0% |
| PubMedQA, right (best EdgeEvals scored: 62.2%) | 77.0% | 74.4% |
| Measure | ask | Claude Opus 5.5 |
|---|---|---|
| Questions right, of 95 | 59 | 63 |
| Small companies right, of 20 | 13 | 9 |
| Measure | realestate-us | Best of four assistants |
|---|---|---|
| Floor-plan rents right, of 26 | 26 | 23 |
| Amenities claimed the listing doesn't state | 12 | 129 |
| Measure | ask | jev |
|---|---|---|
| Right, of the questions answered | 98% | 79% |
| Wrong answers, of 92 | 2 | 19 |
| Measure | Trained localiser | Best of four frontier models |
|---|---|---|
| Mean overlap with the defect (IoU, 0 to 1) | 0.421 | 0.109 |