Research log Small Model Experimentation
GitHub

Qwen In-Policy VM-ECHO Distillation

Learned how programs run, not which ones work

The one idea you need

A helper reads a frozen model's internal state, writes tiny programs, and runs each in a sandbox. It was also trained to foresee each program's fate: will it crash, how deep it runs, is its answer right. The hope was that this foresight would reveal which program to trust.

The question

If a system answers questions by writing little programs and running them, does teaching it to predict what happens when each program runs help it choose better answers?

What we found

Only partly. It became excellent at predicting mechanical outcomes, like how deep a program runs (about 92% right), but stayed no better than a coin flip at judging which program is actually correct. So it could not rank its own guesses, and ranking did worse than plain answering on every test. First-try accuracy on paired problems stayed stuck near 9%, far below the 77% a fully-supervised version reached.

Why it matters

Teaching a model to simulate its own execution is not the same as teaching it correctness. To improve which answer you pick, train on near-identical attempts that differ only in whether they are right, emphasizing plausible-but-wrong ones.

Predicting how deep a program runsabout 92%a mechanical detail it learned well
Judging which program is actually correctabout a coin flipno better than 50/50 chance
Best-of-many success on the hardest puzzles48% → 52%the one modest, real gain from watching outcomes
First-try accuracy on paired puzzles9%, unchangedvs 77% reached with full answer keys
On this page
  1. Results at a glance
  2. Overview
  3. Report
    1. Abstract
    2. Setup
    3. Main Results
    4. Candidate Surface
    5. VM Observation Learning
    6. Training Dynamics
    7. Pilot Results
    8. Interpretation
    9. Artifacts
  4. Experiment log
  5. Figures
  6. Data files
  7. Reproduce
  8. Related

Results at a glance 6

Hardest puzzles: best-of-many versus first try, by training style

How to read

Five training styles run left to right along the bottom. One color is best-of-many success (keep the best attempt), the other is first-try success. Taller is better; the rightmost style trained on complete answer keys.

0%25%50%75%100%seedseed44.5%11.7%answer distillanswer distill47.7%14.1%VM-ECHO distillVM-ECHO distill51.6%14.1%gold tracegold trace56.2%16.4%full supervisedfull supervised85.9%58.6%

Takeaway → Watching outcomes nudges best-of-many up a little, yet both bars stay far below the towering full-answer-key style at the right.

Data table
training phaseanswer searchdirect decode
seed44.5%11.7%
answer distill47.7%14.1%
VM-ECHO distill51.6%14.1%
gold trace56.2%16.4%
full supervised85.9%58.6%

Numbers from report table (reports/qwen_inpolicy_vm_echo_distillation_report.md)

Technical framing

Hard-composition accuracy across training phases — VM-ECHO lifts hard-composition answer search from 47.7% to 51.6%, but direct accuracy stays far below the 58.6% full-supervised ceiling.

First-try success on paired puzzles stays flat until full answer keys

How to read

One bar per training style, left to right; bar height is first-try success on paired puzzles. Taller is better. The rightmost style trained on complete answer keys.

0%20%40%60%80%seedseed8.6%answer distillanswer distill8.6%VM-ECHO distillVM-ECHO distill8.6%gold tracegold trace16.4%full supervisedfull supervised76.6%

Takeaway → The first three bars sit flat at the same low height; the gold-trace bar rises modestly and only the full-answer-key bar leaps far up, showing outcome-watching moved nothing.

Data table
training phasedirect decode
seed8.6%
answer distill8.6%
VM-ECHO distill8.6%
gold trace16.4%
full supervised76.6%

Numbers from report table (reports/qwen_inpolicy_vm_echo_distillation_report.md)

Technical framing

Fresh-paired direct accuracy: VM-ECHO does not move the needle — Fresh-paired direct accuracy is stuck at 8.6% through VM-ECHO training while the full-supervised ceiling is 76.6%.

What the model learned to predict about its own programs

How to read

One bar per kind of prediction about a program's behavior; height is how often the guess was right. Taller is better. Bars span structural traits down to whether the final answer is correct.

0%25%50%75%100%trace depthtrace depth91.5%validityvalidity72.9%trace toptrace top53.9%answer correctanswer correct49.9%final valuefinal value26.2%

Takeaway → Structural bars, like how deep a program runs, tower over the is-the-answer-right bar, which sits near a coin flip.

Data table
VM observation channelobservation prediction accuracy
trace depth91.5%
validity72.9%
trace top53.9%
answer correct49.9%
final value26.2%

Numbers from analysis/main_metrics.csv (inpolicy_vm_echo_distill rows)

Technical framing

