[Bugfix][Rollout] Validate batched RM reward lengths#313
Open
BreezyB1n wants to merge 2 commits into
Open
Conversation
Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: BreezyB1n <160214624+BreezyB1n@users.noreply.github.com>
There was a problem hiding this comment.
Code Review
This pull request introduces validation to ensure that the number of rewards returned by a batched reward model matches the number of samples. It updates batched_async_rm to raise a ValueError on mismatch, sets strict=True in zip calls within vllm_rollout.py, and adds corresponding unit tests. Feedback suggests adding explicit type validation for the returned rewards to prevent potential silent correctness bugs or generic errors when non-sequence types (like None, str, or dict) are returned.
Signed-off-by: BreezyB1n <160214624+BreezyB1n@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #312
Summary
dict,str, andbytesbefore materializing rewards.Root Cause
The rollout code assigned batched rewards with
zip(..., strict=False). When a custom batched RM returned too few rewards, later samples keptreward=None; when it returned too many rewards, the extra values were silently dropped. Also, blindly callinglist(rewards)could convert a top-leveldict,str, orbytesresult into keys, characters, or integers whose length happened to match the sample count.User Impact
Custom batched RM plugins now fail fast with a clear error instead of producing partially rewarded rollout data or assigning invalid values to
sample.reward. Successful batched RM paths keep the same API and ordering behavior.Testing
/Users/bytedance/miniconda3/bin/python3.13 - <<'PY' ... pytest.main(['tests/test_vllm_rollout.py', '-q', '-k', 'batched_rm']) ... PY/Users/bytedance/miniconda3/bin/python3.13 -m pytest tests/plugin_contracts/test_plugin_path_loading_contracts.py -q -k 'custom_rm'.venv/bin/python -m black --check vime/rollout/rm_hub/__init__.py vime/rollout/vllm_rollout.py tests/test_vllm_rollout.py.venv/bin/python -m ruff check vime/rollout/rm_hub/__init__.py vime/rollout/vllm_rollout.py tests/test_vllm_rollout.pygit diff --check