Skip to content

M4 · 12 h · skeleton

Step caching

On the published RTX 5090 ablation, cache — not the kernel pass — is where the large factor appears. It is also where quality quietly dies.

Prerequisite
Module 3. You understand a denoising loop.
VRAM
Same as the model you cache. The cache itself is a residual, not a second copy of the weights.
Runtime
A sweep of thresholds is an afternoon.

What you must be able to show

  1. 01

    At a threshold of zero, match the uncached loop within a tolerance you wrote down first.

  2. 02

    Plot skip rate and error against step, then across a segment boundary with the cache cleared and with it kept.

  3. 03

    Ship one threshold as a point on that curve, plus the rule that makes you refuse to skip.

Insights

A skip is only a skip if the decision is cheaper than the step. TeaCache’s probe is the timestep embedding’s residual. First Block Cache’s probe is the relative change of the first block. Both are bets that a small probe means the rest of the network barely moved. Verify the bet on your model. Do not import the threshold.

The teaching model in public/programme/modules/04-cache/error_horizon.py is not a DiT. Signal is U-shaped: high at the first and last step, low in the middle. A skip adds a fixed drift. A dense step, a forced refresh, or a segment reset sets the running error back to zero. The unit test checks four facts you should be able to say out loud: threshold 0 never drifts; an aggressive threshold drifts every step; a forced refresh bounds the run of skips; a reset at a boundary beats carrying the error across.

SIMULATED — error_horizon.trace
def signal(t, steps):
    # 1 at both ends, 0 in the middle
    return abs((t / (steps - 1)) - 0.5) * 2

# dense if threshold <= 0, or signal >= threshold,
# or t hits force_every, or t is a segment reset.
# else error += drift
  • Acceptance: threshold 0 matches the uncached loop within a tolerance you wrote down before looking.
  • Acceptance: the segment-cut test fails if the cache is reused and passes if it is cleared. Score the concatenation.
  • Acceptance: the shipped threshold is one marked point on a curve of skip rate versus error.
  • Use a relative delta. An absolute L2 tracks the scale of the activation and will look like ‘the cache stopped working’ halfway through a clip.

Wrong conclusion. ‘Reuse rate is 70%, close to the 67% in the H100 write-up, so the method matches.’ Reuse rate is not quality, and their 67.35% is one claimed run on MiniMax-H3. Your percentage on a toy is a different fact.

SIMULATED drill. python -m unittest discover -s public/programme/modules/04-cache -p 'test_*.py'. The in-browser drill is the same idea. Neither is FBCache on H3.