Skip to content

feat(sc): per-token NVFP4 vLLM rollout on SingleController - #5262

Open
zhangyimi wants to merge 9 commits into
NVIDIA-NeMo:mainfrom
zhangyimi:feat/sc-nvfp4
Open

zhangyimi wants to merge 9 commits into
NVIDIA-NeMo:mainfrom
zhangyimi:feat/sc-nvfp4

Conversation

@zhangyimi

@zhangyimi zhangyimi commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor
  • I, the PR author, have personally reviewed every line of this PR.

What and why

Lets generation.nvfp4_pertoken_rollout run on the SingleController path, which uses non-colocated vLLM.

  • Non-colocated vLLM engines feed the NCCL collective refit stream through the same quantizer into vLLM's native reload_weights, as the colocated IPC path already does. A failed reload resets vLLM's per-layer state, so a retried refit starts clean.
  • nvfp4_pertoken_rollout no longer requires colocated rollout, and SingleController no longer rejects it.
  • SingleController GRPO counts as validated; PPO and distillation on SingleController still warn at setup. Distillation teachers drop the student's rollout block.
  • Two SingleController recipes with test scripts: a 4-node quick one (added to nightly_gb200.txt) and the 8-node one (in disabled.txt, manual).
  • Design doc updated.
uv run examples/run_grpo_single_controller.py \
  --config examples/configs/recipes/llm/grpo-qwen3-30ba3b-base-8n4g-megatron-te-nvfp4-pertoken-single-controller.yaml

Not covered:

Issues

Part of #5044 (NVFP4 per-token item).

Convergence / perf / functionality proof

Qwen3-30B-A3B on GB200.

  • 4-node quick nightly script at a899ed8 (vLLM 0.33): 20/20 steps, metric checks pass, mean train/gen_kl_error 0.0084.
  • 8 nodes (4 train + 4 vLLM), 60 steps, against the run_grpo.py run of the same recipe, figure below: red = SingleController with overlong penalty, green = SingleController without, blue = run_grpo.py. The three runs follow the same curves; train/gen_kl_error goes 0.011 → ~0.004. Quantized refit ~25 s per step.
  • Async samplers (in_order lookahead 1, windowed staleness 1), 4 nodes, 20 steps: both complete.

Only the quick test was rerun after the rebase onto vLLM 0.33.

image

train/reward is not the same metric on the two entry points: SingleController logs it after the dynamic-sampling filter, run_grpo.py before it (its filtered value is train/filtered_reward). On the filtered definition the means over steps 1–60 are −0.505 (red), −0.477 (green) and −0.458 (blue), so the gap in the reward panel is the metric, not the training.

Needs upstream changes

None.

Non-colocated vLLM engines now quantize the BF16 collective refit stream
through vLLM's native reload API, so generation.nvfp4_pertoken_rollout no
longer requires colocated rollout and SingleController accepts it.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: shuazhang <[email protected]>
Signed-off-by: Shuai Zhang (Worldwide Field Ops) <[email protected]>
@zhangyimi zhangyimi added the CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) label Nov 17, 2026
@copy-pr-bot

copy-pr-bot Bot commented Nov 17, 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.

@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Nov 17, 2026
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: Shuai Zhang (Worldwide Field Ops) <[email protected]>
@zhangyimi
zhangyimi marked this pull request as ready for review November 17, 2026 04:57
@zhangyimi

Copy link
Copy Markdown
Contributor Author

/ok to test 6a48869

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes for the distillation teacher setup failure (C1) and the false-green result in watched launches (C2). C3–C5 cover lower-impact corrections.

I reviewed all 14 changed files and their directly affected paths with three delegated reviewers. This was a static review: I did not run tests or verify CI results. The convergence comparisons and GPU runs in the PR description are author-reported evidence.

Note: formal approval is not available for this request, so this review is posted as a comment only.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

nvfp4_entry_point = "single_controller_distillation"
else:
nvfp4_entry_point = "single_controller"
normalize_nvfp4_pertoken_policy_config(policy_config, entry_point=nvfp4_entry_point)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

C1 · 1 action item.
TL;DR — [BUG, confidence 95] The newly admitted NVFP4 distillation path applies the student's rollout requirements to frozen teachers.

An NVFP4 student with a separate BF16 teacher cannot start when the teacher overrides disable FP4 and clear the TE precision recipe. This normalization call leaves the rollout block in the policy config that setup passes to teacher creation. Teacher construction copies that config and applies its precision overrides, but keeps the rollout flag. The teacher therefore enters the student NVFP4 prerequisite check and raises instead of using its configured precision. Different-depth teachers can also fail the student rollout-boundary comparison. A frozen scoring teacher should not need to match the student's rollout representation.

AI-1

Action: Remove the student's rollout-only block immediately after the teacher's deep copy:

        if cfg.get("generation") is not None:
            cfg["generation"].pop("nvfp4_pertoken_rollout", None)

This targets a different file outside the diff, so it is not an in-place suggestion. Keep the student's normalized block, the teacher's other sampling fields, and explicit teacher precision overrides unchanged.

Proposed acceptance checks, not executed: construct a teacher from an NVFP4 student and assert that only the teacher copy lacks the rollout block. Teacher precision setup with FP4 disabled and no TE recipe must not raise the student NVFP4 prerequisite error. A 48-layer student and 80-layer teacher must not compare their rollout boundaries. Retain the existing router-replay and provider-override isolation assertions and pretrained-checkpoint isolation assertions. Verify the proposed code before adopting it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

C11 · No action needed — status note on the bot's C1; no new ask.
TL;DR — the bot's C1 is still open at 658e324, and this PR is what makes it reachable on SingleController: before, the flag was rejected in config validation, so a teacher was never built with it.

How far this was verified

Static trace only; not run.

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.

C16 · No action needed — fixed in 994c4cc

TL;DR — the teacher's config copy now drops generation.nvfp4_pertoken_rollout, and a test covers it.

