advanced25 min studyLesson 586 in Engineering

Incremental checkpoints and deduplication

Reduce repeated storage only while preserving exact reconstruction, live dependency closure, and safe garbage collection.

On this page

What you’ll understand

  • Distinguish exact changed-block snapshots from approximate or replay-based schemes.
  • Compute retained storage for a base and several incremental generations.
  • Identify shared-object and active-reader constraints on garbage collection.

Incremental checkpointing stores less new data by reusing earlier state or recording changes. It also turns a checkpoint into a dependency graph. A small new manifest can remain dependent on a very large base, and deleting one old-looking object can break many newer generations. Evaluate the complete restoration path and retention rules before celebrating a reduction in bytes written.

Define what a change means for this format

An exact changed-block scheme partitions a serialized logical state into stable regions, writes changed regions, and references unchanged immutable objects. A content-addressed scheme can identify identical encoded bytes, but hashes need a declared algorithm and metadata interpretation. Tensor names, dtype, shape, and region boundaries must remain connected to those bytes. If chunk boundaries change whenever sharding changes, otherwise similar state may deduplicate poorly. Optimizer moments often change densely, so the actual savings depend on the state and workload rather than a universal checkpoint compression ratio.

A gradient log or numerical delta is a different design. Reconstruction may require an ordered base plus records and possibly application computation. Lossy quantization, omitted small updates, or recomputed optimizer state can alter the resumed trajectory unless the recovery contract explicitly allows that approximation. The cited Check-N-Run work studies a particular recommendation-training setting; its workload-specific incremental and quantization results do not establish exact general-purpose recovery for every dense model. Name whether the scheme preserves bytes, logical numerical values, or only an evaluated training-quality criterion.

O(g)=Closure⁡ ⁣(References⁡(g))\mathcal O(g)=\operatorname{Closure}\!\left(\operatorname{References}(g)\right)
O(g) is the full set of immutable stored objects needed to reconstruct generation g, including indirect dependencies. Closure follows the format’s reference graph and has no byte units; it must terminate without missing or incompatible references.↔ Scroll wide equations horizontally.

Count retained dependencies rather than manifest sizes

In a simplified base-plus-delta chain, storage includes the base and every distinct retained delta, plus metadata. A newer generation may reference older unchanged blocks directly rather than require replay of every intermediate generation; another format may require the whole ordered chain. These are different restore costs. Measure read amplification, metadata traversal, reconstruction computation, and failure behavior for the actual representation. Periodic materialized full snapshots can shorten chains at the cost of additional writes and temporarily higher retained storage.

Deduplication also separates logical deletion from physical reclamation. Removing an old generation’s manifest does not authorize deleting all objects it once referenced, because newer generations may share them. Compute reachability from all retained committed manifests, then account for active readers, in-progress writers, and any required recovery grace period. A reference-count update that races publication can lose live data unless updates are transactional or otherwise coordinated. A conservative mark-and-sweep protocol needs a stable root set or an explicit rule for objects created during the sweep.

Sretained=S0+∑i=1mΔi+SmetadataS_{\rm retained}=S_0+\sum_{i=1}^{m}\Delta_i+S_{\rm metadata}
This simplified no-cross-delta-duplication model retains one full base of S_0 bytes and m distinct incremental payloads Delta_i bytes. It excludes replication, temporary compaction copies, compression changes, and other retained bases. Actual reference sharing changes the accounting.↔ Scroll wide equations horizontally.

Do not confuse a cache eviction rule with retention safety

A shared container file can pack live and dead chunks together. Reclaiming the file requires either proving every chunk dead or compacting live chunks into a new immutable container and publishing replacement references safely. Compaction cannot rewrite an object still referenced by a committed manifest in place. Restore leases or another reader-protection mechanism keep a collector from deleting the only source while a long recovery is reading it. Test interruptions during compaction, publication, and collection, including a retry that sees partially completed work.

