The Control-Flow Tax: Specialized Decision Routing for LLM Agent Workflows

Zhikai Cheng, Shuanghu Wang, Li JiangarXiv 2026

TL;DR

LLM agents can spend nearly as much money deciding what to do next as they spend actually generating useful work—a hidden overhead the authors call the "control-flow tax." Simply swapping in a cheap, general-purpose chat model to direct traffic often backfires by sending the expensive worker model on wild goose chases. Instead, pairing a heavy-duty generator with a dedicated, non-autoregressive decision model cuts total workflow costs nearly in half while keeping execution crisp and fast.

What Problem Does This Paper Address?

Picture a senior software architect pausing after every forty lines of documentation to re-read the entire project spec, directory tree, and git history—just to utter a single word: "Next."

That is how modern LLM agent loops operate. After generating an artifact, a controller must inspect all accumulated evidence to decide whether to advance, repair, backtrack, or stop. The output token is tiny, but the input context balloons at every step. In the authors' baseline workflow, this orchestration overhead consumes 42.5% of the total cost and 66.5% of all input tokens.

You might think the fix is obvious: just route those routing decisions to a dirt-cheap smaller LLM! Not so fast. Unlike standard model routing (which picks which LLM answers a single prompt), control-flow routing dictates future actions. If a cheap model makes a slightly clumsy call—say, unnecessarily ordering a rewrite—it triggers another round of expensive generation, wiping out any token savings and then some.

Specialized control paired with shared generation cuts overall workflow cost nearly in half.

Methods

Instead of relying on one monolith or a cheap generalist chat model, the authors evaluate a heterogeneous "System 1 / System 2" architecture within a three-step software documentation workflow (Specify, Tasks, Analyze):

  • The Generator: Every experimental arm keeps the heavy-lifting document writer fixed as Sol (gpt-6.1-sol).
  • The Specialized Controller: Rather than an autoregressive text generator forced into a JSON schema, the authors bring in Jev (jev-1.13.0), a dedicated decision model. Jev ingests rich natural-language evidence but skips token-by-token text generation, using a non-autoregressive parallel sampler trained specifically to output probability distributions over finite, declared choices.
  • Two Specialization Boundaries: Every loop has two control points: a content-aware chooser (reads all files/history to pick the next step) and a tiny Boolean existence gate (checks if required output files exist). The authors test replacing just the gate (E1) versus replacing both the chooser and the gate (E2), benchmarking Jev against matched Sol controls and general-purpose comparators (Haiku, Luna, and Sonnet) under an 80-request cap per run.
Figure 2: Execution loop and specialization boundaries. (a) A content-aware chooser reads a scope- and digest- checked snapshot, dispatches a registered step to Sol, or requests complete or abstain. The gate receives required paths and Boolean existence values: true refreshes the evidence; false repeats generation of the same step. Comple- tion additionally requires the deterministic terminal constraints shown. Invalid decisions, abstention, and request exhaustion stop execution. Icons distinguish evidence, model calls, artifacts, and deterministic safeguards; an ex- istence check does not certify artifact quality. (b) E1 changes only the gate backend; E2 changes both decision backends. Sol generation and the independent 80-request allowance per arm remain unchanged.

Datasets

No models were trained in this study; evaluation spans two custom setups:

  1. Software Documentation Tasks (D01–D04): Four authored software-change tasks requiring 40-line specifications, task decompositions, and consistency analyses. D01 covers a queue-normalization library (used during development); D02–D04 test generalization across JSON Merge Patch, HTTP Retry-After timing, and Semantic Version precedence (480 valid runs total).
  2. Reviewed Retail States: 100 single-decision customer-service states authored from 30 tasks and 25 accounts in the $\tau^2$-bench pool. Models read conversation history and retail policy to select one of 17 actions (reply or 16 tools), isolating decision accuracy on identical states without compounding trajectory drift.

