Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
b88aa2c
perf(vllm): optimize quantized refit paths
seonjinn Jul 21, 2026
438e20d
Merge branch 'main' into sna/pr-mxfp8-refit-optimization
seonjinn Jul 21, 2026
96ba299
Merge branch 'main' into sna/pr-mxfp8-refit-optimization
seonjinn Jul 27, 2026
0fb59b6
fix(trtllm): align refit metadata interface
seonjinn Jul 27, 2026
c4a5e14
test(vllm): include MXFP8 refit tests in L0
seonjinn Jul 27, 2026
5c53bd4
fix(refit): complete prequant metadata handshake
seonjinn Jul 27, 2026
98fc197
test(refit): cover MXFP8 optimization paths
seonjinn Jul 27, 2026
b237fd2
test(refit): fix vLLM test import order
seonjinn Jul 27, 2026
d1f9fc9
Merge upstream/main into sna/pr-mxfp8-refit-optimization
seonjinn Jul 28, 2026
ab030c3
test(fp8): cover MXFP8 MoE padding path
seonjinn Jul 28, 2026
2c147ac
Merge upstream/main into sna/pr-mxfp8-refit-optimization
seonjinn Jul 28, 2026
150e25f
Merge remote-tracking branch 'upstream/main' into sna/pr-mxfp8-refit-…
seonjinn Jul 29, 2026
f391a4a
fix(refit): reconcile MXFP8 optimizations with NCCL reshard
seonjinn Jul 29, 2026
85a6fea
fix(refit): validate checkpoint prequant backend
seonjinn Jul 29, 2026
716bb74
fix(refit): reject MXFP8 with NCCL reshard
seonjinn Jul 29, 2026
f638fa6
fix(refit): validate NCCL reshard storage precision
seonjinn Jul 29, 2026
2fde3b0
ci: associate Codecov uploads with pull requests
seonjinn Jul 30, 2026
2b0b262
Merge remote-tracking branch 'origin/main' into sna/pr-mxfp8-refit-op…
seonjinn Jul 30, 2026
6fe0632
Merge remote-tracking branch 'upstream/main' into sna/pr-mxfp8-refit-…
seonjinn Jul 30, 2026
00fa128
fix: address MXFP8 refit review feedback
seonjinn Jul 30, 2026
de65f06
Merge remote-tracking branch 'upstream/main' into sna/pr-mxfp8-refit-…
seonjinn Jul 30, 2026
2339686
Merge remote-tracking branch 'upstream/main' into sna/pr-mxfp8-refit-…
seonjinn Jul 31, 2026
5880499
fix(vllm): preserve MXFP8 refit on vLLM 0.25
seonjinn Jul 31, 2026
123cc07
style(vllm): sort MXFP8 backend import
seonjinn Jul 31, 2026
ef3fa08
fix(vllm): allow partial configs in quant validation
seonjinn Jul 31, 2026
7989113
Merge remote-tracking branch 'upstream/main' into sna/pr-mxfp8-refit-…
seonjinn Jul 31, 2026
c4a7b06
feat(recipe): add async Qwen3 30B MXFP8 rollout
seonjinn Jul 31, 2026
69f7995
feat(recipe): add async Qwen3 235B MXFP8 rollout
seonjinn Jul 31, 2026
d53bfdf
ci: allowlist async recipe result path
seonjinn Jul 31, 2026
2405bf5
fix(vllm): initialize async driver FP8 config
seonjinn Jul 31, 2026
0a11e94
fix(vllm): propagate FP8 config to refit workers
seonjinn Jul 31, 2026
81ce860
fix(recipe): keep Qwen router gate in BF16
seonjinn Jul 31, 2026
9e43378
fix(recipe): exclude Qwen MoE routers from MXFP8
seonjinn Jul 31, 2026
6e582b8
fix(vllm): patch FP8 in RayExecutorV2 workers
seonjinn Aug 1, 2026
93394c2
fix(vllm): serialize FP8 worker pre-init hook
seonjinn Aug 1, 2026
f3c9196
test(vllm): share RayExecutorV2 patch recorder
seonjinn Aug 1, 2026
e3384d2
feat(vllm): configure refit runtime optimizations
seonjinn Aug 1, 2026
c4d453e
fix(refit): propagate runtime configuration
seonjinn Aug 1, 2026
d43372e
Merge remote-tracking branch 'upstream/main' into sna/pr-mxfp8-refit-…
seonjinn Aug 1, 2026
2b80a85
fix(refit): cover standalone algorithm paths
seonjinn Aug 1, 2026
0b6b5cc
fix(vllm): scope refit optimization config
seonjinn Aug 1, 2026
cd7732c
fix(refit): allow matching fp8 reshard storage
seonjinn Aug 1, 2026
80cd8fe
Merge remote-tracking branch 'upstream/main' into sna/pr-mxfp8-refit-…
seonjinn Aug 13, 2026
7705d22
fix(refit): validate MXFP8 prequant wire format
seonjinn Aug 13, 2026
88721ce
Merge remote-tracking branch 'origin/main' into review/pr3294-latest-…
seonjinn Aug 18, 2026
94a312e
fix: accept serialized_fp8_config in real-quant prepare_refit_info
seonjinn Aug 25, 2026
759b44c
fix: gate slim-refit optimizer offload on offload_optimizer_for_refit
seonjinn Aug 25, 2026
3736d16
fix: validate MXFP8 scale presence against full refit manifest
seonjinn Aug 25, 2026
1d6a10a
Merge branch 'main' into pr-3294-fixes
seonjinn Aug 26, 2026
8dc4c36
fix(dynamo): align prepare_refit_info override with interface
seonjinn Aug 26, 2026
db442ef
Merge branch 'main' into sna/pr-mxfp8-refit-optimization
seonjinn Aug 26, 2026
4427f4c
Merge main into sna/pr-mxfp8-refit-optimization
seonjinn Aug 26, 2026
c162cfd
fix: resolve CI unit-test failures after main merge
seonjinn Aug 26, 2026
382fa8b
Merge remote branch update, keeping local merge resolution and CI fixes
seonjinn Aug 26, 2026
125f178
Merge main into sna/pr-mxfp8-refit-optimization
seonjinn Aug 26, 2026
e28239c
fix(refit): derive prequantize metadata without re-exporting weights
seonjinn Aug 26, 2026
232da17
Fix pyrefly no-matching-overload false positive on masked_fill
seonjinn Aug 26, 2026
6b2ab6e
test: update refit cleanup fixture after main merge
seonjinn Aug 27, 2026
06b6fbb
refactor(refit): limit optimized recipes to sync RL
seonjinn Aug 27, 2026
7c9b881
Merge remote-tracking branch 'origin/main' into codex/pr3294-push-202…
seonjinn Sep 4, 2026
bf03429
fix(mxfp8): handle mixed grouped expert refit
seonjinn Sep 4, 2026
d9246a9
test(mxfp8): align refit fixtures with vllm
seonjinn Sep 4, 2026
443a9f9
test(mxfp8): model routed expert config
seonjinn Sep 4, 2026
b8159de
fix(vllm): reroute grouped MXFP8 scale sidecars
seonjinn Sep 4, 2026
8d38b28
test(mxfp8): patch modular kernel factory
seonjinn Sep 4, 2026
658d385
test(mxfp8): use block-aligned hidden size
seonjinn Sep 4, 2026
172d346
test(mxfp8): exercise unpadded kernel reuse
seonjinn Sep 4, 2026
546d346
test(mxfp8): use current refit loader contract
seonjinn Sep 4, 2026
db15416
test(mxfp8): update remaining loader fixtures
seonjinn Sep 4, 2026
1d4d013
test(refit): reject native loader cache wrapping
seonjinn Sep 7, 2026
1b5e642
fix(refit): preserve vLLM online loaders
seonjinn Sep 7, 2026
f377f0a
Merge remote-tracking branch 'origin/main' into codex/pr3294-push-202…
seonjinn Sep 7, 2026
b7d4ce6
test(refit): avoid duplicate kv scale finalization
seonjinn Sep 7, 2026
201ad9e
test(refit): avoid duplicate fp8 kv finalization
seonjinn Sep 7, 2026
7438153
test(refit): use a realized module fixture
seonjinn Sep 7, 2026
08e7d10
test(refit): expect serialized FP8 config
seonjinn Sep 7, 2026
d003483
test(refit): follow collective sender contract
seonjinn Sep 7, 2026
238f241
fix(refit): preserve MXFP8 kernel scale storage
seonjinn Sep 7, 2026
b72f4d4
test(refit): update offload call expectation
seonjinn Sep 7, 2026
bc024e8
Merge branch 'main' into sna/pr-mxfp8-refit-optimization
seonjinn Sep 12, 2026
0122151
style: apply lint fixes
seonjinn Sep 12, 2026
07eda91
fix(vllm): accept weights keyword in refit loader callback
seonjinn Sep 15, 2026
85a9a53
Merge main into MXFP8 refit optimization
seonjinn Sep 17, 2026
0982f5d
test: restore mock call import after main merge
seonjinn Sep 17, 2026
83011b1
fix(refit): renegotiate metadata after communicator rebuild
seonjinn Sep 17, 2026
b3e36e9
refactor(refit): define MXFP8 wire contract
seonjinn Sep 17, 2026
f61f498
test(refit): exercise both MXFP8 quantization paths
seonjinn Sep 17, 2026
b65f89d
test(refit): require vLLM MXFP8 quantizer backend
seonjinn Sep 17, 2026
1c5ece7
test(refit): complete MXFP8 quantizer test double
seonjinn Sep 17, 2026
0ac5b7d
test(refit): model MXFP8 tensor size API
seonjinn Sep 17, 2026
aabd384
test(refit): cover metadata renegotiation
seonjinn Sep 17, 2026
c619ac4
fix(refit): align prequantization lifecycle
seonjinn Sep 17, 2026
1d2a023
fix(refit): restore grouped MXFP8 value shape
seonjinn Sep 17, 2026
385cbf0
fix(refit): preserve canonical MXFP8 tensor identity
seonjinn Sep 17, 2026
8f2d78a
test(refit): compare MXFP8 values by storage bits
seonjinn Sep 17, 2026
5409fb4
Merge latest main into MXFP8 refit optimization
seonjinn Sep 21, 2026
9643037
Merge latest main into MXFP8 refit optimization
seonjinn Sep 28, 2026
c24bef9
fix: align MXFP8 refit quantization with vLLM selection
seonjinn Sep 28, 2026
9c59f6e
style: sort MXFP8 prequant test imports
seonjinn Sep 28, 2026
9c9628d
test: align MXFP8 refit fixtures with current dependencies
seonjinn Sep 28, 2026
b319b7f
Merge latest main into PR #3294
seonjinn Sep 28, 2026
077a48a
fix: preserve unpadded MXFP8 W13 storage
seonjinn Sep 28, 2026
c315841
Merge remote-tracking branch 'upstream/main' into codex/fix-pr3294-re…
seonjinn Sep 29, 2026
69b585e
fix(vllm): preserve refit loader callback contract
seonjinn Sep 29, 2026
ead0b4c
Merge remote-tracking branch 'upstream/main' into codex/fix-pr3294-re…
seonjinn Sep 29, 2026
d45552f
Merge latest main into PR #3294
seonjinn Sep 30, 2026
190a521
fix(vllm): reject prequantization with native reload
seonjinn Sep 30, 2026
dc4e355
test(vllm): cover refit scratch release
seonjinn Oct 1, 2026
01e05c7
fix(vllm): release MXFP8 shuffle scratch after refit
seonjinn Oct 1, 2026
64b91c4
fix(vllm): fence refit finalization before scratch release
seonjinn Oct 1, 2026
9084313
fix(vllm): keep MXFP8 shuffle scratch in weight pool
seonjinn Oct 1, 2026
54ed892
Merge latest main into MXFP8 refit optimization
seonjinn Oct 3, 2026
5b3a7d1
chore: merge latest main for vLLM 0.29 (PR3294)
seonjinn Oct 4, 2026
fd294b5
chore: merge latest main into MXFP8 refit optimization
seonjinn Oct 6, 2026
09987a9
style: match pinned Ruff formatting in refit test
seonjinn Oct 6, 2026
90a35e4
docs: clarify MXFP8 refit options
seonjinn Oct 6, 2026
9b5a132
fix(refit): stream receiver-side quantized weights without route cache
seonjinn Oct 8, 2026
a7459ec
fix(refit): address cache config and stale collective path review
seonjinn Oct 8, 2026
1c1e952
Merge NVIDIA-NeMo/RL main into MXFP8 refit PR
seonjinn Oct 8, 2026
89572c0
test(refit): exercise lazy MXFP8 validation and complete worker config
seonjinn Oct 8, 2026
2503f3c
refit: drop unmeasured persistent IPC buffer option
seonjinn Oct 8, 2026
5c9dab7
Address MXFP8 refit review feedback
seonjinn Oct 13, 2026
1d3ff56
Merge remote-tracking branch 'origin/main' into fix/pr3294-review-202…
seonjinn Oct 13, 2026
69ac028
Fix MXFP8 refit tests and lint after review cleanup
seonjinn Oct 13, 2026
9b04a62
Align refit metadata return annotations across backends
seonjinn Oct 13, 2026
f420b01
Merge upstream/main into sna/pr-mxfp8-refit-optimization
seonjinn Oct 15, 2026
4520c78
Remove stale MXFP8 shuffle verification references
seonjinn Oct 15, 2026
9e2ab4b
Merge upstream/main into sna/pr-mxfp8-refit-optimization
seonjinn Oct 16, 2026
f555a77
Fix MXFP8 CI test collection
seonjinn Oct 16, 2026
21a70a6
Merge upstream/main into sna/pr-mxfp8-refit-optimization
seonjinn Oct 16, 2026
d30a813
Install vLLM extra for GB200 MXFP8 CI tests
seonjinn Oct 16, 2026
5e451db
Merge latest main and repair MXFP8 GB200 L1 config
seonjinn Oct 18, 2026
7bc2096
Match pinned Ruff formatter for refit test
seonjinn Oct 18, 2026
ecb9aa0
Fix MXFP8 checkpoint handshake unit fixture after main merge
seonjinn Oct 18, 2026
501b5d5
Update MXFP8 refit test for source metadata API
seonjinn Oct 18, 2026
b1a8060
test(refit): exercise prequant handshake through real worker
seonjinn Oct 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions examples/configs/grpo_math_1B.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ policy:

