Research log Small Model Experimentation
GitHub

Qwen3.5-4B Foofah Selective Program Fallback

Matching the shown examples wins; stress-tests backfire

The one idea you need

Reshaping a messy table has two routes: hand-write the finished answer, or write a tiny program that does the reshaping. Run that program on the worked examples you can already see; if it reproduces them exactly, it has earned the right to handle the hidden test.

The question

When a small model can either write a table's answer directly or write a program to produce it, which should you trust, and do extra sanity checks help decide?

What we found

Trust the program the moment it reproduces the visible worked examples. Doing that lifted exact-match accuracy from 55% to 62% across 250 table tasks, rescuing 18 answers the direct route got wrong while losing none it got right. The fancier idea of stress-testing the program against fresh made-up inputs did not help and slightly lowered accuracy.

Why it matters

When a generated program reproduces the examples you can see, deploy it as a fallback and stop there. Skip synthetic double-checks: the model's own answers on invented inputs repeat the same mistakes, so they veto good programs more than bad ones.

Accuracy: writing answers directly vs trusting the matching program55% → 62%share of 250 table tasks solved exactly
When direct answer and program disagreed, who was rightprogram 18, direct 0across the 26 tasks where the two routes clashed
Answers the program rescued vs broke18 fixed, 0 brokenwrong direct answers made right; no correct one lost
The stress-test signal pointed the wrong way25% vs 33%agreement was lower for correct programs than for wrong ones
On this page
  1. Results at a glance
  2. Overview
  3. Report
    1. Question
    2. Candidate Pool
    3. Main Result
    4. Counterexample Probes
    5. Iteration
    6. Read
    7. Caveats
  4. Experiment log
  5. Figures
  6. Data files
  7. Reproduce
  8. Related

Results at a glance 4

Held-out Foofah accuracy by fallback policy The simplest rule wins: committing the program whenever it passes the visible example gains +7.2pp over direct JSON, with zero losses.

held-out exact match · selector policy →

0%20%40%60%80%direct JSON onlydirect JSON only55.2%program if parse failsprogram if parse fails56.8%program if probe support >= 0.50program if probe support >= 0.5056%visible program, probe veto < 0.67visible program, probe veto < 0.6758.4%program whenever visible passesprogram whenever visible passes62.4%
Data table
selector policyaccuracy
direct JSON only55.2%
program if parse fails56.8%
program if probe support >= 0.5056%
visible program, probe veto < 0.6758.4%
program whenever visible passes62.4%

Numbers from reports/report_metrics.json (summary.policies)

When program and direct answer disagree, who is right? (26 cases) On all 26 visible-disagreement cases the direct answer was never correct, while the program was correct 18 times.

hidden-correct cases (of 26) · answer source →

05101520direct JSON answerdirect JSON answer0visible-passing programvisible-passing program18
Data table
answer sourcehidden-correct
direct JSON answer0
visible-passing program18

Numbers from reports/report_metrics.json (summary.visible_disagree_direct_correct, visible_disagree_program_correct)

Program commits vs correct commits per policy Probe-thresholded policies commit few programs and reject useful wins; committing on visible pass keeps ~80% precision at full volume.

cases · selector policy →

020406080program if parse failsprogram if parse fails54program if probe support >= 0.50program if probe support >= 0.5052program on visible disagreementprogram on visible disagreement2618visible program, probe veto < 0.67visible program, probe veto < 0.676252program whenever visible passesprogram whenever visible passes7862
Data table
selector policyprogram commitscorrect commits
program if parse fails54
program if probe support >= 0.5052
program on visible disagreement2618
visible program, probe veto < 0.676252
program whenever visible passes7862

Numbers from reports/report_metrics.json (summary.policies program_commits / program_commit_correct)

Probe agreement does not separate correct from wrong programs Counterexample probes were an anti-signal: wrong programs had slightly higher agreement with independent direct answers than correct ones.

mean probe agreement · program hidden-correctness →

0%10%20%30%40%hidden-correct programshidden-correct programs25%hidden-wrong programshidden-wrong programs33.3%
Data table
program hidden-correctnessmean probe support
hidden-correct programs25%
hidden-wrong programs33.3%

Numbers from reports/report_metrics.json (extra.visible_disagreement_correct_probe_mean, extra.visible_disagreement_wrong_probe_mean)

In the author’s words from the Overview

This standalone experiment tests whether a generated Python table-transform program should be used as a fallback to direct JSON generation on Foofah table-transformation tasks. The experiment starts from a self-contained candidate set with one direct JSON answer and one repaired executable transform(table) candidate per task. It then evaluates selector policies that decide whether to keep the direct answer or commit the visible-verified program. Some policies use extra counterexample-style probe inputs and independent direct model answers on those probes. Primary question: > Can counterexample-stressed agreement safely convert visible-verified program candidates into deployed accuracy beyond direct JSON generation? … Read the full result →

Overview

This standalone experiment tests whether a generated Python table-transform program should be used as a fallback to direct JSON generation on Foofah table-transformation tasks.

The experiment starts from a self-contained candidate set with one direct JSON answer and one repaired executable transform(table) candidate per task. It then evaluates selector policies that decide whether to keep the direct answer or commit the visible-verified program. Some policies use extra counterexample-style probe inputs and independent direct model answers on those probes.

Primary question:

Can counterexample-stressed agreement safely convert visible-verified program candidates into deployed accuracy beyond direct JSON generation?

The report is generated by scripts/make_report.py.

Report

Rendered from reports/report.md

Question

Can Qwen3.5-4B improve deployed Foofah table-transformation accuracy by using a visible-verified executable transform(table) program as a fallback to direct JSON generation, and do counterexample-style probe inputs make that fallback decision safer?

The benchmark is Foofah (https://github.com/markjin1990/foofah_benchmarks). Each task has visible input-output examples and a held-out test input. Hidden answers are used only for evaluation.

Candidate Pool

The package contains 250 task records. Each record has:

  • one direct JSON answer for the held-out input,
  • one executable program candidate after visible-example repair,
  • visible-example execution status for the program,
  • held-out exact-match labels for evaluation.

Main Result

selectorexact held-outrateprogram commitsprogram precisiondirect-miss recoveriesdirect-correct losses
Direct JSON138/25055.2%0-00
Program only if direct parse fails142/25056.8%580.0%40
Program on disagreement if probe support >= 0.50140/25056.0%540.0%20
Visible program, veto disagreement if probe support < 0.67146/25058.4%6283.9%80
Program on visible disagreement only156/25062.4%2669.2%180
Program whenever visible example passes156/25062.4%7879.5%180

The strongest deployed policy was also the simplest: commit the program whenever it passes the visible example. It reached 156/250 (62.4%), improving direct JSON by +18 cases with 0 direct-correct losses.

The key diagnostic is the visible-disagreement slice. There were 26 cases where the program passed the visible example but disagreed with the direct answer. In that slice, direct JSON was hidden-correct on 0 cases, while the program was hidden-correct on 18 cases. That made visible-program fallback strongly complementary to direct generation in this candidate pool.

Counterexample Probes

For each visible-disagreement case, the evaluator generated up to three deterministic probe input tables and asked Qwen3.5-4B for direct JSON outputs on those probes. The candidate program was also executed on the same probes. Probe support is the fraction of comparable probes where direct output and program output agreed.

The probe mechanism did not improve selection:

  • Probe support >= 0.50 recovered 2 direct misses and reached 140/250 (56.0%).
  • Visible-program fallback with a probe-support veto recovered 8 direct misses and reached 146/250 (58.4%).
  • Mean probe agreement on the decision slice was 28.3%.

Probe support was not a reliable correctness signal. Among visible-disagreement cases with comparable probes, mean support was 25.0% for hidden-correct programs and 33.3% for hidden-wrong programs.

Iteration

The experiment used three stages:

  1. A no-model selector diagnostic over all 250 cases established that visible-program fallback reached 156/250 and parse-failure fallback reached 142/250.
  2. A small model-probe smoke on 8 visible-disagreement cases showed probe thresholds rejecting most useful program wins.
  3. A full model-probe pass on all 26 visible-disagreement cases confirmed that probe support was weaker than the simple visible-pass rule.

Read

The useful result is not that counterexample-stressed direct agreement solved selection. It did not. The useful result is that visible-example execution alone was a strong fallback gate for this candidate pool: every direct-correct case survived, and the visible-passing programs recovered 18 direct misses.

The counterexample probes failed for a concrete reason: the independent direct channel often agreed with the same wrong extrapolation, while rejecting many correct programs. Generated probes added cost and reduced accuracy under thresholded policies.

Caveats

  • The candidate pool is fixed and included in data/candidate_records.jsonl.
  • Program fallback is evaluated only for programs that pass the visible example.
  • Probe answers are greedy Qwen3.5-4B direct JSON generations on synthetic probe inputs, not ground truth.
  • Hidden answers are used only for evaluation and policy comparison.
  • Exact table matching is strict after normalizing cells to strings.

Experiment log 1

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

2026-06-27

  • Created standalone selective-program-fallback experiment.
  • Objective: test whether visible-verified executable program candidates can be safely used as fallback answers for Foofah table transformations, and whether counterexample-style probe agreement improves the fallback decision.
  • Copied self-contained Foofah cases and candidate records into data/.
  • Planned process:

    • Build selector/probe evaluator.
    • Run no-model diagnostic to establish deterministic selector baselines.
    • Run smoke with model-scored probe inputs.
    • Iterate selector thresholds if smoke reveals useful signal.
    • Run full visible-program probe evaluation.
    • Generate report, figures, and validation evidence.
  • Built scripts/eval_selective_fallback.py with policies for direct-only, parse-failure fallback, visible-program fallback, visible-disagreement fallback, and counterexample-probe support thresholds.
  • No-model full diagnostic:

    • direct JSON: 138/250 (55.2%).
    • program only if direct parse fails: 142/250 (56.8%).
    • program whenever visible example passes: 156/250 (62.4%).
    • visible-program fallback recovered 18 direct misses and lost 0 direct-correct cases.
    • visible-disagreement slice: 26 cases; direct correct 0, program correct 18.
  • Model-probe smoke on 8 visible-disagreement cases:

    • visible-program fallback: 5/8.
    • probe-support threshold policies: 0/8 or 1/8.
    • probe support was higher on some hidden-wrong programs than on hidden-correct programs, so broader probing was restricted to the decision slice.
  • Deterministic program-probe full pass:

    • all 78 visible-passing programs executed on generated probe inputs.
    • crashes, constant outputs, and output-variety features did not separate correct programs from hidden-wrong programs.
  • Full model-probe pass on all 26 visible-disagreement cases:

    • visible-program fallback: 18/26.
    • probe support >= 0.50: 2/26.
    • visible-program fallback with probe veto: 8/26.
    • mean probe support was 25.0% for hidden-correct programs and 33.3% for hidden-wrong programs among comparable cases.
  • Final merged all-250 policy comparison:

    • direct JSON: 138/250 (55.2%).
    • parse-failure fallback: 142/250 (56.8%).
    • probe support >= 0.50: 140/250 (56.0%).
    • visible-program fallback with probe veto: 146/250 (58.4%).
    • program on visible disagreement only: 156/250 (62.4%).
    • program whenever visible example passes: 156/250 (62.4%).
  • Generated report and figures:

Figures 4

family gains
family gains · reports/figures/
policy accuracy
policy accuracy · reports/figures/
probe support histogram
probe support histogram · reports/figures/
program commit tradeoff
program commit tradeoff · reports/figures/

Data files 8

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 ↗