[RFC]: Weight version attribution for RL rollouts and Background survey
Revision 2 (2026-09-28): re-anchored on #48305 §3.8 after #48306 closed; spans are always returned; no request-level scalar; KV provenance is out of scope; corrected the keep/clear_cache description.
Motivation
vLLM reports one engine-wide weight-version label (/weight_info, #49040), but it does not say which weights produced a given output.
#48305 §3.8 ("Per-Request Weight Provenance") asks for exactly that, at token granularity:
- contiguous
[start, end)ranges of generated tokens; - each range tagged with the version used by the model computation;
- together covering every output token and its logprob exactly once;
- a defined contract for streaming, speculative decoding and DP.
This RFC is the design for that item, and it asks for decisions on the points §3.8 leaves open.
Requests straddle weight updates
docs/training/async_rl.md describes pause(mode="keep") → update → resume as the typical async RL flow. A kept request produces tokens from the old weights before the pause and from the new weights after it. keep has two KV variants:
pause(mode="keep", ...) |
Running requests after resume |
|---|---|
clear_cache=True (default) |
Preempted (_finish_pause → _reset_caches()). On resume their KV is recomputed with the new weights, or loaded from a KV connector that kept an old copy (#57970). |
clear_cache=False |
The KV computed with the old weights is kept, and new tokens attend to it. |
The /pause docstring still says clear_cache is ignored under keep. #57970 (draft) fixes the docs, and #57810 fixes that docstring.
Nothing tells the caller where the boundary fell. The official example infers it by sleeping five seconds after pausing and then counting streamed tokens (rlhf_async_new_apis.py).
Requests admitted during the pause wait in the queue and are then served entirely by the new weights (#51476; #51488 keeps that behavior for keep).
prime-rl, SkyRL and PipelineRL use keep on their async update paths and retain KV by default, and so does NeMo-RL when in-flight weight updates are enabled. #58041 describes the same setup for GLM-5.3 with P/D.
Existing signals are not enough
Take request R. It generates tokens [0, 57) under v7, the weights become v8, and it generates [57, 128) under v8.
/weight_inforeturns v8, the engine's label at query time.- Draft #53199 records v7, the label at admission. For a request that waited in the queue across the update, that label names weights that produced none of its tokens.
- The controller knows which version it dispatched. It does not know which version was live on a given replica when a token was sampled. Delayed or failed replica updates, DP, P/D and
keepall break that link, and the fact is gone once the step is over.
Only the engine can record this. Today, token-level attribution requires patching vLLM, and each patch uses its own encoding:
- PrimeIntellect-ai/prime-rl#2957 (a closed prototype): version segments on the
/inference/v1/generatechoice. - ServiceNow/PipelineRL#150 (
fast-llmbranch): a per-token version appended to each OpenAI chat logprob token string. - OpenPipe/ART: its own
policy_token_spans.
Other frameworks record coarser versions on the client side: request start and end versions on chat responses in NVIDIA-NeMo/RL#4146 (draft), and a version-keyed cache_salt in SkyRL.
What this is, and is not
The span shape is SGLang's weight_versions (sgl-project/sglang#35926, consumed by radixark/miles#1891), so frameworks can share one parser. On top of that shape, this RFC adds a native output-attribution contract to vLLM, with the capture point, the boundary definition, delivery (final output only, including aborts) and n > 1 written down and tested.
The metadata is a filtering, masking and audit signal:
- Freshness filtering by the oldest version. GLM-5 records
(w0, …, wk)per response and drops it whencurrent − w0 > τ. - Token-level staleness masking, as in DeepSeek-V4.1 §5.2.2 and areal-project/AReaL#1722.
- Per-segment replay of
routed_expertsandsampling_maskfor samples that span checkpoints (DeepSeek-V4.1 §5.2.1). This needs the offsets, not just a list of versions. - Auditing partial fleet updates.
It is not an off-policy correction; that stays on rollout logprobs, routed_experts and sampling_mask. Freshness thresholds, global version assignment and update coordination stay with the RL controller.
A span names the target weights that ran a step. It does not certify which weights computed the KV that the span's tokens attended to:
- With
keepandclear_cache=False, the spans after a boundary attended to KV retained from the older version. - Salting requests with the weight version (
cache_salt) prevents new requests from reusing prefix-cache blocks across versions. It does not refresh KV that a kept request already holds. - P/D version skew and external KV tiers belong to #48312 (cache coherence).
Proposed Change
Output
The final output of every output sequence carries weight_versions, a list of spans over its output tokens. There is one span per version, so the size grows with updates, not tokens:
"weight_versions": [
{"version": "v7", "start": 0, "end": 57},
{"version": "v8", "start": 57, "end": 128}
]| Case | weight_versions |
|---|---|
| No update while the request ran | [{v7, 0, n}] |
Running when a keep pause starts, like R (either clear_cache value) |
[{v7, 0, 57}, {v8, 57, 128}] |
| Admitted during the pause | [{v8, 0, n}] |
| No output tokens | [] |
It is always returned on CompletionOutput and on /inference/v1/generate choices. OpenAI chat and completions return it on each choice only when the request asks for it, like return_token_ids.
Contract
- Coverage. Each output sequence, including each
n > 1child, has its own list. Spans are half-open ranges over output-token indexes (prompt excluded), contiguous and in generation order, and together cover every returned token and logprob exactly once. Adjacent spans with the same label merge; A → B → A gives three spans.routed_expertsrows use their own coordinates and must be converted before slicing. - Capture.
versionis the label of the target weights whose forward pass sampled the token: under DP, the label of the engine that ran the request; under P/D, the decode instance's label. It is stamped when the step is scheduled, so in-flight steps keep their label. It does not say which weights computed the KV that the token attended to. - Boundaries. A new span starts when the engine's committed label changes: after a successful update that carries a label, or after
update_weight_version. The label changes in the same EngineCore call that finishes the update. Failed and draft-only updates leave it unchanged; keeping a partially updated model from serving is #48312's job. Any request that crosses a change gets one span per version, whatever the pause mode:waitdrains running requests, not preempted ones. LoRA adapters swapped without a pause are not covered until adapters have versions (#48297). - Delivery. Only on the final output, including aborted ones. Streaming sends it on the last chunk, with offsets over the whole output; streaming-input sessions send it at the end of each input chunk.
- Labels. Opaque strings set by the caller; vLLM never orders them. There is no request-level scalar:
[0]is the first token's version and[-1]the last, and neither is necessarily the oldest. An engine argument sets the initial label;"default"means unknown. §3.8'smodel_id(the served model or LoRA adapter) cannot change within a sequence, so it stays at the sequence level.
Implementation
EngineCore stamps its label on each scheduled step, and every finish path (Python, the Ray client, the Rust server) passes the new label into the finish call. The scheduler attaches the label to EngineCoreOutput only when it changes for a request, and OutputProcessor turns those change points into spans on the final output. The Rust engine-core client decodes EngineCoreOutput too, so its protocol struct changes in the same PR; Rust frontend responses and gRPC follow under #44280. This reuses the transport of #53199, but records the label of the step that ran rather than the label at admission, per CompletionOutput rather than per request.
CC List.
@aoshen02
Before submitting a new issue...
- Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.
Source: vllm-project/vllm