megatron_cfg:
enabled: false
# When true, offload_after_refit skips rerunning the full offload_before_refit
# pass and only re-offloads the optimizer with a single allocator cleanup.
refit_slim_offload_after: false
# When true, stage the per-step reference-policy swap in persistent pinned
# CPU buffers instead of pageable copies (faster PCIe, more host RAM).
pinned_reference_swap: false
checkpoint:
async_save: true
ckpt_assume_constant_structure: true
Expand Down Expand Up @@ -306,6 +312,10 @@ policy:
# makes the training sequence length divisible by the tensor parallel size
# this is useful for sequence parallel training
make_sequence_length_divisible_by: ${policy.dtensor_cfg.tensor_parallel_size}
# Keep refit CUDA-IPC staging buffers allocated across refits (skips two large
# allocations plus a gc/empty_cache pair per refit). Best with a fixed
# refit_buffer_size_gb; buffers stay resident on the trainer GPU between refits.
refit_persistent_ipc_buffers: false
max_grad_norm: 1.0

optimizer:
Expand Down
6 changes: 4 additions & 2 deletions nemo_rl/algorithms/distillation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
DistillationLossDataDict,
DistillationLossFn,
)
from nemo_rl.algorithms.utils import set_seed
from nemo_rl.algorithms.utils import maybe_enable_refit_prequantize, set_seed
from nemo_rl.data import DataConfig
from nemo_rl.data.collate_fn import rl_collate_fn
from nemo_rl.data.datasets import AllTaskProcessedDataset
Expand Down Expand Up @@ -620,7 +620,9 @@ def init_nemo_gym():
student_generation.weight_synchronizer.init_communicator()
elif student_generation is not None:
state_dict_info = student_policy.prepare_refit_info()
student_generation.prepare_refit_info(state_dict_info)
maybe_enable_refit_prequantize(
student_policy, student_generation, state_dict_info, master_config.policy
)

