NVIDIA-NeMo / NVIDIA-NeMo/Automodel

Adopt composable activation checkpointing once compile + DDP ready

Open
#2,956 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
963
Forks
318
Avg merge
3d 20h
Merged PRs (30d)
143

Description

Summary

Track migration from module-replacing CheckpointWrapper activation checkpointing to PyTorch's type-preserving composable activation-checkpointing API:

from torch.distributed._composable import checkpoint

checkpoint(module)

The composable API installs checkpointing through forward hooks, preserving module identity, concrete type, model structure, and fully-qualified parameter names.

Motivation

PR #2955 fixes AM-370, where replacing block.mlp with CheckpointWrapper broke forward-time isinstance(self.mlp, MLP | MoE) dispatch in GPT-OSS and Qwen3-MoE.

Using the composable API centrally would avoid changing the apparent module type and eliminate this class of wrapper-aware model logic. PyTorch already exercises composable activation checkpointing together with FSDP2, but its compiled-FSDP parity test currently skips the composable variant.

Readiness gates

Adopt the composable API after all of the following are true:

  • PyTorch exposes the API as stable/public, or AutoModel explicitly accepts depending on the private torch.distributed._composable namespace.
  • Composable activation checkpointing is supported and covered with torch.compile + FSDP2; the current upstream compile skip is removed.
  • The AutoModel DDP activation-checkpointing path is validated with the composable API.
  • Full and selective activation checkpointing remain correct with context_fn, RNG preservation, and per-layer compile.
  • Context-parallel attention hooks fire correctly during both forward and recomputation.
  • KV-sharing fallback behavior remains correct.
  • State-dict save/load, DCP, SafeTensors export, and FQN normalization remain compatible.
  • Pipeline-parallel and expert-parallel configurations are covered.

Proposed migration

  1. Migrate the ordinary non-compiled submodule path in apply_submodule_checkpointing().
  2. Migrate the DDP submodule-checkpointing path after parity coverage exists.
  3. Migrate compile/selective-AC paths only after upstream compile support is established.
  4. Remove model-specific _checkpoint_wrapped_module inspection once no supported path replaces those submodules with CheckpointWrapper.

References

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with apply_submodule_checkpointing() and AutoModel PR #2955, then inspect the referenced PyTorch FSDP2 parity test and its compiled-FSDP skip. Trace the ordinary, DDP, compile, and selective-checkpointing paths against the listed readiness gates. Done means the supported paths use the composable API, compatibility coverage passes, and obsolete CheckpointWrapper inspection can be removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems, machine-learning
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.