Compiling Expert Procedures into Verified Programs: When a Small Model Is Enough
Organizations: CoreThink AI · Stanford University
Abstract
In procedural tool-use domains, how much of the gap between base models is procedure rather than capability? We build an explicit program from a teacher's traces and run it in front of unchanged small models, including an 8B model. The construction, PLVR , takes the reasoning traces of a teacher, Kimi-K3, clusters their segments to locate recurring operations, has a frontier model author one typed primitive per operation, each run by a small frozen model and assembles the program by A* search over a mined rule library, under a reference-action objective. At inference the program takes one of two forms: for troubleshooting and tool search it produces the chain of thought the student would otherwise generate for itself, and the student acts on it; for multi-turn tool matching the student proposes each action and the program checks, repairs, or retries it before it goes out. On the official tau2-Bench Retail and Telecom test sets and on LiveMCPBench, with three Nemotron base models and the same program for each, the answer depends on the domain. On Telecom, Granite-4.2-8B as the student goes from 43.0% to 91.2% under the program, and every Nemotron student reaches 93.3-94.4%, against at most 58.2% for fine-tuning on the same traces, prompt optimisation of the student, or two token-matched baselines. With Granite-4.2-8B as the student, the program is within 2 to 3 points of the Nemotron students on Telecom and within 3 on Retail, and 3 to 13 points below them on LiveMCPBench: where the domain is procedural an 8B student is enough, and on tool search the student still matters. On Retail and LiveMCPBench the program is competitive with the best baseline. The spread between base models shrinks from about 7 points to about 2, averaged over the suites, with no weights changed.
Figures & tables
| Subset | Format | Tasks | Train | Held aside | Kept traces |
| Retail | retail format, multi-turn tool matching | 142 | 119 | 23 | 128 |
| Telecom | telecom format, troubleshooting | 178 | 122 | 56 | 178 |
| Tool-search | LiveMCPBench format, tool search | 233 | 183 | 50 | 233 |
| Total | 553 | 424 | 129 | 539 |
| -Bench | ||||
| System | Retail | Telecom | LiveMCP | Avg |
| Vanilla (chain-of-thought prompting) | ||||
| Nemotron 3.5 Lightning | 75.4 | 47.4 | 42.5 | 55.1 |
| Nemotron 3 Nano | 64.0 | 36.8 | 45.3 | 48.7 |
| Nemotron 3 Super | 79.8 | 51.8 | 34.4 | 55.3 |
| SFT on the kept teacher traces | ||||
| Student | Granite-4.2-8B | ||||||
| Student | Arm | Tasks | Output | Input | Calls | Output | Input |
| Nemotron 3.5 Lightning | Vanilla | 278 | 2,323 | 45,907 | – | – | – |
| SFT | 278 | 1,646 | 37,704 | – | – | – | |
| GEPA | 278 | 2,356 | 45,137 | – | – | – | |
| ReAct | 228 | 10,700 | 176,800 | 100 | 29,100 | 492,000 | |
| Sample-and-judge | 228 | 25,700 | 532,700 | 99 | 29,500 | 634,000 | |
| Lightning (3B) | Nano (3B) | Super (12B) | |
| SFT, selected run only | |||
| SFT, full sweep (24 runs) | |||
| PLVR search, Granite scoring, all three blocks | (once) | ||
| PLVR rule mining (Claude Sonnet 4.5) | 16 calls, 287k prompt and 47k completion tokens (once; FLOPs not counted) | ||
Appendix figures & tables3 assets
Supplementary material from the paper’s appendix.
Appendix
| Cluster | Kind | Size | Domains | # | Primitives |
|---|---|---|---|---|---|
| reason9 | reason | 24 | telecom | 14 | Alternatives when blocked, Can the question be answered, Device reply, Does the condition hold now, Is the condition met, Is the rule a condition, Is the rule about this action, Order requests, Plan steps, Price terms, Requests covered by the same call, Split into requests, User’s own premise or condition, Where a value comes from |
| message0 | message | 236 | tool-search, retail, telecom | 12 | Audit, Classify one request, Does the condition hold now, Is the condition true by the quote alone, Is the rule about this action, Order requests, Plan steps, Reply to a confirmation, Requests covered by the same call, Split into requests, Where a value comes from, Write the reply |
| reason17 | reason | 41 | retail | 12 | Does the condition hold now, Is the condition met, Is the condition true by the quote alone, Is the problem fixed, Is the request achieved, Is the rule about this action, Order requests, Plan steps, Reply to a confirmation, Requests covered by the same call, User’s own premise or condition, Where a value comes from |
| reason5 | reason | 117 | tool-search, telecom | 11 | Alternatives when blocked, Can the question be answered, Functions a policy section governs, Is the condition true by the quote alone, Is the rule about this action, Is the setting already as wanted, Plan steps, Price terms, Question for a missing parameter, User’s own premise or condition, Widen tools |
| call5 | call | 128 | tool-search | 9 | Device action arguments, Fill the parameters, Parts, Pick the function, Search phrases, Servers for the task, Split into requests, Widen tools, Write the reply |
| reason11 | reason | 102 | telecom | 8 | Fill the parameters, Functions a policy section governs, Is the rule about this action, Order requests, Plan steps, Question for a missing parameter, Requests covered by the same call, User’s own premise or condition |
| Id | Rule | What the expert does |
|---|---|---|
| M01 | Read before use | Reads a source before doing anything with its contents |
| M02 | Complete answer | The final answer includes everything the task asked for |
| M03 | Stop after answering | Takes no further action after the final answer |
| M04 | Inputs before calculating | Retrieves all input values, then computes locally |
| M05 | No tools for simple logic | Never searches for a tool to do arithmetic, parsing or filtering |
| M06 | Gather before writing | Finishes all data gathering before writing an output |
| Rule | What the expert does |
|---|---|
| Identify first | Looks up the user before anything else |
| Target details first | Reads the target record’s details before target-specific work |
| Confirm the fix at the end | Runs the task’s success check to confirm the fix |
| Grant each permission | Grants each required permission separately |
| Clear the blocking state first | Clears a state that blocks everything else before other troubleshooting |
| Check detailed status | Reads detailed state on connectivity problems |
LLM Tool Use
Large language model tool use studies how models select, call, and coordinate external tools to extend their reasoning and take actions.
See all 295 papers