Repository navigation
fix: restore unexpanded Nemotron prompts for vLLM - #4182
Conversation
eb2ba4c to
e1b5162
Compare
Signed-off-by: Ali Roshan Ghias <[email protected]>
e1b5162 to
5c33fe5
Compare
aroshanghias-nvd
left a comment
There was a problem hiding this comment.
Team review of PR #4182 (5 agents: rl-expert, test-agent, design-reviewer, devil-advocate, leader; the bug-finder agent hung and its checks were re-done by the leader).
The fix is substantive and correct: with a string prompt vLLM 0.25.1 only finds placeholders (_apply_hf_processor_text_mm returns is_update_applied=True), so learner and rollout ids agree by construction, and the new guard turns the silent 342 → 599 mismatch into a hard error. Two inline comments below.
Verified clean (no action): learner/vLLM BOS handling agrees for Nemotron (add_bos_token: false; vLLM add_special_tokens=False), Gemma4 (override) and Qwen (no BOS); RequestOutput.prompt_token_ids is always list[int] | None (outputs.py); the new test needs no @pytest.mark.vllm (base shard of L0_Unit_Tests_Vllm_*.sh, no top-level vllm imports in the workers); stubbed workers provide every attribute the real generate paths read; Megatron inference does not consume vllm_content. Pinned ruff 0.9.9 check/isort/format pass on all 7 files (pyrefly not run locally; utils.py is already in pyrefly.toml).
Context — no action (non-blocking):
- It would be helpful to include one short Nemotron clevr run on this branch showing no
ValueErrorand the restored 342-token prompt, since the new assert is unconditional and the CPU tests cannot exercise vLLM's real expansion. - Known adjacent case: a Gemma-3 VLM (none shipped) would double-BOS on the vLLM string path (vLLM default
add_special_tokens=True, no override ingemma3_mm.py) while the learner has a single BOS; the new guard will surface that as aValueError. Worth a line in the PR description.
Generated by Claude Code
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
|
/ok to test 3347a74 |
Signed-off-by: Ali Roshan Ghias <[email protected]>
|
/ok to test 741973f |
Signed-off-by: Ali Roshan Ghias <[email protected]> Signed-off-by: Yuki Huang <[email protected]>
…vLLM (#4412) Signed-off-by: Ali Roshan Ghias <[email protected]> Signed-off-by: Yuki Huang <[email protected]> Co-authored-by: aroshanghias-nvd <[email protected]>
What does this PR do ?
Restore unexpanded Nemotron image prompts at the native vLLM handoff and reject rollouts generated from a different prompt than the learner's.
#3920 set
vllm_contenttoNonefor placeholder-style image processors. That sends learner-expanded token IDs alongside raw images to vLLM, which expands them again. A 342-token prompt becomes 599 tokens while the learner retains the original 342.Restore
vllm_content = string_formatted_dialog. Before constructing a training trace, both native vLLM workers require the returned prompt IDs to match the learner's IDs exactly.Issues
Fixes the native image-prompt regression introduced by #3920.
Usage
No configuration changes. The learner's expanded IDs and Megatron Inference inputs are preserved.
Before your PR is "Ready for review"
Additional Information
Validation: 26 focused CPU tests passed in the pinned vLLM environment (12.14 seconds), covering the MMPR processor/formatter handoff, exact/mismatched/missing prompt IDs, both native workers, and the existing sampled-logprob test. Ruff lint, import ordering, formatting, and diff checks pass. No model weights or new training runs were used.
The PR contains no vLLM source patch, compactor, tokenizer setup changes, or native multi-turn extension. Prompt equality is checked after generation; this does not validate vLLM's internal embedding placement. The separate numerical TMPE investigation is outside this PR.
Native multimodal multi-turn limitation: if an environment continues beyond the first response, later native turns send updated token IDs with the original media. vLLM may re-expand image placeholders, and the new guard rejects the resulting prompt mismatch. This PR does not fix that existing path. The shipped VLM environment terminates after the first response, so increasing
max_rollout_turnsalone does not exercise it. NeMo-Gym manages its own multi-turn rollout path.