Gradient checkpointing, what does it trade, and roughly by how much?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Gradient checkpointing trades extra compute for activation memory. Typical cost is roughly 30 percent more wall-clock per step in exchange for roughly 60 to 70 percent less activation memory.
Imagine taking a long road trip and writing down detailed notes about every turn so you can retrace your route home. Eventually your notebook fills up. Activation checkpointing is like deciding to write down only the major waypoints (every fifth turn) instead of every single turn. When you need to find your way back, you can drive the small loops between waypoints again to reconstruct the detailed turns you did not write down. You burn extra fuel doing the small re-drives, but your notebook stays small enough to carry. For long sequences during model training, the savings are dramatic: the difference between running out of GPU memory and finishing the job.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: explain the compute-memory tradeoff, walk through the recomputation mechanism, then cover the typical magnitudes and the interactions with FlashAttention and ZeRO-3.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Believing gradient checkpointing saves optimizer state or weight memory. It only reduces activation memory, the third memory term, by recomputing forward activations during backward.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.