Skip to content

Fix beam search width collapse on early completions#20

Draft
cursor[bot] wants to merge 1 commit into
workingbranchfrom
cursor/critical-bug-inspection-4296
Draft

Fix beam search width collapse on early completions#20
cursor[bot] wants to merge 1 commit into
workingbranchfrom
cursor/critical-bug-inspection-4296

Conversation

@cursor

@cursor cursor Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

When some beam-search candidates reached EOS before max_tokens while other active beams were still valid, the backend discarded all remaining active beams because completed was non-empty. The cache then contained fewer responses than the requested beam width, so later beam indices repeated the same completed candidate and effective beam width collapsed for constrained/two-stage rollout evaluation and training.

Root cause

The recent duplicate-avoidance logic only preserved active beams when no candidate had completed at all, instead of preserving active beams whenever completed candidates did not fill beam_width.

Fix

Fill the remaining beam slots with active length-finished beams until beam_width is reached, while still avoiding active-beam duplicates once completed beams already cover the requested width.

Validation

  • Added regression coverage for a beam search where one candidate completes with EOS early and another remains active until max_tokens.
  • Ran a direct Python regression scenario for the new case.
  • Ran python3 -m py_compile verl_gr/workers/rollout/beam_backend.py tests/test_minionerec_parity.py.

Note: python3 -m pytest tests/test_minionerec_parity.py could not run in this environment because pytest is not installed.

Open in Web View Automation 

Co-authored-by: XU Mingshi <mxuax@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant