Repository navigation
feat(trtllm): Gym rollout fixes, validation sampling, dummy-weight startup - #4123
Conversation
ca59235 to
b8e883e
Compare
d6b6fbc to
741f12b
Compare
741f12b to
0ef8188
Compare
6d2db31 to
7d72619
Compare
7d72619 to
50a63ca
Compare
50a63ca to
097ac40
Compare
shuyixiong
left a comment
There was a problem hiding this comment.
Thanks for this PR. Validation-only sampling on TRT-LLM, the validate() fix with a test that fails on the old code, the keyword-only server arguments, and the pure _request_matches_profile helper are all good additions.
The main ask is C1: with disaggregation on, the new load_format never reaches the prefill and decode engines, so bf16 loses the dummy-weight startup and precision: fp8 + disaggregation now fails at startup. C2 is next: the new seed variable has no reader at the pinned TensorRT-LLM.
- (C1)
load_formatis set afterresolve_role_overrides, so disaggregated engines get"auto"; set it first, move the key out of the per-role knobs, and add a disaggregated test. - (C2) Nothing reads
NEMO_RL_TRTLLM_SEEDat the pinned TensorRT-LLM; remove it and thetorchimport. - (C3) No test checks which sampling profile the chat route serves; a route test is included.
- (C4) No test shows trtllm + NeMo-Gym now passes the validation-sampling check in
setup(); a test is included. - (C5) Move the fastokens check into
nemo_rl/utils/fastokens.pyand drop_tokenizer_backend_namefrom the HTTP server. - (C6) Shorten the 8-line sampling comment in the chat handler to two lines.
- (C7) Drop the history from the
val_sampling_configcomment in the worker. - (C8)
grpo_sync'svalidate_syncstill drops the partial last validation batch; apply the same fix there (pre-existing).
Other notes:
- No existing thread needs a reply. The
nemo_rl/utils/venvs.pythread is about code that was reverted and can be resolved. - CI Lint and unit tests have not run on this PR yet; please trigger them.
- Could you add the engine startup time with dummy vs real weights from one run? It would show the benefit of the dummy-weight startup.
Generated by Claude Code
96e084e to
0459baf
Compare
|
/ok to test 0459baf |
configure_generation_config gave vllm_cfg["load_format"] the value "auto" if is_eval else "dummy" but left trtllm_cfg alone, so a TRT-LLM engine read the full checkpoint at startup even though refit_policy_generation overwrites every weight before the trajectory collector is allowed to issue its first request. On a 397B engine that read is minutes of startup the run throws away. Mirror the vLLM contract: set trtllm_cfg["load_format"] in configure_generation_config and pass it through to the AsyncLLM constructor. precision="fp8" stays "dummy" in both modes -- the engine is built with the quantized layout the BF16 refit populates, and configure_fp8_llm_kwargs already rejects anything else -- so this changes nothing for FP8. Evaluation keeps "auto": it has no refit to supply weights. Signed-off-by: Erin Ho <[email protected]>
The guard pinned the exact private class name `fastokens._compat._TokenizerShim`. fastokens 0.3.1 renamed it to `fastokens._ConfiguredTokenizerShim`, so `patch_transformers()` succeeded but the worker still refused to start: RuntimeError: NRL_USE_FASTOKENS=1, but the TRT-LLM HTTP tokenizer backend is 'fastokens._ConfiguredTokenizerShim'; expected 'fastokens._compat._TokenizerShim' What the check is for is whether the monkey-patch landed at all, so match on the `fastokens.` module prefix instead of an internal class name that moves with every release. Signed-off-by: Erin Ho <[email protected]>
Signed-off-by: shuyixiong <[email protected]> Signed-off-by: Erin Ho <[email protected]> Signed-off-by: Erin Ho <[email protected]> Co-authored-by: Erin Ho <[email protected]> Co-authored-by: Erin Ho <[email protected]>
…ckouts Signed-off-by: Erin Ho <[email protected]>
…ocally built TensorRT-LLM Signed-off-by: Erin Ho <[email protected]>
…DITABLE) Remove NRL_TRTLLM_EDITABLE from this PR. This reverts 5a6e571, 8df2eaf and 097ac40: the editable-install hooks in nemo_rl/utils/venvs.py, tools/build-editable-trtllm.sh, and the docs/docker.md section describing them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: shuyixiong <[email protected]>
Signed-off-by: Jeremi Piotrowski <[email protected]> (cherry picked from commit 34116c2) Signed-off-by: shuyixiong <[email protected]>
Each TrtllmAsyncGenerationWorker printed pg and pg.bundle_specs at init. The bundle spec list has one entry per bundle in the placement group, so each line grows with the job and every worker prints its own copy: on a 256-node run that is 192 lines of ~67 KB, 12 MB of a 15 MB log. Keep bundle_indices, which is the part that differs per worker. (cherry picked from commit 770b644) Signed-off-by: shuyixiong <[email protected]> Signed-off-by: Erin Ho <[email protected]>
validate() runs max_val_samples / val_batch_size batches. Flooring that silently drops a partial last batch (251 prompts in batches of 126 scored only 126), and the round-up from 02f4007 overshoots the cap whenever the validation set is larger than max_val_samples (max 200 in batches of 126 scored 252). Keep the round-up so the partial last batch is scored, and trim the last batch to the prompts still left under the cap, so exactly min(max_val_samples, len(val_dataset)) prompts are scored. The trim runs before repeat_interleave, so a prompt's generations are never split. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: shuyixiong <[email protected]>
…n sampling changes - Set load_format before resolve_role_overrides so the prefill and decode engines inherit it under disaggregation (bf16 loaded the full checkpoint, fp8 failed at startup). It now defaults via setdefault and is a shared setting, not a per-role override. - Drop NEMO_RL_TRTLLM_SEED and the torch import: nothing reads the variable. - Move the fastokens backend check to nemo_rl.utils.fastokens as check_fastokens_applied and move its tests next to the other fastokens tests. - Add tests for the train/validation sampling profile the chat route serves, for accepting TRT-LLM validation sampling on the Gym path, and for the disaggregated load_format. - Round up and trim the last validation batch in grpo_sync.validate_sync, as validate() does. - Shorten two code comments. Signed-off-by: Erin Ho <[email protected]>
Signed-off-by: Erin Ho <[email protected]>
… fastokens on a real engine Signed-off-by: Erin Ho <[email protected]>
Signed-off-by: Erin Ho <[email protected]>
17987c0 to
fd0230e
Compare
yuki-97
left a comment
There was a problem hiding this comment.
Thanks for adding TRT-LLM validation sampling and avoiding redundant checkpoint loading during training.
Thanks also for reporting the GB200 sampling-route and real-engine fastokens HTTP checks.
Scope: TRT-LLM Gym sampling and startup, GRPO validation limits, Megatron checkpoint cache release, and launcher environment forwarding, at fd0230e
Checked:
- Sampling profiles — traced Gym validation parameters through the worker to the HTTP sampling profile selected for generation.
- Dummy startup — checked the pinned loader contract, prefill/decode inheritance, and initial refit before rollout dispatch.
- Tokenizer initialization — checked the environment override, locked fastokens backend, and patch-before-construction ordering.
- Checkpoint lifecycle — cache release follows prior asynchronous-save finalization and CUDA synchronization.
Validation: Static source inspection only; no local project or GPU tests run. Current head checks contain no L0/L1 test results.
Remaining comments are on:
- Sample-weighted validation response lengths and partial-batch regression coverage.
- Recipe-specific UCX requirements and the scope of launcher changes.
- Checkpoint OOM evidence and removal of diagnostic-only logging.
nit
- Required validation profiles and a single source for weight-loading defaults.
- Shared validation-sampling documentation.
- Function-local comment length and PR-description accuracy.
Generated by Codex
…LM server - weight validate/validate_sync avg_length by rollouts per batch; add validate_sync partial-batch/cap tests and a weighted avg_length assertion - make val_sampling_config required in the TRT-LLM HTTP server - read trtllm_cfg.load_format directly in the worker (no second default) - document val_temperature/val_top_p support for TRT-LLM in GenerationConfig - keep only gc.collect + empty_cache before checkpoint save - revert the ray.sub env-forward option; export UCX_NET_DEVICES=all in the PD-disagg nightly script and document it - shorten function-local comments Signed-off-by: Erin Ho <[email protected]>
|
/ok to test 4db1b83 |
configure_generation_config now reads generation.trtllm_cfg for the trtllm backend, so the test config copied from the vLLM one needs that block. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: shuyixiong <[email protected]>
|
/ok to test 58561ca |
|
/ok to test d477124 |
Conflicts: - grpo.py: keep _validate_val_sampling and accept trtllm as main (NVIDIA-NeMo#4123) does. The TRT-LLM server picks the train or validation profile by temperature/top_p like the vLLM one, so the val_top_k rule applies to both; main's "val_top_k is not supported" check is dropped. - loss_input.py: keep the replay/non-replay split; pass main's (NVIDIA-NeMo#4973) reuse_logits_storage on the non-replay logprob call. - vllm/config.py: keep resolve_vllm_logprobs_mode and main's resolve_vllm_kv_cache_dtype (NVIDIA-NeMo#5028). - test_model_utils.py: keep both sides' new tests. - interfaces.py comment and test_setup_accepts_val_sampling_on_gym_path updated to the val_top_k rule. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Hayate Iso <[email protected]>
What does this PR do ?
TRT-LLM generation fixes and features for NeMo-Gym GRPO runs (HTTP-server sampling parity, validation-only sampling, fastokens, dummy-weight startup), plus GRPO validation and Megatron checkpoint fixes found along the way.
Changes
TRT-LLM HTTP server / Gym rollouts
top_k,logprobs_simple_format) and usegenerate_async.generation.val_temperature/val_top_p) on TRT-LLM: the server accepts either the train or the validation sampling profile and serves the one the request pins;grpo.setup()now allows val sampling overrides for both vLLM and TRT-LLM NeMo-Gym rollouts.val_top_koverrides are rejected.NRL_USE_FASTOKENS=1but the patch did not take effect (matching anyfastokens.shim rather than a private class name).TRT-LLM engine
configure_generation_configsetstrtllm_cfg.load_format("dummy"for training,"auto"for eval, always"dummy"forprecision=fp8), skipping a full checkpoint read that the first refit overwrites anyway.GRPO
validate()now scores exactlymin(max_val_samples, len(val_dataset))prompts. Previouslymax_val_samples // val_batch_sizesilently dropped a partial last batch (e.g. 251 prompts in batches of 126 scored only 126). The same applies tovalidate_sync, andavg_lengthis weighted by rollouts per batch so a partial batch does not count as a full one.Megatron
torch_distcheckpoint save, so NCCL's save-planning gather doesn't fail withunhandled cuda erroron a full device.Docs / tests
UCX_NET_DEVICES=allso NIXL KV transfer uses the RDMA HCAs; noted indocs/design-docs/pd-disaggregation-rollout.md.Issues
Usage
Before your PR is "Ready for review"
Pre checks:
Additional Information
tests/unit/algorithms/test_grpo.py(test_validate_scores_exactly_max_val_samples),tests/unit/models/generation/trtllm/test_trtllm_http_server.py,tests/unit/models/generation/trtllm/test_trtllm_generation.py,tests/unit/models/generation/trtllm/test_trtllm_worker_startup.py(real-engine HTTP server with fastokens),tests/unit/utils/test_fastokens.py, andtest_validate_sync_scores_exactly_max_val_samplesintest_grpo.py.🤖 Generated with Claude Code