arXiv:2611.09614cs.LGNov 2026

Manuscript Offprint

arXiv:2611.09614

Know What You Need: Efficient Activation Checkpointing

Danyal Ahmed, Edouard Oyallon

Abstract

Large Language Model training is increasingly constrained by memory capacity. Activation Checkpointing reduces activation memory by avoiding storing selected activations during the forward pass and rematerializing them during backpropagation, thereby trading memory savings for additional computation. Although this technique is essential for scaling model training, rematerialization can be prohibitively expensive, particularly for Transformer linear layers. Approximate computation could reduce this overhead, but conventional approaches either introduce errors that accumulate over the backward pass or fail to exploit information available from the initial forward pass. We introduce a novel approximate rematerialization method that can yield unbiased gradient estimates: using information collected during the initial forward pass, the method selectively recomputes only the most important layer components, either through greedy selection or randomized sketching. Ablation studies show that the resulting gradients closely match the exact gradients. When applied to feed-forward layers, attention layers, or both, our method can recompute only two-thirds of the layer components in a Llama-488M model, while increasing perplexity by just 1.7%, 1.2%, and 2.5%, respectively.

1 Introduction

Large Language Models (LLMs) have progressed largely through scaling, resulting in models with a larger number of parameters that need to process more data in parallel [13, 17]. At the same time, accelerator throughput has improved much faster than memory capacity [48]. This trend has made memory overhead a major bottleneck, particularly during gradient computation: while model states represent a constant fraction of the memory which can be sharded [14, 37, 41, 47], the activation memory also scales with batch size and context length [54]. This makes activations a particularly challenging source of memory pressure during training, since they must be stored during training for computing gradients. Indeed, these gradients are typically computed using reverse-mode automatic differentiation [3, 32] over a computation graph, where operations are represented as nodes of this graph. During the forward pass, intermediate activations are stored and kept in memory until the backward pass, where they are used to compute gradients and are progressively released. Thus, this activation storage can represent a substantial memory overhead and must therefore be carefully managed.

Several strategies have been proposed to reduce this overhead, typically by trading memory savings for additional data movement or computation. One approach is to offload tensors, such as model states [42] or activations [43], from the accelerator to CPU memory. However, this can be inefficient in practice because of the high cost of repeated data transfers between devices. Another approach is to carefully schedule pipeline execution to reduce peak memory usage [25], but such schedules often introduce their own drawbacks, such as communication overhead, known as pipeline bubbles

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

[23], and load imbalance across layers [28], since earlier pipeline stages typically retain activation memory for longer as they are the last to process gradients. A notable example is the V-shaped pipeline schedule used in [12], which improves memory efficiency under specific settings but comes with additional scheduling constraints.

A natural way to avoid storing activations is to recompute them on the fly during the backward pass. For instance, instead of storing activations during the forward pass, invertible architectures [16, 24, 44] use model invertibility to progressively reconstruct them while simultaneously computing gradients during the backward pass, at the cost of additional computation. This idea of reconstructing activations is closely related to Activation Checkpointing (AC) [19], which also recomputes selected parts of the computation graph during the backward pass. Any missing activations required during backpropagation are recomputed on the fly from the latest available checkpoint, enabling gradient computation with lower memory usage at the cost of additional computation, which can cause up to a 33% compute overhead compared to a vanilla backward pass. Consequently, AC trades memory overhead for computation, but its benefits are layer-dependent: selective AC [30] allows one to choose the layers for which this trade-off is favorable. For instance, thanks to its IO-aware implementation, FlashAttention [11] recomputes the attention module during the backward pass, with a negligible overhead: the most important intermediate quantities are rematerialized in the accelerator cache. In contrast, linear layers typically retain matrix-multiplication outputs, since these operations are expensive to rematerialize during backpropagation.

In this work, we challenge the need to fully recompute expensive linear layers to obtain the memory benefits of Full AC. In contrast to existing approaches that approximate both the forward and backward pass or the gradient computation alone [18, 36, 50], we propose an approximation strategy tailored specifically to AC: we approximate the computations performed during rematerialization. Accordingly, the approximation we use stems from the observation that many monolithic computational blocks can be expressed as linear combinations of elementary components, and can therefore be effectively approximated through sketching [53]. Consequently, only a fraction of the activations produced by linear layers need to be rematerialized by AC. Since checkpoints are stored exactly, the approximation is repeatedly reset to reliable intermediate states, preserving unbiased gradient estimates and preventing errors from propagating over long computation chains. We propose KEAP (Know What You Need: Efficient Activation Checkpointing), an approximation method that leverages activation checkpointing by selectively approximating the computations needed during recomputation, thanks to an initial exact forward pass.

Contributions. We make the following contributions. (1) We introduce a novel AC strategy, KEAP, that approximates rematerialization using only information obtained from the full forward pass. (2) We show how to maintain high-quality gradients, either through unbiased estimation or through a greedy approximation scheme. (3) We explain how to apply the method to both FFN and attention layers. (4) We demonstrate numerically, on up to 488M parameter Llama-style models, that KEAP retains the activation-memory benefits of full AC while causing only limited perplexity degradation. (5) We provide ablation studies to better understand the trade-off between AC approximation quality and model accuracy.

Structure of the paper. Sec. 3 introduces the necessary background on AC, while Sec. 3.2 shows how KEAP can recover unbiased gradients, followed by a discussion on the computational benefits in Sec. 3.3. Sec. 4 presents our numerical experiments, followed by ablation studies in Sec. 4.3. Our source code can be found at https://github.com/da462/KEAP.

References (54)