Skip to content

[BugFix] Set default random seed to 0 for V1 #17929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 13, 2025
Merged

[BugFix] Set default random seed to 0 for V1 #17929

merged 3 commits into from
May 13, 2025

Conversation

WoosukKwon
Copy link
Collaborator

@WoosukKwon WoosukKwon commented May 10, 2025

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).

Signed-off-by: Woosuk Kwon <woosuk.kwon@berkeley.edu>
@WoosukKwon WoosukKwon requested a review from DarkLight1337 May 10, 2025 01:02
Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

Signed-off-by: Woosuk Kwon <woosuk.kwon@berkeley.edu>
@WoosukKwon WoosukKwon requested a review from DarkLight1337 May 13, 2025 04:09
@WoosukKwon WoosukKwon added the ready ONLY add when PR is ready to merge/full CI is needed label May 13, 2025
@DarkLight1337
Copy link
Member

LGTM now

@DarkLight1337 DarkLight1337 enabled auto-merge (squash) May 13, 2025 04:09
@DarkLight1337 DarkLight1337 merged commit 2ff297d into main May 13, 2025
89 checks passed
@DarkLight1337 DarkLight1337 deleted the v1-seed branch May 13, 2025 07:52
mawong-amd pushed a commit to ROCm/vllm that referenced this pull request May 14, 2025
Signed-off-by: Woosuk Kwon <woosuk.kwon@berkeley.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready ONLY add when PR is ready to merge/full CI is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants