Research log Small Model Experimentation
GitHub

Qwen Trace Procedure Depth Stress

Writes recipes it cannot cook itself

The one idea you need

Picture a cook who writes a flawless six-step recipe but burns the dish whenever he cooks it himself. Hand that written recipe to a machine and it follows the steps perfectly. This model wrote correct multi-step procedures yet could not carry them out in its own head.

The question

If you train a small model only on single-step operations, can it chain them into correct multi-step procedures it never saw during training?

What we found

Yes. Trained only on single-step tasks, the 4-billion-parameter model wrote six-step procedures that ran correctly 63% of the time once a plain step-follower executed them, versus 0% when the model tried to state the final answer itself. Accuracy slid down gently as tasks lengthened, never collapsing. So it truly composes steps into working procedures, but cannot reliably run them in its own head. Treat it as a recipe-writer, not a calculator.

Why it matters

Have small models emit an explicit step list and run it with a deterministic step-follower rather than trusting their stated answer. The steps hold up on long tasks; the weak spot is reworded requests, so invest in language grounding.

Six-step tasks: direct answer vs written procedure0% → 63%answering in its head collapses; the machine-run procedure holds up
Correct procedure but wrong self-answer at six steps58% vs 0%one setup wrote runnable six-step procedures yet its own final answer was never right
Six-step procedure when the task is reworded63% → 42%same task, only the phrasing changed
Single steps it was trained onabout 98%accuracy on the operations seen during training
On this page
  1. Results at a glance
  2. Overview
  3. Report
    1. Abstract
    2. Method
    3. Run Configuration
    4. Primary Results
    5. Interpretation
    6. Limitations
    7. Artifacts
  4. Experiment log
  5. Figures
  6. Data files
  7. Reproduce
  8. Related

Results at a glance 4

Written procedures hold up as tasks get longer; direct answers collapse

How to read

Horizontal axis is how many steps the task needs, from two to six; vertical axis is how often it was solved, higher is better. Three upper lines are machine-run procedures; the bottom line is the model answering directly in its head.

0%25%50%75%100%23456compact program (executed)compact program (…trace + final (executed)trace + final (ex…trace, no final (executed)trace, no final (…answer only (final answer)answer only (fina…

Takeaway → The procedure lines slope down gently and stay high, while the direct-answer line falls all the way to zero by six steps.

Data table
composition depthcompact program (executed)trace + final (executed)trace, no final (executed)answer only (final answer)
276.7%76.7%65%41.7%
375%75%61.7%15%
470%63.3%68.3%5%
663.3%58.3%56.7%0%

Numbers from report table (reports/qwen_trace_procedure_depth_stress_report.md); same data in analysis/summary_by_arm.csv

Technical framing

Held-out composition accuracy vs procedure depth (trained on atomic steps only) — Procedure arms degrade gradually with depth (63% at depth 6) while direct answering collapses to 0% — a compiler, not a self-executor.

The procedure runs right even when the model's own answer is wrong

How to read

Horizontal axis is task length in steps; vertical axis is how often solved, higher is better. The top line is the model's written procedure run by a machine; the bottom line is the final answer the model wrote itself.

0%25%50%75%100%23456executed proceduremodel's emitted final answermodel's emitted f…

Takeaway → The two lines split wide apart: at six steps the machine-run procedure is often right while the model's own answer is essentially never right.

Data table
composition depthexecuted proceduremodel's emitted final answer
276.7%30%
375%18.3%
463.3%3.3%
658.3%0%

Numbers from report table (reports/qwen_trace_procedure_depth_stress_report.md), trace_stack_final rows: exec_accuracy_mean vs final_accuracy_mean

Technical framing

Trace arm: procedure executes correctly even when its own final answer is wrong — At depth 6 the emitted procedure runs correctly 58% of the time while the model's own final answer is right 0% — compilation beats self-execution.

Rewording the same task lowers success at every length

How to read

Horizontal axis is task length in steps; vertical axis is how often the machine-run procedure solved it, higher is better. The upper line is the familiar wording, the lower line is the same tasks reworded.

20%40%60%80%100%23456standard promptstemplate-shifted promptstemplate-shifted …

Takeaway → The reworded line sits below the familiar-wording line at every length, showing the wording of the request is the remaining hurdle.

Data table
composition depthstandard promptstemplate-shifted prompts
276.7%53.3%
470%43.3%
663.3%41.7%

Numbers from report table (reports/qwen_trace_procedure_depth_stress_report.md), program_stack eval_comp vs eval_template rows

Technical framing

Template-shifted wording cuts compact-program execution at every depth — Rewording the task drops depth-6 execution from 63% to 42%, so the remaining bottleneck is language grounding, not procedure execution.

When a procedure fails, it usually fails to run at all

How to read

Each bar is one outcome type for the written procedures across all task lengths; taller means a bigger share. The first bar is fully correct; the rest are kinds of mistakes, taller meaning more common.

0%20%40%60%correct (exact)correct (exact)58%invalid / unexecutableinvalid / unexecutable33.7%wrong op order or choicewrong op order or choice4.5%correct semantic variantcorrect semantic variant3.8%

Takeaway → The tallest failure bar is procedures that won't run at all, while picking the wrong steps is a tiny sliver, so parsing not reasoning is the main breakdown.

Data table
failure categorytrace + final, all composition depths
correct (exact)58%
invalid / unexecutable33.7%
wrong op order or choice4.5%
correct semantic variant3.8%

Numbers from report interpretation section (reports/qwen_trace_procedure_depth_stress_report.md); underlying rows in analysis/all_details.csv

Technical framing

Where trace-arm procedures go wrong on composition splits — Most failures are procedures that fail to parse or execute; picking the wrong operations is rare once a procedure is valid.

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

This standalone experiment tests whether a local 4B model composes known primitives into executable procedures when trained only on atomic procedures. The primary score for procedure arms is external execution of the emitted stack program, not the model's own final answer.

Overview

This standalone experiment tests whether a local 4B model can compile natural language tasks into explicit executable procedures over a fixed stack ABI.

The primary metric for procedure arms is external execution of the generated procedure. The model's emitted final answer is measured separately and is not trusted as the procedure score.

Large adapter checkpoints are stored outside this experiment directory:

/workspace/large_artifacts/qwen_trace_procedure_depth_stress

Report

Rendered from reports/qwen_trace_procedure_depth_stress_report.md

Abstract

This standalone experiment tests whether a local 4B model composes known primitives into executable procedures when trained only on atomic procedures. The primary score for procedure arms is external execution of the emitted stack program, not the model's own final answer.

Method

Training examples contain one primitive operation. Evaluation sweeps held-out procedure depths 2, 3, 4, and 6, plus template-shifted prompts at depths 2, 4, and 6. The task families are string, number, table, date, list, and path transformations. Four arms are compared: answer_only, trace_stack_final, trace_stack_no_final, and program_stack.

The load-bearing distinction is compilation versus self-execution. trace_stack_final may emit a FINAL line, but its procedure is also parsed and executed by the interpreter. trace_stack_no_final tests the same numbered procedure format without answer supervision. program_stack tests compact raw instructions.

Run Configuration

  • Primary suite: main.
  • Seeds: 101,202,303,404,505.
  • Evaluation examples across trained arms: 1920.
  • QLoRA update steps per adapter: 32.
  • Large adapters are stored outside the experiment tree.

Primary Results

  • Best held-out composition execution row: program_stack depth 2 at 76.7%.
  • Compact program execution at depth 6: program_stack 63.3% with seed std 11.2%, versus answer_only final accuracy 0.0%.
  • trace_stack_final depth-6 composition execution: 58.3% with seed std 8.3%.
  • trace_stack_final depth-6 template-shift execution: 36.7%.
  • Final-answer supervision comparison at depth 4: trace_stack_final execution 63.3%; trace_stack_no_final execution 68.3%.
  • Template-shift depth-6 execution for program_stack: 41.7%, a 21.7% absolute drop from standard depth-6 composition.
armsplitdepthrunsn_totalprimary_accuracy_meanprimary_accuracy_stdexec_accuracy_meanexec_accuracy_stdvalid_exec_rate_meanfinal_accuracy_meanno_final_rate_meanexact_program_rate_mean
answer_onlyeval_comp_d2256041.7%10.2%0.0%0.0%0.0%41.7%0.0%0.0%
program_stackeval_comp_d2256076.7%3.7%76.7%3.7%78.3%0.0%100.0%75.0%
trace_stack_finaleval_comp_d2256076.7%7.0%76.7%7.0%80.0%30.0%0.0%73.3%
trace_stack_no_finaleval_comp_d2256065.0%16.0%65.0%16.0%75.0%0.0%100.0%63.3%
answer_onlyeval_comp_d3356015.0%7.0%0.0%0.0%0.0%15.0%0.0%0.0%
program_stackeval_comp_d3356075.0%10.2%75.0%10.2%81.7%0.0%100.0%68.3%
trace_stack_finaleval_comp_d3356075.0%5.9%75.0%5.9%83.3%18.3%0.0%70.0%
trace_stack_no_finaleval_comp_d3356061.7%4.6%61.7%4.6%73.3%0.0%100.0%61.7%
answer_onlyeval_comp_d445605.0%7.5%0.0%0.0%0.0%5.0%0.0%0.0%
program_stackeval_comp_d4456070.0%11.2%70.0%11.2%71.7%0.0%100.0%63.3%
trace_stack_finaleval_comp_d4456063.3%11.2%63.3%11.2%63.3%3.3%0.0%63.3%
trace_stack_no_finaleval_comp_d4456068.3%13.7%68.3%13.7%71.7%0.0%100.0%65.0%
answer_onlyeval_comp_d665600.0%0.0%0.0%0.0%0.0%0.0%0.0%0.0%
program_stackeval_comp_d6656063.3%11.2%63.3%11.2%65.0%0.0%100.0%60.0%
trace_stack_finaleval_comp_d6656058.3%8.3%58.3%8.3%63.3%0.0%0.0%48.3%
trace_stack_no_finaleval_comp_d6656056.7%12.4%56.7%12.4%61.7%0.0%100.0%48.3%
answer_onlyeval_indist_d1156086.7%12.6%0.0%0.0%0.0%86.7%0.0%0.0%
program_stackeval_indist_d1156098.3%3.7%98.3%3.7%98.3%0.0%100.0%98.3%
trace_stack_finaleval_indist_d1156098.3%3.7%98.3%3.7%100.0%91.7%0.0%98.3%
trace_stack_no_finaleval_indist_d1156098.3%3.7%98.3%3.7%98.3%0.0%100.0%96.7%
answer_onlyeval_template_d2256045.0%12.6%0.0%0.0%0.0%45.0%0.0%0.0%
program_stackeval_template_d2256053.3%4.6%53.3%4.6%56.7%0.0%100.0%46.7%
trace_stack_finaleval_template_d2256050.0%5.9%50.0%5.9%53.3%40.0%0.0%43.3%
trace_stack_no_finaleval_template_d2256048.3%9.1%48.3%9.1%58.3%0.0%100.0%43.3%
answer_onlyeval_template_d445603.3%7.5%0.0%0.0%0.0%3.3%0.0%0.0%
program_stackeval_template_d4456043.3%7.0%43.3%7.0%45.0%0.0%100.0%40.0%
trace_stack_finaleval_template_d4456040.0%7.0%40.0%7.0%41.7%8.3%1.7%35.0%
trace_stack_no_finaleval_template_d4456033.3%0.0%33.3%0.0%43.3%0.0%100.0%31.7%
answer_onlyeval_template_d665601.7%3.7%0.0%0.0%0.0%1.7%0.0%0.0%
program_stackeval_template_d6656041.7%8.3%41.7%8.3%41.7%0.0%100.0%36.7%
trace_stack_finaleval_template_d6656036.7%12.6%36.7%12.6%38.3%0.0%11.7%30.0%
trace_stack_no_finaleval_template_d6656038.3%9.5%38.3%9.5%41.7%0.0%100.0%33.3%

Execution by depth

Template shift by depth

Final versus execution gap

Failure taxonomy

Training curves

Interpretation

A real compiler result should degrade gradually with depth rather than collapse immediately once procedure length exceeds the atomic training distribution. A gap between trace_stack_final execution and final-answer accuracy means the model can emit a correct procedure while failing to self-execute it. A gap between standard composition and template-shift composition localizes the remaining problem to language grounding rather than procedure sequencing. The main result is positive: training only on atomic procedures still produced executable depth-6 compositions at 63.3% for the compact raw stack ABI, while answer-only scoring was 0.0%. This is not a self-execution win; it is a compiler win, because the deterministic interpreter supplies the execution. The final-answer confound persists at the hardest standard composition split: trace_stack_final executed correctly at 58.3% but its emitted final answer was correct at 0.0%. Removing the final-answer line did not kill procedure learning: trace_stack_no_final reached 56.7% at depth 6. Final-answer supervision is therefore not required for the basic compiler effect, though arm ranking varies by depth and template split. The remaining major weakness is prompt wording. program_stack falls from 63.3% on standard depth-6 composition to 41.7% under template shift, so the next bottleneck is language grounding into the ABI, not deterministic execution. For trace_stack_final on composition splits, generated procedures break down as: correct_exact 58.0%, invalid_or_unexecutable 33.7%, wrong_op_order_or_choice 4.5%, correct_semantic_variant 3.8%.

Limitations

This experiment tests composition over a fixed known primitive library. It does not test invention of new operations outside the ABI. The families are synthetic but selected to cover several common deterministic task shapes.

Artifacts

  • Metrics: analysis/summary_by_arm.csv and analysis/all_metrics.csv
  • Details: analysis/all_details.csv
  • Training logs: analysis/all_train_logs.csv
  • Checkpoints: /workspace/large_artifacts/qwen_trace_procedure_depth_stress/checkpoints

Experiment log 4

Show the running log (4 entries)

Setup

  • Created: 2026-06-26 UTC
  • Fresh experiment directory: experiments/qwen_trace_procedure_depth_stress
  • Large artifact directory: large_artifacts/qwen_trace_procedure_depth_stress
  • Base model: Qwen/Qwen3-4B
  • Primary question: can a model trained on atomic procedures compose known primitives into deeper executable procedures when the generated procedure is run by a deterministic interpreter?
  • Primary readouts: execution accuracy by composition depth, template-shift execution by depth, final-answer-vs-execution gap, and failure taxonomy.

Run smoke_v1

  • Started: 2026-06-26 07:14:05 UTC
  • Suite: smoke
  • Model: Qwen/Qwen3-4B
  • Seeds: 101
  • Arms: answer_only,trace_stack_final,trace_stack_no_final,program_stack
  • Training examples per seed: 24
  • Eval examples per split: 6
  • Steps: 2

Completed smoke_v1 in 657.7s.

  • Metric rows: 32
  • Detail rows: 192
  • Training log rows: 8

Run pilot_v1

  • Started: 2026-06-26 07:25:33 UTC
  • Suite: pilot
  • Model: Qwen/Qwen3-4B
  • Seeds: 101
  • Arms: answer_only,trace_stack_final,trace_stack_no_final,program_stack
  • Training examples per seed: 120
  • Eval examples per split: 12
  • Steps: 20

Completed pilot_v1 in 533.6s.

  • Metric rows: 32
  • Detail rows: 384
  • Training log rows: 20

Run main_v1

  • Started: 2026-06-26 07:35:04 UTC
  • Suite: main
  • Model: Qwen/Qwen3-4B
  • Seeds: 101,202,303,404,505
  • Arms: answer_only,trace_stack_final,trace_stack_no_final,program_stack
  • Training examples per seed: 180
  • Eval examples per split: 12
  • Steps: 32

Completed main_v1 in 2743.2s.

  • Metric rows: 160
  • Detail rows: 1920
  • Training log rows: 100

Figures 5

execution by depth
execution by depth · analysis/figures/
failure taxonomy
failure taxonomy · analysis/figures/
final vs execution gap
final vs execution gap · analysis/figures/
template shift by depth
template shift by depth · analysis/figures/
training curves
training curves · analysis/figures/

Data files 5

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

Reproduce

This entry is source code or analysis only — there is no separate run to reproduce.

Browse the experiment folder on GitHub ↗