Skip to content

contrib: add SOAP optimizer (arXiv:2409.11321)#1692

Open
irhyl wants to merge 3 commits into
google-deepmind:mainfrom
irhyl:contrib/soap-optimizer
Open

contrib: add SOAP optimizer (arXiv:2409.11321)#1692
irhyl wants to merge 3 commits into
google-deepmind:mainfrom
irhyl:contrib/soap-optimizer

Conversation

@irhyl

@irhyl irhyl commented Jun 9, 2026

Copy link
Copy Markdown

SOAP (Improving and Stabilizing Shampoo using Adam) combines Shampoo's Kronecker-factored preconditioning with Adam's per-coordinate adaptivity. For each 2-D weight matrix it maintains left/right Kronecker factors whose eigenbases define a rotation; Adam's moment buffers are tracked in that rotated space and the final update is unprojected back. Parameters with fewer than two dimensions fall back to standard Adam.

New files:
optax/contrib/_soap.py: scale_by_soap and soap implementations
optax/contrib/_soap_test.py : 14 unit tests (shapes, orthogonality, convergence, JIT stability, Adam fallback, weight decay, mu_dtype, frequency control)

Modified files:
optax/contrib/init.py: export soap / scale_by_soap / ScaleBySOAPState
optax/contrib/_common_test.py: add soap to the shared optimizer test matrix and mark precondition_frequency as static

SOAP (Improving and Stabilizing Shampoo using Adam) combines Shampoo's
Kronecker-factored preconditioning with Adam's per-coordinate adaptivity.
For each 2-D weight matrix it maintains left/right Kronecker factors
whose eigenbases define a rotation; Adam's moment buffers are tracked in
that rotated space and the final update is unprojected back.  Parameters
with fewer than two dimensions fall back to standard Adam.

New files:
  optax/contrib/_soap.py        – scale_by_soap and soap implementations
  optax/contrib/_soap_test.py   – 14 unit tests (shapes, orthogonality,
                                   convergence, JIT stability, Adam fallback,
                                   weight decay, mu_dtype, frequency control)

Modified files:
  optax/contrib/__init__.py      – export soap / scale_by_soap / ScaleBySOAPState
  optax/contrib/_common_test.py  – add soap to the shared optimizer test matrix
                                   and mark precondition_frequency as static
@google-cla

google-cla Bot commented Jun 9, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

irhyl added 2 commits June 18, 2026 08:59
Move test_utils and transform imports to file top (C0415), fix dict
iteration to use .items() (C0206), and wrap the 81-char docstring line
in _soap.py (E501).
Change count field type from jax.Array to jax.typing.ArrayLike to match
the established pattern in transform.py (ScaleByAdamState). Add pyrefly
ignore comments for the GradientTransformation and add_decayed_weights
calls, matching the pattern used in alias.py.
@irhyl irhyl force-pushed the contrib/soap-optimizer branch from 99dc5d9 to 7735263 Compare June 25, 2026 04:48
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