perf(checkpoint): load standard HF safetensors with DCP - #3616
Draft
yuhezhang-ai wants to merge 3 commits into
Draft
perf(checkpoint): load standard HF safetensors with DCP#3616yuhezhang-ai wants to merge 3 commits into
yuhezhang-ai wants to merge 3 commits into
Conversation
Signed-off-by: Yuhe Zhang <yuhez@nvidia.com>
yuhezhang-ai
force-pushed
the
yuhez/perf/standard-hf-dcp-load
branch
from
August 21, 2026 18:33
4d5d387 to
7de2cc7
Compare
Signed-off-by: Yuhe Zhang <yuhez@nvidia.com>
Signed-off-by: Yuhe Zhang <yuhez@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
DCP reads checkpoint tensors into model-owned weight storage. It avoids first building the complete checkpoint as a CPU dictionary and then installing that complete state into the model. This is ordinary DCP loading, not grouped streaming.
What still uses full CPU loading
This table describes base-checkpoint initialization after this PR:
.bincheckpointThe two custom-adapter fallbacks are specific to one GPU. Distributed custom-model loading already uses DCP, because each rank transforms only its local checkpoint shard.
The remaining full-CPU routes at every world size are legacy
.binloading, standard-HF dequantization, and the legacy generic Transformers MoE conversion. I did not find a checked-in recipe that exercises the standard-HF dequantization row: current recipes that request checkpoint dequantization use registered custom models and adapters instead. The final MoE row covers older model families; Mixtral is deprecated for 26.10, and the Qwen1.5 MoE recipe uses the separate Transformers/BitsAndBytes path. We may leave this compatibility fallback unchanged unless a current workload needs it.Stack and scope
This PR is stacked on #3610. #3610 defines and validates the low-memory contract for custom MoE adapters. This PR covers ordinary HF/external models and the dense Llama, Qwen2, and Qwen3 passthrough adapters.
Performance
Measured HF-model speedup
Falcon H1 7B is the ordinary HF/external-model example for this PR. It uses the Transformers implementation and has no custom NeMo adapter. Before this change, every rank read the complete checkpoint into CPU memory. With this change, DCP reads the tensors needed by each rank directly into model weights.
The same 14.13 GB checkpoint and recipe were measured twice before and twice with this change:
The mean checkpoint-load time is 9.04x faster, an 88.9% reduction. On the two DCP runs, destination setup was 0.06 s and final installation was 0.10 s; nearly all remaining time was the storage read.
Baseline jobs: 402367452, 402371059. Treatment jobs: 406906717, 406918235.
The stock 50-step Falcon recipe reproduced its existing step-12 3.13 GiB OOM after loading and training correctly. The established one-step form passed with finite step-0 loss 26.0887, gradient norm 225.1654, and validation loss 11.6139.
Llama, Qwen2, and Qwen3 coverage
The scoped jobs measured these DCP checkpoint loads:
These distributed jobs are correctness coverage, not additional speedup measurements: distributed custom adapters already used DCP before this PR. This PR changes the one-GPU route for these three adapters. The August 15 release jobs also predate the checkpoint-only timer, so their logs do not provide a comparable baseline load duration. No speedup ratio is claimed for these small models.
This CI did not measure controlled peak host RSS, so no numerical memory reduction is claimed.
Correctness and coverage
Exact-SHA scoped CI covered the affected paths:
Pipelines: full matrix, green Falcon rerun, August 15 release pipeline.
The GPU jobs ran on the routing implementation before the final code-only passthrough-base cleanup. That cleanup only moved the identical identity methods from three adapters into one shared base. On the current head: