advanced25 min studyLesson 590 in Engineering

Checkpoint corruption and restore drills

Detect broken payloads, validate trusted provenance, and prove recovery with staged structural and next-update oracles.

On this page

What you’ll understand

  • Separate checksum integrity from authenticity and semantic correctness.
  • Design restore oracles beyond successful deserialization.
  • Measure recovery stages and test known failure cases without inferring universal safety from a small sample.

A checkpoint strategy is proven by successful, checked restoration rather than by a save log. Recovery can fail because payload is truncated, metadata is missing, dependencies were collected, credentials expired, a format changed, or the restored data means something different from what the program expects. A useful drill exercises both storage and computation, with explicit oracles and measured time to an actually usable training state.

Integrity and authenticity answer different questions

For immutable payload objects, record a cryptographic digest with the algorithm and exact byte scope in a trusted manifest. On restore, verify lengths and recomputed digests before treating those bytes as the expected representation. A checksum mismatch can detect altered or corrupted payload, while a matching checksum does not prove correct tensor placement, a consistent logical cut, or the intended next batch. Shared containers need a defined whole-object or chunk-level verification policy so a partial range read does not pretend to validate bytes it never checked.

A malicious party able to replace both payload and its unauthenticated checksum can produce a self-consistent replacement. Authenticity requires an appropriate trust mechanism, such as authenticated storage access and a signed or keyed-authenticated manifest whose identity and policy are verified. NIST’s secure hash and HMAC standards describe different primitives; a plain hash has no secret or signer identity. Also respect the deserializer’s trust boundary. Do not load arbitrary executable object formats just to discover whether an untrusted checkpoint was well formed.

SHA256⁡(bytes⁡(oj))=hj\operatorname{SHA256}(\operatorname{bytes}(o_j))=h_j
o_j is one immutable object and h_j its expected 256-bit digest under a declared exact encoding and byte scope. Equality checks integrity relative to that expectation; it does not authenticate who supplied h_j or prove the bytes represent valid training state.↔ Scroll wide equations horizontally.

Build several independent restoration oracles

Begin with the committed manifest, dependency closure, schema compatibility, tensor coverage, lengths, and digests. Then verify logical tensor identities, dtype, shape, aliases, optimizer associations, step counters, and data progress. A strict loader should reject missing required keys instead of silently initializing them. Memory allocation can fail before useful restore progress even when final tensors fit, so test peak staging and conversion requirements. Reconstruct into an isolated recovery job and keep the original immutable artifact available for diagnosis.

Next run a controlled continuation test against a trusted uninterrupted reference. Compare the next sample or token identities, loss inputs, successful-update decisions, scheduler values, optimizer states, and parameter update. Numerical closeness and bitwise equality are different oracles; choose each only where its assumptions hold. A finite loss value is weak evidence because missing moments or repeated data can still yield plausible numbers. When exact next-step comparison is unavailable, record the weaker statistical or behavioral evidence honestly rather than upgrading it to proof of faithful continuation.

E∞=max⁡i∣θirestored−θireference∣max⁡(1,∣θireference∣)E_{\infty}=\max_i\frac{|\theta^{\rm restored}_i-\theta^{\rm reference}_i|}{\max(1,|\theta^{\rm reference}_i|)}
This example uses dimensionless parameter components and a fixed reference scale of one, producing a dimensionless mixed absolute/relative error. A threshold must be justified for the tested operation and precision. Passing it does not validate cursors, optimizer state, or later trajectory equality.↔ Scroll wide equations horizontally.

Inject failures and time the entire usable recovery

A drill matrix should include missing and truncated objects, wrong-generation metadata, modified manifests, unavailable shared dependencies, unsupported versions, interrupted staging, and changed worker counts when supported. Include an intentionally corrupted case that must be rejected; a drill that only exercises the happy path cannot demonstrate detection. Measure allocation, download, validation, resharding, state application, input recovery, and first validated update. Time to deserialization completion is not time to usable training, and overlapping stages require a measured critical path rather than blindly adding independent timers.

The probability instrument illustrates limits of sampled coverage. Reset, set both p=0.1 and n=20, predict two hits on average and zero-hit probability 0.9²⁰, then Play or Step. Separately Reset, set both p=0.1 and n=30, predict three hits on average and zero-hit probability 0.9³⁰, then Play or Step. Here a hit represents an independently sampled stipulated bad case, not a checksum collision. The exact binomial display performs no restore or random fault injection, and unknown or correlated incident types do not satisfy its assumed common probability.

A numerical oracle can pass while recovery still fails

A reference parameter vector is (1, −2, 0.5); restored values are (1.000001, −2.000002, 0.500003). Use the displayed mixed error and a threshold of 5×10⁻⁶. A separate cursor check expects next sample 1000 but observes 1100.

  1. The component absolute differences are approximately 10⁻⁶, 2×10⁻⁶, and 3×10⁻⁶. Divide by reference scales 1, 2, and 1, respectively.

  2. The normalized differences are approximately 10⁻⁶, 10⁻⁶, and 3×10⁻⁶, so E∞≈3×10⁻⁶ passes the stipulated 5×10⁻⁶ numerical threshold.

  3. The cursor is still wrong by one hundred sample identities under the stated ordered-input contract. The overall restore must fail its faithful-continuation oracle despite passing this parameter comparison; one metric does not subsume independent state requirements.

The result

Use multiple oracles whose scopes are explicit. A plausible tensor or loss check cannot excuse missing data, optimizer history, provenance, or required structural state.

Explore the model

Interactive lab

Interactive lab · probability

Repeated checks can still miss a stipulated bad case

Reset, set both p=0.1 and n=20, predict mean two and zero-hit probability 0.9²⁰≈0.12158, then Play or Step. Separately Reset, set both p=0.1 and n=30, predict mean three and zero-hit probability 0.9³⁰≈0.04239, then Play or Step. These exact iid binomial bars are not actual fault injection, checksum collision rates, or a recovery certificate.

Repeated checks can still miss a stipulated bad caseThese are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Current readings: Mean · np: 5; Variance · np(1−p): 2.5; Total probability: 1. All parameters are adjustable with the labeled controls below.03581000.070.150.220.3Successes kP(X = k)k = 0 · P = 9.77e-4
Exact probabilityHighlighted outcomeMean np
Mean · np
5
Variance · np(1−p)
2.5
Total probability
1
t = 0 s

These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. 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 forDeliberate adversarial cases and independent state oracles complement sampled drill coverage.

Check your understanding

An attacker replaces a checkpoint payload and its unauthenticated SHA-256 value together. What does a successful recomputation establish?

Try it yourself

A restore takes twelve seconds for allocation, forty for sequential download, eight for validation, and ten to reach the first validated update. Under these stipulated nonoverlapping stages, what is usable recovery time? Why would timing only download understate it?

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

Give me a hint

The recovery endpoint is usable checked computation, not completion of one I/O phase.

Compare with the solution

The stipulated total is 12+40+8+10=70 seconds. Reporting only forty seconds omits thirty seconds of necessary work before training is usable and checked. In a real implementation stages can overlap, so measure the end-to-end critical path and also preserve stage timing to identify the limiting work.

Take it with you

  • Verify integrity against trusted expectations and authenticate provenance separately.
  • Check structure, logical state, input progress, and the next update with independent oracles.
  • Rehearse rejected corruptions and measure time to usable validated training.

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.