Subagents are inefficient. Let the model fork.
When an orchestrator spawns subagents, every one of them rereads the same context. We present a model that reads it only once, then answers every sub task in one batch, with the same accuracy as one call per question, 4.8x fewer tokens read and up to 5.2x faster.
- Author
- Chady Dimachkie
- Published
- Code
- GitHub
- Reading
- 9 min
At rev0 we run a lot of subagents. Splitting a big task into small ones and handing each to its own agent is what lets us scale our work, and it works well. But at that volume you start to see where the tokens go, and a large share of them is the same context being read again and again. That is where this question came from.
Here is how subagents work today: the lead model writes a brief for each one, and each subagent reads its brief plus whatever shared context it needs before it starts working. It works, but it is wasteful in two ways.
First, the lead already understands the task. That understanding lives in its hidden states, and to hand it over it has to write it back out as text, token by token. Second, every subagent then reads the same shared context again. Five subagents over a 4,000 token document means reading 20,000 tokens to answer five questions about one document.
So we asked a simple question: what if the model could just fork? Read the shared context once, then split into the necessary number of output heads that each finish one sub task, in parallel, on top of the same cache. No context rewriting and rereading that waste tokens (Figure 1).
In this article, I’ll share how we built this on a very small model. Concretely, we wanted something that was:
- Read once: the shared context is processed a single time, whatever the number of sub tasks.
- Parallel: sub task answers are decoded in parallel, not one after the other.
- As accurate as subagents: no accuracy given up for the speed.
- Small and reproducible: a 0.6B model, LoRA training, runs on your laptop.
Key findings
- Same accuracy as one call per question. On 150 SQuAD questions, fork heads tie the subagent style baseline at every context length from 500 to 4,000 tokens.
- 4.8x fewer tokens read, 5.2x faster at 4,000 tokens of context, and the gap widens as the context grows.
- Heads must know their task. Our first design, where a head only gets an index for each question, collapsed to 31% exact match: every head answered the same question. Giving each head its question solved it.
Shared context (tokens)
Sub tasks
Tokens read before answering
Subagents read the context 5 times. One stream and fork heads read it once.
Sequential decode steps
One stream writes 5 answers one after the other. Subagents and fork heads write them in parallel.
How fork heads work
The model is Qwen3 0.6B with a rank 16 LoRA adapter on every projection, plus a few new tokens. After reading the prompt, the model emits <|mode_fork|> and a count token such as <|fork_5|>. The model decides by itself how many heads it’ll spawn: nothing outside tells it how many sub tasks the prompt holds. From there, decoding switches to a batch of K heads. Head i starts from its own tag <|h_i|> and writes its answer. Figure 3 shows the whole model.
The important part is what the heads share. The prompt’s KV cache is computed once and kept once. Each head only adds its own few tokens on top. At every decode step, a head attends to two things: the shared prefix, and its own suffix (Figure 4). It never sees another head’s tokens, so heads cannot interfere with each other, and the result is exactly what you would get by running each head alone on a copy of the prompt. To be sure, a test (test_fork_q.py) runs every head alone on its own copy of the prompt, then checks that the forked heads write exactly the same tokens.
On a toy set of prompts that each bundle 2 to 5 short sub tasks (arithmetic, capitals, reversing a word, unit conversions, sorting), this worked out of the box: 99.9% sub answer accuracy, the model picked the right number of heads every time, 2.2x faster than one stream answering in turn and 4.2x faster than a lead plus subagents, all with the same adapter. Encouraging, but toy prompts are 40 tokens long. The whole point of forking is a long shared context, so we needed a better dataset.
Picking a dataset: many questions, one long text
The test needs many questions about one long shared text, and questions a 0.6B model can actually answer:
- QuALITY has many questions per long story, which is the right shape. But it is too hard for a 0.6B model: after training, every mode, forked or not, answered “C” to most questions. That is a capacity problem and most likely requires longer training, not a forking problem.
- SQuAD has the right shape and is within reach of a small model with a short training: many questions per Wikipedia article, answers are short spans of the text, so they can be checked automatically against the accepted answers.
- Shared text
- a Wikipedia article
- Questions per text
- 5 in our test
- Answers
- a short span of the text
… The left side consist mainly of two levels: the highest one contains former flooded terraces and the lowest one the flood plain terrace. The contemporary flooded terrace still has visible valleys and ground depressions with water systems coming from the Vistula old riverbed. …
The Wikipedia article on Warsaw, grown to 500, 1,000, 2,000 or 4,000 tokens.
- When did Warsaw start to rebuild?After liberation
- What type of forested areas can be found on the highest terrace?pine
- What does the currently flooded terrace still have visible?valleys
- What does the highest level of the Vistula plateau contain?former flooded terraces
The right shape and within reach of a small model: the dataset used for every result below.
The setup: 30 validation articles, 5 questions each, with the article context grown around the relevant paragraphs to 500, 1,000, 2,000 and 4,000 tokens. Training used 1,326 prompts built from the SQuAD train split (different articles), for 300 steps, about 50 min on an M4 Pro laptop. We compare four ways of answering the same 5 questions (Figure 6):
- One call per question: what subagents do. Each call rereads the whole context. Batched, so it is not handicapped on speed.
- One stream: read once, answer the 5 questions one after the other.
- Fork, original: read context and questions once, fork 5 heads tagged
<|h_1|>to<|h_5|>. - Fork, question per head: the fix described below.
The first result was bad, and why
The original fork scored 31% exact match at 500 tokens, against 68% for one call per question. Looking at the outputs made the cause obvious: the heads collapse. They all latch onto the same salient answer in the text, whatever their index (Figure 7).
[article + 5 questions] <|mode_fork|><|fork_5|> → head i starts from <|h_i|> alone- head 1: When did Warsaw start to rebuild?✗ 1950s and 1960s (accepted: After liberation)
- head 2: Where can Aeolian sand with a number of dunes be found?✗ peat swamps or small ponds (accepted: plain Vistula terraces)
- head 3: What type of forested areas can be found on the highest terrace?✗ 1950s and 1960s (accepted: pine)
- head 4: What does the currently flooded terrace still have visible?✗ flood plain terrace (accepted: valleys)
- head 5: What does the highest level of the Vistula plateau contain?✓ former flooded terraces (accepted: former flooded terraces)
1 of 5 correct. Several heads answer the same question.
In hindsight this makes sense. A tag like <|h_3|> asks the model to count to the third question in a long prompt and route its attention there, using nothing but a learned pointer. On 40 token toy prompts the questions sit right next to the tags and it works. Behind 4,000 tokens of Wikipedia, a 0.6B model does not learn that pointer in 300 steps, and every head falls back to whatever the text makes most salient.
The solution is simple: put the question in the head itself. Head i now starts from <|h_i|> Task: question i <|ans|>. That costs about 17 tokens per head, which is nothing next to a 4,000 token context, and the context is still read exactly once (Figure 8). On the implementation side, heads have different suffix lengths, so they are left padded with explicit position ids and a causal mask inside each suffix, and we verified token for token that each head decodes exactly as it would alone.
Results
With the question in each head, fork heads match one call per question at every context length, within the confidence interval, while reading the context once (Figure 9).
The model also picks the head count itself on SQuAD. Given the same articles with 2, 3, 4 or 5 questions, it emitted the right <|fork_k|> 480 times out of 480, at every context length. So the scores in this section would be the same whether the count is forced or left to the model.
The cost side is where forking pays off, and the gap grows with the context. One call per question reads the context five times; fork heads read it once, plus their short questions. At 4,000 tokens that is 4.8x fewer tokens read and 5.2x less wall clock per article (Figure 10). One stream reads as little as fork heads, but it writes its answers in turn and gets less accurate as the context grows: 47% at 4,000 tokens against 56% for fork heads, likely because each answer is written after all the previous ones rather than straight from the context.
| Context | Fork, question per head | One call per question (Subagents) | One stream (Agent Conversation) | Speed up |
|---|---|---|---|---|
| 500 | 70.0%, 0.57 s | 68.0%, 1.10 s | 64.7%, 0.96 s | 1.9x |
| 1,000 | 67.3%, 0.80 s | 65.3%, 2.07 s | 62.7%, 1.22 s | 2.6x |
| 2,000 | 62.0%, 1.18 s | 63.3%, 4.32 s | 55.3%, 1.57 s | 3.7x |
| 4,000 | 56.0%, 1.99 s | 56.7%, 10.27 s | 46.7%, 2.64 s | 5.2x |
Exact match and seconds per article; the speed up is fork heads against one call per question. Confidence intervals are about ±8 points, so the first two columns are a tie at every length.
Limitations
This is a first experiment, and a small one:
- One small model. Every result comes from Qwen3 0.6B, on 150 test questions, run on one laptop. Confidence intervals are about ±8 points wide, so a tie means we measured no loss in accuracy, not that the scores are identical.
- Independent questions. The five questions never depend on each other’s answers.
- Short answers. SQuAD answers are a few tokens long.
Future work
What I find exciting is everything that opens up once a model can split itself:
- Heads that work together. A head that waits on another head’s answer, or several heads merging back into one. A first merge step already works on toy prompts.
- Long, uneven work. One head writes a paragraph while another returns a number, each stopping when it is done.
- Bigger models, real agent tasks. The same LoRA recipe on a larger model, on work taken from real agent runs instead of reading comprehension.
- A cached context as a search index. Read a very large corpus once, keep its cache, then answer each new question with a cheap head on top of it. This could replace part of today’s semantic search stack (an encoder, a vector database, then retrieved chunks pasted back into a prompt): the model answers from what it already read instead of from a nearest neighbour lookup. The cache grows with the context, and we have only tested up to 4,000 tokens, so this needs work at scale.
- Networks that change shape. Forking is one way for a model to reshape itself while it runs. In other experiments we go further: changing the network itself, adding new operations, cutting or growing parts of it dynamically. Fork heads are a first step toward models with that kind of plasticity, whose shape fits the task instead of being fixed once at training time.
Conclusion
Forking lets a model read a shared context once and then answer several sub tasks in parallel, on top of one cache, without writing briefs or rereading anything. On SQuAD with a 0.6B model, it matches one call per question on accuracy while reading up to 4.8x fewer tokens and running up to 5.2x faster, and the advantage grows with the length of the context.
The most useful lesson was the failure. A head needs to know its task: an index into the prompt is not enough for a small model, and the fix costs a handful of tokens.
Reproducing
The code and every result file are on GitHub: cpc-studio/rev0-research. Everything runs with uv on one Apple silicon machine. squad_data.py builds the train and test sets, train.py trains the LoRA adapter (TRAIN_GLOB=squad_train.jsonl, 300 steps, batch 4), validate_squad.py --ctx 500,1000,2000,4000 produces every number in this article, headcount_squad.py checks the model’s own head count, and test_fork_q.py checks that forked heads decode exactly as each head run alone.