Research log Small Model Experimentation
GitHub

Qwen3.5-4B Foofah Adaptive Program Budget Router

A cheap shape check beats running every program

The one idea you need

Picture a returns desk that opens a package for full inspection only when the box comes back lighter than it shipped, a weight drop hinting something inside went missing. Here the quick answer having fewer columns than the input table is that lighter box, triggering the slow repair programs.

The question

Can a cheap rule decide when a small model should run its slow, expensive extra program attempts on a table task, instead of always running them?

What we found

Yes, and here is the twist: running all five programs on every task scored lower (56%) than the cheap rule (58%), because blanket spending overwrote one answer the quick pass already had right. The rule fires only when the quick answer has fewer columns than the input, flagging exactly the hard cases, beating the quick answer's 42% and tying a perfect-hindsight ceiling at half the compute.

Why it matters

Before training a learned judge, check whether your expensive fallback's wins cluster behind one cheap, visible signal; a hand-written trigger may match the best achievable accuracy. And beware: running every tool everywhere can clobber correct answers, not just waste compute.

Quick answer alone vs. the routed rule42% → 58%exactly correct answers on 50 table-transformation tasks
Running all five programs on every task56%below the rule's 58%, at double the compute
Compute per task, run-everything vs. rule17,801 → 9,017 tokensthe rule spends about half while scoring higher
Wrong answers fixed vs. broken by the rule8 fixed, 0 brokencaptured every available fix with no losses
On this page
  1. Results at a glance
  2. Overview
  3. Report
    1. Summary
    2. Headline Test Result
    3. Pilot Selection
    4. Test Family Breakdown
    5. Pareto Readout
    6. Figures
    7. Interpretation
    8. Limitations
  4. Experiment log
  5. Figures
  6. Data files
  7. Reproduce
  8. Related

Results at a glance 7

Cheap rule ties perfect hindsight and beats running everything

How to read

Bars show exactly-correct accuracy on 50 tasks for four policies: quick answer only (42%), running all five programs everywhere (56%), the cheap shape rule (58%), and a perfect-hindsight policy that runs programs only when they help (58%). Taller is better.

