2026-07-13 – 07-19 · Xiao Liang

7.13 – 7.19 Weekly Update

Summary

My motivation for interning here is to find strategies for better post-training of code-agent models, both with and without a teacher model, namely self-improvement and distillation. I'm currently exploring multiple experimental settings and hypotheses in parallel, identifying the most promising direction, and then investigating it in greater depth.

1. SWE-OPD full-infrastructure evaluation (§1). This week I completed the SWE-OPD training and inference infrastructure and verified that the model trained with OPD improves performance on both SWE-Bench Verified and SWE-Bench Pro.

2. Self-distillation Training (35B-A3B) (§2). Following "Embarrassingly Simple Self-Distillation" — shape the sampling distribution with temperature and top-k / top-p truncation alone — I test whether the recipe carries over to agentic SWE tasks. The self-sampling stage is complete, and the SFT-based self-training stage is now running.

3. Math TIR (tool-integrated reasoning) validation platform (§3). A SWE trajectory takes 25–40 minutes, so the contribution of each improvement is hard to see. I use math TIR for initial validation of the method instead — a 60–100× speedup — to sweep the OPD design space first, then transfer the conclusions back to SWE.

4. Self-in-context distillation experiments (§4). In this setting, the teacher is replaced with a frozen snapshot of the student model, together with injected hints. I will initially use a strong critic model to generate the hints and, if the approach proves effective, gradually transition hint generation to the student itself. I completed the configuration alignment and compared the resulting training dynamics.

1OPD: full infra evaluation

The OPD-trained model beats the 9B base on both benchmarks — SWE-bench Verified (495) and SWE-bench Pro (266) — which demonstrates the correctness of the current infra.

Setup. Qwen3.5-9B student distilled from a standalone 27B teacher, minimal harness, no hint injection, TP2 × CP2 × DP4 = 16 across 4 training nodes plus 1 teacher node, context 65,536 / generation 12,288, max_tokens_per_gpu 38,912.

1.1 Evaluation results

ModelTrainingVerified 495Pro 266Avg. turns (V/P)Abort
9B basenone38.4% net 40.5%20.7% net 22.9%162 / 17626 / 26
OPD-plain-i38minimal harness42.2% net 42.7%24.8% net 25.3%101 / 1206 / 5

1.2 What the numbers say

The gain shows up on both benchmarks and survives pairing. Verified improves by 3.8pp (38.4 → 42.2) and Pro by 4.1pp (20.7 → 24.8). Instance by instance, OPD uniquely solves 50 problems on Verified against the base model's 38, and 17 against 12 on Pro. Combined McNemar significance is marginal (p ≈ 0.14) with limited n, but two benchmarks moving the same direction plus a net per-instance gain is a real signal rather than evaluation noise.

1.3 Why OPD suits long-horizon tasks

A natural worry about applying on-policy distillation to SWE work is cost: trajectories are long, so computing teacher log-probs over them sounds prohibitive. In practice it is not, because OPD is a per-turn teacher–student distillation. The context may be long, but the generated span that actually participates in the OPD computation at each turn is short.

This follows from how multi-turn SWE harnesses are normally built: the think tokens of each turn are not carried into the next turn's input. The next turn sees only the previous turn's tool selection, not the reasoning behind it — otherwise retaining think content at every turn would make the trajectory balloon. But those think tokens are model-generated and must still be trained on, so the implementation proceeds one turn at a time.

Consequence There is no "short prompt, very long output, teacher log-probs over an enormous sequence" cost problem. Only a small fraction is computed at each step — which is why OPD is workable on SWE-style tasks at all.

2Self-distillation Training (35B-A3B)

Testing whether sampling-distribution shaping alone — temperature plus top-k / top-p truncation — can self-distill a gain on agentic SWE tasks, with no external teacher involved. Training is running.

Apple's paper, "Embarrassingly Simple Self-Distillation Improves Code Generation," shows that a remarkably simple recipe — shaping the exploration distribution and the resulting token distribution by training on self-generated rollouts with appropriate temperature and truncation — can improve code generation on its own.

If the student's own rollouts turn out not to be good enough, there is a fallback: let a teacher intervene in the student's trajectories, either by teacher selection or by teacher re-rollout.

2.1 Choosing the rollout temperature

Eleven temperatures were swept on 100 SWE-bench Verified instances at top-k 10, on a clean H100 curve.

Temperaturepass@1Timeouts
0.753%3
0.859%3
0.958%0
1.059%4
1.1 — selected57%4
1.253%4
1.446%6
1.621%15
1.86%7
2.01%3
2.21%8

1.1 was chosen to preserve rollout diversity. 0.8 and 1.0 score slightly higher (59%), but 1.1 gives up almost nothing (57%) while leaving more exploration in the distribution — which is precisely the lever the self-distillation recipe depends on. Quality collapses beyond 1.4.

2.2 Training data

ItemValue
Rollout source6,650 SWE problems / 5,124 Docker images
Dataset10k self-sampled trajectories
Design decisionTrain on both positive and negative trajectories — not rejection sampling.
SamplingTemperature 1.1 / top_k 10 / top_p 0.95 — same spec as Apple's paper

2.3 Error masking

Failed steps stay in the trajectory, so the model still sees them and keeps its error-recovery context. What changes is the loss: the single assistant turn whose action itself was invalid does not contribute. The masked share comes to 2.45%.

TierConditionTurnsMasked
Tier 1No valid action — no tool_call, or hallucinated tool name / arguments20,729yes
Tier 2Command syntax error — rc ≠ 0 with command-not-found or syntax-error867yes
ExcludedLegitimate command that failed — a test not passing, a genuine traceback10.4% of turnsno

The exclusion is the important line. A command that runs correctly and reveals a real failure is an error-recovery signal worth learning from; only turns that were never valid actions get zeroed out.

2.4 Training

Running on 2 MI300 nodes under slime Megatron: 2 epochs, global batch size 16, lr 1e-5 cosine, bf16, loss taken only on assistant think and tool_call spans.

Correction The earlier conclusion that "Megatron cannot run this, we need a different framework" was wrong and has been retired. The framework was never the blocker.

Evaluation is pending compute. Once the rollout work frees capacity, base 35B and SFT 35B will be run against Verified 495 + Pro 266, minimal harness only, temperature 1.0.

3Math TIR as a faster ablation platform

A math tool-integrated-reasoning setup generates a trajectory 60–100× faster than SWE while keeping the OPD teacher mechanism byte-for-byte identical — which makes it the right place to answer the open design questions.

The difficulty with iterating on OPD inside SWE is that three expensive properties are entangled: the task needs a CPU-heavy sandbox cluster that is prone to falling over, trajectories routinely exceed 100 turns, and the reward comes from noisy sandbox evaluation. When a run improves or fails to improve, it is hard to attribute that to the OPD signal itself. Math TIR removes all three while changing nothing about the distillation mechanism.

DimensionSWE-OPD (current)Math TIR-OPD (proposed)
Sandboxdocker / E2B container cluster; CPU-heavy, fragilein-process subprocess — no containers, nothing remote
Trajectory lengthoften > 100 turns≤ 16 tool calls
Rewardsandbox eval, noisyboxed answer — verifiable and clean

Because the OPD loss and the teacher query are unchanged, the confounders drop out and the OPD signal itself can be isolated — the KL coefficient, the teacher–student gap, early stopping, ReOPD prefix scheduling. Conclusions then transfer back to SWE.

3.1 Measured cost difference

MetricQwen3.5-9B · SWE (minimal)Qwen3-4B-SFT · math TIRRatio
Tool-call turns~101–1623.5~30–46× fewer
Trajectory length~24k tokens~3.6k tokens~7× shorter
Time per trajectory~25–40 min ~14s/turn = 9.5s model + 4.5s sandbox~24s~60–100× faster

With limited compute, that ratio is the whole argument: settle the OPD design space where a trajectory costs 24 seconds, then carry the answers back to the setting where one costs half an hour.

3.2 Qwen3-4B TIR baseline

Runaime24aime25aime26amc23hmmt25hmmt26AVG
base, reasoning only38.342.552.584.426.720.544.1
base, TIR47.951.260.896.934.221.252.0
SFT, reasoning only31.238.340.884.417.513.637.7
SFT, TIR23.326.725.881.917.512.131.2

The base TIR score is misleading on its own. 52.0 against 44.1 for reasoning-only looks like tool use helping, but in many of those runs the model never actually calls a tool. Scoring well is not the same as having learned TIR; genuine interleaved tool-use reasoning is a capability that has to be trained in with RL.

The only openly available model we could find that has learned this interleaved behaviour through RL is from the Qwen2.5 generation. Because its distillation data comes from that older generation, quality is lower and SFT costs accuracy — 37.7 reasoning-only and 31.2 TIR, both below base. That does not block the experiment: the Re-OPD paper works the same way, and we are following their setting.

3.3 Status

Waiting on the teacher SFT, which should complete within a day. After that the OPD and OPSD ablations will likely run here first rather than on SWE, simply because SWE is too slow for the compute currently available.

4OPSD: hint-bearing feedback

The other form self-distillation can take: the student is 35B-A3B, the teacher is its own frozen initial snapshot, and the difference between them is manufactured by injecting a hint.

The motivating observation is that an RL reward is a scalar and carries no direction. It says an attempt was worse without indicating how. Replacing it with hint-bearing feedback, trained through a feedback-distillation loss, turns that into directional supervision. The intended progression is to hold a critic model fixed while it generates hints, then swap the hint source over to the student itself, and eventually let the critic improve on its own.

4.1 Open questions

4.2 Two-stage plan

Stage one, in progress: establish whether hints written by a genuinely strong teacher — GPT-5.6-terra in the current experiments — actually help the student train on this task at all.

Stage two: work out how to write good hints, and then whether the student model can be brought to write them itself. If that lands, it closes the loop into iterative self-improvement.

4.3 Configuration against OPD

DimensionOPD (9B + 27B)OPSD (35B-A3B)Same
Distillation typecross — 9B student ← 27B teacherself — 35B student ← own frozen snapshot
StudentQwen3.5-9BQwen3.5-35B-A3B
TeacherQwen3.6-27BQwen3.5-35B-A3B
HintnoneGPT-5.6-terra, one per trajectory
Non-expert parallelismTP2 × CP2 × DP4 = 16TP2 × CP2 × DP4 = 16
Nodes4 training + 1 teacher4 training + 1 teacher
ctx / gen65,536 / 12,28865,536 / 12,288
max_tokens_per_gpu38,91238,912

4.4 Training dynamics

MetricOPD 9BOPSD 35BReading
step_time~72 min~68 minessentially the same
rollout_time42 min36 minOPSD slightly faster
train_time31 min29 mincomparable
actor_train_time25 min22 mincomparable
effective tok/gpu/s25.314.3OPD higher — 9B, longer outputs
num_turns / traj5759the same
tokens_per_turn28210635B emits much less per turn
opd_reverse_kl0.1220.004the substantive difference — see below
student_gt_teacher_frac0.650.46

The reverse-KL gap is the finding worth sitting with. At 0.122 against 0.004 the two runs differ by roughly 30×, which is exactly what self-distillation predicts: a student and its own frozen snapshot start out very nearly identically distributed, so there is almost no divergence to measure. The implication is that OPSD's effective supervision does not come from a capability gap at all — it comes from the distributional difference the injected hint creates. That makes hint quality the central variable rather than a detail, and connects directly to the open questions in §4.1.

2026-07-13 – 07-19 · Xiao Liang ↑ Top   All reports