Skip to content

Release prior vocabulary-head chunk references before the next projection - #929

Merged
bradhilton merged 3 commits into
mainfrom
schulman/release-head-chunk-lifetimes
Sep 21, 2026
Merged

bradhilton merged 3 commits into
mainfrom
schulman/release-head-chunk-lifetimes

Conversation

@bradhilton

@bradhilton bradhilton commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

Vocabulary-head projection keeps the previous chunk's logits in local variables while computing the next checkpoint call. Gathered logits and eager top-k selections can also remain referenced after their last use, extending their lifetimes into the next chunk.

Release those references after their final use. Projection calculations, checkpointing and returned outputs are unchanged; all runtime changes are in art.trainer_rank.

The regression covers target, logits, top-k and mixed outputs with gradients enabled and disabled. It checks reference lifetimes at the next chunk and finite backward gradients, and preserves any pre-existing CUDA initialization state.

Validation: all ten targeted lifetime/output/gradient cases passed. Exact-head CPU CI and the hosted two-H200 validation passed, including Ruff, formatting, types, unit tests and distributed GPU checks. The lifetime cases themselves use CPU tensors, so these results do not establish a CUDA peak-memory reduction. Merged-main CPU CI also passed; native memory qualification remains separate.

Related to #848 and #870.

codex and others added 2 commits September 21, 2026 08:07
Drop unused prior-chunk tensors before the next head-statistics call. Exercise the real two-chunk CPU caller in five output modes and both grad modes with existing head helpers. This change does not add estimator accounting or claim CUDA reclamation.
Apply repository Ruff formatting without changing test AST or production.
@bradhilton
bradhilton had a problem deploying to trainer-rank-gpu-validation September 21, 2026 10:26 — with GitHub Actions Failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants