rev0 research

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
1 Read the context once2 Fork into five heads3 Decode every head in one batchSHARED CONTEXT · SQuAD, Super Bowl 50...ProBowldefensivetackleKawannShortledtheteaminsackswith11...Behindthem,twoofthePanthersthreestartinglinebackerswerealsoselectedtoplayintheProBowl:ThomasDavisandLukeKuechly....ProBowlquarterbackCamNewtonhadoneofhisbestseasons,throwingfor3,837yardsandrushingfor636,whilerecordinga...45totaltouchdowns(35passing,10rushing)...reading... 0 tokensh1How many Panthers defense players made the Pro Bowl?h2How many yards did Newton pass for in 2015?h3What is Newton's record number of touchdowns?h4How many yards did Newton throw for in 2015?h5How many touchdowns did Newton get in 2015?TOKENS READ FOR THESE FIVE ANSWERS (measured, 500 token context)Fork heads0One call per question0
Real outputs from Qwen3 0.6B + LoRA. The article is read once; five heads then decode in one batch, one token per step. Four of five answers are exact; head 5 reports Newton’s rushing yards instead of his touchdowns.

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.
SubagentsThe lead writes each brief out as text; every subagent reads the context again.Leadshared contextbrief 1brief 2brief 3writes, token by tokenSubagent 1context againbrief 1ans 1Subagent 2context againbrief 2ans 2Subagent 3context againbrief 3ans 3Context read 4 times (lead + 3 subagents)3 briefs generated before any work startsFork headsOne read, then the same model splits into heads on the same cache.One modelshared context, cached oncefork 3Head 1shares the cacheq 1ans 1Head 2shares the cacheq 2ans 2Head 3shares the cacheq 3ans 3Context read once, shared by every headNo briefs: each head gets its question (~17 tokens)
Figure 1. Subagents versus fork heads, for three sub tasks over one shared document. Subagents need the lead to write each brief out as text, then each subagent pays for the context again. Fork heads read the context once and branch on the same cache; each head only adds its question and its answer.

Key findings

  1. 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.
  2. 4.8x fewer tokens read, 5.2x faster at 4,000 tokens of context, and the gap widens as the context grows.
  3. 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 (one call per question)20,085One stream4,085Fork heads4,085

Subagents read the context 5 times. One stream and fork heads read it once.

Sequential decode steps

Subagents (one call per question)6One stream30Fork heads6

One stream writes 5 answers one after the other. Subagents and fork heads write them in parallel.

Figure 2. What each strategy costs before and during answering. Subagents pay the context once per sub task; one stream pays it once but writes answers in turn; fork heads pay it once and write in parallel. Questions are about 17 tokens and answers about 6, as in our SQuAD test.

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.

1 · PROMPT, READ ONCElong contextq1 q2 q32 · ONE MODELlayer 1LoRAlayer 2LoRA⋮LoRAlayer 28LoRAQwen3 0.6B, weights frozen+ LoRA rank 16 on every projection+ new tokens: fork count, head tags3 · FORK ON ONE CACHEShared KV cachecomputed once, stored oncefork_3h_1q1a1h_2q2a2h_3q3a3Heads are rows of one batch throughthe same weights: no extra parameters.each head attends to
Figure 3. The whole model. One Qwen3 0.6B with a LoRA adapter reads the prompt once into a KV cache. It then emits a fork token with the number of heads it needs, and each head, tagged and given its question, decodes on top of that cache. The heads share every weight; they are rows of one batch.

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.

shared prefixcontext, read oncehead 1head 2head 3head suffixeshead 1head 2head 3
Figure 4. Attention pattern during fork decoding, three heads with four tokens each. Light cells: every head reads the same shared prefix, stored once. Dark cells: each head reads its own tokens causally. Grey cells are masked: heads never see each other.

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.

  1. When did Warsaw start to rebuild?After liberation
  2. What type of forested areas can be found on the highest terrace?pine
  3. What does the currently flooded terrace still have visible?valleys
  4. 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.

