Use HybridAdam for Gemini CPU optimizer offload - #6435
Open
sdjasj wants to merge 1 commit into
Open
Conversation
sdjasj
marked this pull request as ready for review
August 1, 2026 12:03
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.
What changed
FusedAdamwithHybridAdamin that case while preserving the original parameter groups and their hyperparametersoffload_optim_frac=1.0andmin_chunk_size_m=2settingsWhy
FusedAdamonly has a CUDA update kernel, but Gemini listed it as supported even when static placement moved master shards, gradients, and optimizer state to CPU. Small chunk sizes make those shards eligible for offload, and the fused CUDA kernel then failed withexpected input to be on cuda.HybridAdamdispatches each update to the CPU or CUDA implementation according to the parameter device and is the compatible implementation for mixed Gemini placement.Impact
Users can keep constructing
FusedAdamwhile using Gemini optimizer offload; Gemini selectsHybridAdamonly when CPU shards are actually present.Fixes #6388.
Validation
python -m pytest tests/test_zero/test_gemini/test_fused_adam_offload.py -q(2 GPUs; 1 passed)compileallandgit diff --check: passed