Research log Small Model Experimentation
GitHub

Qwen3.5-4B Adaptive Tool Controller

Knowing when tools help beats running them all

The one idea you need

Picture a data clerk reshaping spreadsheets, usually answering by eye. One tell flags the hard cases: when her quick answer has fewer columns than the raw data holds, real restructuring is needed, so she runs a scripted tool instead of guessing.

The question

When a small model can answer a table task directly or run a slower program, can one simple rule decide when the program is worth the extra cost?

What we found

Partly. One structural cue — does the direct answer have fewer columns than the raw data implies? — safely flags the reshaping tasks where a program helps, lifting accuracy from 42% to 50% with zero broken tasks. But it captures only half the gain; the full 58% ceiling needs a slightly broader set of tool calls, not one cheap program.

Why it matters

Before wiring an expensive tool loop into a small-model system, look for one cheap structural signal that predicts when the tool actually helps, and route on it. Firing every tool by default costs many times more and gains nothing extra.

Accuracy from direct answering to cued tool routing42% → 50%exact-match on 50 unseen table tasks
Ceiling any policy reached58%hit by a fixed shape rule and a perfect-hindsight a perfect chooser
Tool calls that helped versus hurt4 helped, 0 hurtevery tool the router fired paid off
Extra compute from running every toolabout 12x17,801 vs 1,478 tokens per task, same 58% as a cheap rule
On this page
  1. Results at a glance
  2. Overview
  3. Report
    1. Summary
    2. Held-Out Test Result
    3. Pilot Selection
    4. Family Breakdown
    5. Pareto Frontier
    6. Figures
    7. Interpretation
    8. Limitations
  4. Experiment log
  5. Figures
  6. Data files
  7. Reproduce
  8. Related

Results at a glance 3

Accuracy of each tool-use policy on the test tasks

How to read

Bars give exact-match accuracy over 50 test tasks, one per policy: answer directly, the learned one-cue controller, the best fixed shape rule, and two perfect-hindsight oracles. Taller is better; the oracles mark the 58% ceiling.

0%20%40%60%direct onlydirect only42%learned controllerlearned controller50%best fixed shape rulebest fixed shape rule58%oracle: tools only when helpfuloracle: tools only when helpful58%oracle: full budget, best pickoracle: full budget, best pick58%

Takeaway → The learned controller lifts 42% to 50% but stalls halfway; the fixed shape rule and both oracles reach 58%, so one cue is not enough.

Data table
Policyexact-match accuracy
direct only42%
learned controller50%
best fixed shape rule58%
oracle: tools only when helpful58%
oracle: full budget, best pick58%

Numbers from experiments/qwen35_4b_adaptive_tool_controller/reports/final_summary.json

Technical framing

Held-out accuracy: learned controller vs direct answering and diagnostics — A one-feature learned controller lifts accuracy 42% to 50% cheaply, but a fixed shape rule reaches the 58% oracle ceiling.

Accuracy versus compute cost per task

How to read

Each point plots a policy's accuracy against its average tokens per task, the compute cost. One line links the three deployable policies, another the two hindsight oracles. Up and to the left — more accuracy, less compute — is better.

40%45%50%55%60%50001k15kdeployable policiesdeployable polici…oracle reference policiesoracle reference …

Takeaway → The deployable policies climb cheaply to 58%; the full-budget a perfect chooser sits far to the right at the same 58%, so heavy extra spending buys no accuracy.

Data table
Avg forward tokens per taskdeployable policiesoracle reference policies
1.48e+0342%
2.97e+0350%
3.96e+0358%
4.63e+0358%
17.8k58%

Numbers from experiments/qwen35_4b_adaptive_tool_controller/reports/final_summary.json

Technical framing

Accuracy vs token cost: the controller is a low-cost Pareto point — Direct-only, learned controller, and the fixed shape rule form the deployable frontier; the full-budget oracle costs ~4x more for the same 58%.

Which task families the controller actually improves

How to read

Paired bars per task family, five tasks each: darker is direct answering, lighter is the learned controller. Higher is better; equal-height pairs mean tools changed nothing. Families run from structural splits to already-easy folds.

0%25%50%75%100%potters_wheel_merge_splitpotters_wheel_merge_split0%40%synthetic_8synthetic_80%40%crime_data_wranglercrime_data_wrangler0%0%agricultureagriculture80%80%proactive_wrangling_foldproactive_wrangling_fold100%100%

Takeaway → Both gains come from two split-and-reshape families rising from 0% to 40%; every other family is unchanged, so all gains sit in a narrow structural niche.

Data table
Task familydirect onlylearned controller
potters_wheel_merge_split0%40%
synthetic_80%40%
crime_data_wrangler0%0%
agriculture80%80%
proactive_wrangling_fold100%100%

Numbers from experiments/qwen35_4b_adaptive_tool_controller/reports/final_summary.json

Technical framing

Where the controller helps: per-family accuracy, direct vs controller — All controller gains come from two structural-split families; it never hurts families the direct answer already handles.

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

