Repository navigation
feat(v1): by-handle payload segments on traces - #2765
Open
faresobeid wants to merge 7 commits into
Open
faresobeid wants to merge 7 commits into
faresobeid wants to merge 7 commits into
Conversation
This was referenced Oct 3, 2026
faresobeid
force-pushed
the
feat/payload-by-handle
branch
from
October 10, 2026 15:21
93cc96a to
62b0e32
Compare
faresobeid
marked this pull request as ready for review
October 13, 2026 17:49
Contributor
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — This adds by-handle payload support across generation parsing, graph attribution, branch materialization, and live trace deltas, with handles referencing short-lived shared files and omitted from persisted records. Existing inline paths remain unchanged, but the cross-component training integration and new runtime attribution behavior warrant focused human review. You can add or adjust custom eligibility rules. Learn more. |
# Conflicts: # verifiers/v1/types.py
# Conflicts: # verifiers/v1/clients/train.py # verifiers/v1/types.py
# Conflicts: # verifiers/v1/__init__.py
This branch has not been deployed
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.
What
Adds by-handle payload segments to v1 traces. The inference server can write router-replay ids and sampling masks to a shared file and return
payloadsegments instead of the inlinerouted_experts/sampling_mask. Verifiers then moves only the handles.PayloadSegment(field, file, offset, pos, rows, dtype, shape):rowsfixed-width rows of one per-token array at byteoffsetoffile.posis the first row's token position.TurnTokens.payload: the request's segments, request-absolute positions. The train client fills it from the generate result'spayload.Trace.payload: list[NodeSegment]: append-only. Each turn'scommitclips the request segments to the nodes created this turn (node-local positions). The one position before them, the prefix's final token, goes to the prefix's last node when that node was sampled. That replaces the placeholder-row repair: no row is ever rewritten. Rows of other reused prefix positions are dropped, the same as the inline path.Branch.payload: the trace's segments on that path, rebased to branch positions, in append order.payloadis a delta-stream list field. New entries ship once, so norouting_repairsare needed. It is excluded fromto_recordbecause the handles are short-lived.The inline fields are unchanged. A turn carries one form or the other, depending on the server.
Companion PRs: PrimeIntellect-ai/renderers#170 (passes
payloadthrough) and PrimeIntellect-ai/prime-rl#3902 (writer, orchestrator clipping/packing, trainer reads, retention).Validation
tests/unit/test_graph.py::test_payload_segments_attributed_per_node_and_rebased_per_branch: a bridged turn (the prior sampled node gets request rowpath_len-1), a fork off a non-sampled prefix node (its re-forwarded rows are dropped), andBranch.payloadrebasing on both branches.pytest tests/unit/test_graph.py tests/unit/test_trace.py,ruff check,ruff format --check.Landing order
deps/renderers/deps/verifiersto the merged commits first)Note
Medium Risk
Touches turn commit attribution and branch construction for training data; payload handles are wire-only and omitted from persisted traces, so consumers must read shared files before they expire.
Overview
Adds by-handle per-token side arrays to v1 traces so inference can return file offsets instead of inlining large tensors (e.g.
routed_experts,sampling_mask).Introduces
PayloadSegment/NodeSegmentwith clipping and rebasing. The train client maps generatepayloadinto transientTurnTokens.payload. Turncommitappends node-attributed segments onTrace.payload(including the bridged “previous turn final token” row without rewriting earlier rows, and dropping re-forwarded prefix rows).Branch.payloadexposes branch-aligned handles for training.payloadstreams as an append-only delta field but is excluded from disk records (EXCLUDE_FIELDS). Inlinerouted_experts/sampling_maskpaths are unchanged.A new graph unit test covers bridged attribution, prefix reuse, and per-branch rebasing.
Reviewed by Cursor Bugbot for commit bacf577. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add by-handle payload segments to v1 traces
PayloadSegmentandNodeSegmentmodels in types.py, with aclipoperation that intersects a segment with a half-open range and adjusts row count, byte offset, and position.response_from_generatein train.py parses payload mappings into typed segments carried transiently onTurnTokens._attribute_payloadin graph.py splits each turn's payload across the matching nodes: it clips segments to node spans, converts to node-local positions, and appends non-empty entries toTrace.payload.payloadas an append-only field.payloadis added toEXCLUDE_FIELDSin trace.py, soto_recordserialization omits it; the field stays available in the in-memory and wire models.Macroscope summarized bacf577.