Skip to content

Commit ec009fe

Browse files
authored
[Feature] Implement SpectralSphere optimizer (#485)
* build(deps): update * docs: README * docs: v3.10.0 changelog * feature: SpectralSphere optimizer * chore: update-deps recipe * update: codes * build(ci): update pyright version to 1.1.408 * build(deps): update the deps * refactor: remove unused params * refactor: type stuff * update: codes * docs: update documentation * update: codes * docs: update index.md * fix: typo * update: codes * update: recipe * docs: docstring * refactor: remove unused codes * update: recipe * docs: docstring * update: codes * update: codes * update: codes * update: codes --------- Co-authored-by: kozistr <15344796+kozistr@users.noreply.github.com>
1 parent bd612f7 commit ec009fe

File tree

16 files changed

+812
-301
lines changed

16 files changed

+812
-301
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151

5252
- uses: jakebailey/pyright-action@v2
5353
with:
54-
version: 1.1.407
54+
version: 1.1.408
5555

5656
test:
5757
runs-on: ubuntu-latest

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: format lint test check requirements visualize docs update-docs
1+
.PHONY: format lint test check requirements visualize docs update-docs update-deps
22

33
FILES := pytorch_optimizer examples tests scripts hubconf.py
44
BLACK_FLAGS := -S -l 119
@@ -29,3 +29,6 @@ docs:
2929

3030
update-docs:
3131
python scripts/update_docs.py
32+
33+
update-deps:
34+
uv sync --upgrade

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ get_supported_optimizers(['adam*', 'ranger*'])
226226
| BCOS | *Stochastic Approximation with Block Coordinate Optimal Stepsizes* | [github](https://github.com/facebookresearch/bcos) | <https://arxiv.org/abs/2507.08963> | [cite](https://ui.adsabs.harvard.edu/abs/2025arXiv250708963J/exportcitation) |
227227
| Cautious WD | *Cautious Weight Decay* | | <https://arxiv.org/abs/2510.12402> | [cite](https://ui.adsabs.harvard.edu/abs/2025arXiv251012402C/exportcitation) |
228228
| Ano | *Faster is Better in Noisy Landscape* | [github](https://github.com/Adrienkgz/ano-optimizer) | <https://arxiv.org/abs/2508.18258> | [cite](https://github.com/Adrienkgz/ano-optimizer?tab=readme-ov-file#citation) |
229+
| Spectral Sphere | *Controlled LLM Training on Spectral Sphere* | [github](https://github.com/Unakar/Spectral-Sphere-Optimizer) | <https://arxiv.org/abs/2601.08393> | [cite](https://ui.adsabs.harvard.edu/abs/2026arXiv260108393X/exportcitation) |
229230

230231
## Supported LR Scheduler
231232

docs/changelogs/v3.10.0.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* Update the Emo-series optimizers. (#472, #478)
1010
* Update `EmoNavi`, `EmoFact`, and `EmoLynx`.
1111
* Fade out `EmoNeco` and `EmoZeal` optimizers.
12+
* Implement `SpectralSphere` optimizer. (#483, #485)
13+
* [Controlled LLM Training on Spectral Sphere](https://arxiv.org/abs/2601.08393)
1214

1315
### Fix
1416

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ get_supported_optimizers(['adam*', 'ranger*'])
226226
| BCOS | *Stochastic Approximation with Block Coordinate Optimal Stepsizes* | [github](https://github.com/facebookresearch/bcos) | <https://arxiv.org/abs/2507.08963> | [cite](https://ui.adsabs.harvard.edu/abs/2025arXiv250708963J/exportcitation) |
227227
| Cautious WD | *Cautious Weight Decay* | | <https://arxiv.org/abs/2510.12402> | [cite](https://ui.adsabs.harvard.edu/abs/2025arXiv251012402C/exportcitation) |
228228
| Ano | *Faster is Better in Noisy Landscape* | [github](https://github.com/Adrienkgz/ano-optimizer) | <https://arxiv.org/abs/2508.18258> | [cite](https://github.com/Adrienkgz/ano-optimizer?tab=readme-ov-file#citation) |
229+
| Spectral Sphere | *Controlled LLM Training on Spectral Sphere* | [github](https://github.com/Unakar/Spectral-Sphere-Optimizer) | <https://arxiv.org/abs/2601.08393> | [cite](https://ui.adsabs.harvard.edu/abs/2026arXiv260108393X/exportcitation) |
229230

230231
## Supported LR Scheduler
231232

docs/optimizer.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,10 @@
496496
:docstring:
497497
:members:
498498

499+
::: pytorch_optimizer.SpectralSphere
500+
:docstring:
501+
:members:
502+
499503
::: pytorch_optimizer.SPlus
500504
:docstring:
501505
:members:

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ dependencies = [
5858
[dependency-groups]
5959
dev = [
6060
'black<25; python_version < "3.9"',
61-
'black>=25,<26; python_version >= "3.9"',
61+
'black<26; python_version >= "3.9"',
6262
'ruff>=0.14,<0.15',
63-
'pyright==1.1.407',
63+
'pyright==1.1.408',
6464
'pytest<9; python_version < "3.10"',
6565
'pytest>=9,<10; python_version >= "3.10"',
6666
'pytest-cov<6; python_version < "3.9"',

pytorch_optimizer/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
DiffGrad,
123123
DistributedMuon,
124124
DynamicLossScaler,
125+
SpectralSphere,
125126
EmoFact,
126127
EmoLynx,
127128
EmoNavi,

pytorch_optimizer/optimizer/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
from pytorch_optimizer.optimizer.spam import SPAM, StableSPAM
105105
from pytorch_optimizer.optimizer.splus import SPlus
106106
from pytorch_optimizer.optimizer.srmm import SRMM
107+
from pytorch_optimizer.optimizer.sso import SpectralSphere
107108
from pytorch_optimizer.optimizer.swats import SWATS
108109
from pytorch_optimizer.optimizer.tam import TAM, AdaTAM
109110
from pytorch_optimizer.optimizer.tiger import Tiger
@@ -234,6 +235,7 @@
234235
Tiger,
235236
VSGD,
236237
Yogi,
238+
SpectralSphere,
237239
]
238240
OPTIMIZERS: Dict[str, OPTIMIZER] = {str(optimizer.__name__).lower(): optimizer for optimizer in OPTIMIZER_LIST}
239241

0 commit comments

Comments
 (0)