What the VM-ECHO head learned to predict (fresh standard) — ECHO learned structural consequences (trace depth 91.5%, validity 72.9%) far better than which candidate answers correctly (49.9%).

Picking answers by predicted outcome loses to just answering

How to read

Four puzzle types run along the bottom. One color is plain first-try answering; the other picks among attempts using the model's own outcome predictions. Taller is better.

0%5%10%15%fresh standardfresh standard14.8%10.9%fresh paraphrasefresh paraphrase14.1%10.2%fresh pairedfresh paired8.6%6.2%hard compositionhard composition14.1%8.6%

Takeaway → The prediction-picking bar is shorter in every group, so using those predictions to choose answers hurts rather than helps.

Data table
evaluation splitdirect decodeECHO rerank
fresh standard14.8%10.9%
fresh paraphrase14.1%10.2%
fresh paired8.6%6.2%
hard composition14.1%8.6%

Numbers from report table (reports/qwen_inpolicy_vm_echo_distillation_report.md)

Technical framing

ECHO reranking underperforms direct decoding on every split — The learned consequence model is not a useful reranker: selecting candidates by ECHO score loses to plain direct decoding everywhere.

The small gain shows up at only one training setting

How to read

Three training configurations run along the bottom; colors compare answer-key training against outcome-watching on two puzzle types. Taller is better. The other configs raise the weighting or add a second pass.

0%10%20%30%ECHO weight 0.10ECHO weight 0.10ECHO weight 0.35ECHO weight 0.35Weight 0.10, 2 roundsWeight 0.10, 2 rounds

Takeaway → Outcome-watching's clear edge over answer-key training shows only in the leftmost setting; stronger weighting or a second pass shrinks it to a near tie.

Data table
Pilot configurationAnswer distill, fresh pairedVM-ECHO distill, fresh pairedAnswer distill, hard compositionVM-ECHO distill, hard composition
ECHO weight 0.1012.5%21.9%7.8%17.2%
ECHO weight 0.3512.5%12.5%7.8%10.9%
Weight 0.10, 2 rounds10.9%12.5%7.8%7.8%

Numbers from experiments/qwen_inpolicy_vm_echo_distillation/analysis/pilot_comparison.csv

Technical framing

Pilot ablations: the VM-ECHO gain vanishes at higher weight or a second round — The pilot gain that motivated the main run appears only at weight 0.10 with one round; 0.35 and a second round erase it.

Best-of-many success by training style, four puzzle types

How to read

Five training styles run along the bottom; four colors mark four puzzle types. Height is best-of-many success. Taller is better. The rightmost style trained on complete answer keys.

0%25%50%75%100%SeedSeedAnswer distillAnswer distillVM-ECHO distillVM-ECHO distillGold traceGold traceFull supervisedFull supervised

Takeaway → Outcome-watching lifts most colored bars slightly above answer-key training, yet the full-answer-key style at the right stands far taller than all.

Data table
Training phase (main run)Fresh standardFresh paraphraseFresh pairedHard composition
Seed44.5%40.6%44.5%44.5%
Answer distill44.5%46.9%45.3%47.7%
VM-ECHO distill48.4%50%44.5%51.6%
Gold trace49.2%55.5%53.1%56.2%
Full supervised90.6%88.3%95.3%85.9%

Numbers from experiments/qwen_inpolicy_vm_echo_distillation/analysis/all_metrics.csv

Technical framing

Answer-search accuracy by phase: VM-ECHO nudges the search surface, full supervision transforms it — VM-ECHO lifts search on 3 of 4 splits (hard comp 47.7%→51.6%) but full supervision reaches 86-95%, far above any distill phase.

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

VM-ECHO learned the observation channels: on the main run, trace-depth prediction reached about 91.5% on fresh-standard candidates and trace-top prediction reached 53.9%. It also improved some answer-search metrics over answer-verified distillation, including hard-composition search from 47.7% to 51.6%. But it did not produce a broad direct-accuracy jump: fresh-paired direct accuracy stayed at 8.6%, while the full-supervised ceiling reached 76.6%.

Overview

Standalone experiment for testing whether a frozen-Qwen typed-bytecode compiler improves when it learns the VM consequences of its own proposed programs during repair distillation.

Small artifacts live in this directory:

experiments/qwen_inpolicy_vm_echo_distillation/

Large checkpoints live separately here:

large_artifacts/qwen_inpolicy_vm_echo_distillation/checkpoints/

Layout

  • src/: experiment and analysis scripts.
  • runs/: per-run metrics, logs, and dataset manifests.
  • analysis/: aggregate CSVs and generated figures.
  • reports/: Markdown and HTML reports.
  • experiment_log.md: running journal.
  • checkpoint_manifest.csv: run-to-checkpoint map.

Question

Can in-policy VM-observation learning turn sampled program failures into useful posttraining signal, beyond answer-verified repair targets alone?

Report

Rendered from reports/qwen_inpolicy_vm_echo_distillation_report.md

Abstract

This experiment tests whether a Qwen-attached typed-bytecode compiler improves when it learns the VM consequences of its own proposed programs during repair distillation. The compiler first emits executable candidates from frozen Qwen/Qwen3-4B hidden states. Those candidates are executed in a typed VM. The training objective combines answer-verified repair distillation with an integrated observation loss over all sampled candidates: validity, final value, trace top, trace depth, and answer-correctness.

The result is mixed. VM-ECHO learned the observation channels: on the main run, trace-depth prediction reached about 91.5% on fresh-standard candidates and trace-top prediction reached 53.9%. It also improved some answer-search metrics over answer-verified distillation, including hard-composition search from 47.7% to 51.6%. But it did not produce a broad direct-accuracy jump: fresh-paired direct accuracy stayed at 8.6%, while the full-supervised ceiling reached 76.6%.

Setup

  • Base model: Qwen/Qwen3-4B, used as a frozen hidden-state feature extractor.
  • Compiler: transformer slot decoder over Qwen hidden states.
  • Integrated VM-ECHO head: candidate-conditioned transformer sharing the compiler prompt projection.
  • Seed examples: 192.
  • Candidate prompts: 1024.
  • Candidate programs: 246784.
  • Candidate positive rate: 8.3%.
  • Prompt-level oracle found rate: 44.8%.
  • Repair targets selected: 459.
  • ECHO loss weight selected by pilot: 0.1.
  • Checkpoints: large_artifacts/qwen_inpolicy_vm_echo_distillation/checkpoints/main_inpolicy_vm_echo_s192_w010/.

Main Results

PhaseSplitDirectAnswer searchOracleECHO rerankProgram exact
Seedfresh standard12.5%44.5%44.5%0.8%
Seedfresh paraphrase14.8%40.6%40.6%0.8%
Seedfresh paired8.6%44.5%44.5%0.0%
Seedhard composition11.7%44.5%44.5%0.0%
Answer distillfresh standard14.1%44.5%44.5%0.0%
Answer distillfresh paraphrase10.9%46.9%46.9%0.0%
Answer distillfresh paired8.6%45.3%45.3%0.0%
Answer distillhard composition14.1%47.7%47.7%0.8%
VM-ECHO distillfresh standard14.8%48.4%48.4%10.9%0.8%
VM-ECHO distillfresh paraphrase14.1%50.0%50.0%10.2%1.6%
VM-ECHO distillfresh paired8.6%44.5%44.5%6.2%0.0%
VM-ECHO distillhard composition14.1%51.6%51.6%8.6%0.8%
Gold tracefresh standard16.4%49.2%49.2%3.9%
Gold tracefresh paraphrase18.0%55.5%55.5%3.1%
Gold tracefresh paired16.4%53.1%53.1%5.5%
Gold tracehard composition16.4%56.2%56.2%3.9%
Full sup.fresh standard71.9%90.6%90.6%55.5%
Full sup.fresh paraphrase78.9%88.3%88.3%63.3%
Full sup.fresh paired76.6%95.3%95.3%63.3%
Full sup.hard composition58.6%85.9%85.9%39.1%

Main accuracy

Candidate Surface

PhaseRoundTargetsOracle foundChangedCandidate valid
answer_verified_targets145944.8%70.6%64.3%
echo_repair_targets145944.8%70.6%64.3%

Candidate and target stats

The candidate surface is large enough to matter but not large enough to solve the task by itself. The main run generated 246784 candidates from 1024 prompts, and 44.8% of prompts had at least one answer-correct candidate. This puts a ceiling on what one round of repair distillation can learn.

VM Observation Learning

Observation accuracy

VM-ECHO learned validity and trace structure much better than final answer correctness. This is important: the auxiliary loss did train a consequence model, but the learned consequence model was not a useful no-answer reranker. ECHO reranking was below direct decoding on every main split. The useful effect, where present, came from joint training changing the compiler, not from selecting candidates at inference time.

Training Dynamics

Training curves

The main ECHO auxiliary loss decreased from 5.35 to 2.67, while repair loss also improved. A higher pilot weight damaged deployable accuracy, so the auxiliary needs to remain secondary to the repair target.

Pilot Results

Pilot comparison