0%20%40%60%direct JSON onlydirect JSON only42%full fixed portfolio (5 programs)full fixed portfolio (5 programs)56%adaptive shape routeradaptive shape router58%oracle (run programs only when helpful)oracle (run programs only when he…58%

Takeaway → The cheap rule reaches the perfect-hindsight ceiling and edges past run-everything, while the quick answer trails far below, so selective spending beats blanket spending.

Data table
policytest accuracy (50 tasks)
direct JSON only42%
full fixed portfolio (5 programs)56%
adaptive shape router58%
oracle (run programs only when helpful)58%

Numbers from reports/report.md table; verified against reports/decisions/*.json

Technical framing

Adaptive shape router matches the oracle ceiling at a fraction of the fixed portfolio's cost — The pilot-selected router (run programs when direct output loses columns) hits the 58% oracle ceiling; always-run-everything gets 56%.

Compute spent per task by each of the four policies

How to read

Bars show average tokens per task for the same four policies: quick answer cheapest at 1,478, run-everything priciest at 17,801, the shape rule in between at 9,017, perfect-hindsight lowest among spenders at 3,959. Shorter is better.

050001k15k2kdirect JSON onlydirect JSON only1478full fixed portfolio (5 programs)full fixed portfolio (5 programs)17.8kadaptive shape routeradaptive shape router9017oracle (run programs only when helpful)oracle (run programs only when he…3959

Takeaway → The rule costs about half of run-everything yet scores higher, and the perfect-hindsight bar shows even more compute could still be shaved.

Data table
policyavg tokens per task
direct JSON only1478
full fixed portfolio (5 programs)17.8k
adaptive shape router9017
oracle (run programs only when helpful)3959

Numbers from reports/report.md table

Technical framing

Token cost per task for the same policies — The adaptive router spends about half the tokens of the fixed portfolio while beating its accuracy; the oracle shows further headroom.

Fixed budgets never catch the selective rule

How to read

A rising line tracks accuracy as 0 to 5 programs are forced on every task, climbing from 42% to 56%; a flat reference line marks the shape rule at 58%. Higher is better.

40%45%50%55%60%024adaptive shape routeradaptive shape ro…fixed budget (first-visible commit)fixed budget (fir…

Takeaway → The always-run line climbs then stalls at 56%, always under the rule's 58%, so spending the whole budget blindly cannot match spending it selectively.

Data table
Number of program strategies always runfixed budget (first-visible commit)adaptive shape router
042%58%
150%
252%
354%
454%
556%58%

Numbers from reports/decisions/direct_only.json, prefix1-5_first_visible.json, shape_direct_out_cols_less_new_in_all_first_visible.json

Technical framing

Fixed program budgets: accuracy saturates below the adaptive router — Spending the whole 5-program budget on every task never reaches the 58% the adaptive router gets by spending it selectively.

All the gains come from just two task families

How to read

Paired bars per task family (five tasks each) compare quick answer against the shape rule across ten families. Higher is better. Two families jump from 0 to 80%; every other family is unchanged.

0%25%50%75%100%agricultureagriculture80%80%crime_data_wranglercrime_data_wrangler0%0%potters_wheel_merge_splitpotters_wheel_merge_split0%80%potters_wheel_unfoldpotters_wheel_unfold40%40%potters_wheel_unfold2potters_wheel_unfold20%0%proactive_wrangling_foldproactive_wrangling_fold100%100%synthetic_12synthetic_12100%100%synthetic_25synthetic_2580%80%synthetic_48synthetic_4820%20%synthetic_8synthetic_80%80%

Takeaway → All eight rescues cluster in the merge/split and one synthetic family, and the rule never dents a family the quick answer already solved.

Data table
task family (5 tasks each)direct JSON onlyadaptive shape router
agriculture80%80%
crime_data_wrangler0%0%
potters_wheel_merge_split0%80%
potters_wheel_unfold40%40%
potters_wheel_unfold20%0%
proactive_wrangling_fold100%100%
synthetic_12100%100%
synthetic_2580%80%
synthetic_4820%20%
synthetic_80%80%

Numbers from reports/report.md family breakdown table

Technical framing

Where the router's gains come from: per-family test accuracy — All eight recoveries are concentrated in two families (merge/split and synthetic_8); the router never hurts a family the direct answer already solves.

Trying one program first barely helps

How to read

Paired bars per program strategy compare running that strategy alone against a version that escalates only when its answer disagrees with the quick answer. Higher is better; all bars sit between 42% and 50%.

0%20%40%60%verified_structuralverified_structural50%50%cell_parsercell_parser42%42%row_column_rulerow_column_rule50%50%header_awareheader_aware42%44%split_fold_unpivotsplit_fold_unpivot50%50%

Takeaway → Escalating after one program adds at most two points, and no single-strategy approach reaches the shape rule's 58%.

Data table
Program strategySingle strategy onlyCanary: escalate on disagreement
verified_structural50%50%
cell_parser42%42%
row_column_rule50%50%
header_aware42%44%
split_fold_unpivot50%50%

Numbers from reports/final_summary.json (test_metrics: single_* and canary_*_disagree_escalate accuracy)

Technical framing

Paying for one program strategy first (canary) barely beats running it outright — Canary escalation adds at most 2pp over the lone strategy and every variant stays below the shape router's 58%.

Requiring programs to agree lowers accuracy at every budget

How to read

Grouped bars at three portfolio sizes compare committing to the first plausible program against requiring two or three programs to agree. Higher is better; the agreement bars are shortest.

0%20%40%60%3-strategy prefix3-strategy prefix54%46%42%4-strategy prefix4-strategy prefix54%46%44%5-strategy prefix5-strategy prefix56%48%48%

Takeaway → Demanding agreement drops accuracy 8 to 12 points versus trusting the first plausible program, so consensus voting throws away correct lone answers.

Data table
Fixed portfolio budgetFirst visible-consistent commitConsensus of 2Consensus of 3
3-strategy prefix54%46%42%
4-strategy prefix54%46%44%
5-strategy prefix56%48%48%

Numbers from reports/final_summary.json (test_metrics: prefix*_first_visible, prefix*_consensus2, prefix*_consensus3 accuracy)

Technical framing

Requiring consensus among program candidates hurts accuracy at every budget — Demanding agreement between program outputs drops accuracy by 8-12pp versus committing to the first visible-consistent program.

Looser trigger rules pay far more compute for the same accuracy

How to read

Bars show total tokens over 50 tasks for six trigger rules, from the tightest fewer-columns rule (231,365) to always-run (890,030). Shorter is better; the five selective rules all score 29 of 50, or 58%.

025k5k75k1Mvisible out has fewer colsvisible out has fewer cols231.4kdirect out cols < new inputdirect out cols < new input450.9kfewer cols or direct mismatchfewer cols or direct mismatch516.5kvisible cols changevisible cols change699.2kany visible shape changeany visible shape change814.1kalways run portfolioalways run portfolio89k

Takeaway → The five selective triggers tie at 58% accuracy while the loosest costs about three and a half times the tightest, so trigger precision is what saves compute.

Data table
Shape trigger ruleTotal forward tokens (50 tasks)
visible out has fewer cols231.4k
direct out cols < new input450.9k
fewer cols or direct mismatch516.5k
visible cols change699.2k
any visible shape change814.1k
always run portfolio89k

Numbers from reports/final_summary.json (test_metrics: shape_* total_forward_tokens)

Technical framing

Looser shape triggers reach the same 29/50 accuracy at up to 3.5x the token bill — The five selective triggers all score 29/50; only 'always' slips to 28/50 while paying the full 890k-token portfolio cost.

In the author’s words from the Report · “Summary”

This experiment evaluates whether a cheap deployable router can decide when to spend the executable-program portfolio budget for Foofah-style table transformations. The router is selected only on pilot data and then frozen for test. Pilot-selected router: direct_out_cols_less_new_in. It runs when the direct JSON output has fewer columns than the new input table; otherwise it returns the direct JSON output.

Overview

This standalone package evaluates adaptive budget policies over a fixed Foofah-style table-transformation candidate pool. Each task has one direct JSON completion and five executable-program strategy completions. The experiment asks whether a cheap deployable router can decide when the expensive program portfolio is worth running.

Primary comparison:

  • Direct JSON only.
  • Fixed program budgets: prefixes of the five-strategy portfolio.
  • Adaptive public-shape router selected on pilot data and frozen on test.
  • Canary routers that pay for one program strategy before deciding whether to escalate.
  • Nondeployable oracle diagnostics.

Run:

python scripts/eval_adaptive_router.py \
  --root /workspace/experiments/qwen35_4b_foofah_adaptive_program_budget_router

Outputs are written under reports/.

Report

Rendered from reports/report.md

Summary

This experiment evaluates whether a cheap deployable router can decide when to spend the executable-program portfolio budget for Foofah-style table transformations. The router is selected only on pilot data and then frozen for test.

Pilot-selected router: direct_out_cols_less_new_in. It runs when the direct JSON output has fewer columns than the new input table; otherwise it returns the direct JSON output.

Headline Test Result

PolicyExactAccuracyTokensAvg tokens/taskProgram commitsRecoveriesLossesCommit precision
direct_only21/5042.0%73,9111478000n/a
shape_direct_out_cols_less_new_in_all_first_visible29/5058.0%450,8539017880100.0%
shape_visible_out_less_cols_all_first_visible29/5058.0%231,3654627880100.0%
prefix5_first_visible28/5056.0%890,03017801238178.3%
oracle_budget_run_all_only_on_helpful_tasks29/5058.0%197,9513959880100.0%
oracle_best_available_full_budget29/5058.0%890,03017801880100.0%

The pilot-selected adaptive router matches the hidden oracle union accuracy on this test set while using fewer tokens than the full fixed portfolio. It recovers eight direct misses with no direct-correct losses.

The best observed deployable diagnostic is shape_visible_out_less_cols_all_first_visible at 29/50 (58.0%) with 231,365 tokens. Treat this as a test-set diagnostic, not the preselected primary router.

Pilot Selection

Variant order selected on pilot train: verified_structural, cell_parser, row_column_rule, header_aware, split_fold_unpivot. Shape trigger selected on pilot dev: direct_out_cols_less_new_in.

TriggerPilot train exactPilot dev exactPilot dev tokensPilot dev losses
direct_out_cols_less_new_in8/305/1021,6320
visible_out_less_cols9/305/1034,8870
visible_less_cols_or_direct_mismatch9/305/1048,4400
visible_cols_change11/305/1058,6850
visible_cols_change_or_direct_mismatch11/305/1058,6850
never9/304/105,2350
direct_parse_fail9/304/105,2350
visible_out_more_rows9/304/1016,7370

Test Family Breakdown

FamilynDirectAdaptiveRecoveriesLossesProgram commitsTokens
agriculture54/54/50005,453
crime_data_wrangler50/50/5000233,360
potters_wheel_merge_split50/54/540421,126
potters_wheel_unfold52/52/500012,913
potters_wheel_unfold250/50/50001,409
proactive_wrangling_fold55/55/50001,708
synthetic_1255/55/500011,102
synthetic_2554/54/50009,942
synthetic_4851/51/50002,242
synthetic_850/54/5404151,598

Pareto Readout

Deployable policies on the accuracy/token Pareto frontier:

  • shape_visible_out_less_cols_all_first_visible: 29/50 (58.0%), 231,365 tokens
  • prefix1_first_visible: 25/50 (50.0%), 214,562 tokens
  • direct_only: 21/50 (42.0%), 73,911 tokens

Figures

Accuracy vs tokens

Budget curve

Family accuracy

Trigger selection

Interpretation

The experiment finds a simple, deployable budget rule rather than a learned judge. Public and direct-output table-shape signals identify the cases where the executable-program portfolio is worth its cost. On the test set, the pilot-selected rule triggers on 15 tasks, commits a program on eight of them, and captures every direct-miss recovery available to the fixed portfolio without taking the fixed portfolio's one direct-correct loss.

The result is an efficiency win, not a claim that the candidate pool contains more hidden-correct outputs than the full portfolio. The nondeployable oracle diagnostics show the available ceiling in this recorded pool. The adaptive router reaches that ceiling because the useful program cases are concentrated in a public structural signature.

Limitations

  • The policy is selected from a small pilot split and evaluated on 50 test tasks; the trigger should be re-run across additional family splits.
  • This is an offline router over a recorded candidate pool. It charges only the candidates each policy would generate, but it does not regenerate model outputs.
  • The router relies on visible table-shape structure; it may not transfer to transformations where useful program candidates are not aligned with column contraction.

Experiment log 1

Show the running log (1 entry, 2026-06-28)

2026-06-28

  • Created standalone package with copied Foofah candidate-pool records and task cases.
  • Planned an offline adaptive-budget router evaluation over direct JSON outputs plus five executable-program strategies.
  • Primary policy selection is restricted to pilot data. Test labels are reserved for final evaluation.

Figures 4

budget curve
budget curve · reports/figures/
family accuracy
family accuracy · reports/figures/
policy pareto
policy pareto · reports/figures/
trigger selection
trigger selection · reports/figures/

Data files 1

Result tables and metrics copied from the experiment folder — preview inline or open the raw file.

Reproduce

Run steps are documented inside the experiment folder (README and scripts).

Browse the experiment folder on GitHub ↗