[BugFix] Set default random seed to 0 for V1 #17929
Merged
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.
Currently, the random seed is unset (
seed=None
) by default. This behavior was originally intended for vLLM V0, where the driver (rank-0) worker shared the same process as the user, causing any fixed seed to affect the user process.In vLLM V1, however, each worker typically runs in its own process different from the user process (except for TP=1 and
VLLM_ENABLE_V1_MULTIPROCESSING=0
). When the seed is unset in V1, tensor parallel workers independently sample different tokens, which previously didn't matter since we only used output from the rank-0 worker and discarded others. However, this randomness causes problems for advanced features like spec decoding, where consistent token generation across TP workers is required.This PR resolves the issue by setting the default random seed to
0
in vLLM V1.Note: This change affects the user experience. Previously, users saw entirely different outputs for each run due to the unset seed. After this PR, first few outputs can be consistent across runs by default (while the full consistency/reproducibility requires
VLLM_ENABLE_V1_MULTIPROCESSING=0
).