Key Insights and Ideas

  • Amdahl's Law bites small gates: Optimizing only the simple Boolean existence gate (E1) cuts gate costs by 97.6%, yet shaves a measly 1.8% off total workflow cost—because the gate was only 3% of the bill to begin with. Real savings require tackling the context-heavy semantic chooser.
  • The "Cheap-Generalist Trap": Low per-token pricing is a mirage if the router induces longer trajectories. On D01, Haiku got stuck revisiting earlier steps until it hit the 80-request limit on every single run, ballooning total session costs by 734.3%. Luna completed the tasks, but requested 60% more Sol generations than baseline, turning an 87.9% routing discount into a net 3.7% cost increase.
  • Minimum-length trajectories preserve savings: Across all 40 full-routing runs (D01–D04), Jev never wasted a step—completing every single workflow in the theoretical minimum of 10 requests (3 generations, 4 choices, 3 gate checks).

Key Results

  • Initial Software Task (D01, Serial): Jev full routing (E2) slashed routing cost by 98.1%, driving total session cost down by 49.6% ($0.0885 to $0.0446) and elapsed wall-clock time down by 33.2%.
  • Cross-Task Expansion (D02–D04, Concurrent): Jev achieved the lowest mean cost and latency on every task, reducing full-run reference costs by 40.5%–42.9% and concurrent elapsed time by 12.9%–14.4% relative to matched Sol controls.
  • Customer-Service Single Decisions: Both Sol and Jev selected valid, pre-reviewed actions on 100/100 retail cases (agreeing identically on 97/100), with Jev requiring 97.88% less cost and 72.30% less mean request latency (0.698s vs. 2.519s).

Limitations and Future Work

  • Artifact quality vs. execution integrity: The software workflows verify structural contracts (file paths, headings, line limits), not executable code or blinded human grading of document quality. Minimum-length completion proves efficiency, not necessarily optimal prose—nor can it rule out subtle premature completion.
  • System-level scope: Costs rely on fixed reference tariffs rather than live invoices (ignoring prompt-caching discounts), and comparisons evaluate deployed APIs end-to-end rather than isolating Jev’s exact parameter count or training recipe. Retail labels were reviewed by a single project lead rather than independent blinded annotators.
  • Future directions: Extending specialized decision models beyond phase-level routing into fine-grained agent checks—such as retrieval-source selection, candidate ranking, and using calibrated uncertainty estimates to escalate ambiguous states to heavy-duty reasoning models or humans.

Summary updated

Abstract

An agent can spend almost as much deciding what to do as doing it. In our documentation workflow, control-flow routing accounts for 42.5% of baseline reference cost on the initial task. Lower token prices alone do not solve this control-flow tax: inexpensive general-purpose routers can trigger additional calls to the expensive generator. We evaluate a heterogeneous architecture in which Jev, a specialized System 1 decision model, controls finite actions while Sol generates documents. Across four software tasks, 480 valid runs comprise 470 completions and ten request-limit endpoints. Jev full routing achieves the lowest mean cost and elapsed time on every task, completing all 40 specialist-controlled runs along the shortest trajectory. On the initial task, mean cost falls by 49.6% (95% paired-bootstrap interval: 42.9% to 56.3%) and elapsed time by 33.2% (19.6% to 46.7%). Across three further tasks, cost reductions are 40.5% to 42.9% and concurrent elapsed-time reductions are 12.9% to 14.4%. Existence-only specialization saves just 1.8% on the initial task. Separately, Sol and Jev each select accepted actions on 100/100 reviewed retail states, with Jev using 97.88% less reference cost and 72.30% less mean request time. The results identify two requirements for efficient agent control: inexpensive decisions and trajectories that preserve those savings.
BibTeX
@misc{cheng2026control,
  author = {Zhikai Cheng and Shuanghu Wang and Li Jiang},
  title = {{The Control-Flow Tax: Specialized Decision Routing for LLM Agent Workflows}},
  year = {2026},
  eprint = {2611.32365},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.32365},
}
Figure