Commit 6a81fa9
Fix Lion to use decoupled weight decay in the CUDA 32-bit kernel
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>1 parent 5e7ff4e commit 6a81fa9
1 file changed
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
858 | 858 | | |
859 | 859 | | |
860 | 860 | | |
861 | | - | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
862 | 866 | | |
863 | 867 | | |
864 | 868 | | |
| |||
875 | 879 | | |
876 | 880 | | |
877 | 881 | | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
878 | 886 | | |
879 | 887 | | |
880 | 888 | | |
| |||
0 commit comments