# if it is not colocated inference, initialize collective communication for update weights
if not colocated_inference and checkpoint_engine_config is None:
Expand Down
5 changes: 4 additions & 1 deletion nemo_rl/algorithms/grpo.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
calculate_baseline_and_std_per_prompt,
get_gdpo_reward_component_keys,
log_generation_metrics_to_wandb,
maybe_enable_refit_prequantize,
print_efficiency_summary,
print_performance_metrics,
set_seed,
Expand Down Expand Up @@ -1384,7 +1385,9 @@ def init_trtllm():
else:
state_dict_info = policy.prepare_refit_info()
if policy_generation is not None:
policy_generation.prepare_refit_info(state_dict_info)
maybe_enable_refit_prequantize(
policy, policy_generation, state_dict_info, master_config.policy
)

# Spin up non-colocated OPD teacher worker groups AFTER policy / vLLM are
# ready. Parallelizing with policy init races on Megatron-Bridge's HF->mcore
Expand Down
10 changes: 8 additions & 2 deletions nemo_rl/algorithms/ppo.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@
RewardShapingConfig,
apply_reward_shaping,
)
from nemo_rl.algorithms.utils import print_performance_metrics, set_seed
from nemo_rl.algorithms.utils import (
maybe_enable_refit_prequantize,
print_performance_metrics,
set_seed,
)
from nemo_rl.data import DataConfig
from nemo_rl.data.collate_fn import rl_collate_fn
from nemo_rl.data.datasets import AllTaskProcessedDataset
Expand Down Expand Up @@ -658,7 +662,9 @@ def initialize_generation_with_policy(
# prepare refit info
state_dict_info = policy.prepare_refit_info()
if policy_generation is not None:
policy_generation.prepare_refit_info(state_dict_info)
maybe_enable_refit_prequantize(
policy, policy_generation, state_dict_info, master_config.policy
)

# Calculate total setup time
total_setup_time = time.perf_counter() - setup_start_time
Expand Down
37 changes: 35 additions & 2 deletions nemo_rl/algorithms/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import random
import warnings
from functools import partial, wraps
from typing import Any, Optional
from typing import TYPE_CHECKING, Any, Optional

import numpy as np
import torch
Expand All @@ -27,10 +27,16 @@
)

