Skip to content

fix(vlm): use the vLLM prompt keys in async rollouts - #4151

Merged
yfw merged 1 commit into
mainfrom
yifu/fix_main_import
Sep 16, 2026
Merged

yfw merged 1 commit into
mainfrom
yifu/fix_main_import

Conversation

@yfw

@yfw yfw commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Main is import-broken at 806e9d1: #3803 (4d969c9) consolidated the per-media vllm_images / vllm_videos / vllm_audios rows into one vllm_multi_modal_data dict and replaced NATIVE_MULTIMODAL_KEYS with VLLM_PROMPT_KEYS, while #4113 (26f3b19), merged afterwards, imports NATIVE_MULTIMODAL_KEYS in nemo_rl/experience/rollout_manager.py. Every import of the async rollout manager, and therefore of the single-controller setup, fails with ImportError: cannot import name NATIVE_MULTIMODAL_KEYS, and the Lint check on main is red.

This PR collects the vLLM prompt side channels with VLLM_PROMPT_KEYS, matching the sync rollout path in rollouts.py, and updates the two #4113 tests to the consolidated vllm_multi_modal_data key (the dropped vllm_images key is asserted not to be forwarded).

Test plan

  • python -c "import nemo_rl.experience.rollout_manager, nemo_rl.algorithms.single_controller_utils.setup" succeeds (fails on main).
  • tests/unit/experience/test_rollout_manager.py -k "generate_response or single_rollout or GenerateAndPush": 22 passed on a CPU-only host.
  • pre-commit (ruff, pyrefly) clean on both files.

🤖 Generated with Claude Code

main is import-broken at 806e9d1: 4d969c9 (#3803) consolidated the per-media vllm_images/vllm_videos/vllm_audios rows into one vllm_multi_modal_data dict and replaced NATIVE_MULTIMODAL_KEYS with VLLM_PROMPT_KEYS, while 26f3b19 (#4113), merged afterwards, imports NATIVE_MULTIMODAL_KEYS in the async rollout manager. Every import of nemo_rl.experience.rollout_manager (and so of the single-controller setup) fails with ImportError, and the Lint check on main is red.

Collect the vLLM prompt side channels with VLLM_PROMPT_KEYS, matching the sync rollout path, and update the two #4113 tests to the consolidated vllm_multi_modal_data key; the old per-media keys are asserted not to be forwarded.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
@yfw yfw added the CI:L0 Run doctests and unit tests label Sep 16, 2026
@yfw
yfw requested review from a team as code owners September 16, 2026 06:24
@copy-pr-bot

copy-pr-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@yfw

yfw commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 7444b9a

@yfw yfw added CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) and removed CI:L0 Run doctests and unit tests labels Sep 16, 2026
@yfw

yfw commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 7444b9a

@yfw yfw left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR #4151 — team review (rl-expert, bug-finder, test-agent, design-reviewer, devil-advocate)

LGTM, no inline comments. The fix restores the import that #3803 (4d969c9) deleted and #4113 (26f3b19) re-added 37 minutes later without a CI re-run. VLLM_PROMPT_KEYS is the same-hunk replacement; the only producer of these side channels, vlm_hf_data_processor, already emits the two consolidated keys, and no producer or consumer of the per-media keys remains anywhere in the repo, docs, or the Gym submodule. A compatibility alias would have been wrong: an alias to the old set silently drops vllm_multi_modal_data on the async VLM path.

Verified (CPU-only host, no vLLM):

  • Lint check is red on main at 806e9d1 and at b03da0f, green on this head; pre-commit run --all-files passes every hook here.
  • The whole tests/unit/experience/ directory passes at head: 388 passed, 1 skip (nemo_gym not installed). test_vllm_utils.py (41) and test_collate_fn.py (9) pass alongside.
  • The multi-turn test's vllm_images control has teeth: a nine-mutant matrix over the two modified tests shows it is the only assertion that fires when a per-media key regrows into the constant or the filter becomes forward-everything.
  • Eight DatumSpec shapes (text-only, truncated, media, placeholder-style, multi-item lists, empty values, content-only, no keys) on turn 1 and later turns hand format_prompt_for_vllm_generation identical prompts from the async manager and the sync path; two end-to-end _run_single_rollout runs match. A {prompt_token_ids, multi_modal_data} prompt is a valid TokensPrompt at the pinned vLLM 0.25.1 (vllm/inputs/llm.py#L106-L109).

Not verified: a GPU end-to-end async VLM rollout; the formatter is shared with the sync path, so nothing here is new to vLLM.

Process note, not a PR ask: branch protection requires only DCO and the quality check with strict: false, and the up-to-date job tolerates ten commits behind, so lint never ran on #4113 against the post-#3803 main. Requiring branches to be up to date, or a merge queue with Lint required, would have caught this class; no code seam would.

Generated by Claude Code

@yfw
yfw merged commit 1cef394 into main Sep 16, 2026
71 checks passed
@yfw
yfw deleted the yifu/fix_main_import branch September 16, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants