Back to Skills

nemo-mbridge-perf-cpu-offloading

Validate and use CPU offloading in Megatron Bridge, including layer-level activation offloading and fractional optimizer state offloading with HybridDeviceOptimizer.

2,741stars319forksUpdated 7/31/2026

Security Assessment

Safe(95/100)
Security Score95/100

About nemo-mbridge-perf-cpu-offloading

CPU Offloading is an NVIDIA instruction skill covering how to validate and use CPU offloading in Megatron Bridge to relieve GPU memory pressure during training. It addresses two independent mechanisms: layer-level activation offloading (moving per-transformer-layer activations, and optionally weights, from GPU to CPU) and fractional optimizer-state offloading (moving Adam momentum and variance to CPU via HybridDeviceOptimizer). It also helps investigate commits that changed offloading config and caused OOM or crashes.

The skill provides a quick-decision matrix mapping situations to recommendations — for example, optimizer offloading for large MoE models needing pipeline parallelism greater than 1 (since activation offloading requires PP=1), activation offloading for small/medium models where activation memory dominates, and a tunable optimizer_offload_fraction for a memory-speed tradeoff. It gives exact Python and CLI enablement for both mechanisms, a full config-parameter reference with defaults, and detailed compatibility constraints (activation offloading requires PP=1, recompute_granularity=None, and no CUDA graphs; optimizer offloading requires the distributed optimizer but has no PP/recompute/CUDA-graph restrictions). It includes a minimal runnable command for a Qwen3-30B-A3B pretrain config and a practical note that activation offloading is blocked for large MoE models because the PP=1 constraint makes weights plus optimizer states exceed H100 80 GB.

The intended users are ML performance engineers tuning Megatron Bridge / NeMo training to fit memory budgets and those debugging offloading-related OOM or crashes. This is commercial/non-commercial-ready reference documentation with configuration examples and read-only training commands, with no destructive or exfiltration behavior.

FAQ

What are the two offloading mechanisms?

Activation offloading (model.cpu_offloading*) moves per-layer activations and optionally weights to CPU, and optimizer offloading (optimizer.optimizer_cpu_offload) moves Adam optimizer states to CPU via HybridDeviceOptimizer.

Which should I use for a large MoE model?

Optimizer offloading, because activation offloading requires pipeline parallelism of 1, which is usually infeasible for large MoE models — the skill notes activation offloading is blocked for models like Qwen3-30B-A3B.

What are the compatibility constraints for activation offloading?

It requires pipeline_model_parallel_size=1, recompute_granularity=None, cannot combine with fine_grained_activation_offloading or CUDA graphs, and cpu_offloading_num_layers must be within [0, num_layers-1).

Can I tune the memory-speed tradeoff?

Yes. Optimizer offloading supports a fractional optimizer_offload_fraction from 0.0 to 1.0; the skill suggests roughly 25-50% for best efficiency under moderate memory pressure.

Does offloading affect throughput?

Yes — offloading always adds overhead, so the skill advises not enabling it when throughput is the top priority and memory fits without it.

All Files

6 files
BENCHMARK.md4.2 KB
View
skill.oms.sig4.7 KB
View
card.yaml8.0 KB
View
skill-card.md3.8 KB
View
evals/evals.json1.4 KB
View
SKILL.md9.1 KB
View

Install nemo-mbridge-perf-cpu-offloading

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill

Repository

nvidia/skills