Skip to content

feat(v1): store engine weight-version spans on assistant nodes - #2894

Merged
faresobeid merged 1 commit into
mainfrom
feat/weight-versions
Oct 19, 2026
Merged

faresobeid merged 1 commit into
mainfrom
feat/weight-versions

Conversation

@faresobeid

@faresobeid faresobeid commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Store the engine's weight-version spans on the sampled assistant node. MessageNode.weight_versions holds vLLM's [{version, start, end}] spans over the node's sampled tokens (indexes into the completion). None when the engine labels none. TurnTokens.weight_versions carries them from generate() to the turn's commit, the same way sampling_mask is carried.

No-op on vLLM 0.31 and before PrimeIntellect-ai/renderers#195: with no weight_versions in the result, the node field stays None. 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 from generate() through the trace graph.

Introduces WeightVersionSpan and mirrors the existing sampling_mask pattern—a transient TurnTokens.weight_versions field populated in response_from_generate from result["weight_versions"], then copied onto MessageNode.weight_versions when the turn commits. Spans are completion-indexed (as vLLM returns them); the field stays None when 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 TurnTokens and assistant graph nodes

  • Adds a WeightVersionSpan Pydantic model with an engine version string and inclusive-start/exclusive-end completion-token offsets in types.py
  • TurnTokens gains an excluded weight_versions field, so spans travel from generation to turn commit but are dropped from serialized responses
  • The generate response parser in train.py maps weight_versions entries into spans on TurnTokens
  • _commit_turn in graph.py copies the span list onto the sampled assistant MessageNode, which now has an optional weight_versions field
  • Behavioral Change: graph nodes serialize with a new optional weight_versions field; existing consumers that reject unknown fields may fail

Macroscope summarized 3f142cc.

@faresobeid
faresobeid merged commit 66f7e72 into main Oct 19, 2026
30 checks passed
@faresobeid
faresobeid deleted the feat/weight-versions branch October 19, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants