Skip to main content

FANoS: Friction-Adaptive Nosé–Hoover Symplectic momentum optimizer for PyTorch.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

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

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

fanos_optimizer-0.2.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fanos_optimizer-0.2.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file fanos_optimizer-0.2.0.tar.gz.

File metadata

  • Download URL: fanos_optimizer-0.2.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for fanos_optimizer-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9fea0bff0316d1bd0b8e3192e85c7ebfb1b1415f56e1df4341d5301b99037806
MD5 41f7a2f91b79b2975bd80979adf6ce6c
BLAKE2b-256 8636fae327452383cb566660eedf7bdb2cfe88c41ee840faf94f6311f06e5d2b

See more details on using hashes here.

File details

Details for the file fanos_optimizer-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fanos_optimizer-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c62a2484188b0c5712a361708f05dbd6b37fd0c611241478492d5f89b4c0bd6
MD5 8c2ee1949fcd2a495a637efc5b2f48cf
BLAKE2b-256 7311765bd0b2379df2b5a74fbd736514f23209b56c23369e5151d22161a090b8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page