Gradient Checkpointing
What Is Gradient Checkpointing?
Gradient checkpointing is a neural network training technique that reduces GPU memory use by saving selected intermediate results, called activations. During backpropagation, it recreates discarded activations when needed, trading memory savings for extra computation. It is also called activation checkpointing.
Each layer creates activations during the forward pass. The backward pass uses them to calculate gradients and update model weights. Saving every activation can require substantial memory in deep models or with larger batches and sequence lengths.
How Gradient Checkpointing Works During Model Training
Instead of retaining every layer output, training saves planned restore points.
- Run the forward pass through the model.
- Save activations at selected checkpoint layers.
- Discard activations between checkpoints to free GPU memory.
- During backpropagation, rerun the needed segment from the nearest saved activation.
- Use recreated activations to calculate gradients and update the model.
Recomputation must match the original forward pass. Random operations such as dropout need consistent random-number handling, or gradients may be incorrect.
Gradient Checkpointing vs. Related Memory Techniques
These techniques address different training-memory needs and can often be combined.
| Technique | Main target | Trade-off | Best use |
|---|---|---|---|
| Gradient checkpointing | Activations | More computation | Deep or long-context models |
| Model checkpoints | Training recovery | Storage and save time | Resuming after interruption |
| Gradient accumulation | Batch memory | More training steps | Simulating a larger batch |
| Mixed precision | Many tensors | Numerical care | Modern GPU training |
| Activation offloading | GPU activations | Data-transfer delay | GPU memory is tight |
| Distributed training | Model and state memory | More infrastructure | Very large workloads |
Benefits of Gradient Checkpointing
Benefits depend on the model architecture and checkpoint placement.
- Lowers peak activation memory on the same GPU.
- Can make larger models, longer inputs, or larger batches practical.
- Works with mixed precision, efficient attention, and accumulation.
- Lets teams test configurations before moving to larger hardware.
Limits and Performance Trade-Offs
Checkpointing saves memory, not time or cost.
- Repeated forward computations slow training.
- Extra GPU work can increase energy and compute cost.
- It helps less when weights or optimizer states dominate memory.
- Random layers and custom operations can complicate debugging and reproducibility.
When Should You Enable Gradient Checkpointing?
Use it when activation memory is the constraint, not as a default for every run.
- Enable it after an out-of-memory error during large-model or long-context training.
- Consider it for fine-tuning language models on a constrained single GPU.
- First test mixed precision, a smaller batch, and efficient attention where available.
- Combine methods when those changes still do not fit the workload in memory.
Using Gradient Checkpointing in AI Application Development
Teams may encounter gradient checkpointing when fine-tuning a custom model or running evaluation workflows. It is one infrastructure choice behind an application, alongside the product work covered in app design and development. Emergent is an agentic platform for building, testing, and shipping AI-powered full-stack applications, including projects created with its AI web app builder. The right configuration depends on the model, data, hardware, and reliability requirements.
on Emergent today

