Repository navigation
feat(v1): store engine weight-version spans on assistant nodes - #2894
Merged
Merged
Conversation
faresobeid
marked this pull request as ready for review
October 19, 2026 10:05
hallerite
approved these changes
Oct 19, 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.
Store the engine's weight-version spans on the sampled assistant node.
MessageNode.weight_versionsholds vLLM's[{version, start, end}]spans over the node's sampled tokens (indexes into the completion).Nonewhen the engine labels none.TurnTokens.weight_versionscarries them fromgenerate()to the turn's commit, the same waysampling_maskis carried.No-op on vLLM 0.31 and before PrimeIntellect-ai/renderers#195: with no
weight_versionsin the result, the node field staysNone. It can land before prime-rl's vLLM 0.32 bump (PrimeIntellect-ai/prime-rl#4140). Needs renderers#195 to be populated; consumed by PrimeIntellect-ai/prime-rl#4141.Test:
pytest tests/unit/test_graph.py tests/unit/test_trace.py(35 passed).Note
Low Risk
Additive metadata plumbing with no behavior change when weight_versions is absent; limited to training trace construction.
Overview
Adds engine weight-version attribution for sampled assistant turns: vLLM can return
{version, start, end}spans over completion tokens, and this PR threads them fromgenerate()through the trace graph.Introduces
WeightVersionSpanand mirrors the existingsampling_maskpattern—a transientTurnTokens.weight_versionsfield populated inresponse_from_generatefromresult["weight_versions"], then copied ontoMessageNode.weight_versionswhen the turn commits. Spans are completion-indexed (as vLLM returns them); the field staysNonewhen the engine omits labels (e.g. vLLM ≤0.31 before renderers support).Reviewed by Cursor Bugbot for commit 3f142cc. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add engine weight-version spans to
TurnTokensand assistant graph nodesWeightVersionSpanPydantic model with an engine version string and inclusive-start/exclusive-end completion-token offsets in types.pyTurnTokensgains an excludedweight_versionsfield, so spans travel from generation to turn commit but are dropped from serialized responsesweight_versionsentries into spans onTurnTokens_commit_turnin graph.py copies the span list onto the sampled assistantMessageNode, which now has an optionalweight_versionsfieldweight_versionsfield; existing consumers that reject unknown fields may failMacroscope summarized 3f142cc.