Research log Small Model Experimentation
GitHub

Qwen Complete-Program Trace Reranker

Right answer's always there, picker can't find it

The one idea you need

A fixed model writes a tiny program to solve each problem. The system then spins off about 111 slightly edited variant programs and trains a small judge to pick the best one purely by watching each program run, never seeing the correct answer.

The question

If a model generates many candidate programs and a correct one is almost always among them, can a small trained judge reliably pick that winner out?

What we found

Barely, and it backfires on hard cases. A correct program sat in the candidate pile 91 to 100 percent of the time, yet the trained picker nudged easy prompts only from 69 to 70 percent and actively hurt longer ones, dropping them from 41 to 35 percent. The ceiling was right there; the picker just could not reach it. Selection, not availability, is the bottleneck.

Why it matters

When you generate many candidates and rerank, the hard part is not producing a correct one; it is supervision. Grading a picker only on the final answer is too weak, since many wrongly reasoned programs land on it. Reward correct intermediate steps instead.

A correct program was almost always available91% to 100%share of prompts where at least one generated candidate reached the right answer
Easy prompts, before then after the picker69% → 70%accuracy without versus with the trained judge
Longer prompts, before then after the picker41% → 35%the judge actively hurt accuracy on longer problems
Candidate programs generated per promptabout 111roughly 28 to 30 of them reached the correct answer
On this page
  1. Results at a glance
  2. Overview
  3. Report
    1. Abstract
    2. Question
    3. Method
    4. Main Results
    5. Candidate Geometry
    6. Objective Pilots
    7. Domain Breakdown
    8. Interpretation
    9. Most Impactful Next Options
    10. Artifacts
  4. Experiment log
  5. Figures
  6. Data files
  7. Reproduce
  8. Related

Results at a glance 6

Trained picker barely beats the plain system, far below the best possible pick

How to read

Grouped bars, one cluster per test set. Each cluster shows three heights: the model's plain first pick, the trained picker, and the best candidate that actually exists. Taller means more answers correct; the best-possible bar towers over the other two everywhere.

0%25%50%75%100%validation mixed L6validation mixed L659.4%60.2%98.4%fresh standard L6fresh standard L668.8%70.3%98.4%fresh paraphrase L6fresh paraphrase L657.8%60.2%100%hard standard L8hard standard L850%46.9%98.4%harder standard L10harder standard L1040.6%35.2%98.4%harder paraphrase L10harder paraphrase L1017.2%14.1%91.4%

Takeaway → The picker's bar sits almost on top of the plain first pick in every cluster, while the best-possible bar stays near the top, so nearly all reachable gain goes untouched.

Data table
evaluation splitfrozen compiler (base)learned verifieroracle (best candidate)
validation mixed L659.4%60.2%98.4%
fresh standard L668.8%70.3%98.4%
fresh paraphrase L657.8%60.2%100%
hard standard L850%46.9%98.4%
harder standard L1040.6%35.2%98.4%
harder paraphrase L1017.2%14.1%91.4%

Numbers from report table (reports/qwen_complete_program_trace_reranker_report.md, Main Results)

Technical framing

Program selection accuracy: learned verifier vs frozen compiler vs oracle — Correct candidates exist for ~91-100% of prompts, but the learned verifier gains little in-distribution and loses on longer chains.

On longer problems the picker sinks below the plain system

How to read

Lines track how often the answer is correct as problems grow from six to ten steps, left to right. One line each for the plain first pick, the trained picker, and the best available candidate. Higher is better; the best-possible line stays flat near the top.