The cache lab illustrates reuse but deliberately lacks dependency protection. Reset, set both C=4 and s=4, predict four misses and thirteen hits after seventeen requests, then Step once. Separately Reset, set both C=2 and s=4, predict seventeen misses after seventeen requests, then Step once. Each run begins at sixteen requests, and one Step adds one. The four-address cycle fits only the larger LRU cache. Its eviction decisions are not a checkpoint garbage collector: a rarely accessed object can remain indispensable to a retained generation and must not be deleted merely because LRU would evict it.

Retain a base and exact changed chunks

A lossless scheme stores one 100 GiB base and three distinct 10 GiB incremental payloads, each retaining every needed unchanged object by reference. Ignore metadata and replication for this accounting example.

  1. The retained unique payload is 100+10+10+10=130 GiB. Four independent 100 GiB full snapshots would retain 400 GiB under the comparison’s stipulated equal sizes.

  2. The difference is 270 GiB, or 67.5 percent of the 400 GiB full-snapshot baseline. This is the example’s storage result, not a claim about typical optimizer changes.

  3. Deleting the base manifest alone may leave its objects live through newer references. Reclamation must follow the newest retained generations’ full dependency closure; removing the physical 100 GiB base indiscriminately can destroy their restorability.

The result

Incremental storage savings carry a dependency-management obligation. Retention policy applies to reachable objects, not simply to the apparent age of files.

Explore the model

Interactive lab

Interactive lab · cache

Reuse is different from a live recovery dependency

Reset, set both C=4 and s=4, predict four misses and thirteen hits after seventeen requests, then Step once. Separately Reset, set both C=2 and s=4, predict seventeen misses after seventeen requests, then Step once. Reset starts at sixteen requests and one Step adds one; this modulo-16 LRU stream is not checkpoint deduplication or garbage collection.

Reuse is different from a live recovery dependencyA fully associative LRU cache starts empty and requests address (i·s) mod 16. Hits move an address to the newest position; misses evict the oldest when full. Playback starts with 16 requests and adds two per second, capped at 4096 explicitly simulated requests. This toy stream is not a processor-cache benchmark. Current readings: Hits / requests: 0 / 16; Hit rate: 0%; Address-stream period: 16 addresses. All parameters are adjustable with the labeled controls below.Fully associative LRU cache after 16 deterministic requests: 0 hits and 16 misses.Most recent 16 requestsaddress = i × 3 mod 160M3M6M9M12M15M2M5M8M11M14M1M4M7M10M13MCurrent cache order · oldest → newest471013Latest address 13 · miss: inserted as newestToy address stream · period 16 · starts empty
Cached addressMiss / evictionMost recent request
Hits / requests
0 / 16
Hit rate
0%
Address-stream period
16 addresses
t = 0 s

A fully associative LRU cache starts empty and requests address (i·s) mod 16. Hits move an address to the newest position; misses evict the oldest when full. Playback starts with 16 requests and adds two per second, capped at 4096 explicitly simulated requests. This toy stream is not a processor-cache benchmark. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forRecent access frequency cannot decide whether a shared object remains necessary for recovery.

Check your understanding

An old base object has not been read recently but is referenced by a retained committed incremental checkpoint. May an LRU-style collector delete it?

Try it yourself

A shared container holds three chunks of 8 MiB each. Two are unreachable, but one remains required by a retained generation. How much payload is logically dead, and can the whole file be deleted immediately?

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Separate chunk-level liveness from file-level reclamation.

Compare with the solution

Sixteen MiB of payload is logically dead, while eight MiB remains live. The whole container cannot be deleted until the live chunk has been preserved through a safe replacement and reference-publication protocol, and active readers are protected. Physical space recovery may require compaction rather than direct file deletion.

Take it with you

  • State whether incremental reconstruction is exact, approximate, or replay-based.
  • Retained storage and restore cost include the full dependency graph.
  • Coordinate shared-object reclamation with publication, compaction, and readers.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.