SLM-418: convert replay preference rows to PreferencePair (DSH5-10) - #1131
Conversation
Sixth slice of the DSH5-10 replay-preference scope: extraction of all 7 named patterns finished in the prior slice, so this takes the smallest next step of the still-unattempted training scope -- converting an already extracted OperatorReplayPreferenceRowV1 into this repo's existing PreferencePair shape (the same schema slm preference build-pairs/train already reads/writes), so a later slice can feed rows into that harness without inventing a second corpus shape. prompt is the row's real, pack-authorized input-state OpenUI source (traces carry no user utterances to recover instead); chosen/rejected are the row's own legal-set action tokens verbatim, not replayed alternate programs; composite_reward is never called on those tokens since scoring "undo" as OpenUI source would manufacture a meaningless number. A row whose input state is foreign to its trace (e.g. MERGE_SUCCESS, grounded on a branch-edit tip) is skipped with a reason, never fabricated. Claim class: wiring, same tier as every prior slice. No training, checkpointing, or composite-reward scoring is attempted; the DSH3 policy heads, four-baseline comparison, and held-out measurement remain fully unattempted. Verified (fresh Python 3.12 venv, NODE_OPTIONS= npm ci in src/apps/openui_bridge): 69 passed (61 baseline + 8 new) across tests/test_dsl/test_replay_preference.py plus the sibling merge/ conversation/disposition suites; ruff check clean; verify_version_stamps --check ok (dsl.operators.replay_preference v6->v7); repo_policy ok; verify_decode_invariants clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUwBZ5X9HJzzvVjXcd2RZ9
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughChangesThis change adds conversion from extracted replay preference rows into Replay preference conversion
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant preference_pairs_from_trace
participant ConversationTraceV1
participant preference_pair_from_replay_row
participant PreferencePair
Caller->>preference_pairs_from_trace: provide trace and replay rows
preference_pairs_from_trace->>ConversationTraceV1: locate input_state_id
ConversationTraceV1-->>preference_pairs_from_trace: return input state source
preference_pairs_from_trace->>preference_pair_from_replay_row: convert grounded row
preference_pair_from_replay_row->>PreferencePair: create mapped preference pair
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…1132) * SLM-418: convert replay preference rows to PreferencePair (DSH5-10) Sixth slice of the DSH5-10 replay-preference scope: extraction of all 7 named patterns finished in the prior slice, so this takes the smallest next step of the still-unattempted training scope -- converting an already extracted OperatorReplayPreferenceRowV1 into this repo's existing PreferencePair shape (the same schema slm preference build-pairs/train already reads/writes), so a later slice can feed rows into that harness without inventing a second corpus shape. prompt is the row's real, pack-authorized input-state OpenUI source (traces carry no user utterances to recover instead); chosen/rejected are the row's own legal-set action tokens verbatim, not replayed alternate programs; composite_reward is never called on those tokens since scoring "undo" as OpenUI source would manufacture a meaningless number. A row whose input state is foreign to its trace (e.g. MERGE_SUCCESS, grounded on a branch-edit tip) is skipped with a reason, never fabricated. Claim class: wiring, same tier as every prior slice. No training, checkpointing, or composite-reward scoring is attempted; the DSH3 policy heads, four-baseline comparison, and held-out measurement remain fully unattempted. Verified (fresh Python 3.12 venv, NODE_OPTIONS= npm ci in src/apps/openui_bridge): 69 passed (61 baseline + 8 new) across tests/test_dsl/test_replay_preference.py plus the sibling merge/ conversation/disposition suites; ruff check clean; verify_version_stamps --check ok (dsl.operators.replay_preference v6->v7); repo_policy ok; verify_decode_invariants clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUwBZ5X9HJzzvVjXcd2RZ9 * docs(autotrain): joint seed x steps smoke sweep, real new evidence Follow-up to the ledger's diminishing-returns note after batch #4: instead of another single-variable check, this batch varies --seed (1, 2, 3) and --steps (4, 16) jointly against main HEAD f3adde1 (PR #1131, already merged), same wf_smoke_v2 fixture/model/recipe as every prior batch. 6 more independently-run rows, combined with the prior single-variable batches into a full seed x steps grid: seed-to-seed spread is real but bounded and shrinks as steps increase, and seed introduces variance without a directional bias (seed 0 is neither systematically highest nor lowest). Genuinely new joint evidence, not a repeat of either single-variable batch. Still fixture_or_scratch: n=1 per (seed, steps) cell, 101-record fixture, context-backend scratch. No convergence/generalization/ship claim. Per the ledger's own next-steps note, the smoke-loop's role as a harness liveness check is now thoroughly covered at this fixture size; the next scheduled iteration should move off this fixture entirely. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUwBZ5X9HJzzvVjXcd2RZ9 --------- Co-authored-by: Claude <noreply@anthropic.com>
…er adapter gap Investigation-only design note, no code or training changes. Confirms and extends PR #1131's reward-shape mismatch finding with a deeper structural gap: OperatorActionViewV1 (operator_policy_view.py) requires operator_id/ verdict/coverage fields that history-control actions (undo/redo/checkout/ merge -- 6 of the 7 confirmed ReplayPreferenceRelation members) simply don't have, since those actions never route through the operator-legality compiler. Only PRONOUN_FOCUS_FOLLOWUP rows draw both chosen/rejected from real OperatorActionViewV1-compatible legal_actions. Lays out two candidate designs (extend the frozen OperatorPolicyInputV1 schema vs. a separate history-control scorer) with tradeoffs and a recommendation, so a future session with real time budget (MAX_RUN_MINUTES is 3, too tight for this) doesn't have to re-derive the mismatch before writing code. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VDeTk7RxBAbWX5fKjBqb4r
…er adapter gap (#1144) Investigation-only design note, no code or training changes. Confirms and extends PR #1131's reward-shape mismatch finding with a deeper structural gap: OperatorActionViewV1 (operator_policy_view.py) requires operator_id/ verdict/coverage fields that history-control actions (undo/redo/checkout/ merge -- 6 of the 7 confirmed ReplayPreferenceRelation members) simply don't have, since those actions never route through the operator-legality compiler. Only PRONOUN_FOCUS_FOLLOWUP rows draw both chosen/rejected from real OperatorActionViewV1-compatible legal_actions. Lays out two candidate designs (extend the frozen OperatorPolicyInputV1 schema vs. a separate history-control scorer) with tradeoffs and a recommendation, so a future session with real time budget (MAX_RUN_MINUTES is 3, too tight for this) doesn't have to re-derive the mismatch before writing code. Claude-Session: https://claude.ai/code/session_01VDeTk7RxBAbWX5fKjBqb4r Co-authored-by: Claude <noreply@anthropic.com>
Summary
Sixth slice of the DSH5-10 replay-preference scope (SLM-418). Extraction of all 7 named patterns finished in the prior slice (#1119); this takes the smallest next step of the issue's still-unattempted training scope: converting an already-extracted
OperatorReplayPreferenceRowV1into this repo's existingPreferencePairshape (slm_training.harnesses.preference) — the same schemaslm preference build-pairs/trainalready reads/writes — so a later slice can feed rows into that harness without inventing a second corpus shape.preference_pair_from_replay_row/preference_pairs_from_trace(new, insrc/slm_training/dsl/operators/replay_preference.py), re-exported fromoperators/__init__.py.promptis the row's real, pack-authorized input-state OpenUI source — aConversationTraceV1's turns are AST operations, never user utterances, so there's no natural-language instruction to recover instead.chosen/rejectedare the row's own legal-set action tokens verbatim (e.g."undo","checkout:<state>"), not replayed alternate full-program renderings — that replay is explicitly out of scope for this slice.composite_rewardis deliberately never called on those tokens (scoring"undo"as OpenUI source would manufacture a meaningless number);chosen_score/rejected_scorestay at the0.0default, with the distinction recorded inmeta.input_state_idis foreign to its trace (theMERGE_SUCCESScase, grounded on a branch-edit tip rather than any single trace) is skipped with a recorded reason, never fabricated.Claim class:
wiring, same tier as every prior slice in this doc. Not attempted (unchanged from before this slice): SFT/preference training against the DSH3-selected policy/control heads, the four-baseline comparison, held-out benefit measurement, turn-depth/context-view ablations, or replaying a rejected action to an alternate program.Verification (real, this session)
→ 69 passed (61 baseline + 8 new)
ruff checkon every changed Python file → cleanpython -m scripts.verify_version_stamps --check --base origin/main→ok(dsl.operators.replay_preferencev6→v7;dsl.operators.contractsno-bump for the new re-exports)python -m scripts.repo_policy→okpython -m scripts.verify_decode_invariants→ cleanFull details, design rationale, and the doc's own reproducibility log:
docs/design/dsh5-10-replay-preference-rows.md— "Sixth slice (v7)".Test plan
pytest -q tests/test_dsl/test_replay_preference.py …(see above) — 69 passedruff check— cleanverify_version_stamps --check— okrepo_policy— okverify_decode_invariants— cleanGenerated by Claude Code
Summary by CodeRabbit
New Features
Documentation
Tests