cpu-offloading

Offload GPU activations and optimizer states to CPU memory during Megatron Bridge training.

2.8k|332|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/NVIDIA/skills --skill cpu-offloading
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpu-offloading
Source: https://github.com/NVIDIA/skills/tree/main/skills/Megatron-Bridge/perf-techniques/cpu-offloading
Command: npx skills add https://github.com/NVIDIA/skills --skill cpu-offloading

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Reduces GPU memory pressure by moving transformer activations and optimizer states to CPU memory, enabling larger models and more aggressive memory strategies in Megatron Bridge.

Core Features & Use Cases

  • Activation offloading: layer-level offload with per-transformer-layer control, PP constraints, and optional weight offload.
  • Optimizer offloading: fractional offload of Adam states via HybridDeviceOptimizer with overlap between GPU and CPU transfers.
  • Use cases include training/inference of large models with limited GPU memory and scenarios requiring memory-speed tradeoffs.

Quick Start

Enable optimizer CPU offload with a 0.5 fraction to start reducing GPU memory usage while preserving performance.

Frequently Asked Questions about cpu-offloading

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce GPU memory pressure during Megatron Bridge training?

CPU offloading reduces GPU memory pressure during Megatron Bridge training by moving transformer activations and optimizer states to CPU memory. It provides configurable options for both layer-level activations and fractional optimizer state offloading to accommodate larger models.

How do I configure optimizer state offloading to CPU in Megatron Bridge?

Configuring optimizer state offloading in Megatron Bridge involves setting the optimizer.optimizer_cpu_offload key to true. You can control the memory-speed tradeoff by adjusting the optimizer.optimizer_offload_fraction and enabling optimizer.overlap_cpu_optimizer_d2h_h2d for transfer overlap.

Can I offload only a fraction of optimizer states instead of the full model?

Yes, you can offload a fraction of optimizer states using the HybridDeviceOptimizer. By setting the optimizer.optimizer_offload_fraction parameter to a value like 0.5, you partially offload Adam states to CPU, balancing memory savings with training performance.

Does pipeline parallelism affect CPU activation offloading behavior?

Pipeline parallelism affects CPU activation offloading behavior. Megatron Bridge supports PP=1 activation offloading with per-transformer-layer control, while PP>1 configurations utilize optimizer offloading instead to manage memory across pipeline stages.

What is the best way to overlap GPU and CPU data transfers during offloading?

The best way to overlap GPU and CPU data transfers during offloading is to enable the optimizer.overlap_cpu_optimizer_d2h_h2d configuration key, which concurrently executes D2H and H2D transfers alongside GPU compute to preserve training throughput.