Figure 5. One prompt from each dataset we tried, real records. Pick a dataset to see its shared text, some of its questions and their answers.

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.
context (read)question or task (read)brief or answer (written)A timeline: left to right is time, longer blocks mean more tokensTokens, in our SQuAD test: context 500 to 4,000, question ~17, answer ~6. Not drawn to scale.Subagentscontext read 4 times3 briefs written firstleadcontexttaskbrief 1brief 2brief 3contextbrief 1a1contextbrief 2a2contextbrief 3a3doneOne call per questioncontext read 3 timesno briefs, calls run in parallelcontextq1a1contextq2a2contextq3a3doneOne streamcontext read once,answers one after anothercontextq1q2q3a1a2a3doneFork heads (ours)context read onceanswers written in parallelcontextq1a1q2a2q3a3donestarttime
Figure 6. Four ways to answer three questions about one document, laid out as a timeline; longer blocks mean more tokens. The baselines in this article are one call per question (the subagent cost without the briefs) and one stream (read once, answer in turn). Fork heads keep the single read of one stream and the parallel answers of one call per question.

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
  1. head 1: When did Warsaw start to rebuild?✗ 1950s and 1960s (accepted: After liberation)
  2. head 2: Where can Aeolian sand with a number of dunes be found?✗ peat swamps or small ponds (accepted: plain Vistula terraces)
  3. head 3: What type of forested areas can be found on the highest terrace?✗ 1950s and 1960s (accepted: pine)
  4. head 4: What does the currently flooded terrace still have visible?✗ flood plain terrace (accepted: valleys)
  5. 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.

Figure 7. Real outputs at 500 tokens of context, same model and adapter. In the original design, head i only gets the tag <|h_i|> and must work out which of the five questions in the prompt is its own; most heads answer the same question. Giving each head its question fixes it. SQuAD accepts several answers per question, and the marks use all of them. A right answer worded differently from every accepted one is marked correct here, but the scores in this article count only word for word matches.

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.

READ ONCEarticle, 500 to 4,000 tokensthe 5 questionsfork_5EACH HEAD, ON TOP OF THAT CACHE<|h_1|>Task:When did Warsaw start to rebuild?<|ans|>after liberation<|h_2|>Task:What type of forested areas can be found on the highest terrace?<|ans|>pine forest<|h_3|>Task:What does the currently flooded terrace still have visible?<|ans|>valleys and ground …… heads 4 and 5 the same way, all in one batchwhat a head reads on its own: about 17 tokenswhat it writesTO SCALE, AT 4,000 TOKENS OF CONTEXTcontext, read onceone head's question: the sliver at the left, under 0.5%
Figure 8. The fix. The article and its questions are read once; each head then starts from its tag, its own question and an answer token, about 17 tokens, and writes its answer. Real questions and answers from the Warsaw article. Drawn to scale at the bottom: one head's question next to a 4,000 token context.

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.

0204060805001,0002,0004,000context length (tokens)One call per questionFork, question per headOne streamFork, original
Figure 9. Accuracy on 150 SQuAD questions (30 articles × 5) as the shared context grows. The shaded band is the 95% confidence interval for fork heads; one call per question has the same width. Hover a context length for the values.

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.

02468105001,0002,0004,000context length (tokens)One call per questionOne streamFork, question per head
Figure 10. Measured cost per article (5 questions) on one Apple M4 Pro, fp32, greedy decoding. The original fork is left out: it costs the same as the fixed one but is not accurate.
ContextFork, question per headOne call per question (Subagents)One stream (Agent Conversation)Speed up
50070.0%, 0.57 s68.0%, 1.10 s64.7%, 0.96 s1.9x
1,00067.3%, 0.80 s65.3%, 2.07 s62.7%, 1.22 s2.6x
2,00062.0%, 1.18 s63.3%, 4.32 s55.3%, 1.57 s3.7x
4,00056.0%, 1.99 s56.7%, 10.27 s46.7%, 2.64 s5.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.
Heads that work togetherOne head waits on another; heads merge back into one.shared contexth_1a1h_2waits on a1a2mergeA first merge step already works on toy prompts.Long, uneven workEach head stops when its own work is done.h_1a paragraph■ stoph_2a number■ stoph_3a list■ stopA finished head frees its slot in the batch.A cached context as a search indexRead a huge corpus once; cheap heads answer on top of it.today:encodervector DBretrieved chunkshuge context, read once and cachedq_1q_2q_3q_4q_5q_6Each new question costs a few tokens, not a new read.Networks that change shapeCut, add and grow parts of the network while it runs.layer 1layer 2− cut a layernew op+ add an operationlayer 3↔ grow a blocklayer 4
Figure 11. Four of the directions we are working on next.

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.