[codex] add sampled-token OPD recipe#391
Open
renfeichen-fw wants to merge 3 commits intomainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Result
This PR adds a privileged-prompt OPD loop and validates it end-to-end on a real GSM8K-style privileged-context run with the same Qwen 3.5 9B model used as both student and frozen teacher.
The live run completed all requested OPD steps and showed the main teacher-trace logprob gap moving in the right direction:
The key signal is the teacher-trace gap: the frozen teacher sees the privileged prompt, the student sees the normal prompt, and we score the same teacher trace under both prompts. Lower means the online student is getting closer to the privileged teacher on the target response distribution.
What Changed
opd_loop.pyis easier to audit.Live Run
gsm8k-opd-qwen3p5-9b-256k-202604250928-attachedaccounts/fireworks/trainingShapes/qwen3p5-9b-256kfirectllaunch/kill mutation commandsTeacher-Trace Gap
Lower is better. This is the strongest OPD validation signal because it compares student vs frozen privileged teacher logprobs on the same teacher trace.
Final-Answer Token Gap
This isolates the final-answer token span on the teacher traces. It moves below zero early, meaning the trained student assigns at least as much probability as the privileged teacher to the final-answer tokens on these traces.
Greedy Generation Accuracy
Exact-match generation is noisy on this small validation set, so this should not be treated as the primary OPD metric. It does show intermittent improvement, but the final point is not stable enough to claim deployed generation quality from this run alone.
On-Policy Sampled Reverse KL
This is the training-time OPD loss signal from sampled online completions. It is noisier than teacher-trace eval because the sampled responses change every step.
Active OPD Tokens
Each optimizer step receives packed datums rather than one single sample. The run trained over 1.37M active response tokens across 25 steps.
Validation
483 passed, 32 skipped28 passedgit diff --checkclean