Exit 9

From the research to the code

Nothing in the method is new. Each part comes from published work, and each card says what was taken, where it lives in the code and what it produces here.

The question

What is being tested, and on what

Send work to a cheaper model

The source says
  • Chen et al., 2023. FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance Describes LLM cascades that send queries to cheaper models first; relates to the hypothesis that moving the delegate lane to a small model lowers cost per task.
  • Ong et al., 2024. RouteLLM: Learning to Route LLMs with Preference Data Studies routing between a strong and a weak model to trade cost against quality; relates to the two arms, which fix the delegate lane to the frontier model or to the small model.
  • Aggarwal et al., 2023. AutoMix: Automatically Mixing Language Models Routes queries from a smaller to a larger model based on a self-check of the smaller model's answer; relates to the cost-versus-solve-rate trade-off the experiment measures.
  • Ding et al., 2024. Hybrid LLM: Cost-Efficient and Quality-Aware Query Routing Routes each query to a small or a large model according to predicted difficulty and a quality target; relates to the choice of model for the delegate lane.
What we took
The hypothesis: moving the delegate lane to a small model lowers the cost per task. Here the routing is fixed per arm, so one switch can be tested.
What it produces here
Mean cost per task −56.7%, interval −67.1% to −42.9%.

Split planning from execution

The source says
  • Xu et al., 2023. ReWOO: Decoupling Reasoning from Observations for Efficient Augmented Language Models Detaches the model's planning from tool execution and observations, with a planner handing steps to workers; relates to the agent's split between the planner (main lane) and the worker (delegate lane).
What we took
The agent's two lanes: a planner that reads, edits and decides, and a worker that runs the shell and reports back as short findings.
Where it lives
harness/agent.py
What it produces here
The worker lane took 62.5% of control's cost and 11.5% of lanes_v1's.

Real issues, graded by the repository's tests

