Gradient Checkpointing (Activation Recomputation)

Recompute activations during backward to reduce training memory in PyTorch.

Updated Feb 28, 2026
One-click install
npx skills add https://github.com/sovr610/refffiy --skill gradient-checkpointing-activation-recomputation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Gradient Checkpointing (Activation Recomputation)
Source: https://github.com/sovr610/refffiy/tree/main/brain-ai-dev/skills/gradient-checkpointing
Command: npx skills add https://github.com/sovr610/refffiy --skill gradient-checkpointing-activation-recomputation

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

Gradient checkpointing addresses the memory bottleneck during training by enabling selective recomputation of activations, allowing larger models or bigger batches within fixed GPU memory.

Core Features & Use Cases

  • Activation recomputation trades compute for memory to reduce peak activations during backpropagation.
  • Supports multiple strategies (none, full, selective, sequential) and integrates with distributed wrappers like FSDP and DDP.
  • Per-timestep checkpointing for SNN components to further reduce memory in long unrolls.
  • Works with standard transformer-style architectures and hybrid brain-inspired modules.

Quick Start

Use this to reduce training memory by wrapping expensive submodules with CheckpointWrapper or applying SelectiveCheckpointer according to your memory budget.

Frequently Asked Questions about Gradient Checkpointing (Activation Recomputation)

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

FAQPage Schema
How do I reduce PyTorch training memory for large transformer models?

Gradient checkpointing reduces PyTorch training memory by enabling selective recomputation of activations, trading compute for memory to allow larger models or bigger batches within fixed GPU limits.

Does gradient checkpointing work with FSDP and DDP distributed training setups?

Yes, gradient checkpointing integrates directly with FSDP and DDP distributed training wrappers to resolve activation memory bottlenecks across multiple GPUs during large-scale training.

What strategies are available for activation recomputation in PyTorch?

Activation recomputation supports none, full, selective, and sequential checkpointing strategies, letting you wrap expensive submodules with CheckpointWrapper or apply SelectiveCheckpointer according to your memory budget.

When should I use selective recomputation instead of full checkpointing?

Selective recomputation targets specific expensive submodules to balance memory savings and compute overhead, whereas full checkpointing recomputes all activations, making selective ideal for optimizing memory budgets without excessive slowdown.

Can I apply per-timestep checkpointing to SNN components during long unrolls?

Yes, per-timestep checkpointing supports SNN components during long unrolls to further reduce activation memory in hybrid brain-inspired modules and transformer-style architectures.