Fix Lion decoupled weight decay in the CUDA 32-bit kernel - #3
Merged
Conversation
Mirror of the merged upstream fix (bitsandbytes-foundation#1993): kOptimizer32bit1State folded weight decay into the gradient (coupled L2) for every optimizer including Lion, which corrupts Lion's sign update. Exclude LION from the coupled fold and apply decoupled decay (p *= 1 - lr*wd) in the LION branch, matching the 8-bit kernel and the cpu/default backends. The default backend + test_lion32bit_weight_decay are already on this fork's main; this adds the remaining CUDA kernel piece. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Consolidates the CUDA 32-bit Lion weight-decay fix into fork main (the default-backend fix and
test_lion32bit_weight_decayare already on main; this adds the remaining CUDA kernel piece).kOptimizer32bit1Statefolded weight decay into the gradient for every optimizer including Lion. Excludes LION from the coupled fold and applies decoupled decay (p *= 1 - lr*wd) in the LION branch, matching the 8-bit kernel and the cpu/default backends. Identical to the merged upstream fix (bitsandbytes-foundation#1993). CUDA can't be built/run on Apple Silicon; relies on the device-parametrizedtest_lion32bit_weight_decayon GPU CI. Fork-internal; not for upstream.