find "$LOG_DIR" -type f -name 'train_data_step*.jsonl' -print | sort -V
)
if [[ ${#TRAIN_DATA_FILES[@]} -ne $MAX_STEPS ]]; then
echo "[ERROR] Expected $MAX_STEPS rollout JSONL files, found ${#TRAIN_DATA_FILES[@]}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

C2 · 1 action item.
TL;DR — [BUG, confidence 95] A watched launch reports success when the final rollout-file assertion fails.

This new driver prints its successful metric table before counting the JSONL files. With passing metrics through step 20 but only 19 files, the driver exits 1 and prints [ERROR]. However, the watched launcher reports METRIC PASS and exits 0 when it finds Metric Checks without a subsequent FAIL. The new driver therefore does not reliably enforce its file-count assertion through that launcher.

AI-1

Action: Include the launcher's failure token in this diagnostic:

Suggested change
echo "[ERROR] Expected $MAX_STEPS rollout JSONL files, found ${#TRAIN_DATA_FILES[@]}"
echo "[FAIL] Expected $MAX_STEPS rollout JSONL files, found ${#TRAIN_DATA_FILES[@]}"

Keep the exact file-count comparison and nonzero exit. Proposed acceptance checks, not executed: passing metrics plus 19 files must make a watched launch report METRIC FAIL and exit 1; the same metrics plus 20 files must still pass. Static acceptance: this post-table failure must emit FAIL within the launcher's scanned output. Verify the suggestion before adopting it.

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.

C17 · No action needed — fixed in 658e324

TL;DR — the message now prints [FAIL]; a899ed8 later switched the count to Parquet manifests and kept it.

…try point

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: Shuai Zhang (Worldwide Field Ops) <[email protected]>
@zhangyimi

Copy link
Copy Markdown
Contributor Author

/ok to test b357e16

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: Shuai Zhang (Worldwide Field Ops) <[email protected]>
@zhangyimi

Copy link
Copy Markdown
Contributor Author

/ok to test 6ac98aa

…launch

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: Shuai Zhang (Worldwide Field Ops) <[email protected]>
@zhangyimi

Copy link
Copy Markdown
Contributor Author

/ok to test 658e324

@sharonyu-115 sharonyu-115 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for bringing the per-token NVFP4 rollout to SingleController. A few things that work well:

  • The collective path reuses the existing _get_reload_weight_preparer hook, so the shared backend gains no NVFP4-specific branch.
  • The failure path receives every remaining broadcast, so the trainers are not left blocked. A pure-Python repro over six failure cases confirms this.
  • Both SingleController recipes inherit the colocated recipes through defaults: and override only placement and SingleController plumbing.
  • The performance evidence (8-node curves against run_grpo.py, gen_kl_error, ~25 s refit) is adequate for what the PR claims.

Inline comments:

  1. (C6) A retried refit can reuse half-loaded vLLM layer state when fleet health is on.
  2. (C8) The setup test covers one of the three entry-point arms.
  3. (C9) The doc sentence about async samplers says more than was run.
  4. (C10) Four docstrings still say IPC only.
  5. (C11) Reply on the bot's C1 thread: still open.

The bot's C2 and C3 are fixed in 658e324 and b357e16.

Scope: static review plus CPU unit runs with vLLM 0.33.0; no GPU run. As the PR description notes, the 8-node comparison and the async-sampler runs predate the rebase onto vLLM 0.33.

Generated by Claude Code

logger.exception(
"Failed to drain the collective sender after reload failure"
)
raise

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

C6 · 2 action items. Correctness bug on a non-default path, introduced by this PR.
TL;DR — when the reload fails mid-stream, this except block does not reset vLLM's per-layer reload state, so a retried refit on the same engine reuses half-loaded layers: wrong weights are possible and nothing raises.

It needs async_rl.generation_fleet_health.enabled: true (default false) and a refit that breaks mid-stream. With fleet health off, the run ends and nothing is retried.

  1. vLLM's reload_weights runs initialize → load → finalize, with no cleanup when the load raises:
    initialize_layerwise_reload(model)
    loaded_weights = model.load_weights(weights_iterator)
    finalize_layerwise_reload(model, model_config)
  2. When the refit watchdog aborts the NCCL group mid-refit, the next broadcast raises RefitAborted from inside the weight iterator, which is inside the load step, so finalize never runs.
  3. This except block closes the iterator and receives the remaining broadcasts, but leaves vLLM's per-layer reload state as it was. The native layerwise path resets it with _abort_layerwise_reload, called here.
  4. With fleet health on, SingleController retries the refit once on the same engines.
  5. On the retry, vLLM skips every layer that is still marked as loading. That layer keeps the byte count and buffered tensors of the interrupted attempt, finishes early, and the rest of its tensors are written without the quant method's post-load step. Nothing raises.

AI-1

Action: reset vLLM's per-layer state before re-raising, as the native layerwise path does:

Suggested change
raise
# A failed reload skips vLLM's finalize. Reset its per-layer state so
# a retry on this worker does not reuse the half-loaded layers.
try:
_abort_layerwise_reload(self.model_runner.model)
except Exception:
logger.exception("Failed to reset the layerwise reload state")
raise

AI-2

Action: add the regression test below right after test_collective_refit_with_preparer_rejects_partial_reload in test_vllm_backend.py. It is a new function in a different file than this anchor, so it is a plain fence, not a suggestion block. It passes only once AI-1 is applied.

Regression test (fails at head, passes with AI-1)
@pytest.mark.vllm
def test_collective_refit_with_preparer_retry_after_failed_reload(monkeypatch):
    """A refit retried on the same worker must not reuse half-loaded layers."""
    from vllm.model_executor.layers.quantization.base_config import QuantizeMethodBase
    from vllm.model_executor.model_loader.reload.layerwise import (
        finalize_layerwise_reload,
        initialize_layerwise_reload,
        record_metadata_for_reloading,
    )
    from vllm.model_executor.model_loader.weight_utils import default_weight_loader

    from nemo_rl.models.generation.vllm import vllm_backend

    class _TimesTen(QuantizeMethodBase):
        """Kernel format differs from checkpoint format, like a real quant method."""

        def create_weights(self, layer, *args, **kwargs):
            raise NotImplementedError

        def apply(self, layer, *args, **kwargs):
            raise NotImplementedError

        def process_weights_after_loading(self, layer):
            for param in layer.parameters():
                param.data.mul_(10)

    model = torch.nn.Module()
    for layer_name in ("a", "b"):
        layer = torch.nn.Module()
        for index in range(2):
            layer.register_parameter(
                f"p{index}", torch.nn.Parameter(torch.zeros(2), requires_grad=False)
            )
        layer.quant_method = _TimesTen()
        model.add_module(layer_name, layer)
    record_metadata_for_reloading(model)
    names = [name for name, _ in model.named_parameters()]

    def reload_weights(*, weights_iterator, is_checkpoint_format):
        # The checkpoint-format body of vLLM's reload_weights.
        assert is_checkpoint_format is True
        initialize_layerwise_reload(model)
        for name, tensor in weights_iterator:
            param = model.get_parameter(name.removeprefix("prepared."))
            getattr(param, "weight_loader", default_weight_loader)(param, tensor)
        finalize_layerwise_reload(model, None)

    failing = _RecordingPreparer(fail_on=names[1])
    ext, _, _ = _make_collective_reload_extension(monkeypatch, vllm_backend, failing)
    ext.state_dict_info = {name: object() for name in names}
    ext.model_runner.model = model
    ext.model_runner.reload_weights = reload_weights

    with pytest.raises(RuntimeError, match="preparer failed"):
        ext.update_weights_from_collective()

    ext._get_reload_weight_preparer = lambda: _RecordingPreparer()
    assert ext.update_weights_from_collective() is True

    # Every tensor in the stream is ones(2); the quant method scales it once.
    for name, param in model.named_parameters():
        assert torch.equal(param, torch.full((2,), 10.0)), name

Context — no action. The older refit_with_reload_api branch has the same gap; the new method follows that pattern, and AI-1 changes only the new method. AI-1 passes self.model_runner.model as the root because that is what the existing reset path uses.

Test results and what was not run
  • A CPU test that runs vLLM 0.33.0's real layerwise functions through the collective refit call fails at head with AssertionError: a.p1 (tensor([1., 1.]) where tensor([10., 10.]) is expected) and passes with AI-1.
  • AI-1 applied on a scratch copy: ruff 0.9.9 clean; -k collective in test_vllm_backend.py: 28 passed.
  • Not run on a real NVFP4 routed-experts layer (no GPU). The claim is that the retry reuses half-loaded per-layer state, not a specific corruption.

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.

C18 · No action needed — fixed in 994c4cc

TL;DR — the failure path now resets vLLM's per-layer reload state before it re-raises, and the retry test is added.

Comment on lines +855 to +866
def test_nvfp4_pertoken_normalized_as_validated_grpo_entry_point(
self, patched_factories: dict[str, Any]
) -> None:
mc = _make_master_config(colocated=colocated, megatron_enabled=True)
mc = _make_master_config(megatron_enabled=True)
mc.policy["generation"]["nvfp4_pertoken_rollout"] = {"enabled": True}

with pytest.raises(
ValueError,
match="SingleController does not support generation.nvfp4_pertoken_rollout",
):
with patch.object(
sc_setup_mod, "normalize_nvfp4_pertoken_policy_config"
) as normalize:
setup_single_controller(mc, MagicMock(pad_token_id=0))

for factory in (
"setup_response_data",
"_build_clusters",
"_build_generation",
"_build_trainer",
):
patched_factories[factory].assert_not_called()

@pytest.mark.parametrize("rollout", [None, {"enabled": False}])
def test_nvfp4_pertoken_off_preserves_single_controller_validation(
self, rollout: dict[str, bool] | None
) -> None:
mc = _make_master_config()
if rollout is not None:
mc.policy["generation"]["nvfp4_pertoken_rollout"] = rollout
validate_single_controller_config(mc)
normalize.assert_called_once_with(mc.policy, entry_point="single_controller")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

C8 · 1 action item. Test gap, introduced by this PR.
TL;DR — this test reaches only the last arm of the three-way entry-point choice, so relabelling the PPO or distillation arm as validated, or reverting the disabled-distillation fix from b357e16, breaks no test.

The entry-point choice has three arms. Nothing covers the PPO arm, the distillation arm, or the disabled-distillation case fixed in b357e16.

AI-1

Action: replace this test with one parametrized over plain GRPO, disabled distillation, enabled distillation and PPO. Like the two tests this PR deleted (linked at the base, since they no longer exist at head: test_setup.py L856-L883), it also checks that no builder ran before the call.

Suggested change
def test_nvfp4_pertoken_normalized_as_validated_grpo_entry_point(
self, patched_factories: dict[str, Any]
) -> None:
mc = _make_master_config(colocated=colocated, megatron_enabled=True)
mc = _make_master_config(megatron_enabled=True)
mc.policy["generation"]["nvfp4_pertoken_rollout"] = {"enabled": True}
with pytest.raises(
ValueError,
match="SingleController does not support generation.nvfp4_pertoken_rollout",
):
with patch.object(
sc_setup_mod, "normalize_nvfp4_pertoken_policy_config"
) as normalize:
setup_single_controller(mc, MagicMock(pad_token_id=0))
for factory in (
"setup_response_data",
"_build_clusters",
"_build_generation",
"_build_trainer",
):
patched_factories[factory].assert_not_called()
@pytest.mark.parametrize("rollout", [None, {"enabled": False}])
def test_nvfp4_pertoken_off_preserves_single_controller_validation(
self, rollout: dict[str, bool] | None
) -> None:
mc = _make_master_config()
if rollout is not None:
mc.policy["generation"]["nvfp4_pertoken_rollout"] = rollout
validate_single_controller_config(mc)
normalize.assert_called_once_with(mc.policy, entry_point="single_controller")
@pytest.mark.parametrize(
("algorithm", "entry_point"),
[
("grpo", "single_controller"),
("disabled_distillation", "single_controller"),
("distillation", "single_controller_distillation"),
("ppo", "single_controller_ppo"),
],
)
def test_nvfp4_pertoken_entry_point_names_the_algorithm(
self, patched_factories: dict[str, Any], algorithm: str, entry_point: str
) -> None:
"""Only plain GRPO is validated; PPO and enabled distillation must warn."""
class _ReachedNormalization(Exception):
pass
mc = _make_master_config(
megatron_enabled=True,
env={"should_use_nemo_gym": algorithm == "distillation"},
)
mc.policy["generation"]["nvfp4_pertoken_rollout"] = {"enabled": True}
if algorithm == "ppo":
mc.ppo = PPOConfig.model_construct(**dict(mc.grpo))
mc.grpo = None
mc.value = {"megatron_cfg": {"enabled": True}, "train_global_batch_size": 8}
mc.value_loss_fn = MseValueLossConfig()
elif algorithm == "distillation":
mc.grpo.adv_estimator = AdvEstimatorConfig(name="opd")
mc.on_policy_distillation = OnPolicyDistillationConfig(
enabled=True,
teacher_model_by_agent_name={"teacher": "/ckpt/teacher"},
default_teacher_alias="teacher",
non_colocated_teachers={"enabled": True},
)
elif algorithm == "disabled_distillation":
mc.on_policy_distillation = OnPolicyDistillationConfig(enabled=False)
# Stop setup at the call: the builders must not have run before it.
with (
patch.object(
sc_setup_mod,
"normalize_nvfp4_pertoken_policy_config",
side_effect=_ReachedNormalization,
) as normalize,
pytest.raises(_ReachedNormalization),
):
setup_single_controller(mc, MagicMock(pad_token_id=0))
normalize.assert_called_once_with(mc.policy, entry_point=entry_point)
for factory in ("_build_clusters", "_build_generation", "_build_trainer"):
patched_factories[factory].assert_not_called()
Mutation results and test run for the suggestion
  • Without the suggestion: with both other arms relabelled to "single_controller" and the b357e16 condition reverted, all 32 -k nvfp4 tests in test_setup.py and test_vllm_generation.py still pass.
  • With the suggestion, on a CPU env with vLLM 0.33.0: 4 passed at head. disabled_distillation fails with the b357e16 fix reverted; distillation and ppo fail when the arms are relabelled.
  • ruff 0.9.9 clean; every name the suggestion uses is already imported in the file.

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.

C19 · No action needed — fixed in 994c4cc

TL;DR — the setup test is now parametrized over the four cases.

```

The recipe trains on 4 nodes and serves rollouts from the other 4. Validation is not available on SingleController yet, so the recipe turns it off.
The recipe is on-policy (`in_order`, zero lookahead); the asynchronous samplers also work and pause in-flight rollouts across each quantized refit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

C9 · 1 action item. Doc wording, introduced by this PR.
TL;DR — "the asynchronous samplers also work" reads as covering every async sampler, but the PR description lists runs for in_order with lookahead 1 and windowed with staleness 1 only, and says weight_fifo and ready_first were not run.

The second half of the sentence is correct: _sync_weights pauses in-flight rollouts across each quantized refit.

AI-1

Action: name the samplers that were run:

Suggested change
The recipe is on-policy (`in_order`, zero lookahead); the asynchronous samplers also work and pause in-flight rollouts across each quantized refit.
The recipe is on-policy (`in_order`, zero lookahead). `in_order` with lookahead 1 and `windowed` with staleness 1 were also run; `ready_first` and `weight_fifo` were not. In-flight rollouts pause across each quantized refit.

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.

C20 · No action needed — fixed in 994c4cc

TL;DR — the doc now names the samplers that were run.

) -> None:
"""Receive collective weights through vLLM's native layerwise reload API.

The collective counterpart of ``_update_weights_via_ipc_zmq_with_reload``.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

C10 · 1 action item. Doc wording, low severity; the docstrings went stale with this PR.
TL;DR — this new method feeds the same preparer from NCCL broadcasts, but four docstrings outside the diff still say the tensors come from an IPC buffer, so they now describe only one of the two transports.

The rule that applies: comments-docstrings-and-docs.md ("After a rename, move or deletion, grep comments, docstrings and docs/ for the old name or the old behaviour, including files the diff does not touch").

AI-1

Action: reword these four docstrings. None of them is on a diff line, so there is no suggestion block:

  • _ReloadWeightPreparer: "must not reference the source IPC buffer, because it is released as soon as the batch is acknowledged" → name the transport's receive buffer (IPC allocation or collective receive buffer).
  • PendingHalf: "cloned off the refit IPC buffer" → "cloned off the refit receive buffer".
  • NvFp4PerTokenQuantizer.process: "cloned off the IPC buffer" and "recycled this batch's IPC buffer" → "receive buffer" in both places.
  • NvFp4PerTokenWorkerExtension: "IPC weight updates enter vLLM through its native reload_weights API" → "IPC and collective weight updates enter ...".

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.

C21 · No action needed — fixed in 994c4cc

TL;DR — the four docstrings now name the receive buffer or both transports.

nvfp4_entry_point = "single_controller_distillation"
else:
nvfp4_entry_point = "single_controller"
normalize_nvfp4_pertoken_policy_config(policy_config, entry_point=nvfp4_entry_point)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

C11 · No action needed — status note on the bot's C1; no new ask.
TL;DR — the bot's C1 is still open at 658e324, and this PR is what makes it reachable on SingleController: before, the flag was rejected in config validation, so a teacher was never built with it.

How far this was verified

Static trace only; not run.

zhangyimi and others added 3 commits November 22, 2026 22:28
- Reset vLLM's layerwise reload state when a collective reload fails, so a
  retried refit does not reuse half-loaded layers.
- Drop the student's per-token NVFP4 rollout block from distillation teachers.
- Cover every algorithm arm of the NVFP4 entry-point choice in the setup test.
- Name the async samplers that were run, and the receive buffer in docstrings.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: Zhang Shuai <[email protected]>
…k test

SingleController writes training dumps as Parquet since NVIDIA-NeMo#4845, so the
JSONL file count is always zero.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: Zhang Shuai <[email protected]>
@zhangyimi

Copy link
Copy Markdown
Contributor Author

/ok to test a899ed8

- Add the copyright header to the two new SingleController test scripts.
- Test that the preparer path wins over refit_with_reload_api.
- State in the design doc that checkpoint save/resume and vLLM TP>1 were not run.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: Zhang Shuai <[email protected]>
@zhangyimi

Copy link
Copy Markdown
Contributor Author

/ok to test 537906a

@zhangyimi zhangyimi 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.

Self-review of a899ed8 (the author's own review, run with the review-pr-team skill).

What holds up:

  • The collective path reuses the existing preparer hook, so the NVFP4 quantizer needed no logic change for a second transport.
  • The failure path holds in each of four cases (preparer raises, vLLM loader raises, broadcast aborted, finish raises): the original error is the one raised, the remaining broadcasts are received, and vLLM's per-layer state is reset.
  • Each override in the two SingleController recipes is needed: reverting any one fails config validation or setup.
  • The earlier threads C1, C2, C3, C6, C8, C9 and C10 are fixed at this head.

Inline comments (found at a899ed8, all fixed in 537906a):

  1. (C12) The doc did not say that checkpoint save/resume was never run on SingleController.
  2. (C13) No test failed if the preparer branch and the refit_with_reload_api branch were swapped.
  3. (C14, C15) The copyright header was missing on the two new .sh drivers.
  4. (C16 to C21) "Fixed in" notes on the earlier threads.

For the PR description, not an inline ask: examples/run_grpo.py with non-colocated rollout was also run (20/20 steps, sync engine, before the rebase onto vLLM 0.33). It is not in the proof list, and that pair gets no "unvalidated" warning, so the list should name it.

Scope: static review plus CPU runs of the four new collective-refit tests against vLLM 0.33.0 (4 passed, run without the Ray conftest). pre-commit run --all-files passes. No GPU run in this review.

nemo-rl-review: kind=self harness=claude-code/claude model=claude-fable-5-2 effort=medium review-pr-team=v2 reviewed=a899ed8

nvfp4_entry_point = "single_controller_distillation"
else:
nvfp4_entry_point = "single_controller"
normalize_nvfp4_pertoken_policy_config(policy_config, entry_point=nvfp4_entry_point)

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.

C16 · No action needed — fixed in 994c4cc

TL;DR — the teacher's config copy now drops generation.nvfp4_pertoken_rollout, and a test covers it.

find "$LOG_DIR" -type f -name 'train_data_step*.jsonl' -print | sort -V
)
if [[ ${#TRAIN_DATA_FILES[@]} -ne $MAX_STEPS ]]; then
echo "[ERROR] Expected $MAX_STEPS rollout JSONL files, found ${#TRAIN_DATA_FILES[@]}"

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.

C17 · No action needed — fixed in 658e324

TL;DR — the message now prints [FAIL]; a899ed8 later switched the count to Parquet manifests and kept it.

logger.exception(
"Failed to drain the collective sender after reload failure"
)
raise

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.

C18 · No action needed — fixed in 994c4cc

TL;DR — the failure path now resets vLLM's per-layer reload state before it re-raises, and the retry test is added.

Comment on lines +855 to +866
def test_nvfp4_pertoken_normalized_as_validated_grpo_entry_point(
self, patched_factories: dict[str, Any]
) -> None:
mc = _make_master_config(colocated=colocated, megatron_enabled=True)
mc = _make_master_config(megatron_enabled=True)
mc.policy["generation"]["nvfp4_pertoken_rollout"] = {"enabled": True}

with pytest.raises(
ValueError,
match="SingleController does not support generation.nvfp4_pertoken_rollout",
):
with patch.object(
sc_setup_mod, "normalize_nvfp4_pertoken_policy_config"
) as normalize:
setup_single_controller(mc, MagicMock(pad_token_id=0))

for factory in (
"setup_response_data",
"_build_clusters",
"_build_generation",
"_build_trainer",
):
patched_factories[factory].assert_not_called()

@pytest.mark.parametrize("rollout", [None, {"enabled": False}])
def test_nvfp4_pertoken_off_preserves_single_controller_validation(
self, rollout: dict[str, bool] | None
) -> None:
mc = _make_master_config()
if rollout is not None:
mc.policy["generation"]["nvfp4_pertoken_rollout"] = rollout
validate_single_controller_config(mc)
normalize.assert_called_once_with(mc.policy, entry_point="single_controller")

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.

C19 · No action needed — fixed in 994c4cc

TL;DR — the setup test is now parametrized over the four cases.

```

The recipe trains on 4 nodes and serves rollouts from the other 4. Validation is not available on SingleController yet, so the recipe turns it off.
The recipe is on-policy (`in_order`, zero lookahead); the asynchronous samplers also work and pause in-flight rollouts across each quantized refit.

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.

C20 · No action needed — fixed in 994c4cc

TL;DR — the doc now names the samplers that were run.

) -> None:
"""Receive collective weights through vLLM's native layerwise reload API.

The collective counterpart of ``_update_weights_via_ipc_zmq_with_reload``.

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.

C21 · No action needed — fixed in 994c4cc

TL;DR — the four docstrings now name the receive buffer or both transports.

@zhangyimi

Copy link
Copy Markdown
Contributor Author

@sharonyu-115 All review comments are addressed. Could you take another look?

@terrykong terrykong removed the Documentation Improvements or additions to documentation label Nov 28, 2026

This branch has not been deployed

No deployments
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.

4 participants