The pilot sweep selected echo_loss_weight=0.1. A stronger 0.35 weight over-regularized the compiler. A second in-policy round improved some standard/paraphrase cells, but it removed the fresh-paired and hard direct signal that made the one-round pilot attractive.

Interpretation

This experiment supports a narrow claim: candidate-consequence prediction can be trained in the same compiler loop without breaking executable decoding, and it can modestly reshape the answer-search surface. It does not support the stronger claim that this objective currently unlocks the full repair oracle or produces a large direct compiler improvement.

The decisive remaining problem is credit assignment among executable candidates. VM-ECHO learned broad consequences such as validity and stack traces, but it did not learn to identify which candidate solves the prompt. The next version should make the preference signal sharper: train on counterfactual candidate pairs from the same prompt, emphasize hard negatives that share validity or final-value plausibility, and expose a more direct representation of the prompt-implied answer to the candidate scorer.

Artifacts

Experiment log 3

Show the running log (3 entries, 2026-06-24)

2026-06-24

  • Created a fresh standalone experiment directory.
  • Selected intervention: in-policy VM-ECHO distillation.
  • Core idea: a frozen-Qwen compiler proposes typed bytecode programs; the VM executes those proposals; integrated observation heads learn validity, final value, trace top, trace depth, and answer-correctness for the compiler's own candidates while answer-verified repairs are distilled into the compiler.
  • Controls: answer-verified repair distillation, matched gold-trace distillation, and full-supervised training.
  • Large artifacts will be stored in large_artifacts/qwen_inpolicy_vm_echo_distillation/checkpoints/.

Iteration Notes

  • Implemented the standalone VM core, integrated compiler/ECHO experiment script, README, checkpoint manifest, and run log.
  • Smoke run smoke_inpolicy_vm_echo passed end to end, including Qwen feature extraction, seed training, answer-verified control, in-policy VM-ECHO training, gold-trace control, full-supervised control, metrics, and checkpoint writing.
  • The first smoke exposed a train-log CSV schema issue because ECHO phases write additional loss columns. Patched the CSV appender to rewrite with a union schema when later rows add columns.
  • Smoke run smoke_inpolicy_vm_echo_v2 verified the fixed schema.
  • Pilot pilot_inpolicy_vm_echo_s96_w010 used 96 seed examples and 256 candidate prompts. It found answer-verified repair targets for 33.2% of candidate prompts. In-policy VM-ECHO improved fresh-paired direct accuracy over answer-verified distillation (21.9% vs 12.5%) and hard-composition direct accuracy (17.2% vs 7.8%). The ECHO reranker itself was weak, so the useful effect appeared through training, not inference-time selection.
  • Pilot pilot_inpolicy_vm_echo_s96_w035 tested a stronger ECHO loss. It was worse on fresh-paired direct accuracy (12.5%), so the main run will use echo_loss_weight=0.1.
  • Main run main_inpolicy_vm_echo_s192_w010 completed with 192 seed examples, 1024 candidate prompts, 1024 full-supervised examples, and 128 examples per evaluation split.
  • Main candidate surface: 246,784 sampled candidates, 8.3% answer-correct candidate rate, 64.3% valid candidate rate, and 44.8% prompt-level oracle found rate. Both answer-only and VM-ECHO branches selected 459 verified repair targets.
  • Main result: VM-ECHO learned VM observations and improved some answer-search metrics over answer-verified distillation, including hard-composition search 47.7% -> 51.6%, but it did not produce a broad direct-accuracy gain. Fresh-paired direct accuracy stayed at 8.6%, while the full-supervised ceiling reached 76.6% direct and 95.3% search.
  • Pilot pilot_inpolicy_vm_echo_s96_w010_r2 tested two in-policy rounds. It did not justify a second main run because gains were inconsistent and the fresh-paired/hard direct signal weakened.

Final Artifacts

  • Markdown report: reports/qwen_inpolicy_vm_echo_distillation_report.md.
  • HTML report: reports/qwen_inpolicy_vm_echo_distillation_report.html.
  • Analysis summary: analysis/summary.md.
  • Figures: analysis/figures/.
  • Main run files: runs/main_inpolicy_vm_echo_s192_w010/.
  • Checkpoints: large_artifacts/qwen_inpolicy_vm_echo_distillation/checkpoints/.

Figures 5

candidate and target stats
candidate and target stats · analysis/figures/
echo observation accuracy
echo observation accuracy · analysis/figures/
main accuracy by phase
main accuracy by phase · analysis/figures/
pilot comparison
pilot comparison · analysis/figures/
training curves
training curves · analysis/figures/

Data files 14

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

Reproduce

The run commands are documented inside the experiment folder (see the README).

Browse the experiment folder on GitHub ↗