Compiling Agentic Workflows into LLM Weights: Near-Frontier Quality at Two Orders of Magnitude Less Cost
This paper argues that compiling agentic workflows directly into the weights of small, fine-tuned models ("subterranean agents") offers a cost-effective, private, and context-efficient alternative to the prevailing external orchestration frameworks, demonstrating near-frontier quality across diverse complex tasks while overcoming key adoption barriers.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
The Big Idea: Baking the Recipe into the Chef
Imagine you are trying to get a complex task done, like booking a complicated trip or fixing a broken machine. Currently, most companies use a "Manager and Worker" system (called Agent Orchestration).
- The Current Way (The Manager): You have a very smart, expensive "Manager" (a frontier AI model). Every time the "Worker" (the AI talking to you) needs to make a decision, the Manager stops, reads a giant rulebook, tells the Worker what to do next, and then waits for the Worker to reply. This happens over and over. It's slow, expensive, and the Manager has to read the whole rulebook every single time.
- The New Way (The Subterranean Agent): The authors propose a different approach: Compile the procedure into the weights. Imagine taking that giant rulebook and baking it directly into the Worker's brain. Now, the Worker is the expert. They don't need a Manager to tell them what to do next; they just know the flow naturally. They become a "Subterranean Agent"—an expert who works from the inside out.
The paper asks: Is baking the rules into a smaller, cheaper AI actually as good as using a giant, expensive Manager?
The Three Hurdles (And How They Cleared Them)
The authors thought people weren't doing this because of three big fears. They tested these fears in three real-world scenarios: Travel Booking, Zoom Tech Support, and Insurance Claims.
1. The Quality Fear: "Will a small brain be as smart as a big brain?"
- The Fear: People thought a small, cheap AI (3 billion or 8 billion parameters) couldn't handle complex steps as well as a massive, expensive AI (like the ones used by big tech companies).
- The Result: Surprisingly, the small AI did almost as well as the big one.
- In Travel, the small AI was slightly less "polite" or "graceful" than the big one, but it got the job done correctly.
- In Zoom Support and Insurance (which are much harder), they upgraded the small AI to a slightly bigger version (8 billion). This version matched the big, expensive AI on almost every metric.
- The Analogy: It's like hiring a local, experienced mechanic (the small AI) vs. flying in a world-famous racing team (the big AI). For fixing your daily car trouble, the local mechanic is 90–98% as good, but costs a fraction of the price.
2. The Cost Fear: "Is it actually cheaper to run this?"
- The Fear: People thought that even if the small AI is cheap to train, running it might still be expensive because you have to pay for the computer power.
- The Result: It is massively cheaper.
- The "Manager" system has to call a very expensive API for every single sentence the AI says.
- The "Baked-in" system runs on a standard computer server (self-hosted).
- The Math: The new method is 128 to 462 times cheaper per conversation.
- The Analogy: The old way is like paying a taxi driver $50 every time you ask them to turn the wheel. The new way is like buying a car for $1,000 and driving it yourself. The more you drive (the more complex the task), the more money you save.
3. The Flexibility Fear: "What if the rules change? Do I have to retrain for months?"
- The Fear: People thought that if the insurance company changes a form or the travel agency changes a policy, you'd have to wait weeks to retrain the AI.
- The Result: It's fast.
- Changing the rules and retraining the AI takes 30 to 50 minutes on standard hardware.
- The Analogy: It's not like rebuilding a house from scratch; it's more like updating the software on your phone. You can do it in the time it takes to brew a pot of coffee.
How It Works (The "Subterranean" Pipeline)
The process is surprisingly simple:
- Draw the Map: You draw a flowchart of how the conversation should go (e.g., "Ask for dates" -> "Check budget" -> "Show options").
- Practice Run: A super-smart AI (the "Teacher") plays through this map thousands of times, creating fake conversations.
- Bake the Brain: You teach a smaller AI these fake conversations. The AI learns the pattern of the conversation, not just the words.
- Go Live: You deploy the small AI. It doesn't need the flowchart anymore; the flowchart is now part of its memory. It talks to you directly.
The Verdict
The paper concludes that for tasks with clear steps (like booking, support, or claims), you don't need a Manager.
- Persistent Structure belongs in the weights: The rules of the game should be baked into the AI's brain.
- Transient State belongs in the prompt: The specific details of your trip or your broken Zoom call should be told to the AI in the conversation.
By moving the rules from the "Manager" to the "Worker's brain," you get near-perfect quality at two orders of magnitude (100x) less cost, with the ability to update the rules in under an hour.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.