Repository navigation
[LLM] slime example: offload optimizer state to host RAM by default - #10269
Merged
ishankaul1 merged 1 commit intoJul 29, 2026
Merged
Conversation
Long multi-turn RL rollouts can spike the trainer's activation memory past what a 4-GPU (TP4) 14B trainer has left once optimizer state (Adam moments + fp32 master weights, ~12 of ~16 bytes/param) sits on-device — runs fail with CUDA OOMs a few GiB short after several steps, depending on how long a batch's trajectories happen to be. Moving optimizer state to pinned host RAM (--optimizer-cpu-offload + overlap/precision-aware companions, the same trio slime's own large-model scripts use) roughly halves per-GPU static memory (measured: ~56 GB -> ~22 GB at 14B TP4) and keeps long runs comfortably inside the memory ceiling on the same 4 GPUs. Adds a matching memory: 256+ request on the trainer task (the offloaded states live on the host) and an OPTIMIZER_OFFLOAD=0 escape hatch to keep optimizer state on-GPU. Validated with a 50-step training run on the full SWE-smith dataset (plus a matched no-offload baseline at TP8). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
ishankaul1
marked this pull request as ready for review
July 29, 2026 20:16
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
MadhavJivrajani
approved these changes
Jul 29, 2026
kevinmingtarja
approved these changes
Jul 29, 2026
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.
Problem
Long multi-turn RL rollouts can spike the trainer's activation memory past what a 4-GPU (TP4) 14B trainer has left once optimizer state sits on-device. The trainer's per-GPU statics are ~16 bytes/param (bf16 weights + fp32 grads + fp32 master weights + Adam moments) ≈ 56 GB at 14B/TP4 on an 80 GB H100 — leaving only a few GB of headroom. Long trajectories can produce a single packed sample tens of thousands of tokens long, whose fp32
[T, vocab/TP]log-prob computation transiently needs several contiguous GiB; runs then fail with CUDA OOMs a few GiB short after several steps, depending on how long a batch's trajectories happen to be:Fix
Offload optimizer state (Adam moments + fp32 master weights, ~12 of the ~16 bytes/param) to pinned host RAM — the same flag trio slime's own large-model scripts use:
--optimizer-cpu-offload --overlap-cpu-optimizer-d2h-h2d --use-precision-aware-optimizeron by default inrun-slime.sh(OPTIMIZER_OFFLOAD=0opts out)memory: 256+on the trainer task (the offloaded states live on the host)Measured effect at 14B/TP4: per-GPU statics drop ~56 GB → ~22 GB, so the transient spike lands in ~38 GB of slack instead of ~4. Optimizer-step overhead is hidden behind rollout time for this workload (the D2H/H2D transfers overlap with compute).
Tested
🤖 Generated with Claude Code