20%40%60%80%100%120%678910oracle (best candidate)oracle (best cand…frozen compiler (base)frozen compiler (…learned verifier

Takeaway → Past the shortest problems the picker line dips under the plain first pick, even though a correct candidate is nearly always available, showing the picker actively hurts on harder problems.

Data table
program length (VM steps)frozen compiler (base)learned verifieroracle (best candidate)
668.8%70.3%98.4%
850%46.9%98.4%
1040.6%35.2%98.4%

Numbers from report table (reports/qwen_complete_program_trace_reranker_report.md, Main Results)

Technical framing

Accuracy vs program length on standard splits — The oracle stays near-perfect as programs get longer, but the learned verifier falls below the frozen compiler beyond length 6.

Share of the reachable improvement the picker actually captured

How to read

One bar per test set showing how much of the gap between the plain first pick and the best available candidate the picker closed. Above zero is good; below zero means it did worse than picking nothing.

-10%-5%0%5%10%validation mixed L6validation mixed L62%fresh standard L6fresh standard L65.3%fresh paraphrase L6fresh paraphrase L65.6%fresh paired L6fresh paired L6-5.1%hard standard L8hard standard L8-6.5%hard paraphrase L8hard paraphrase L8-4%harder standard L10harder standard L10-9.5%harder paraphrase L10harder paraphrase L10-4.2%

Takeaway → Bars reach at most a thin positive sliver on the shortest splits and turn negative on the paired split and every longer problem, so the picker captured almost none of the available headroom.

Data table
evaluation splitlearned verifier
validation mixed L62%
fresh standard L65.3%
fresh paraphrase L65.6%
fresh paired L6-5.1%
hard standard L8-6.5%
hard paraphrase L8-4%
harder standard L10-9.5%
harder paraphrase L10-4.2%

Numbers from report table (reports/qwen_complete_program_trace_reranker_report.md, Main Results)

Technical framing

Share of the base-to-oracle gap recovered by the learned verifier — The verifier recovers at most 5.6% of the reachable headroom and goes negative on paired and longer-chain splits.

Picker helps most task types a little, hurts yes-or-no questions

How to read

Grouped bars per task type: the plain first pick, the trained picker, and the best available candidate. Higher is better. The best-possible bar sits near the top for every type.

0%25%50%75%100%arithmeticcalendarunitlistbooleanlookup

Takeaway → The picker nudges four task types up slightly, leaves one unchanged, and knocks the yes-or-no type down about nine points, where answers collapse to few values.

Data table
task domainfrozen compiler (base)learned verifieroracle (best candidate)
arithmetic31.2%34.4%96.9%
calendar37.5%40.6%100%
unit40.6%43.8%96.9%
list81.2%84.4%100%
boolean87.5%78.1%100%
lookup65.6%65.6%100%

Numbers from report table (reports/qwen_complete_program_trace_reranker_report.md, Domain Breakdown)

Technical framing

Per-domain accuracy on length-6 prompts — Modest verifier gains in four domains, no change on lookup, and a 9.4-point loss on boolean, where answers collapse to few values.

Scoring candidates by simulation loses to simply trusting the system

How to read

Grouped bars per test set: the plain first pick, a shortcut that scores candidates by simulating them run, and the trained picker. Higher is better.

0%20%40%60%80%Val mixed L6Val mixed L659.4%43%60.2%Fresh std L6Fresh std L668.8%46.1%70.3%Fresh para L6Fresh para L657.8%35.2%60.2%Hard std L8Hard std L850%32%46.9%Hard para L8Hard para L838.3%27.3%35.9%Harder std L10Harder std L1040.6%23.4%35.2%Harder para L10Harder para L1017.2%23.4%14.1%

Takeaway → The simulation shortcut's bar sits below the plain first pick on every test set except the hardest reworded one, so scoring by simulation alone underperforms doing nothing.

Data table
Evaluation splitFrozen compiler (base)Soft-trace heuristicLearned verifier
Val mixed L659.4%43%60.2%
Fresh std L668.8%46.1%70.3%
Fresh para L657.8%35.2%60.2%
Hard std L850%32%46.9%
Hard para L838.3%27.3%35.9%
Harder std L1040.6%23.4%35.2%
Harder para L1017.2%23.4%14.1%

Numbers from experiments/qwen_complete_program_trace_reranker/analysis/all_final_metrics.csv (main_complete_program_trace_reranker_s384_answer rows)

Technical framing

Differentiable soft-executor scorer trails the frozen compiler on every split — The differentiable soft-executor scoring heuristic loses to just keeping the compiler argmax on all splits except the hardest paraphrase one.

Reworded questions widen the accuracy gap as problems lengthen

How to read

Lines track accuracy as problems grow from six to ten steps, split into plainly worded and reworded versions, for both the plain system and the trained picker. Higher is better; reworded lines sit lower.

0%20%40%60%80%678910Base, standardLearned, standardBase, paraphraseLearned, paraphraseLearned, paraphra…

Takeaway → Reworded lines fall well below plainly worded ones at every length, and the picker fails to close that reworded gap on the longer problems, dragging accuracy lower on both.

Data table
Program length (VM steps)Base, standardBase, paraphraseLearned, standardLearned, paraphrase
668.8%57.8%70.3%60.2%
850%38.3%46.9%35.9%
1040.6%17.2%35.2%14.1%

Numbers from experiments/qwen_complete_program_trace_reranker/analysis/all_final_metrics.csv (main_complete_program_trace_reranker_s384_answer, fresh/hard/harder standard and paraphrase splits)

Technical framing

Paraphrased prompts widen the accuracy drop as programs get longer — Paraphrasing costs ~11-23 points at every length, and the learned verifier makes the paraphrase drop worse, not better, at lengths 8-10.

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

The candidate search contains answer-correct programs for 91.4% to 100.0% of the main evaluation prompts, so the executable candidate set has substantial reachable headroom. The learned verifier captures only small in-distribution gains and loses accuracy on paired and longer-chain splits. The bottleneck is therefore candidate selection and credit assignment, not candidate availability.

Overview

This standalone experiment tests whether a learned verifier can better select hidden-VM candidate traces when it receives prompt-conditioned Qwen hidden-state context in addition to candidate execution features.

Large checkpoints are stored outside this directory:

Local structure:

  • src/qwen_complete_program_trace_reranker_experiment.py: run generator, training, and evaluation
  • src/analyze_qwen_complete_program_trace_reranker.py: regenerate aggregate CSVs, figures, reports, and checkpoint manifest
  • runs/: per-run logs and metrics
  • analysis/: aggregate metrics and figures
  • reports/: standalone Markdown and HTML report
  • checkpoint_manifest.csv: checkpoint and artifact index

Regenerate analysis artifacts from completed runs:

python experiments/qwen_complete_program_trace_reranker/src/analyze_qwen_complete_program_trace_reranker.py

Report

Rendered from reports/qwen_complete_program_trace_reranker_report.md

Abstract

This experiment tests a complete-program posttraining route for improving a frozen local Qwen compiler. A Qwen3-4B hidden-state adapter emits a compact virtual-machine program. Around that program, the system enumerates local executable edits and trains a small context-conditioned verifier to select the best candidate using only prompt hidden-state context, candidate features, and execution traces. The verifier never sees the target answer at inference time.

The result is diagnostic rather than successful. The candidate search contains answer-correct programs for 91.4% to 100.0% of the main evaluation prompts, so the executable candidate set has substantial reachable headroom. The learned verifier captures only small in-distribution gains and loses accuracy on paired and longer-chain splits. The bottleneck is therefore candidate selection and credit assignment, not candidate availability.

Question

Can a small posttraining module make a frozen Qwen-attached compiler select better complete programs by inspecting executable traces, without forcing the model to generate every intermediate reasoning step as text?

Method

  • Base model: Qwen/Qwen3-4B.
  • Value space: arithmetic over modulus 97 with up to 10 VM steps.
  • Frozen compiler: Qwen hidden states feed a trained hidden-VM compiler checkpoint.
  • Candidate generator: local edits around the compiler argmax program, with top-k alternatives and up to 2 edits.
  • Verifier input: candidate execution trace, scalar candidate features, and compact prompt hidden-state summaries.
  • Main verifier: 3 trace-transformer layers, width 128, 4 heads.
  • Main training set: 384 prompts, length range 1 to 6, positive label answer.
  • Main checkpoint selection: best validation learned accuracy; selected epoch 14.

The key baselines are:

  • base: the frozen compiler argmax program.
  • soft trace: a differentiable executor scoring heuristic.
  • learned: the trained verifier top-1 selection.
  • pair rerank: pair-level consistency reranking for paraphrase pairs.
  • oracle: any answer-correct candidate in the generated local neighborhood.

Main Results

splitbasesoft tracelearnedpair rerankoraclelearned gap recoveredavg candidatesanswer positives
validation mixed L659.4%43.0%60.2%n/a98.4%2.0%111.030.4
fresh standard L668.8%46.1%70.3%n/a98.4%5.3%111.030.3
fresh paraphrase L657.8%35.2%60.2%n/a100.0%5.6%111.027.9
fresh paired L657.3%43.2%55.2%54.7%98.4%-5.1%111.030.2
hard standard L850.0%32.0%46.9%n/a98.4%-6.5%179.044.7
hard paraphrase L838.3%27.3%35.9%n/a96.9%-4.0%179.043.2
harder standard L1040.6%23.4%35.2%n/a98.4%-9.5%263.047.6
harder paraphrase L1017.2%23.4%14.1%n/a91.4%-4.2%263.036.2

Main accuracy by split

Oracle gap recovered

Fresh length-6 standard prompts improved from 68.8% to 70.3%, a 1.6% absolute gain. Fresh length-6 paraphrase prompts improved from 57.8% to 60.2%. These gains are real but small relative to the oracle.

The same selector did not extrapolate. Fresh paired length-6 accuracy moved from 57.3% to 55.2%, a -2.1% absolute change. Harder standard length-10 moved from 40.6% to 35.2%, a -5.5% absolute change. The oracle stayed high on these splits, so the selector failed to locate available correct candidates.

Candidate Geometry

Candidate density

The candidate generator is broad. On length-6 fresh splits it produces about 111 candidates per prompt, with roughly 28 to 30 answer-correct candidates. On length-10 splits it produces 263 candidates per prompt, with many answer-correct candidates but far fewer state-exact or program-exact candidates. This explains why answer-only labels are easy to satisfy but weakly identify the best computational trace.

Objective Pilots

Pilot objective comparison

Several label objectives were tested before the main run:

  • Answer-correct labels learned a nontrivial selector on validation but were noisy because many candidates share the final answer.
  • State-exact labels were too conservative and mostly preserved the base program.
  • Single-oracle labels were sharper but still mostly preserved the base program.
  • Repair-focused weighting did not overcome the base-preservation tendency.

Validation curves

The main run eventually recovered the best validation learned accuracy at epoch 14, but validation gains were small while train accuracy rose strongly. That is the signature of a selector that can fit candidate artifacts without learning a robust preference rule for unseen prompts.

Domain Breakdown

domainbaselearnedoraclelearned delta
arithmetic31.2%34.4%96.9%3.1%
calendar37.5%40.6%100.0%3.1%
unit40.6%43.8%96.9%3.1%
list81.2%84.4%100.0%3.1%
boolean87.5%78.1%100.0%-9.4%
lookup65.6%65.6%100.0%0.0%

Domain breakdown

The verifier helped arithmetic, calendar, unit, and list prompts modestly, left lookup unchanged, and hurt boolean prompts. Boolean has many answer-correct candidates but relatively little trace-identifying signal because final answers collapse to few values.

Interpretation

This experiment answers one useful subquestion: local executable candidate search is not the limiting factor. The oracle remains high even when the base compiler is weak. The limiting factor is how to train a verifier that identifies the right complete program from a dense equivalence class of answer-correct candidates.

The current learned verifier is too passive. It sees traces and context, but its supervision says many different programs are equally good whenever they hit the final answer. Sharper labels alone did not fix this because the base program dominates many training groups and the correct non-base candidates are sparse. The result argues against scaling this exact reranker unchanged.

Most Impactful Next Options

  1. Train the selector from executable teacher traces, not just final answers. Use the oracle candidate to produce dense supervision over every intermediate state and operation, then train the verifier or compiler with a margin that explicitly ranks state-consistent candidates above answer-only candidates. This directly targets the observed dense-label failure.

  2. Convert reranking into preference learning on repairable failures. Filter training to groups where the base program is wrong and at least one non-base candidate is right, then train pairwise preferences with hard negatives that share the answer but diverge in state. This removes the base-preservation shortcut.

  3. Let Qwen read serialized candidate traces. Instead of only a small verifier, serialize a small shortlist of candidate programs and traces back into Qwen hidden states or text tokens, then train a LoRA selector head. This tests whether the frozen model already has the semantic machinery needed to choose among executable candidates when the candidates are made legible.

  4. Train a differentiable interpreter objective upstream. Backpropagate through the soft executor into the adapter with auxiliary losses on intermediate states, then use the discrete candidate oracle only for evaluation. This attacks the compiler's crystallized program quality rather than relying on post-hoc selection.

The first option is the cleanest next experiment because it directly matches the failure mode found here: answer-correct candidate availability is high, but answer-only selection is underdetermined.

Artifacts

Experiment log 1

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

2026-06-23

Objective: train and evaluate a context-conditioned learned verifier for local candidate traces emitted by a frozen Qwen-attached hidden VM compiler. The verifier uses candidate execution traces, compiler-local features, and compact Qwen hidden-state summaries from the prompt. Reports must be standalone.

Initial setup:

  • Created standalone experiment directory.
  • Copied the frozen mixed-domain trace compiler into this experiment's own large-artifact area: /workspace/large_artifacts/qwen_complete_program_trace_reranker/checkpoints/fixed_mixed_vm_trace_compiler_s512.
  • Seeded local source from the mixed-domain verifier implementation and prepared to add context features, hard-negative contrastive loss, and optional paired training.
  • Patched the context-conditioned reranker path so context normalization statistics are returned, saved, and used during evaluation.
  • Switched the primary positive label from full trajectory exactness to final answer correctness, keeping state-exact and program-exact metrics as diagnostics. This aligns the experiment with complete-program candidate selection from executable answer labels.
  • Ran smoke_complete_program_trace_reranker, a tiny Qwen-backed end-to-end smoke test. It loaded the fixed Qwen/Qwen3-4B hidden-VM compiler checkpoint, generated candidate groups, trained the reranker for two epochs, wrote run artifacts, and saved a small verifier checkpoint. Fresh paired length-3 base, learned, and pair-rerank accuracy were all 66.7%; oracle was 100.0%. This validates the pipeline and confirms there is answer-correct candidate headroom even at smoke scale.
  • Ran pilot_complete_program_trace_reranker_s96 with answer-correct positives, length-6 fresh splits, length-8/10 hard splits, top-k 3, and two-edit candidate neighborhoods. Validation improved from 60.4% base to 64.6% learned, and hard standard improved from 54.2% to 56.2%, but fresh paired fell from 65.6% base to 57.8% learned; pair reranking recovered to 64.1%. Interpretation: answer-correct labels are dense, averaging 29.4 positives per 111 candidates on fresh paired, and are not sharp enough by themselves for robust top-1 selection.
  • Ran matched state-exact and oracle-selector pilots. State-exact training and single-oracle training mostly selected the base program everywhere, matching base accuracy on fresh and hard splits. Interpretation: sharper labels alone are insufficient when base-correct groups dominate the training signal.
  • Ran pilot_complete_program_trace_reranker_s96_repairfocus, which used single-oracle positives with base-positive groups downweighted and repairable groups upweighted. This also mostly selected the base program. Interpretation: weighting alone did not expose a strong repair preference under the current feature and trace representation.
  • Ran main_complete_program_trace_reranker_s384_answer, the main answer-label run with 384 training prompts, 128 validation prompts, 128 fresh/hard evaluation prompts, 96 paraphrase pairs, length-6 in-distribution evaluation, and length-8/10 extrapolation. Best validation epoch was 14. The learned selector improved validation from 59.4% to 60.2%, fresh standard length-6 from 68.8% to 70.3%, and fresh paraphrase length-6 from 57.8% to 60.2%. It degraded fresh paired length-6 from 57.3% to 55.2%, hard standard length-8 from 50.0% to 46.9%, hard paraphrase length-8 from 38.3% to 35.9%, harder standard length-10 from 40.6% to 35.2%, and harder paraphrase length-10 from 17.2% to 14.1%. Oracle answer-correct candidate availability stayed high, ranging from 91.4% to 100.0% across the main evaluation splits.
  • Generated aggregate CSVs, six figures, a standalone Markdown report, and a standalone HTML report with src/analyze_qwen_complete_program_trace_reranker.py. The core conclusion is diagnostic: local executable candidate search has enough headroom, but answer-only verifier training is underdetermined and does not learn robust program selection for paired or longer-chain prompts.

Figures 6

accuracy by split
accuracy by split · analysis/figures/
candidate density
candidate density · analysis/figures/
domain breakdown
domain breakdown · analysis/figures/
oracle gap recovered
oracle gap recovered · analysis/figures/
pilot comparison
pilot comparison · analysis/figures/
validation curves
validation 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 ↗