Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

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-optimizer

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.

License

MIT (see LICENSE).

PyPI version

Metadata

Release files for fanos-optimizer 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fanos-optimizer 0.2.0
File Size Uploaded
fanos_optimizer-0.2.0.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fanos-optimizer 0.2.0
File Interpreter ABI Platform
fanos_optimizer-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.5 kB

Release files / fanos_optimizer-0.2.0.tar.gz

Download URL fanos_optimizer-0.2.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9fea0bff0316d1bd0b8e3192e85c7ebfb1b1415f56e1df4341d5301b99037806
BLAKE2b-256 checksum
How to use checksums
8636fae327452383cb566660eedf7bdb2cfe88c41ee840faf94f6311f06e5d2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release files / fanos_optimizer-0.2.0-py3-none-any.whl

Download URL fanos_optimizer-0.2.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c62a2484188b0c5712a361708f05dbd6b37fd0c611241478492d5f89b4c0bd6
BLAKE2b-256 checksum
How to use checksums
7311765bd0b2379df2b5a74fbd736514f23209b56c23369e5151d22161a090b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page