Skip to content

feat: add checkpoint-engine refit interface and integrate NIXL - #2608

Merged
terrykong merged 8 commits into
NVIDIA-NeMo:mainfrom
HollowMan6:nixl
Jul 21, 2026
Merged

feat: add checkpoint-engine refit interface and integrate NIXL#2608
terrykong merged 8 commits into
NVIDIA-NeMo:mainfrom
HollowMan6:nixl

Conversation

@HollowMan6

@HollowMan6 HollowMan6 commented May 28, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds NIXL checkpoint-engine refit for transferring policy weights to
non-colocated vLLM generation workers.

The implementation:

  • Integrates NIXL with the existing refit_transport and weight-synchronizer
    lifecycle.
  • Supports DTensor, DTensor v2, and Megatron policy backends with vLLM
    generation.
  • Supports CUDA UCX/RDMA transfers and host-pinned CPU transfers.
  • Sizes each of the two transfer buffers from a configurable fraction of total
    GPU memory.
  • Keeps communicators and buffers across refits by default, with optional buffer
    release after each refit.
  • Provides a readable full-weight loading path and an optional
    destination-layout-aware sharded-expert path.
  • Validates unsupported topology, quantization, and expert-layout combinations
    before transfer.
  • Makes NIXL available in isolated policy and vLLM actor environments on Linux
    x86-64 and ARM64.

Limitations

  • Only non-colocated vLLM generation is supported.
  • shard_expert_weights: true currently supports unquantized Triton MoE
    storage.
  • Sharded FP8/MXFP8 expert refit is not supported. FP8 models can use
    full-weight refit with shard_expert_weights: false.
  • Dynamic expert load balancing and redundant expert placement are not
    supported by the sharded-expert path.
  • Support for other generation backends is tracked in feat: extend checkpoint-engine refit to SGLang (and Megatron) generation backends #3288.

Issues

None.

Usage

Enable NIXL for non-colocated vLLM generation:

policy:
  generation:
    backend: vllm
    colocated:
      enabled: false
    refit_transport: nixl
    refit_cfg:
      nixl:
        # Fraction of total GPU memory allocated to each transfer buffer.
        # NIXL uses two buffers, so 0.05 reserves up to 10% in total.
        update_weights_bucket_memory_ratio: 0.05
        device: cuda
        backend_name: UCX
        release_after_refit: false
        shard_expert_weights: false

For MoE models, enable destination-local expert transfer with:

policy:
  generation:
    refit_cfg:
      nixl:
        shard_expert_weights: true

NIC and rail selection can be configured through backend_init_params.
Site-specific device names are intentionally not included in the minimal
configuration.

See:

  • docs/guides/refit.md
  • docs/guides/checkpoint-engine-refit.md
  • docs/design-docs/checkpoint-engines.md

Performance

DeepSeek-V3 BF16 was benchmarked with 32 Megatron policy nodes and four vLLM
rollout nodes over eight RDMA rails:

Comparison NIXL NCCL Improvement
Dedicated asynchronous refit 9.25 s 14.21 s 1.54x
Synchronized verifier 10.92 s 15.52 s 1.42x

Within the same NIXL build, destination-local sharded-expert transfer reduced
refit time from 36.81 s to 10.92 s, a 3.37x improvement.
tools/refit_verifier.py reported identical aggregate outputs and log
probabilities for the full- and sharded-expert paths.

Testing

  • Added unit coverage for NIXL bucket splitting, double-buffering, transfer
    lifecycle, async receive/load dispatch, and sharded expert placement.
  • Added a fast non-colocated NIXL GRPO functional smoke test.
  • Ran a two-step end-to-end GRPO refit with fresh isolated Ray actor
    environments.
  • Verified both actor environments import NIXL 1.3.0 and complete repeated
    refits.
  • Verified DeepSeek-V3 full- and sharded-expert refit with
    tools/refit_verifier.py.

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you run the unit tests and functional tests locally? Visit our Testing Guide for how to run tests
  • Did you add or update any necessary documentation? Visit our Document Development Guide for how to write, build and test the docs.

Additional Information

The default configuration retains NIXL transfer buffers and peer connections
across refits for throughput. Set release_after_refit: true when reclaiming
the transfer-buffer memory between refits is more important than avoiding
buffer registration and allocation overhead.

@copy-pr-bot

copy-pr-bot Bot commented May 28, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@HollowMan6
HollowMan6 force-pushed the nixl branch 3 times, most recently from ebf023f to e5829e0 Compare May 30, 2026 20:42
@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label May 30, 2026
@HollowMan6
HollowMan6 marked this pull request as ready for review May 30, 2026 21:02
Copilot AI review requested due to automatic review settings May 30, 2026 21:02
@HollowMan6
HollowMan6 requested review from a team as code owners May 30, 2026 21:02
@copy-pr-bot

copy-pr-bot Bot commented May 30, 2026

Copy link
Copy Markdown

Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@HollowMan6
HollowMan6 force-pushed the nixl branch 4 times, most recently from 6aeadb6 to cad807c Compare June 5, 2026 05:55
@HollowMan6
HollowMan6 force-pushed the nixl branch 2 times, most recently from 6968a6c to cb745fa Compare June 8, 2026 00:36
@HollowMan6 HollowMan6 added CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) CI:L1 Run doctests, unit tests, and functional tests and removed CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) CI:L1 Run doctests, unit tests, and functional tests labels Jun 8, 2026
@HollowMan6
HollowMan6 force-pushed the nixl branch 2 times, most recently from bd5271d to c251ec6 Compare June 9, 2026 00:51
@HollowMan6 HollowMan6 added the CI:L1 Run doctests, unit tests, and functional tests label Jun 9, 2026
@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from github-actions Bot Jun 9, 2026
Comment thread nemo_rl/models/generation/vllm/vllm_worker.py Outdated
Comment thread nemo_rl/models/generation/vllm/worker_utils.py
Comment thread nemo_rl/models/policy/workers/base_policy_worker.py Outdated
Comment thread nemo_rl/models/generation/vllm/refit_loader.py Outdated
Comment thread nemo_rl/models/generation/vllm/vllm_backend.py Outdated
Comment thread nemo_rl/models/generation/vllm/vllm_backend.py Outdated
Comment thread nemo_rl/utils/checkpoint_engines/nixl.py Outdated
@HollowMan6

Copy link
Copy Markdown
Contributor Author

/ok to test 705af30

Comment thread docs/design-docs/checkpoint-engines.md Outdated
Comment thread docs/guides/checkpoint-engine-refit.md Outdated
@ZhiyuLi-Nvidia

Copy link
Copy Markdown
Contributor

Awesome @HollowMan6. Generally looks great to me!

@HollowMan6

Copy link
Copy Markdown
Contributor Author

/ok to test 4d89446

@terrykong terrykong left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-review at head 4d89446b3 (rebased on top of the now-merged delta-refit #2444). Prior rounds were thorough — every earlier "fixed" claim landed, the lint failure I flagged last round is fixed, and the NIXL double-buffer handshake, bucket split/merge, and sharded w13/w2 placement were independently verified against vLLM 0.20.0 and check out.

The main new point from the rebase is structural, not a bug: delta-refit and this PR both add a non-colocated vLLM refit backend, but they're selected and dispatched three different ways (refit_transport string enum vs checkpoint_engine.enabled block vs the legacy inline path), with no single selector and no mutual-exclusion guard. The lead inline comment lays this out — aligning this PR with delta-refit's weight_synchronizer-at-setup pattern (routed through the existing-but-unused create_weight_synchronizer factory) collapses the dispatch to one path and makes the colocated guard actually run. A single docs/guides/refit.md explaining how to pick among the refit methods is also missing.

Minor / non-blocking: the PR description still shows the old update_weights_bucket_megabytes / cleanup_after_load fields (now update_weights_bucket_memory_ratio / release_after_refit); worth refreshing and surfacing the guide's NIXL-vs-NCCL benchmark table.

Generated by Claude Code

Comment thread nemo_rl/algorithms/grpo.py Outdated
Comment thread nemo_rl/algorithms/grpo.py Outdated
Comment thread nemo_rl/weight_sync/checkpoint_engine_weight_synchronizer.py Outdated
Comment thread nemo_rl/utils/checkpoint_engines/base.py
Comment thread nemo_rl/utils/checkpoint_engines/nixl.py
Comment thread nemo_rl/algorithms/grpo.py Outdated
Comment thread docs/guides/checkpoint-engine-refit.md Outdated
Comment thread docs/index.md
Comment thread docs/about/backends.md Outdated
Comment thread examples/configs/grpo_math_8B_megatron_nixl.yaml Outdated
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
@HollowMan6

Copy link
Copy Markdown
Contributor Author

/ok to test 0916403

Signed-off-by: Hollow Man <hollowman@opensuse.org>
@HollowMan6

Copy link
Copy Markdown
Contributor Author

/ok to test 64c42b6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:L1 Run doctests, unit tests, and functional tests Documentation Improvements or additions to documentation Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants