Compiling Agentic Workflows into LLM Weights: An 8B Model Replaces Seven-Layer Orchestration — Deep Dive on the Subterranean Agent
| Paper Info | | |---|---| | Title | Compiling Agentic Workflows into LLM Weights: Near-Frontier Quality at Two Orders of Magnitude Less Cost | | Authors | Simon Dennis, Rivaan Patil, Kevin Shabahang, Hao Guo | | Institution | University of Melbourne | | arXiv ID | 2605.22502 | | Date | May 21, 2026 | | Categories | cs.AI / cs.LG | | Core claim | Compile multi-step agent workflows into small-model weights; no external orchestrator at runtime — an 8B model reaches 87–98% of frontier quality at 128–462x lower cost, with 30–50 minute recompilation cycles (CI/CD level) and lower failure rates |
Today's LLM agent frameworks — LangGraph, CrewAI, Google ADK, OpenAI Agents SDK, Semantic Kernel, Strands, LlamaIndex — total around 290,000 GitHub stars. All seven share the same architecture: a scheduler sits outside the model, injecting instructions each turn, parsing outputs, and deciding the next step. Simon Dennis of the University of Melbourne asks a more fundamental question: what if you don't need the orchestrator at all?
Three Architectures
1. Surface orchestration: an orchestrator sits between user and LLM — injecting node prompts, parsing outputs, consulting the flow graph each turn. Costs: extra API calls per turn, prompt bloat, and routing-decision failures. 2. In-context prompting: put the whole flow graph in the system prompt and let a frontier model navigate itself. Near-perfect quality on procedural tasks, but every conversation needs a frontier model and exposes private workflows to third-party APIs. 3. Subterranean agent: bake the entire flow graph into model weights during training. At runtime, user talks to the model directly. No orchestrator, no graph injection, no routing decisions.
The Three Walls
Developers avoid compiled approaches for three reasons, which the paper dismantles with three scenarios (travel booking 14 nodes, Zoom support 14 nodes, insurance claims 55 nodes):
Wall 1: Quality
- With the same 3B base model, compiling into weights significantly outperformed explicit orchestration on task success, consistency, graceful handling, and naturalness (p < 0.001). The orchestrator dragged the model down.
- Why: orchestrators reason from local node context (no global awareness), routing is a failure source (LangGraph: 24% failure on travel booking vs 5.5% for the subterranean agent), and template injection kills conversational flow.
- The 8B subterranean agent reached 97% of in-context-prompting naturalness on Zoom support (4.87/5) and 92–98% on insurance claims — significantly beating a LangGraph orchestrator running a 70x larger model (p < 0.001).
- Travel booking (14 nodes): 128x cheaper ($0.13 → $0.0010/conversation)
- Zoom support (14 nodes): 296x cheaper ($0.10 → $0.0003/conversation)
- Insurance claims (55 nodes): 462x cheaper ($0.33 → $0.0007/conversation)
- Scope is procedural dialogue tasks — clear steps, bounded branches, closed outcomes. Not poetry or math competitions.
- World knowledge is the real bottleneck: the 8B Zoom agent hit 97% naturalness but only 87% information accuracy — a model-size issue, not a compilation issue.
- External API/tool calling untested (GDS, payment gateways, etc.).
- Synthetic data risk: all training dialogues came from Claude Sonnet 4.5; systematic generation errors would be burned into weights. GPT-4.1 was used as an independent judge to reduce scoring bias.
- LoRA failure is an experimental observation, not a theoretical proof.
Wall 2: Cost
Two multiplicative layers: ~65x cheaper per token (self-hosted 8B on A100, ~$0.05/M input and $0.23/M output vs Claude Sonnet 4.5's $3/$15), plus constant-size prompts versus linear prompt growth with graph complexity.One-time compilation costs $50–80 (data generation + fine-tuning); it pays back within 500 conversations. A 10,000-daily-user support agent costs under $7/day vs $1,740 for LangGraph + Claude Sonnet 4.5.
Wall 3: Flexibility
Recompilation after a workflow change takes 30–50 minutes on 8xH200 (data generation 15–30 min, fine-tuning 10–15 min, evaluation 5–15 min), or ~3 hours on a single A100 80GB — CI/CD build territory, not a retraining project.Compiler, Not Interpreter
A telling dialogue record: the compiled 3B agent proposed three plans by turn 5 and confirmed booking by turn 7. The same model with an orchestrator asked for the departure date three separate times and took 18 turns. The orchestrator makes the model seem amnesiac; the compiled model has the procedure "burned" into its weights. The subterranean agent reasons globally through internalized weights, has zero routing failures, and produces unconstrained, natural replies.
Why LoRA Fails
A notable side finding: LoRA cannot internalize procedural knowledge. Low-rank adaptation (rank 16–128) failed entirely at compiling workflows — the low-rank update space can't change implicit state-tracking behavior. A companion paper concludes: procedural knowledge is not low-rank; full-parameter training is required.
Honest Limitations
The Principle
The paper's deepest contribution is a design principle, not an algorithm:
Durable structure belongs in weights. Transient state belongs in prompts.
For three years, everything — flow graphs, routing rules, current state, history — has been crammed into ever-growing context windows each turn. The subterranean approach says: compile "how to do things" into the model; write "what the situation is now" in the prompt. Like a human brain that contains "how to drive" but still needs today's navigation route.
Compiled approaches have existed since SimpleTOD (2020), FireAct (2023), WorkflowLLM and Agent Lumos (2024) — together under 3,000 GitHub stars, versus 290,000 for orchestration frameworks. Dennis's measurements suggest the perceived walls — quality anxiety, cost doubt, flexibility fear — are made of paper.
References
1. Dennis, S., Patil, R., Shabahang, K., & Guo, H. (2026). Compiling Agentic Workflows into LLM Weights: Near-Frontier Quality at Two Orders of Magnitude Less Cost. *arXiv:2605.22502*. 2. Dennis, S., Diamond, M., Patil, R., Shabahang, K., & Guo, H. (2026a). In-Context Prompting Obsoletes Agent Orchestration for Procedural Tasks. *arXiv preprint*. 3. Dennis, S., Shabahang, K., Guo, H., & Patil, R. (2026b). Procedural Knowledge is Not Low-Rank: Why LoRA Fails to Internalize Multi-Step Procedures. *arXiv preprint*. 4. Hosseini-Asl, E., et al. (2020). A Simple Language Model for Task-Oriented Dialogue. *NeurIPS 2020*. 5. Yin, D., et al. (2024). Agent Lumos: Unified and Modular Training for Open-Source Language Agents. *ACL 2024*.