Compile, Then Page: Executable SOP Programs and a Capability-Gated Runtime for Procedural LLM Agents
This paper introduces a capability-gated runtime system that compiles standard operating procedures into executable pseudo-code and uses program-guided paging to significantly enhance the safety and performance of procedural LLM agents, particularly for models with strong state discipline.
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
Imagine you're trying to teach a super-smart but slightly scatterbrained robot how to run a bank. You have a massive, 10,000-character rulebook (the Standard Operating Procedure, or SOP) that tells the robot exactly what to do, what to check, and when to say "No, absolutely not."
The old way of doing this was like shoving that entire 10,000-character rulebook into the robot's brain every single time it tried to answer a question. The robot would get overwhelmed, miss a crucial step, or accidentally approve a loan it shouldn't have. It's like trying to read a whole encyclopedia while someone is shouting a question at you; you might miss a page.
This paper suggests a smarter way: Compile, Then Page.
The "Recipe Book" vs. The "Chef's Station"
The authors realized that instead of giving the robot the whole messy text, they could first compile the rulebook into a clean, executable program. Think of this like turning a long, confusing paragraph of instructions into a precise, step-by-step recipe card.
But here's the magic trick: they don't show the robot the whole recipe at once. They use a system called paging. Imagine a chef who only puts the current step of the recipe on the counter (the "active frame"), while the rest of the book stays safely on a shelf. The robot only sees the 570 characters it needs for the next move, not the whole 10,000-character mess. This keeps the robot focused and prevents it from getting lost in the details.
The "Gated" Surprise: It Depends on the Robot
Here is where things get really interesting. The paper tested this on six different AI models, ranging from "super-smart" to "struggling."
- For the Smart Robots: The new method was a huge win. On a banking task, the best model went from getting 70.4% of things right to 92.8%. Even better, it got 100% of the "refusal" tasks right (meaning it correctly said "no" when it wasn't supposed to do something). The smart robots loved having the recipe card and the focused counter.
- For the Struggling Robots: The results were the opposite. The weaker models actually got worse. One model dropped from 60.8% to 48.8% right answers.
Why? The paper argues it's not because the weak robots can't "read" the recipe. When the researchers tested if the robots could reconstruct the state of the program, they could! The problem is discipline. The smart robots naturally follow the steps on the counter and stop when they're done. The weak robots, however, tend to keep checking things even after the job is finished, or they get confused by the structure. The "gate" isn't about intelligence; it's about self-control.
What This Rules Out
The authors were very careful to prove what didn't work:
- It's not just about the format: They tried giving the smart robots the same information but in "code" format versus "prose" format. The code format helped the smart robots, but it actually hurt the weak ones. So, just switching to code isn't a magic fix for everyone.
- It's not about hiding information: They tested if the robots failed because they couldn't see the whole program. They found that even if they showed the whole program to the smart robots, the "paging" (showing just the active step) still helped. The weak robots, however, couldn't be fixed by just showing them the whole thing; they still struggled with the discipline of following the steps.
- It's not a "hard" block: The system doesn't physically stop the robot from making a mistake. It just highlights the right path. If the robot decides to ignore the path, it can still do it, but the system will record the mistake in an "audit trail." This means the system relies on the robot choosing to be good, which is why it fails with the undisciplined ones.
The Bottom Line
The paper concludes with a simple rule for anyone building these agents: Compile first, then page.
- Compile: Turn your messy rulebook into a clean, executable program. This helps almost everyone, even if it doesn't change the weak robots much.
- Check the Model: Before you turn on the "paging" feature (showing only the current step), you must check if your robot has the discipline to follow it.
- Page Only if Ready: If your robot is smart and disciplined, paging will boost its performance significantly. If your robot is weak or undisciplined, paging might actually make it mess up more.
In short, giving a robot a focused view of the task is a powerful tool, but it only works if the robot has the self-control to look at the right thing at the right time. For the smart ones, it's a superpower; for the others, it's a trap.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.