vllm.v1.worker.gpu.sample.trace_replay ¶
Classes:
-
TraceReplayState–Per-request state for inference trace-replay.
Functions:
-
apply_trace_tokens–Overwrite
sampledin place with trace tokens for the current step.
TraceReplayState ¶
Per-request state for inference trace-replay.
When a request carries SamplingParams.trace_decode_token_ids, the sampler overwrites the sampled token at each decode step with the predetermined trace token, while real logprobs and ranks are still computed from the unmodified logit distribution. The replay step for a request is derived entirely from GPU state (total_len - prompt_len), so no CPU synchronization or async placeholder handling is needed.
Source code in vllm/v1/worker/gpu/sample/trace_replay.py
apply_trace_tokens(sampled, idx_mapping, trace_token_ids, trace_len, total_len, prompt_len) ¶
Overwrite sampled in place with trace tokens for the current step.