Skip to content

Fix Lion decoupled weight decay in the CUDA 32-bit kernel - #3

Merged
eaglstun merged 1 commit into
mainfrom
mps-lion-cuda
Jul 15, 2026
Merged

Fix Lion decoupled weight decay in the CUDA 32-bit kernel#3
eaglstun merged 1 commit into
mainfrom
mps-lion-cuda

Conversation

@eaglstun

Copy link
Copy Markdown
Owner

Consolidates the CUDA 32-bit Lion weight-decay fix into fork main (the default-backend fix and test_lion32bit_weight_decay are already on main; this adds the remaining CUDA kernel piece).

kOptimizer32bit1State folded 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-parametrized test_lion32bit_weight_decay on GPU CI. Fork-internal; not for upstream.

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>
@eaglstun
eaglstun merged commit 9afd664 into main Jul 15, 2026
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.

1 participant