refactor: share trace_to_sample with verifiers in the prime monitor#2974
Merged
Conversation
Replace the monitor's hand-rolled v1-trace -> sample conversion in `_rollouts_to_parquet_bytes` with `verifiers.v1.samples.trace_to_sample`, the same canonical converter verifiers' eval `uv run eval --push` uses. Both producers now emit one identically-shaped sample record; the RFT-only parquet columns (run/step/advantage/ problem_id/env_name) are layered on here. Behavior-preserving: the parquet schema and all column values are unchanged (verified against the existing monitor unit tests). Bumps the deps/verifiers submodule to the verifiers PR that adds `trace_to_sample`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ixing) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ed-sample # Conflicts: # deps/verifiers
samples.py was dropped on the verifiers branch - trace_to_sample now lives in verifiers.v1.push Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ed-sample # Conflicts: # deps/verifiers
samsja
approved these changes
Jul 8, 2026
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.
Summary
_rollouts_to_parquet_byteswithverifiers.v1.push.trace_to_sample— the single canonical "old format" converter, now shared with verifiers' evaluv run eval --push.--push/prime eval pushin verifiers) now emit one identically-shaped sample record, so the platform renders them consistently and the conversion logic can't drift between the two repos.run_id/step/advantage/problem_id/env_name) are layered on here; the shared function owns the conversation/branch/trajectory extraction.deps/verifierssubmodule to the companion verifiers PR that addstrace_to_sample.Behavior
Behavior-preserving: the
_SAMPLE_SCHEMAand every column value are unchanged. The existingtests/unit/utils/test_prime_monitor.pyasserts (problem_id/sample_id/completion/trajectory) still hold; I verified the refactored mapping produces identicalnum_input_tokens/num_output_tokens(stillbranches[-1]) and completion/trajectory content against those cases. The only nuance: messages now serialize withexclude_none=True(drops null fields liketool_calls: null) — smaller strings, same content.Companion PR
Companion to the verifiers PR that introduced
verifiers.v1.push.trace_to_sample(merged):PrimeIntellect-ai/verifiers#1947
The
deps/verifierssubmodule is pinned to that PR's squash-merge commit on verifiersmain(9c6b155e). Validated end-to-end with a 20-stepreverse_textRL run on this branch (reward 0.78 at step 20, 0 errors).Note
Low Risk
Refactor of monitor upload serialization with intended behavior parity; tests cover key columns; only minor JSON null-field omission differs.
Overview
Prime monitor sample uploads now build each parquet row from
verifiers.v1.push.trace_to_sampleinstead of inline branch/message serialization, aligning training-run pushes with verifiers eval--push._rollouts_to_parquet_bytesstill owns_SAMPLE_SCHEMAand RFT-only fields (run_id,step,advantage,problem_id,env_name, etc.). It mapsexample_id→problem_id, injects advantage on every trajectory branch, and reads token counts from the last branch. Empty trajectories are still skipped.completion,task,reward,metrics, andtimingcome from the shared sample dict (JSON-encoded where before). Message JSON may omit null fields viaexclude_none=Truein verifiers—slightly smaller payloads, same semantics per PR notes.Reviewed by Cursor Bugbot for commit 130bd1d. Bugbot is set up for automated code reviews on this repo. Configure here.