The source says
  • Jimenez et al., 2023. SWE-bench: Can Language Models Resolve Real-World GitHub Issues? arXiv:2310.06770; ICLR 2024 Defines the task format (a real GitHub issue, graded by the repository's tests) behind the `task_solved` outcome.
  • Zhang et al., 2025. SWE-bench Goes Live! arXiv:2505.23419; NeurIPS 2025 Datasets and Benchmarks Track Describes SWE-bench-Live, the continuously updated benchmark family the experiment's tasks come from.
  • Li et al., 2026. RepoLaunch: Automating Build and Management of Code Repositories across Languages and Platforms The reference the SWE-bench-Live site gives for the MultiLang set, which is the task pool used here.
What we took
The unit of the experiment and its outcome: one issue is one task, and it counts as solved only when the repository's own tests say so in a fresh container.
Where it lives
runner/grading.py
What it produces here
472 attempts graded from 1,762,767 test results, across 67 repositories.

Models may have seen the tasks

The source says
  • Liang et al., 2025. The SWE-Bench Illusion: When State-of-the-Art LLMs Remember Instead of Reason Reports evidence that models memorise SWE-bench tasks; relates to the use of a regularly refreshed task source.
What we took
Two tiers: tasks created after the models' training cutoff, and older ones. They are reported separately, and the fresh tier is the registered pool.
Where it lives
tasks/select_tasks.py
What it produces here
Fresh tier alone: solve rate −12.5 pp, mean cost −55.7%.

The experiment

How the comparison is kept fair

A controlled experiment on the live system

The source says
  • Kohavi et al., 2020. Trustworthy Online Controlled Experiments: A Practical Guide to A/B Testing General reference for the experiment design: randomisation unit, guardrail metrics, sample ratio mismatch and checks on whether a result can be trusted.
  • Tang et al., 2010. Overlapping Experiment Infrastructure: More, Better, Faster Experimentation Describes Google's infrastructure and processes for running many experiments on a live system; relates to using the flag platform as the assignment mechanism for the two arms.
  • Flagsmith, n.d.. Experimentation (Beta) Documentation for the platform feature the experiment runs on: a multivariate flag, exposure and conversion events, and a Bayesian results engine.
  • Flagsmith, n.d.. Rollout by Percentage Describes how an identity is hashed to a value between 0 and 1 and compared with a percentage split; relates to the offline re-derivation of each task's arm (the per-identity behaviour of multivariate flags is described at https://docs.flagsmith.com/managing-flags/core-management).
What we took
The design: one randomisation unit (the task), a primary metric and a guardrail, and assignment by the flag platform, never by the runner.
Where it lives
harness/policy.py
What it produces here
146 of 146 recorded arms match Flagsmith's flag-engine 11.1.2, run offline on the saved environment.

Check the split came out as designed

The source says
  • Fabijan et al., 2019. Diagnosing Sample Ratio Mismatch in Online Controlled Experiments: A Taxonomy and Rules of Thumb for Practitioners Relates to the sample-ratio check (chi-square test on the arm counts) reported with the results.
What we took
A chi-square test on the arm counts against the 50/50 split. A flagged mismatch stops the result from being acted on.
Where it lives
analysis/analyse.py
What it produces here
Chi-square 0.338, p = 0.561: not flagged.

Do not stop on a good reading

The source says
  • Johari et al., 2017. Peeking at A/B Tests: Why it matters, and what to do about it Shows how continuous monitoring of a running test invalidates fixed-horizon inference; relates to the pre-registered rule of no early stopping.
  • Deng et al., 2016. Continuous Monitoring of A/B Tests without Pain: Optional Stopping in Bayesian Testing Discusses Bayesian inference for A/B tests and its behaviour under optional stopping; relates to stating the verdict as a posterior probability.
What we took
The stopping rule: the run continues until every task is done, excluded or invalid. The live board shows totals; the decision is read once, at the end.
What it produces here
The decision was read once, on 145 analysed tasks, after the last one finished.
Cost: first below 0.05
task 72 of 145
Cost: at the end
p <0.001
Cost: interval at the end
−$0.0709 to −$0.0172
Solve rate: below 0.05
never (p 0.630)
When the board went public (94 tasks in)
cost p 0.012, solve p 0.630

Added after experiment 1 and labelled secondary; it did not enter the decision. An always-valid p-value stays valid however often it is looked at, so it answers the question a live board raises. The cost reading crossed the line and holds under continuous watching; the solve-rate reading never crossed in either direction. Method: mSPRT, normal mixing distribution N(0, tau^2), plug-in variance.

The always-valid p-value for cost and for solve rate, task by task, against the 0.05 line.
analysis/charts/exp1-always-valid.png, drawn by the analysis, not for the site.

Write the plan down first

The source says
  • Nosek et al., 2018. The preregistration revolution Relates to registering the hypothesis, metrics and decision rule, and publishing their hash, before the first task ran.
  • Gelman & Loken, 2013. The garden of forking paths: Why multiple comparisons can be a problem, even when there is no "fishing expedition" or "p-hacking" and the research hypothesis was posited ahead of time Describes how analysis choices made after seeing the data act as researcher degrees of freedom; relates to fixing the analysis plan and exclusion rules in advance.
What we took
The hypothesis, metrics, margin, exclusions and decision rule in one file, hashed and tagged before the first task. A change goes in a separate hashed amendment.
Where it lives
prereg/HASHES.txt
What it produces here
sha256 44d715bd6bd7f858…, tag prereg-exp1; all three registered conditions held.
Specifications run
72
Cost per solved task lower
72 of 72
Its change, across all of them
−70.3% to −31.2%
Guardrail passes
48 of 72
Guardrail fails
24, all on the fresh tier alone
Guardrail probability, lowest to highest
77.9% to 99.2%

The forking paths, walked on purpose: every combination of 2 choices of attempt, 3 choices of cost stat, 2 choices of outliers, 2 choices of prior, 3 choices of task set. The registered analysis is one of the 72. The cost finding does not depend on the choice. The solve-rate check does: it fails in every specification that uses the fresh tier alone (24 of 24) and in none of the others. Added after experiment 1 and labelled secondary.

The change in cost per solved task under each of the specifications, sorted, with the analysis choices marked beneath.
analysis/charts/exp1-specification-curve.png, drawn by the analysis, not for the site.

The analysis

How the result is read

Report cost with accuracy

The source says
  • Kapoor et al., 2024. AI Agents That Matter Argues that agent evaluations should report cost alongside accuracy; relates to the primary outcome, dollars per solved task.
What we took
The primary outcome is dollars, not a score: mean cost per task and cost per solved task, beside the solve rate.
Where it lives
analysis/analyse.py
What it produces here
Cost per solved task $0.1753 for control, $0.0837 for lanes_v1.
Mean cost per task and solve rate of every arm that has run, with the frontier marked
ArmTasksMean costSolve rateOn the frontier
pilot control9$0.114355.6%no: another arm is cheaper and solves more
pilot lanes_v19$0.072344.4%no: another arm is cheaper and solves more
exp1 control76$0.078444.7%no: another arm is cheaper and solves more
exp1 lanes_v169$0.034040.6%no: another arm is cheaper and solves more
rollout lanes_v113$0.036953.8%yes
exp2 control (lanes_v1 policy)67$0.041462.7%yes
exp2 lanes_v277$0.035050.6%no: another arm is cheaper and solves more
exp3 control61$0.067854.1%no: another arm is cheaper and solves more
exp3 lanes_v160$0.031251.7%yes

3 of 9 arms are on the frontier. This reading is descriptive: batches ran on different task pools (pilot, exp1, rollout, exp2), so comparisons across batches are descriptive; only arms within one experiment were randomised.

Cost against solve rate for every arm that has run, with the frontier marked.
analysis/charts/frontier.png, drawn by the analysis, not for the site.

A margin for 'not worse'

The source says
  • U.S. Food and Drug Administration, 2016. Non-Inferiority Clinical Trials to Establish Effectiveness: Guidance for Industry Relates to the solve-rate guardrail, which is a non-inferiority test against a margin fixed before the experiment.
What we took
The solve-rate guardrail is a non-inferiority test: the challenger passes if its solve rate is not lower by more than a margin fixed before the run.
What it produces here
Margin 20 points; probability the drop is within it 97.7%, against a bar of 90.0%.

A posterior for each solve rate

The source says
  • Gelman et al., 2013. Bayesian Data Analysis (3rd ed.) Textbook treatment of the Beta prior with binomial data; relates to the Beta(1,1) posterior on each arm's solve rate and the posterior probability used in the decision rule.
What we took
A Beta(1,1) prior with binomial data for each arm, and 200,000 draws for the difference.
Where it lives
analysis/analyse.py
What it produces here
Solve-rate difference −4.2 pp, posterior interval −19.8 pp to +11.8 pp.

Intervals by resampling

The source says
  • Efron & Tibshirani, 1994. An Introduction to the Bootstrap Relates to the percentile bootstrap intervals reported for mean cost, cost per solved task and their differences between arms.
What we took
Percentile bootstrap intervals for mean cost, cost per solved task and their differences, since cost per task is skewed.
Where it lives
analysis/analyse.py
What it produces here
10,000 resamples; cost per solved task changed −52.2%, interval −71.1% to −22.3%.

Use what was known before

The source says
  • Deng et al., 2013. Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-Experiment Data Source of CUPED, the covariate adjustment used in the secondary analysis.
What we took
CUPED, a covariate adjustment from pre-experiment data, as a secondary analysis that is labelled as such and never enters the decision.
Where it lives
analysis/analyse.py
What it produces here
Variance reduced by 3.4%.

The record

How anyone can check it

Chain every record to the one before

The source says
  • Haber & Stornetta, 1991. How to time-stamp a digital document Describes linking each record to the hash of the one before it; relates to the hash-chained run ledger.
  • Crosby & Wallach, 2009. Efficient Data Structures for Tamper-Evident Logging Covers hash-chain and tree-based logs that an auditor can check; relates to the ledger verification script.
What we took
The run ledger: each record's hash includes the previous record's hash, so an edit or a deletion breaks every hash after it.
Where it lives
integrity/ledger.py
What it produces here
1,313 chained records across 17 runs, all verified on every push. Check one yourself.

One root over every finished task

The source says
  • Merkle, 1988. A Digital Signature Based on a Conventional Encryption Function The paper commonly cited for hash trees (Merkle trees); relates to the Merkle root computed over the run's `task_done` records.
  • Laurie et al., 2013. Certificate Transparency Specifies an append-only public log built on a Merkle tree; relates to publishing a root hash that others can recompute.
What we took
A Merkle root over the task records, published with the results, so anyone holding the ledger can rebuild it, and one task can be proved to be under it.
Where it lives
integrity/merkle.py
What it produces here
Root 7ed364648c7513ef… over 146 finished tasks of experiment 1. Prove one task.
exp1: proofs that verify
146 of 146
exp1: longest path
8 hashes
exp2: proofs that verify
146 of 146
exp2: longest path
8 hashes
rollout: proofs that verify
13 of 13
rollout: longest path
4 hashes

One inclusion proof per task is exported with the analysis (analysis/out/proofs). Each is the task's hash and at most 8 neighbours; the verify page checks any of them in your browser.

The full list, with how each entry was checked, is docs/references.md. How this differs from common practice is on the comparison page.

Part 2

The paper and the deck

Experiment 1, written up twice: a paper to read and a deck to present. Read the short version here or take the PDFs.

Abstract

Fork in the Bill: a pre-registered feature-flag experiment on a coding agent's model routing

A coding agent spends many of its tokens on work that needs little judgement: searching a repository, reading long files, running tests and reading the log. We asked whether moving that work from a frontier model to a small one lowers the dollars spent per solved task. The agent has two lanes. A planner on Claude Sonnet 5.5 decides and edits, and a worker lane does the grunt work. In the control arm the worker is also Sonnet; in lanes_v1 it is Claude Haiku 5.5. Flagsmith assigned every task to an arm through an experiment on one multivariate flag, recorded the exposure, received the outcome events and computed the verdict our decision rule reads. The hypothesis, metrics, margin and decision rule were hashed, tagged and pushed before the experiment started. On 76 control and 69 lanes_v1 SWE-bench-Live tasks, the small worker changed mean cost per task by −56.7% and cost per solved task from $0.1753 to $0.0837. The solve rate moved from 44.7% to 40.6%, a difference of −4.2 pp with a posterior interval of −19.8 pp to +11.8 pp. All three pre-registered conditions held, so lanes_v1 shipped. Every recorded arm was re-derived offline from Flagsmith's own evaluation engine, and every figure in this paper is filled from one JSON file and checked by script. The experiment rules out large solve-rate losses only; a drop of a few points would go undetected at this size. A registered replication on 61 control and 60 lanes_v1 tasks that no earlier run had used gave the same decision: cost per solved task changed by −51.7% and the solve rate by −2.4 pp, and the decision was applied in Flagsmith by script.

Figures

The figures, as the analysis drew them

Made by analysis/charts.py from the run's own records. Nothing is redrawn for the site.

Cost per solved task by arm, with bootstrap intervals.
Cost per solved task by arm, with bootstrap intervals.
Distribution of cost per task by arm.
Distribution of cost per task by arm.
Solve-rate posteriors for each arm under a flat prior.
Solve-rate posteriors for each arm under a flat prior.
Solve rate by difficulty tertile.
Solve rate by difficulty tertile.
Solve rate by language.
Solve rate by language.
Solve rate by the month the task was created.
Solve rate by the month the task was created.
Always-valid p-values for mean cost and solve rate, in the order tasks finished.
Always-valid p-values for mean cost and solve rate, in the order tasks finished.
Mean cost per task against solve rate for every arm, with bootstrap intervals. Filled points are on the frontier.
Mean cost per task against solve rate for every arm, with bootstrap intervals. Filled points are on the frontier.
Specification curve. Top: change in cost per solved task with bootstrap intervals, sorted. Middle: the guardrail posterior against its bar. Bottom: the choices behind each specification. The diamond is the registered analysis.
Specification curve. Top: change in cost per solved task with bootstrap intervals, sorted. Middle: the guardrail posterior against its bar. Bottom: the choices behind each specification. The diamond is the registered analysis.
Experiment 1, experiment 3 and the pooled estimate on both registered metrics
Experiment 1, experiment 3 and the pooled estimate on both registered metrics

Scope

What the evidence covers

The margin was set after the pilot. m = 20 points was chosen with the pilot's numbers in view (section 3.7), before any experiment task ran. The guardrail rules out large losses only, and the point estimate leans toward a small loss.

The amendment changed the population mid-registration. It added pre-cutoff tasks that the models may have seen in training. Assignment is random, so contamination affects both arms alike in expectation, but it can raise absolute solve rates. The amendment was written after three tasks had finished, on counts only.

One harness, one model pair, one stratum. The planner has no shell by design (D18). The tasks are small changes (at most 3 files and 60 lines) in eight non-Python languages. Other model pairs, a stronger planner, larger changes or an agent that does its own grunt work could behave differently.

Prices. All calls went to one provider at list prices on one date. Cached-token prices and price changes move the dollar figures, though not the token shares.

Platform. Flagsmith's experimentation feature is in beta and its results response is not documented. analysis/pull_results.py parses the shape seen on Flagsmith Cloud and saves every raw response for re-checking.

Repeated attempt. One identity ran twice (section 4); the analysis keeps its last attempt. Both attempts were in the same arm and both failed, so the choice does not change any rate.

Conclusion

In short

With the planner fixed on Sonnet 5.5, moving the worker lane to Haiku 5.5 cut the cost per solved task from $0.1753 to $0.0837 on real SWE-bench-Live tasks. The solve rate changed by −4.2 pp at the point estimate, inside a margin that rules out large losses but not small ones. Flagsmith chose every arm, its verdict and our replication agree on cost to within a hundredth of a cent, and every assignment re-derives offline. The winner now runs as the flag's value. A fresh batch ran on it with no code change; a draft-review prompt for the worker (experiment 2) lost and was not shipped; and the same question asked again on unused tasks (experiment 3) gave the same answer, about half the cost per solved task with the solve-rate check passed.

The results, figure by figure

The latest release is v1.0.0, with the code and the run records. Every figure in the paper is filled from one JSON file and checked by a script.