This experiment trains a small offline controller to choose between direct answering and external executable-program tool actions. The controller is selected on pilot train/dev records and frozen before held-out test scoring. Selected controller: Feature: direct_out_cols_less_new_in If true: single_split_fold_unpivot If false: direct_only Candidates passing train gate: 4468

Overview

This standalone experiment evaluates a small adaptive controller over a fixed table-transformation candidate pool. Each task has a direct JSON attempt and five executable-program tool attempts. The controller decides whether to stop with the direct answer or spend additional forward-token budget on tool actions.

Run:

python scripts/eval_tool_controller.py \
  --root /workspace/experiments/qwen35_4b_adaptive_tool_controller

Outputs:

  • reports/final_summary.json
  • reports/report.md
  • reports/figures/*.png
  • reports/decisions/*.json

Report

Rendered from reports/report.md

Summary

This experiment trains a small offline controller to choose between direct answering and external executable-program tool actions. The controller is selected on pilot train/dev records and frozen before held-out test scoring.

Selected controller:

  • Feature: direct_out_cols_less_new_in
  • If true: single_split_fold_unpivot
  • If false: direct_only
  • Candidates passing train gate: 4468

Held-Out Test Result

PolicyExactAccuracyTokensAvg tokens/taskProgram commitsRecoveriesLossesCommit precision
direct_only21/5042.0%73,9111478000n/a
learned_controller25/5050.0%148,4512969440100.0%
fixed_visible_out_less_cols_full_else_direct29/5058.0%231,3654627880100.0%
prefix5_first_visible28/5056.0%890,03017801238178.3%
oracle_budget_full_only_when_helpful29/5058.0%197,9513959880100.0%
oracle_best_available_full_budget29/5058.0%890,03017801880100.0%

The learned controller improves over direct answering and becomes a low-cost Pareto point. It does not reach the strongest fixed shape rule included as a diagnostic; the learned policy buys the first four recoveries cheaply, while the fixed shape rule buys the remaining four recoveries with additional tool budget.

Pilot Selection

RankFeatureTrue actionFalse actionTrain exactDev exactDev tokensDev losses
1direct_out_cols_less_new_insingle_split_fold_unpivotdirect_only9/305/106,8210
2visible_out_less_colssingle_split_fold_unpivotdirect_only9/305/109,9390
3visible_rows_changedirect_onlysingle_row_column_rule9/305/1011,3390
4visible_row_expansion_or_col_contractionsingle_split_fold_unpivotdirect_only9/305/1011,5880
5direct_out_cols_less_new_incanary_split_fold_unpivot_disagree_escalatedirect_only9/305/1013,0500
6visible_rows_changedirect_onlycanary_split_fold_unpivot_disagree_escalate9/305/1015,8720
7direct_out_cols_less_new_incanary_row_column_rule_disagree_escalatedirect_only9/305/1016,0160
8visible_out_less_colscanary_split_fold_unpivot_disagree_escalatedirect_only9/305/1016,1680
9visible_rows_changedirect_onlycanary_row_column_rule_disagree_escalate9/305/1017,1620
10visible_row_expansion_or_col_contractioncanary_split_fold_unpivot_disagree_escalatedirect_only9/305/1017,8170
11direct_out_rows_less_new_indirect_onlycanary_split_fold_unpivot_disagree_escalate9/305/1018,1140
12visible_col_expansion_or_row_contractiondirect_onlycanary_split_fold_unpivot_disagree_escalate9/305/1018,1140

Family Breakdown

FamilynDirectControllerRecoveriesLossesProgram commitsTokens
agriculture54/54/50005,453
crime_data_wrangler50/50/500566,089
potters_wheel_merge_split50/52/52045,696
potters_wheel_unfold52/52/50013,987
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/52/520540,823

Pareto Frontier

  • direct_only: 21/50 (42.0%), 73,911 tokens
  • learned_controller: 25/50 (50.0%), 148,451 tokens
  • fixed_visible_out_less_cols_full_else_direct: 29/50 (58.0%), 231,365 tokens

Figures

Pareto

Selection

Family

Action mix

Interpretation

The controller confirms that external program tools are valuable only on a narrow structural subset. A one-feature policy selected from pilot data recovers a useful low-cost slice without paying full portfolio cost on every task. The stronger fixed shape diagnostic shows that the remaining recoveries require broader portfolio calls, not just a cheaper single-tool action.

This is an orchestration result, not a generation-capability result. The controller changes how budget is allocated over already-generated tool candidates; it does not create new candidates outside the recorded pool.

Limitations

  • Offline evaluation over a fixed candidate pool; no fresh model generations are produced in this package.
  • The pilot split is small, so feature selection is unstable. The fixed shape-rule diagnostic should be validated across more held-out family splits.
  • The depth-1 controller is intentionally simple. A richer sequential controller should be trained only after this signal replicates under regenerated candidates.

Experiment log 1

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

2026-06-28

  • Created standalone adaptive tool-controller package.
  • Copied fixed candidate-pool and task records into data/.
  • Planned an offline learned-controller evaluation with pilot train/dev policy selection and held-out test scoring.

Figures 4

action mix
action mix · reports/figures/
controller pareto
controller pareto · reports/figures/
controller selection
controller selection · reports/figures/
family accuracy
family accuracy · 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 ↗