TL;DR
Reasoning models generate massive streams of intermediate thoughts and tool calls, meaning a single early slip-up can quietly derail an entire task or trigger irreversible real-world errors. interwhen is a plug-and-play framework that translates plain-English rules into formal code verifiers and runs them asynchronously alongside a model's live thought process. By gently nudging a single reasoning trajectory back on track only when it breaks a rule, it boosts smaller models' success rates by up to 55 percentage points—without finetuning or the massive compute bills of tree-search methods.
What Problem Does This Paper Address?
Imagine deploying an AI agent to manage customer refunds or telecom plans. Checking only the final answer is too late if the agent already executed an unauthorized database write halfway through its chain of thought. Not just the final output, the process itself must follow the rules.
Existing ways to supervise reasoning at test-time hit two walls:
- Compute bloat: Either you wait for the whole trace to finish and retry from scratch upon failure (high latency), or you branch out into a massive tree of candidate thoughts (multiplying token costs). Worse, forcing models into rigid, predefined "steps" for checking cramps their natural, messy reasoning style.
- Verifier scarcity: Math and coding have built-in reality checks like compilers. Real-world workflows—like following an airline's operational rulebook—lack ready-made, reliable verifiers, and asking another LLM to "just check the work" fails to guarantee strict safety.
Methods
The authors introduce a paradigm called LLM-Process-Modulo, implemented in interwhen, which splits supervision into two clean phases:
- Offline Auto-Formalization: Instead of hand-coding checks, a frontier LLM reads a natural-language policy document and synthesizes executable verifier code (in Python, Z3, or the Lean theorem prover) alongside a mapping of which variables each rule needs. Using Lean allows the LLM to generate machine-checked mathematical proofs that the verifier code faithfully matches the formal specification.
- Online Asynchronous Steering: While the main model thinks,
interwhendoesn't interrupt it. At periodic markers (like paragraph breaks or tool calls), it forks a parallel execution thread to extract structured state variables from the messy text trace (using a small model or regex) and feeds them to the code verifiers. - If everything looks good, the main model keeps streaming with zero latency overhead (except right before irreversible "write" tool calls, which pause briefly for clearance).
- If a rule is violated,
interwhenhalts generation, rewinds back to the fork point, injects specific text feedback (e.g., "Wait, refunds must go to the original payment source"), and lets the model course-correct.
Datasets
interwhen is evaluated (training-free) across eight existing benchmarks—no new benchmarks are introduced:
- Agentic tasks: $\tau^2$-bench (telecom and retail workflows in solo and dual user-agent modes), AgentSafetyBench (safety failure modes), and VitaBench (complex interactive tasks).
- Non-agentic reasoning: Spatial navigation (
MAZE,SPATIALMAP), arithmetic (GAMEOF24), logic puzzles (ZEBRALOGIC), and code/specification generation (VERINA).
Key Insights and Ideas
- Checking can actually save tokens: Counterintuitively, adding verification often uses fewer total tokens than standard Chain-of-Thought (CoT). Catching bad assumptions early stops the model from spiraling down long, repetitive dead ends.
- One-size-fits-all verifiers: Because verifiers are compiled from the task policy rather than tailored to model weights, the exact same verifier suite boosts Qwen3, Claude Haiku 4.5, and GPT-5.4-Mini alike.
- Written policies have blind spots: Relying strictly on official policy documents isn't always enough. Inspecting a handful of failed traces revealed implicit rules (e.g., an environment expecting exactly 2GB of data refueling when the policy text said at most 2GB). Augmenting policy verifiers with trace-derived and prompt-specific checks unlocked the biggest gains.
- Forgiving math on imperfect extraction: Using a theoretical Markov chain analysis, the authors prove that even if the LLM state-extractor occasionally misses a violation, steering still improves compliance over standard execution—as long as it avoids false alarms on valid steps.
Key Results
- Massive jumps for open models: On $\tau^2$-bench (telecom, solo mode), Qwen3-30B's task completion jumps from 32.17% to 87.70% while using slightly fewer tokens (96.93%) than baseline CoT. Dual-mode performance more than doubles from 24.56% to 55.26%.
- Frontier models benefit too: On $\tau^2$-bench telecom (solo), Claude Haiku 4.5 leaps from 47.1% to 84.3%, and GPT-5.4-Mini climbs from 71.5% to 94.7%.
- Provable Lean verifiers hold their own: Fully automated, formally proved Lean verifiers reach 83.77% on $\tau^2$-telecom, nearly matching manually validated Python verifiers (87.70%).
- Crushing the compute-accuracy frontier: On non-agentic tasks like
GAMEOF24,interwhenhits 97.2% accuracy using just 61.6% of CoT's token budget—whereas Tree-of-Thoughts burns 7–18$\times$ more tokens and struggles on logic/code tasks. State extraction errors were virtually nonexistent (0.04% on Maze; 0 out of 14.6K agentic tool calls).
Limitations and Future Work
- Soundness vs. Completeness: Formal proofs guarantee soundness (if a solution passes, it obeys the coded spec), not completeness. If a natural-language policy leaves rules implicit or unwritten, the generated verifiers won't catch those hidden violations.
- Over-cautious blocking on vague rules: When policies are fuzzy (like AgentSafetyBench's "don't call tools before getting necessary info"), synthesized verifiers err on the side of caution, boosting safety (+23.56 percentage points) at the cost of occasionally blocking valid, helpful actions. Handling implicit rules in messy, in-the-wild domains remains an open frontier.
Summary updated