feat(runtime): compress checkpoint activations to FP8 - #538
Closed
xsuler wants to merge 4 commits into
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--no-fp8-ckpt-activations; activation checkpointing itself still controls whether the path is used--keep-rollout-stateas the explicit opt-outImplementation
The compression hook wraps only the non-reentrant checkpoint call. PyTorch's checkpoint-owned saved-tensor hook continues to handle normal layer intermediates, while the outer hook packs the BF16 checkpoint input into FP8 plus FP32 scales. The packed payload does not retain the original BF16 tensor. Normalized MoE inputs and routing metadata stay outside the compressed boundary path.
On CUDA, FP8 boundary storage follows activation checkpointing and is enabled by default.
--no-fp8-ckpt-activationsretains BF16 boundary tensors. MLX leaves this CUDA-only feature disabled. Completed rollout KV/cache state is released by default on both backends;--keep-rollout-staterestores the previous retention behavior.The default CLI path uses deterministic E4M3 group-128 scaling. Advanced SDK fields allow per-token/group-256 scaling, stochastic rounding, warm-up steps, and explicit fallback layer indices.
Validation
pytest -q tests/test_recompute_cpu.py— 10 passed (including compiled-counter reset regression)pre-commit run --all-files --hook-stage manual— passedCPU tests cover storage reduction, BF16 restoration, exact original-forward output, gradient cosine similarity >= 0.99, RNG isolation, warm-up/fallback behavior, default/opt-out semantics, WebUI command generation, and CLI/runtime propagation.
Full CUDA long-sequence peak-memory, throughput, and three-seed training/evaluation acceptance benchmarks require GPU infrastructure and are not reported by this local change.
Closes #534