Core mechanism
A checkpoint plan partitions the tape into retained boundaries and recomputed segments. The plan controls peak memory while adding predictable replay work.
Inspect the real tape generated for an Asian option. This browser CPU path retains forward values and adjoints; Java also describes checkpointing as a memory versus recomputation tradeoff without presenting an unmeasured memory saving.
The tape node count is measured from the Java Monte Carlo product. Memory figures are storage estimates from 8-byte values and adjoints per node.
This exact source runs in TeaVM. Form changes update its Java literals and reset manual edits.
import com.nablatensor.quant.EquityMarket;
import com.nablatensor.quant.MonteCarlo;
import com.nablatensor.quant.Products;
public final class ForgetThenRememberRiskStudio {
private ForgetThenRememberRiskStudio() {}
public static void main(String[] args) {
EquityMarket market = EquityMarket.of()
.spot(100.0)
.strike(100.0)
.vol(0.20)
.rate(0.03)
.maturity(1.0)
.build();
int steps = 252;
try (MonteCarlo<EquityMarket> mc = MonteCarlo.of(Products.asianCall())
.market(market)
.steps(steps)
.fp64()
.greeks()
.on("cpu")
.build()) {
long valueBytes = (long) mc.nodes() * 8L, adjointBytes = (long) mc.nodes() * 8L;
System.out.println("RESULT|" + steps + "|" + mc.nodes() + "|" + valueBytes + "|" + adjointBytes);
}
}
}
Long reverse-mode calculations need forward intermediates; checkpointing deliberately discards some and regenerates them only when the reverse pass reaches them.
A checkpoint plan partitions the tape into retained boundaries and recomputed segments. The plan controls peak memory while adding predictable replay work.
Measure tape size and available memory, benchmark checkpoint levels on representative workloads, and choose a plan that protects operational headroom rather than only the fastest benchmark result.
Checkpointing changes resource use, not financial output. Numerical parity and operational failure handling still need testing on each backend.