arXiv:2611.00590cs.AIOct 2026

Manuscript Offprint

arXiv:2611.00590

State-Aware Activation Recomputation with Replay Contracts and Selective Preservation

Annan Zhang, Shengjie Song, Wenshuai Yao, Lihao Zhang, Tianmiao

ABSTRACT

Activation recomputation saves accelerator memory by replaying forward segments during the backward pass, but replay is only correct if it sees the state the original forward pass saw. Mutable buffers, aliased bytes and random-generator state can change in between, so re-executing unchanged code can differentiate a different computation. We make this state explicit. A versioned replay contract specifies what replay must restore, and a joint planner chooses, per segment, between activation retention, whole-buffer snapshots and selective-region preservation, charging each option its measured memory and recovery cost. Independent derivative and byte-level checks validate the contract, and a Torch/JAX cohort retains all 5,900 execution records, including matches, rejections and divergences. On frozen sparse-write H100 workloads, each measured over fifty fresh processes, joint planning reduces paired step time by 18.16% against a correctly costed eager/whole planner at a 44 GiB budget (approximate 97.5% ratio interval [.8172, .8195]). At 32 GiB, where the eager/whole planner has no feasible static policy, joint planning is 4.98% faster than fixed regions at 29.94 rather than 26.20 GiB. A complete CIFAR-100 dense-queue application runs seven methods for 100 encoder and 25 probe epochs at six training seeds, with byte-identical test scores within each seed. There, joint planning uses 22.41% more allocated memory than whole snapshots, with a process-time geometric-mean ratio of 1.0080 (seed range [.9845, 1.0191]). Together, the results map where selective preservation pays off: sparse writes with large activations benefit, while in the dense-queue workload whole snapshots use less allocated memory.

1 INTRODUCTION

Activation recomputation lets training fit in limited accelerator memory by discarding activations and replaying forward segments during the backward pass. Replay is only correct if it reproduces the execution whose gradient is required. Mutable buffers can change before replay, aliases can expose the same bytes through different indices, and random draws can be absent from a tensor dependency graph. Re-executing unchanged code can therefore differentiate a different computation.

Correctness and memory planning are therefore coupled. Whole-state snapshots make replay valid but are costly. Selective preservation reduces that cost when writes are sparse, and a planner that ignores historical-state memory and recovery can exceed its own budget. We specify a versioned replay contract, implement declared-state preservation, and plan activation and state retention jointly from measured profile cards. Finite-program derivatives and byte traces test the contract, and a Torch/JAX study retains all 5,900

matches, rejections and divergences.

The evaluation identifies the regime in which joint planning pays off. In the original 24-shape calibration and a completed 150-process, three-workload cohort, eager retention is already both faster and smaller. In separate fifty-process sparse-write cohorts, joint planning is 18.16% faster than a correctly costed eager/whole planner at 44 GiB. At 32 GiB, it selects a policy that the eager/whole planner cannot fit, trading speed against memory relative to fixed regions. Budgets are logical rather than enforced, so allocation above a budget is not a device out-of-memory event.

Figure 1 summarizes the headline measurement. Our contributions are:

  • A versioned replay contract that identifies values by their producing write and requires replay to reproduce both storage bytes and random-generator state (Section 3).
  • Declared-state preservation engines, including selective region journals that cover the union of current and later destroying writes (Section 3).
  • A joint planner that charges activation retention, temporary workspace and preservation/recovery cost in one static model, with untruncated Pareto frontiers (Sec-

¹Peking University ²Beihang University. Correspondence to: Annan Zhang annan@pku.edu.cn.

Preliminary work. Under review by the Machine Learning and Systems (MLSys) Conference. Do not distribute.

Figure

Figure 1. Headline result. On the frozen sparse-write H100 workload with a 44 GiB logical budget, joint activation/state planning reduces mean step time by 18.16% relative to a correctly costed planner restricted to eager retention and whole snapshots (approximate 97.5% ratio interval [.8172, .8195], 50 independent processes). Hatched bars exceed the logical budget. Labels give mean step time and peak allocation.

tion 4).

  • Executed evidence at several scales: 1,024-program derivative and byte suites, a 5,900-record Torch/JAX cohort, and fifty-process H100 sparse-write cohorts showing an 18.16% step-time reduction at 44 GiB and a 4.98% speedup over fixed regions at 32 GiB.

  • A six-seed CIFAR-100 dense-queue application in which all seven methods produce byte-identical test scores within each seed, which locates the boundary of the sparse-write benefit.

In the application, all seven methods train for 100 encoder and 25 probe epochs at six independent training seeds. Full-process observation at five seeds shows that whole snapshots use less allocated memory at every seed, while the encoder-time ordering reverses at one seed. The sparse-write benefit and the dense-queue resource tradeoff together define where each preservation strategy should be chosen.