Repository navigation
feat: label sampled tokens with the policy step and log per-token policy age (vLLM 0.32 weight_versions) - #4141
Open
faresobeid wants to merge 9 commits into
Open
faresobeid wants to merge 9 commits into
faresobeid wants to merge 9 commits into
Conversation
This was referenced Oct 18, 2026
faresobeid
marked this pull request as ready for review
October 19, 2026 00:07
# Conflicts: # src/prime_rl/orchestrator/clients.py
…abels # Conflicts: # uv.lock
faresobeid
added a commit
that referenced
this pull request
Oct 22, 2026
Ship per-token policy versions from the engines' weight_versions labels (#4141), falling back to the dispatch version for unlabelled tokens, instead of one dispatch version per sample.
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.
Engines label the tokens they sample with the policy step, and the orchestrator logs per-token policy age.
/update_weightstakesweight_versionand callsupdate_weight_versionafter loading./load_lora_adaptertakes aweight_versionquery parameter and does the same. The orchestrator sends the step on both. vLLM 0.32 then returnsweight_versionsspans on every/inference/v1/generatechoice;PrimeRlServingTokensalready passes them through.token_policy_agesturns the spans on a trace's assistant nodes into per-token ages against the batch's training version. The orchestrator logsoff_policy/token/{mean,max}next to the existing episode-leveloff_policy/*.WeightWatcher.sync_startup→receive(v0 or the resume step)→/update_weights) runs before the dispatcher starts, so every train token carries a real step. Only Dynamo engines, whose updates bypass/update_weights, stay"default"; those tokens are not counted.deps/renderersto feat(client): pass through vLLM weight_versions spans renderers#195 anddeps/verifiersto feat(v1): store engine weight-version spans on assistant nodes verifiers#2894 (merged), which carry the field.uv.lockfollows verifiers'prime-sandboxes>=0.4.7.Dynamo deployments keep the
"default"label: their weight updates go through Dynamo's/collective_rpc, not our/update_weights. P/D: the router mergesrouted_expertsby editing the JSON in place, soweight_versionspasses through.Tests:
pytest tests/unit/orchestrator tests/unit/test_configs.py tests/unit/inference -m "not gpu", ruff.GPU check (1×H200, Qwen3-0.6B, vLLM 0.32, this branch): a 4000-token generation paused mid-way,
/update_weightswithweight_version=5, resumed. It returned[{"version": "default", "start": 0, "end": 1390}, {"version": "5", "start": 1390, "end": 4000}]; the next request returned[{"version": "5", "start": 0, "end": 8}].Upstream: vllm-project/vllm#59582 (merged, in 0.32) — the
weight_versionsspans this labels.Note
Medium Risk
Extends the weight-update and LoRA reload admin path with mandatory
weight_version; a mismatch or missing field could break updates, but behavior is additive labeling after successful loads.Overview
Policy-step labeling on vLLM after each weight swap:
/update_weightsand/load_lora_adapternow receive the training step from the orchestrator and call vLLM’supdate_weight_version, so generations returnweight_versionsspans (vLLM 0.32) on sampled tokens.Finer off-policy metrics: new
token_policy_ages/node_policy_versionsturn those spans into per-token ages vs the batch’s training version; shipped batches logoff_policy/token/meanandoff_policy/token/maxalongside existing episode-leveloff_policy/*. Tokens still labeled"default"(e.g. Dynamo) are excluded from token metrics.Tests cover LoRA admin requests carrying
weight_versionand the age aggregation logic.Reviewed by Cursor Bugbot for commit 41804d8. Bugbot is set up for automated code reviews on this repo. Configure here.