Skip to content

contrib: add SCION optimizer (norm-constrained LMO generalisation of Muon) - #1718

Open
irhyl wants to merge 4 commits into
google-deepmind:mainfrom
irhyl:contrib/scion
Open

contrib: add SCION optimizer (norm-constrained LMO generalisation of Muon)#1718
irhyl wants to merge 4 commits into
google-deepmind:mainfrom
irhyl:contrib/scion

Conversation

@irhyl

@irhyl irhyl commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds scion and scale_by_scion to optax.contrib, implementing the SCION optimizer from Pethick et al. (arXiv:2502.07529, LIONS-EPFL).

SCION is a direct generalisation of Muon: instead of always applying the spectral-norm LMO (the polar factor, via Newton-Schulz), it makes the choice of norm ball explicit and applies the corresponding linear minimization oracle (LMO) per parameter:

lmo Direction Geometry
'spectral' polar factor UV^T nuclear norm ball (same as Muon)
'sign' sign(G) element-wise L-inf norm ball (same as Lion)
'frobenius' G / ‖G‖_F Frobenius norm ball

With lmo='auto' (the default), routing is by parameter rank using combine.partition: ndim >= 2 → spectral, ndim == 1 → sign. This mirrors how muon() routes 1D params to Adam, but stays within a single principled framework.

Connection to previous work

This builds directly on #1717 (Gram Newton-Schulz + Polar Express coefficients for Muon). The spectral path in scale_by_scion goes through orthogonalize_via_newton_schulz with the same gram, ns_coeffs, and preconditioning options, so SCION with lmo='spectral' is a strict superset of Muon for matrix-shaped parameters. The ns_coeffs='polar_express' preset from that PR works out of the box here.

Changes

  • optax/contrib/_muon.py: _apply_lmo, ScaleByScionsState, scale_by_scion, scion
  • optax/contrib/__init__.py: export all three new public names
  • optax/contrib/_muon_test.py: 6 new tests (spectral/sign/frobenius paths, auto routing, preset string, agreement with muon)

References

irhyl added 4 commits June 28, 2026 00:20
Gram Newton-Schulz (GramNS) avoids recomputing XX^T at every iteration
by maintaining the Gram matrix R = XX^T and an accumulated orthogonal
transform Q, both in n x n space. This cuts per-step cost from O(nm^2)
to O(n^3) when the matrix aspect ratio is large.

Key changes:
- Add _POLAR_EXPRESS_NS_COEFFS (Amsel et al., 2505.16932) and a
  'polar_express' entry in _NS_COEFFS_PRESET_DICT.
- Add gram=False parameter to orthogonalize_via_newton_schulz,
  scale_by_muon, and muon. When gram=True the Gram NS path runs
  instead of the standard Newton-Schulz loop; the restart at step 2
  materialises Q back into X to keep the Gram matrix condition number
  bounded (Amsel et al., 2025).
- Support both scalar (fori_loop) and per-step (scan) coefficient
  formats in the Gram path, mirroring the existing NS structure.
- Add four parameterised tests covering wide/tall/square matrices,
  preset resolution, end-to-end muon integration, and consistency
  between gram=True and gram=False with the same coefficients.
…Muon)

Implements scale_by_scion and scion from Pethick et al. (arXiv:2502.07529).
SCION selects update directions via a linear minimization oracle over a norm
ball, unifying Muon (spectral LMO / polar factor) with sign updates (Lion,
l-inf norm) and normalised-gradient descent (Frobenius norm).

With lmo='auto', parameters with ndim >= 2 are routed to the spectral LMO
via Newton-Schulz and 1D parameters use the sign LMO, using combine.partition
in the same pattern established by the Muon implementation.

The spectral path is fully compatible with the gram=True Gram Newton-Schulz
option and the polar_express / dion coefficient presets added in the GramMuon
PR, making scion a strict superset of muon for matrix-shaped parameters.
@irhyl

irhyl commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Hi all, just following up on this PR. I believe it's ready for review, but please let me know if there's anything else I should address. Thanks for your time!

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