Strategist Turns Inference Strategy Into a Reusable Code Library
Inference strategy is the half of an agent system that nobody iterates; Strategist writes it as reusable code, searches over it, and wins 24 of 30 benchmarks at 74.7% versus 74.0% accuracy and 39% lower cost.
On this page
Your team has bought 3 model tiers and must decide whether the reasoning pipeline in front of them stays hand-written, but nothing carries from one task's design to the next. The usual advice is to hire a strong prompt engineer and let them iterate by hand — which works once, then freezes the moment the system ships. The paper calls that frozen half the inference strategy: the procedure that decides which model is called, in what order, at which tier, and how the answers are merged. Strategist represents that procedure as code with one shared interface, keeps it in a cross-task library, and lets each new task start from what earlier tasks found [1].
The half of an agent system nobody iterates
An agent system is two halves. One is the model itself; the other is the procedure that turns model calls into an answer — what to ask first, how many times, which tier each step uses, how competing answers are merged. The paper calls the second half the inference strategy. Today it is written by people, tried, adjusted, and then frozen once the system works, making it the one part of the stack that never improves on its own [1].
The reason it stays frozen is representation, not ambition. Prior work took two routes: computation graphs and declarative pipelines, which compose cleanly but can only express predefined patterns; or monolithic code, which can express anything but produces isolated strategies that the next task cannot reuse as a component.
Writing the strategy as code with one interface
A blueprint is a Python program that captures reasoning structure without task-specific prompts. One blueprint, for instance, defines a loop that generates three candidate answers, reviews each, then majority-votes; filling in prompts turns it into a runnable strategy. Every blueprint exposes the same interface, execute(llm, task) -> str, and all of them build on just two foundations: chat and agent.
- One shared interface: any blueprint can be called as a component of any other
- No forward calls: a node may only call nodes created before it
- No cycles
- No duplicates
Inside a blueprint, each step can target its own model tier. The paper defines three tiers, fast, balanced and complex, each with a nothink and a thinking mode, mapped to Qwen3-0.6B, 1.7B and 4B. Cost is weighted by parameter ratio: fast counts 1×, balanced 2.83×, complex 6.67×. Simple steps run cheap and hard steps run expensive, which is why one strategy can be both accurate and affordable.
Each blueprint enters the library with a measurement card and with experience notes on when it works and when it does not. Retrieval indexes those behavioural records rather than code-text similarity.
Four steps: retrieve, propose, evaluate, accumulate
Retrieve: a short text query searches the library using a hybrid of TF-IDF and embedding similarity over traits, measurement cards and experience notes. Besides relevant blueprints, the library returns adjacent inspiration from other domains to break out of local optima.
Propose: each iteration produces K=5 candidates, with at least one of each kind — new, composed, and reuse — forcing an explicit ratio between exploration and exploitation.
Evaluate: the data is split four ways, and this is the part most worth copying. On the training set the designer sees scores plus full traces; on the validation set it sees only aggregate scores, which blocks overfitting to traces; the hidden set picks the winner across iterations; the test set stays sealed until the end. Each split holds at most 100 samples, and the test set is fixed at 200.
Accumulate: the library stores blueprints, not strategies, keeping reusable structure and discarding task prompts. Each round the designer writes a structural analysis and files it with the measurement card, with deduplication.
30 benchmarks, 108 baseline cells, 24 wins
Evaluation spans 40 benchmarks in seven categories. Thirty are randomly drawn for the main loop and 10 are held out for one-shot retrieval. Maths covers GSM8K, MATH500, AIME 2024, SVAMP, ASDiv, Gaokao-Math, AQuA-RAT and MinervaM; commonsense covers StrategyQA, CommonsenseQA, PIQA, HellaSwag, OpenBookQA, SIQA, COPA, WinoGrande, SciQ and BoolQ; knowledge covers TruthfulQA, SQuAD v2, TriviaQA, NQ-Open and MMLU; multi-hop covers HotpotQA, 2WikiMQA, MuSiQue, DROP and QUALITY; logic covers BBH, ReCLor, LSAT-AR/LR/RC, SAT-Math/EN, ANLI-R3 and MedQA; code covers MBPP+; recommendation covers Amazon-Rec.
Eighteen baselines each run at all six model configurations, giving 18×6=108 cells per benchmark. The comparison point BL is the cell most accurate on the training split, scored on the test set — which mirrors deployment, where you pick on the small sample you have and apply to a larger one.
- Prompting, 12: Direct, Direct thinking, Chain-of-thought, Self-consistency, Monte-Carlo vote, Shortlist vote, Least-to-most, Self-refine, Self-discover, Tree of thoughts, Reflexion, CoVe
- Agentic, 6: Vanilla agent, Agent with code, Chain-of-agents, Multi-agent debate, MetaGPT, AutoGen
Strategist wins 24 of 30, ties on 2 (MBPP+, MinervaM), trades accuracy for cost on 2 (MedQA, AIME) and loses on 2 (HotpotQA and COPA, equal accuracy but 9% and 6% higher cost). It cuts weighted cost by more than 2% on 26 of 30, and stays within 2 accuracy points or better on 28. On average accuracy moves 74.0% to 74.7% while cost falls 39%, a mean per-benchmark cost ratio of 0.61×.
| Benchmark | Ours acc. | BL acc. | Δ accuracy | Δ cost |
|---|---|---|---|---|
| ReCLor | 83.5 | 85.0 | -1.8% | -34.2% |
| SAT-EN | 86.5 | 86.5 | 0.0% | -55.6% |
| TriviaQA | 50.5 | 46.0 | +9.8% | -60.0% |
| MATH500 | 94.5 | 92.5 | +2.2% | -22.6% |
| BoolQ | 85.5 | 73.5 | +16.3% | +3103% |
| SIQA | 77.5 | 73.5 | +5.4% | +337% |
| OpenBookQA | 94.5 | 93.0 | +1.6% | -49.2% |
| PIQA | 89.0 | 87.5 | +1.7% | -64.5% |
| QUALITY | 79.5 | 78.5 | +1.3% | +7.4% |
| DROP | 72.5 | 61.5 | +17.9% | +92.4% |
The table shows the 10 held-out benchmarks under one-shot retrieval. Two rows deserve a second look: BoolQ gains 16.3 accuracy points while cost rises 31-fold, and SIQA gains 5.4 points while cost rises 337%. Accuracy gains and cost penalties are not the same curve here, and a bare win count hides that.
Does the strategy survive a new task or a new model
Whether the library pays off shows up when search is switched off. On the 10 held-out benchmarks, retrieval pulls the top-5 blueprints from the final strategies and picks one on a development set, with no search iterations at all. All 10 land within 2 points of the strongest baseline, 8 beat it outright, and the average moves from 77.8% to 81.4%.
Moving models works too. The same strategies dropped onto GPT-5 and Gemini-2.5, unchanged, still beat the baselines. Reported examples include AQuA-RAT gaining 189% relative accuracy on GPT-5 at 86.5% lower cost, and 2WikiMQA gaining 260% relative accuracy on Gemini-2.5 at 72.0% lower cost. Those are relative shifts on low baselines, so read them as direction, not as absolute points.
The reason transfer works is that the library stores structure, not prompts. How many steps a strategy has, how it branches and which step uses a large model are model-agnostic; prompts are not, and they get refilled on every use.
Where this method does not apply
- It needs an environment that actually runs and scores. Without a scorer, step three cannot start.
- It needs a small development set per task; this is not zero-shot.
- The main experiments only use Qwen3 at 0.6B, 1.7B and 4B; larger models are untested.
- The designer itself is GPT-6 invoked through Codex CLI, and its search cost is not inside the 0.61× figure. The 39% refers to task-side inference cost, not the full bill.
- Failures are explicit: HotpotQA and COPA match accuracy at 9% and 6% higher cost, and MedQA and AIME trade accuracy for cost.
- Library transfer is structural transfer, not strategy transfer; swap the model or the task and the prompts must be rewritten.
So the boundary is clear. The method fails when a task has no scalable automatic grader, when there are not a few dozen samples you can rerun, or when you only ever do the task once. It applies when you plan to do many tasks of the same family and can afford to measure [1].
