Skip to main content

mndopt

PyTorch implementation of the Matrix Normal Diagonal (MND) optimizer from A Statistical Viewpoint on Adam, Shampoo and Muon by Tetiana Parshakova, Robert M. Gower, and Paulo Orenstein (2026).

Requires Python 3.10+ and PyTorch 2.2+. Supports dense float32 and float64 parameters.

pip install mndopt
import torch
from mndopt import MND

model = torch.nn.Linear(8, 4)
optimizer = MND(model.parameters(), lr=0.003)

x, y = torch.randn(32, 8), torch.randn(32, 4)
optimizer.zero_grad()
loss = torch.nn.functional.mse_loss(model(x), y)
loss.backward()
optimizer.step()

Matrices use MND; other parameters use AdamW. Both use decoupled weight decay.

Train a small GPT on Tiny Shakespeare for 2,000 MND steps: notebook.

Licensed under Apache 2.0.

Metadata

Release files for mndopt 0.1.2

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

Source distribution (sdist)

Source distribution for mndopt 0.1.2
File Size Uploaded Provenance Actions
mndopt-0.1.2.tar.gz 13.3 kB Without provenance Details for mndopt-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mndopt 0.1.2
File Interpreter ABI Platform Actions
mndopt-0.1.2-py3-none-any.whl Python 3 none any Details for mndopt-0.1.2-py3-none-any.whl

Total release size: 21.6 kB

Release files / mndopt-0.1.2.tar.gz

Download URL mndopt-0.1.2.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
26c5efe0dca1f914c75d2452375db813c23268251899b3a819b05abbc4ea20a3
BLAKE2b-256 checksum
How to use checksums
a08bbe2abc7cc67fd93e3bce6458a41ef3dfd4ac59223d39f1ef9db3ac697240
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / mndopt-0.1.2-py3-none-any.whl

Download URL mndopt-0.1.2-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ed0eb90a751dd40b7774b2df414d9186a3e564d803e47c752c2adc008a9b293
BLAKE2b-256 checksum
How to use checksums
951c90487e6665b2f587e09d0f27ac09e032f71906d16086e8213bc88efef038
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for mndopt 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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