Friction-Adaptive Nosé–Hoover Symplectic Momentum optimizer for PyTorch
Project description
FANoS Optimizer (PyTorch)
FANoS = Friction-Adaptive Nosé–Hoover Symplectic momentum.
This package provides a PyTorch torch.optim.Optimizer implementation of FANoS:
- semi-implicit (symplectic-Euler) momentum update
- a Nosé–Hoover-inspired thermostat variable that adapts friction using kinetic-energy feedback
- optional diagonal RMS “mass” (preconditioner) and optional global gradient clipping
The accompanying paper is included in the release repo; this library is just the clean optimizer code.
Install
pip install fanos
Quickstart
import torch
from fanos import FANoS
model = torch.nn.Linear(10, 1)
opt = FANoS(model.parameters(), lr=1e-3, grad_clip=1.0)
x = torch.randn(64, 10)
y = torch.randn(64, 1)
loss = torch.nn.functional.mse_loss(model(x), y)
loss.backward()
opt.step()
opt.zero_grad()
Notes (read this before hype happens)
FANoS is a research optimizer. In the paper's reported protocols it:
- helps vs unclipped AdamW/RMSProp on Rosenbrock-100D,
- but is not a general replacement for strong baselines like AdamW + clipping,
- and can be unstable or high-variance on some problems without tuning.
So: treat it as a tool for experiments, not a default choice for production.
Citation
Add the paper citation from CITATION.cff in the repo.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fanos-0.3.11.tar.gz.
File metadata
- Download URL: fanos-0.3.11.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbafcd4a3ca2a6a04d5fb94ee522244c7cc69194a3ecb41cb8945b59dcfa3640
|
|
| MD5 |
6935dd61a6cb4c2458ae207e8945670d
|
|
| BLAKE2b-256 |
b542b9116ee18cd7749fc7e4999dea82194fd31d9f49b10d31f6c2bebed78826
|
File details
Details for the file fanos-0.3.11-py3-none-any.whl.
File metadata
- Download URL: fanos-0.3.11-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e52d34685755b3c121b6295bab147aa98dd55863aba72a3708323c8865fc56e
|
|
| MD5 |
e6aaa2f3c32e4db662b6ffede29c395d
|
|
| BLAKE2b-256 |
fbde7239b693185c55ab4489d45f225b86c79a4a4843155e1c591de051e1efb7
|