Opinion: The government should not become the kill switch for AI models◆Breaking: Anthropic says U.S. directive forced suspension of Fable 5 and Mythos 5 access◆AiML SuperAgent launches Context Minimizer for AI coding assistants◆Anthropic launches Claude Sonnet 4.6 and Opus 4.6 with 1M-context beta◆Gemini 3.1 Flash Live targets real-time voice and vision agents◆OpenAI adds more product-layer emphasis to safety and governance◆Google expands Gemini deeper into Docs, Sheets, Slides, and Drive◆GPT-5.4 mini and nano push cheaper production inference tiers◆GitHub spreads GPT-5.4 across Copilot editors, CLI, mobile, and agents◆AI agent UX is shifting from async chat to live multimodal interaction◆Model governance is becoming a shipping requirement, not a policy appendix◆Coding copilots are now competing on workflow integration, not just model access◆Low-latency multimodal APIs are turning into default platform expectations◆Opinion: The government should not become the kill switch for AI models◆Breaking: Anthropic says U.S. directive forced suspension of Fable 5 and Mythos 5 access◆AiML SuperAgent launches Context Minimizer for AI coding assistants◆Anthropic launches Claude Sonnet 4.6 and Opus 4.6 with 1M-context beta◆Gemini 3.1 Flash Live targets real-time voice and vision agents◆OpenAI adds more product-layer emphasis to safety and governance◆Google expands Gemini deeper into Docs, Sheets, Slides, and Drive◆GPT-5.4 mini and nano push cheaper production inference tiers◆GitHub spreads GPT-5.4 across Copilot editors, CLI, mobile, and agents◆AI agent UX is shifting from async chat to live multimodal interaction◆Model governance is becoming a shipping requirement, not a policy appendix◆Coding copilots are now competing on workflow integration, not just model access◆Low-latency multimodal APIs are turning into default platform expectations◆
All Articles
AI Training

Verifier-Calibrated On-Policy Distillation, Version 2

When every repair fails, how much weight should the teacher get? A revised training objective answers that question and defines how to test whether a model retains its old skills.

By Marvin B FreedmanNov 23, 2026 7 min read

Suppose a student proposes four repairs for the same bug and all four fail the tests. Each repair earns the same reward, so each normalized advantage is zero. The first edition used sigmoid(0) = 0.5 as the teacher weight. The teacher could then reinforce a token from a broken patch even though the verifier had rejected every attempt.

Version 2 gives the verifier an explicit pass decision. It also specifies what to train on if the student loses an old skill, and what evidence would justify saying it retained that skill. Minimal code repair is the running example. The method and the experiment below are proposals.

Key Takeaways
  • A failed rollout gets zero teacher weight, even when it ranks first in its group.
  • Every replay prompt keeps a verified answer from before training. A fresh student answer can join it after passing the same checks.
  • Retention is measured on new prompts for each old skill, with the original checkpoint as the baseline.

Give the verifier two outputs

Before adapting the student, freeze a copy of its checkpoint as the reference π₀. At each collection step, take a snapshot π_old of the current student. Sample K completions for each target prompt x. The verifier returns a pass bit bᵢ and a scalar reward Rᵢ for each completion yᵢ. Fix the acceptance rule before training.

bᵢ = 1 if the submission is valid and passes every required test, else 0
Rᵢ = −1 if bᵢ = 0
Rᵢ = 1 − 0.5 × extra_edit − 0.3 × added_complexity − 0.2 × unrelated_lines
     if bᵢ = 1
Aᵢ = (Rᵢ − mean(R₁,…,R_K)) / (population_std(R₁,…,R_K) + 10⁻⁸)

Scale each edit penalty to [0, 1]. A one-line fix and a rewrite can both pass, then earn different rewards for the size of the change. For a graded task, the pass bit can come from a fixed threshold on an absolute correctness score. Set that threshold independently of the sampled group. Aᵢ tells us how an answer ranked within that group.

Admit teacher guidance only on a pass

For each verified completion, score its sampled token a at prefix s under both the teacher T and the behavior snapshot. The teacher may also see a verified reference patch z. The student generates its answer from the prompt alone.

Gᵢ = bᵢ × sigmoid(Aᵢ)
δᵢₜ = clip(log T(a | s, z) − log π_old(a | s), −0.5, 0.5)
Ãᵢₜ = Aᵢ + 0.2 × Gᵢ × δᵢₜ
What the gate does on four repairs of one bug
Verifier outcomesGroup advantages AᵢTeacher weights Gᵢ
Four fail at reward −10, 0, 0, 00, 0, 0, 0
Two fail at −1, two pass at +1≈ −1, −1, +1, +1≈ 0, 0, 0.731, 0.731
Four pass at the same reward0, 0, 0, 00.5, 0.5, 0.5, 0.5

In the all-fail case, every dense advantage is zero, so this group contributes zero to the clipped policy gradient. The reference penalty, entropy term, and replay can still update the model. If every repair passes at the same reward, the teacher can advise on token choices within successful solutions. With a verifier that awards partial credit to failures, a failed rollout can have a positive sequence advantage. Its teacher term is still exactly zero.

Keep a verified answer for each replay prompt

Before adapting the student, make a training bank of old-skill prompts, stratified by skill. For each prompt x, save one answer y₀ generated by the frozen checkpoint that passes the skill’s checks. Keep this answer for the entire run. Record baseline pass rates and bank coverage by skill, including prompts for which the checkpoint produced no verified answer.

  • For code, run the answer against fixed replay-training tests, including edge cases. For tool use, check the schema and execute the call in a fixture to verify the intended result. A well-formed call with the wrong arguments fails.
  • For summaries, have two reviewers independently check required facts against the source and flag unsupported statements. Admit only answers both reviewers pass. Hide the checkpoint identity and use the same rubric for original and refreshed answers.
  • Every 250 updates, sample one fresh answer per bank prompt from the current student. Cache it for the next interval only if it passes the same checks. Discard failures and unresolved judgments. Record first-attempt acceptance by skill before filtering. Student confidence plays no part in admission.

A student that has forgotten how to call a tool may fail every refresh in that skill. Its frozen, verified targets still supply a training signal. If the initial bank lacks coverage of a skill, report the gap and restrict any claim about the scope of replay.

Put replay in the optimizer loss

Sample a skill uniformly, then a bank prompt uniformly within that skill. For each target response y, compute teacher-forced cross-entropy on its response tokens, including the end token. Mask the prompt and padding. Length normalization gives a long summary and a short tool call equal weight when sampling their prompts.

ℓ(x,y) = −(1 / |y|) Σₜ log πθ(yₜ | x, y₁,…,yₜ₋₁)
if x has a fresh verified answer y₁:
    ℓ_anchor(x) = 0.5 × ℓ(x,y₀) + 0.5 × ℓ(x,y₁)
else:
    ℓ_anchor(x) = ℓ(x,y₀)
L_replay = mean of ℓ_anchor over sampled bank prompts

On the new task, use the clipped policy loss below. Take means over generated target tokens. Compute KL and entropy on the next-token distributions at those prefixes. Hold the behavior snapshot, gates, and dense advantages fixed during differentiation. The replay responses are fixed supervised targets between refreshes.

ρ = πθ(a | s) / π_old(a | s)
L_policy = −mean(min(ρ × Ã, clip(ρ, 0.8, 1.2) × Ã))
L_task = L_policy + β × mean(KL(πθ || π₀)) − η × mean(H(πθ))
L = 0.9 × L_task + 0.1 × L_replay

The 0.1 is a loss weight applied once. Each step uses both a target batch and a replay batch. Starting values for an experiment are K = 4, β = 0.01, and η = 0.001. Record any adjustment to β against a target of 0.03 nats per token. These settings still need empirical validation.

One training iteration

old = freeze_snapshot(student)
if step % 250 == 0:
    for x in replay_bank:
        candidate = sample(old, x)
        fresh[x] = candidate if skill_check(x, candidate) else None

records = []
for x in target_batch:
    ys = sample(old, x, K=4)
    outcomes = [verify(x, y) for y in ys]  # (pass bit, reward)
    advantages = normalize_within_prompt([r for b, r in outcomes])
    for y, (passed, reward), A in zip(ys, outcomes, advantages):
        for s, a in response_tokens(x, y):
            dense = A
            if passed:
                d = logprob(teacher, a, s, x.reference) - logprob(old, a, s)
                dense += 0.2 * sigmoid(A) * clip(d, -0.5, 0.5)
            records.append((s, a, stop_gradient(dense)))

task = clipped_loss_with_kl_and_entropy(student, old, frozen_base, records)
anchors = sample_prompts_balanced_by_skill(replay_bank)
replay = mean(anchor_loss(student, x, frozen_answer[x], fresh[x]) for x in anchors)
optimizer_step(0.9 * task + 0.1 * replay)

Test whether the old skills survived

Before training, split by source and task family. Keep replay-training, checkpoint-validation, and final test prompts disjoint, including paraphrases and near-duplicate functions. Reserve fresh tests, reference answers, and blinded graders for the final evaluation. Keep those materials out of teacher context, replay admission, and checkpoint selection.

Use validation to select one checkpoint per training run. On the locked test set, give the frozen π₀ and each selected checkpoint the same prompts, decoding settings, and token budget. Score one answer per prompt. For code, score the fraction passing all hidden tests. For tool use, score successful execution. For summaries, report the fraction passing the factuality and coverage rubric. Score every test prompt, including failures.

Δ_skill = 100 × (final pass fraction − frozen π₀ pass fraction)
Example preregistered retention margin: 2 percentage points per skill

Run at least five paired training seeds. Report each skill’s baseline, final score, paired change in percentage points, and the worst skill change alongside new-task pass@1. Estimate one-sided 95% lower confidence bounds for the changes by resampling paired seeds and prompt families, preserving model pairs. Fix the margin before seeing results. Claim retention within that margin only if every protected skill’s lower bound exceeds −2 points. A mean change of zero could hide a loss in tool use. A wide interval leaves retention unresolved.

To test whether replay helped, repeat the run with the replay gradient disabled, keeping the target-loss coefficient, KL schedule, target rollouts, and optimizer budget matched. Compare paired per-skill changes and new-task performance. A frozen-target-only replay arm isolates the contribution of refreshed student answers. A confidence-only replay arm tests the first edition’s proposal directly. Track replay acceptance and KL as training diagnostics. The retention claim rests on independent test performance.

Sources and first edition

© 2026 Marvin B. Freedman.

Recommended Next Step

Ready to try it yourself?

Get started with the tools mentioned in this article. Most have free trials - no credit card required.

Browse Matching Tools ->
Weekly Newsletter

Stay Ahead of the AI Curve

Get weekly AI tool reviews, workflow breakdowns, and prompt ideas without the recycled hype.

No spam. Unsubscribe anytime.