Skip to content

fix(rollout): forward top-k sampling configuration - #8676

Merged
delock merged 2 commits into
deepspeedai:masterfrom
nathon-lee:fix/rollout-top-k-sampling
Sep 28, 2026
Merged

delock merged 2 commits into
deepspeedai:masterfrom
nathon-lee:fix/rollout-top-k-sampling

Conversation

@nathon-lee

Copy link
Copy Markdown
Contributor

Summary

SamplingConfig exposes top_k, but HybridEngineRollout did not forward it to Transformers generation. As a result, sampling callers could not apply their configured top-k limit and the default non-positive setting could fall through to Transformers' own behavior.

This PR:

  • forwards top_k when HybridEngineRollout uses random sampling;
  • treats top_k <= 0 as disabled by passing Transformers its disabled value;
  • preserves greedy generation, CUDA graph capture, and continuous batching behavior;
  • removes the unused local top-p sampler, since rollout sampling delegates to Transformers.

Validation

  • verifies top-k forwarding during random sampling;
  • verifies prompt expansion for multiple samples;
  • verifies EOS padding and the eos_token_id=None ZeRO lockstep contract;
  • verifies disabled top_k values (-1 and 0);
  • focused regression tests: 4 passed;
  • Changed-file pre-commit checks: passed

Thank you for your review.

Forward SamplingConfig.top_k to Transformers during sampling, map non-positive values to the disabled setting, and cover sampling, multiple samples, EOS handling, and ZeRO lockstep behavior.

Signed-off-by: nathon-lee <leejianwoo@gmail.com>
@delock
delock self-requested a review September 28, 2026 03:23
@delock
delock added this pull request to the merge queue Sep 28, 2026
Merged via the queue into deepspeedai:master with commit 729d5ae Sep 28, 2026
15 checks passed
@auto-pr-labeler-with-jev auto-pr-labeler-with-jev Bot added the skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU. label Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants