Skip to main content

Unit-Scaled Maximal Update Parameterization (u-μP)

tests PyPI version license GitHub Repo stars

A library for unit scaling in PyTorch, based on the paper u-μP: The Unit-Scaled Maximal Update Parametrization and previous work Unit Scaling: Out-of-the-Box Low-Precision Training.

Documentation can be found at https://graphcore-research.github.io/unit-scaling and an example notebook at examples/demo.ipynb.

Note: The library is currently in its beta release. Some features have yet to be implemented and occasional bugs may be present. We're keen to help users with any problems they encounter.

Installation

To install the unit-scaling library, run:

pip install unit-scaling

or for a local editable install (i.e. one which uses the files in this repo), run:

pip install -e .

Development

For development in this repository, we recommend using the provided docker container. This image can be built and entered interactively using:

docker build -t unit-scaling-dev:latest .
docker run -it --rm  --user developer:developer -v $(pwd):/home/developer/unit-scaling unit-scaling-dev:latest
# To use git within the container, add `-v ~/.ssh:/home/developer/.ssh:ro -v ~/.gitconfig:/home/developer/.gitconfig:ro`.

For vscode users, this repo also contains a .devcontainer.json file, which enables the container to be used as a full-featured IDE (see the Dev Container docs for details on how to use this feature).

Key development functionality is contained within the ./dev script. This includes running unit tests, linting, formatting, documentation generation and more. Run ./dev --help for the available options. Running ./dev without arguments is equivalent to using the --ci option, which runs all of the available dev checks. This is the test used for GitHub CI.

We encourage pull requests from the community. Please reach out to us with any questions about contributing.

What is u-μP?

u-μP inserts scaling factors into the model to make activations, gradients and weights unit-scaled (RMS ≈ 1) at initialisation, and into optimiser learning rates to keep updates stable as models are scaled in width and depth. This results in hyperparameter transfer from small to large models and easy support for low-precision training.

For a quick intro, see examples/demo.ipynb, for more depth see the paper and library documentation.

What is unit scaling?

For a demonstration of the library and an overview of how it works, see Out-of-the-Box FP8 Training (a notebook showing how to unit-scale the nanoGPT model).

For a more in-depth explanation, consult our paper Unit Scaling: Out-of-the-Box Low-Precision Training.

And for a practical introduction to using the library, see our User Guide.

License

Copyright (c) 2023 Graphcore Ltd. Licensed under the Apache 2.0 License.

See NOTICE.md for further details.

Metadata

Release files for unit-scaling 0.3.5

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

Source distribution (sdist)

Source distribution for unit-scaling 0.3.5
File Size Uploaded Provenance Actions
unit_scaling-0.3.5.tar.gz 4.8 MB With provenance Details for unit_scaling-0.3.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for unit-scaling 0.3.5
File Interpreter ABI Platform Actions
unit_scaling-0.3.5-py3-none-any.whl Python 3 none any Details for unit_scaling-0.3.5-py3-none-any.whl

Total release size: 4.9 MB

Release files / unit_scaling-0.3.5.tar.gz

Download URL unit_scaling-0.3.5.tar.gz
Size 4.8 MB
Tags Source
SHA-256 checksum
How to use checksums
9df186addff1bca39e888f00fb51cda3e7a54440eb478b203cc585442ba15016
BLAKE2b-256 checksum
How to use checksums
7d3a6e88c1d682900d05f5b2564cd45520d82a6fb75e2e7f5c41760ed49db6dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 11, 2025.

Transparency log

Release files / unit_scaling-0.3.5-py3-none-any.whl

Download URL unit_scaling-0.3.5-py3-none-any.whl
Size 78.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53c270afb1e8bf804a39612b544dafedf1065b0cbf79820296d843392bcfac2c
BLAKE2b-256 checksum
How to use checksums
cebabc682ddafc853e7d9f4ad89384679b9bc5052a5c44fbc52aa0caad591d25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 11, 2025.

Transparency log

Security for unit-scaling 0.3.5

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for unit_scaling-0.3.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 11, 2025.

Transparency log

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