Activate recalculation: save less with more forwards

Activates the check point without saving all intermediate results, and recalculates the parts forward in reverse to reduce peaks to activate memory.

• Step by stepCollate in 2 self-measured2 First-hand sources
Start Body
Learning objectives and first steps2 objectives . 1 first fix

Try to do it after reading

  • Explains the activation of recalculation: more forward swap mechanisms and preconditions for less preservation
  • Positioning the mechanism ' s fault limits with fixed examples

Suggested first

  • Compute diagrams and reverse dependence

Issues and mechanisms

Activates the check point without saving all intermediate results, and recalculates the parts forward in reverse to reduce peaks to activate memory. It trades in calculations and storage, not in approximation of the gradient as another algorithm. If you recalculate it with a random, state or input that is different from the original forward, the resulting gradient may no longer correspond to the original function, and semantic equivalents must be verified.

When selecting the boundary of the checkpoint, consideration is given to which quantities need to be saved, recosted and inter-layered. (b) Long sequence activations may be effective when the ratio is higher; The benefits are limited if the memory is mainly occupied by parameters and optimists. Random layers require the processing of random states on the basis of realization, and the forward direction with side effects cannot duplicate logs or update external resources as a result of recosting.

A concrete example

The four-part network saves a single ten-unit activation, and the plains project requires forty units. If only the boundary is preserved and recalculated in reverse, it may be reduced to 20 units, but a number of forward jobs are added. This value is a teaching book, and it is a true occupancy of the retention and calculation of the dependent framework. The check allows a comparison of the output and parameter gradient of the two paths to be recalculated on the short network that closes the randomity and then adds the random layer test.

Borders and checks

It should not be judged correct by the mere fact that training is capable of running, nor should the equipment be kept in its memory as an active measure. Distributed communications, blending accuracy and compilation may change the recosting costs. Performance reports should be simultaneously available to the effective token throughput and peaks, with the same targets and samples maintained; If the batch changes accordingly, an additional check is required to determine whether the gradient is equivalent.

A method of verification

Recalculation correctness tests are best done using a network of pure functions that have no external status, comparing the gradient of all target parameters, and then adding random layers and status layers to each. If the fixed seed is still different, check whether the random state is restored in the same way and not just the original seed. Memory measurements are to be conducted at the same updated boundary with a clear distinction between active and cache retention; An unheated outcome may also be affected by kernel initialization. Validation of correctness and speed in two stages makes it easier to locate problems.

Check understanding

Does recalculating necessarily make training faster?

This is usually added to the calculation and its value is to reduce memory or allow for more efficient configuration; The overall speed depends on bottlenecks and movement control and needs to be measured.

What's the risk of recalculating it with an external writing?

Reversely, this code may be implemented again, resulting in duplicate side effects. It should be kept as pure or distinct as possible, and training cannot be recalculated as an ordinary one-time call.

Sources and reconciliations

Definitions, methods and interfaces are available.

  1. PyTorch — Automatic Mixed Precision
  2. Stanford CS336 — Language Modeling from Scratch, Spring 2025

Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.

← Back to the knowledge directory
Ask Max Ask about this site
Ask Max ↗

Opening the assistant…

Paper figure

Photo comments

LEAVE A NOTE

About this photograph

Connecting to the discussion board…

    Comments become public after moderation. You can delete your own comments from this browser.
    No email is required. Clearing cookies prevents this browser from claiming earlier comments.

    MAX WANG / INDEX

    Find something

    Enter a keyword, or explore the directory below.