from nemo_rl.data.chat_templates import COMMON_CHAT_TEMPLATES
from nemo_rl.models.policy import TokenizerConfig
from nemo_rl.models.policy import PolicyConfig, TokenizerConfig
from nemo_rl.utils.fastokens import maybe_patch_fastokens
from nemo_rl.utils.logger import Logger

if TYPE_CHECKING:
# Runtime import would cycle: policy.interfaces pulls in algorithms.loss,
# which imports back into algorithms.utils.
from nemo_rl.models.generation.interfaces import GenerationInterface
from nemo_rl.models.policy.interfaces import ColocatablePolicyInterface


def get_gdpo_reward_component_keys(batch) -> list[str]:
"""Return batch keys that are named reward components (e.g. reward/correctness) in sorted order."""
Expand Down Expand Up @@ -1032,3 +1038,30 @@ def print_efficiency_summary(
loggable["efficiency/total_wall_time_s"] = total_wall_time_s

return loggable


def maybe_enable_refit_prequantize(
policy: "ColocatablePolicyInterface",
policy_generation: "GenerationInterface",
state_dict_info: Optional[dict[str, Any]],
policy_config: PolicyConfig,
) -> None:
"""Complete the trainer-side pre-quantized refit handshake if requested.

The generation backend's prepare_refit_info returns the fp8-eligible
parameter names when vllm_cfg.refit_prequantize is enabled; the trainer
then quantizes exactly those during refit and the receiver's unpack
metadata is refreshed to the quantized dtypes plus scale entries.
"""
prequant_names = policy_generation.prepare_refit_info(state_dict_info)
Comment thread
seonjinn marked this conversation as resolved.
Resolved
if not prequant_names:
return
megatron_cfg = policy_config.get("megatron_cfg")
if not (megatron_cfg and megatron_cfg["enabled"]):
raise ValueError(
"vllm_cfg.refit_prequantize requires the Megatron policy backend "
"(policy.megatron_cfg.enabled=true); the DTensor workers do not "
"implement trainer-side pre-quantized refit."
)
updated_info = policy.enable_refit_prequantize(prequant_names)
policy_generation.prepare_refit_info(updated_info)
14 changes: 10 additions & 4 deletions nemo_rl/modelopt/models/generation/vllm_quant_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import types
from collections.abc import Iterator
from contextlib import ExitStack, contextmanager
from typing import Any
from typing import Any, Optional

import torch
import vllm # noqa: F401
Expand Down Expand Up @@ -510,10 +510,15 @@ def _synchronize_before_ipc_data_ack(self) -> None:
return
super()._synchronize_before_ipc_data_ack()

def prepare_refit_info(self, state_dict_info: dict[str, Any]) -> None:
super().prepare_refit_info(state_dict_info)
def prepare_refit_info(
Comment thread
seonjinn marked this conversation as resolved.
Resolved
self, state_dict_info: dict[str, Any]
) -> Optional[list[str]]:
if not self._is_real_quant_model():
return
return super().prepare_refit_info(state_dict_info)

# Real quantization owns a separate refit handshake and must not import
# the legacy FP8 quantization path.
self.state_dict_info = state_dict_info
self._get_modelopt_reload_roots()
quant_config = (
self.model_runner.vllm_config.model_config.hf_config.quantization_config
Expand All @@ -532,6 +537,7 @@ def prepare_refit_info(self, state_dict_info: dict[str, Any]) -> None:
"Fused ModelOpt MoE refits require all experts local; "
"vLLM expert parallelism is unsupported"
)
return None

@contextmanager
def _patch_named_parameters_to_include_buffers(self, model):
Expand Down
12 changes: 10 additions & 2 deletions nemo_rl/models/generation/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,16 @@ def requires_kv_scale_sync(self) -> bool:
"""Whether the generation backend requires KV cache scales synchronization."""
return False

def prepare_refit_info(self, state_dict_info: dict[str, Any]) -> None:
"""Prepare the info for refit."""
def prepare_refit_info(
self, state_dict_info: Optional[dict[str, Any]]
) -> Optional[list[str]]:
Comment thread
seonjinn marked this conversation as resolved.
Resolved
"""Prepare the info for refit.

Returns:
Optionally, the parameter names the backend wants pre-quantized on
the trainer before streaming (e.g. vllm_cfg.refit_prequantize);
None when no trainer-side pre-quantization is requested.
"""
raise NotImplementedError

def update_weights_via_ipc_zmq(self) -> list[ray.ObjectRef]:
Expand Down
6 changes: 4 additions & 2 deletions nemo_rl/models/generation/sglang/sglang_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,10 @@ def init_collective(
) -> list[ray.ObjectRef]:
return []

def prepare_refit_info(self, state_dict_info: dict[str, Any]) -> None:
pass
def prepare_refit_info(
self, state_dict_info: dict[str, Any] | None
) -> list[str] | None:
return None

def update_weights_via_ipc_zmq(self) -> list[ray.ObjectRef]:
return []
Expand Down
7 changes: 6 additions & 1 deletion nemo_rl/models/generation/trtllm/trtllm_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,13 +435,18 @@ def finish_generation(self, *args: Any, **kwargs: Any) -> bool:
print(f"Error in finish_generation: {e}")
return False

def prepare_refit_info(self, state_dict_info: dict[str, Any]) -> None:
def prepare_refit_info(
self, state_dict_info: Optional[dict[str, Any]]
) -> Optional[list[str]]:
if state_dict_info is None:
return None
futures = self.worker_group.run_all_workers_single_data(
"prepare_refit_info_async",
state_dict_info=state_dict_info,
run_rank_0_only_axes=["tensor_parallel"],
)
ray.get(futures)
return None

def start_gpu_profiling(self) -> None:
"""Grpo profiling protocol: start nsys capture on the GPU workers."""
Expand Down
24 changes: 12 additions & 12 deletions nemo_rl/models/generation/vllm/checkpoint_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,18 @@ async def _update_weights_from_checkpoint_engine_async(self) -> bool:
load_time = 0.0
start_time = time.time()

async for weight_batch in self.checkpoint_engine.receive_weight_batches():
loaded_batches += 1
loaded_tensors += len(weight_batch)
loaded_bytes += sum(weight.nbytes for _name, weight in weight_batch)

load_start = time.time()
self._load_weights(weight_batch)
torch.cuda.current_stream().synchronize()
load_time += time.time() - load_start
del weight_batch

self._maybe_process_fp8_kv_cache()
with self._weight_update_lifecycle("checkpoint_engine") as finalize:
async for weight_batch in self.checkpoint_engine.receive_weight_batches():
loaded_batches += 1
loaded_tensors += len(weight_batch)
loaded_bytes += sum(weight.nbytes for _name, weight in weight_batch)

load_start = time.time()
self._load_weights(weight_batch)
torch.cuda.current_stream().synchronize()
load_time += time.time() - load_start
del weight_batch
finalize()

total_time = time.time() - start_time
loaded_gib = loaded_bytes / (1024 * 1024 * 1024)
Expand Down
5 changes: 5 additions & 0 deletions nemo_rl/models/generation/vllm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ class VllmSpecificArgs(TypedDict):
precision: NotRequired[str]
# Use ModelOpt MXFP8 quantization when precision is fp8.
is_mx: NotRequired[bool]
# With is_mx, quantize weights to MXFP8 on the trainer during refit and
# stream E4M3 data plus scales (~47% smaller payload) instead of BF16;
# the vLLM worker then skips its per-refit re-quantization. Requires the
# Megatron policy backend.
refit_prequantize: NotRequired[bool]
Comment thread
seonjinn marked this conversation as resolved.
Resolved
kv_cache_dtype: Literal["auto", "fp8", "fp8_e4m3"]
enforce_eager: NotRequired[bool]
enable_return_routed_experts: NotRequired[bool]
Expand Down
Loading
Loading