Skip to main content

cuPyLMA: a Multi-GPU Levenberg-Marquardt (Deep Learning) Optimizer Powered by NVIDIA cuPyNumeric

cuPyLMA is a scalable multi-GPU (deep learning) optimizer that implements the Levenberg-Marquardt algorithm (LMA). This library is built on PyTorch and powered by NVIDIA cuPyNumeric (a NumPy-like scientific computing framework).

Background

The Levenberg-Marquardt algorithm (LMA) is a second-order optimizer. It solves parameter updates $\mathbf{v}$ from the equation involving the Jacobian matrix $\mathbf{J}$ of the batched outputs with respect to model parameters, and the residuals $\mathbf{r}$.

$$ \large (\mathbf{J}^T\mathbf{J}+\lambda \mathbf{I})\mathbf{v} = \mathbf{J}^Tr $$

The Jacobian matrix requires large computation and memory space. To resolve them, we take advantage of NVIDIA cuPyNumeric. This NumPy-like scientific computing framework automatically distributes the Jacobian matrix and schedules computation to multiple GPUs.

Features

  • cuPyLMA utilizes LMA as the optimizer, which can converge to a lower loss in a shorter time than the Adam optimizer.

  • cuPyLMA explicityly computes the Jacobian matrix required by LMA, which boosts the performance while sacrificing the memory space. This is different from most LMA implementations which utilizes the preconditioned conjugate gradient solver (PCG).

  • cuPyLMA reduces the computation cost and the peak memory usage of the Jacobian matrix computation by selecting the best strategy.

  • cuPyLMA scalably solves LMA parameter updates via cuPyNumeric.

  • cuPyLMA reduces the number of hyperparameter tuning. All we need to tune is the batch size.

Install

Pip

pip install cupylma

Usage

See curve fitting example.

References

[1] fabiodimarco/torch-levenberg-marquardt: Our base code refers to the repository.

[2] H. P. Gavin, “The Levenberg-Marquardt algorithm for nonlinear least squares curve-fitting problems,” 2024.: It provides theoretical explanation of LMA.

Citation

J. Taylor, W. Wang, B. Bala, and T. Bednarz, “Optimizing the optimizer for data driven deep neural networks and physics informed neural networks,” May 16, 2022, arXiv: arXiv:2205.07430. doi: 10.48550/arXiv.2205.07430.

Metadata

Release files for cupylma 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 cupylma 0.1.2
File Size Uploaded Provenance Actions
cupylma-0.1.2.tar.gz 9.4 kB Without provenance Details for cupylma-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 18.2 kB

Release files / cupylma-0.1.2.tar.gz

Download URL cupylma-0.1.2.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ca793278c5d861fb34cc66862388dfcb5c0e5e57212fb80551107c5959220f05
BLAKE2b-256 checksum
How to use checksums
7fdb31586cc42b0c3fdd785dcdde95e4030eff0c4f9927f8e294f6f3b5967794
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

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

Download URL cupylma-0.1.2-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dad46f7f2fd5fc6ec22ccc7221e81f9b7bff12712af843ee5f314461c9973eea
BLAKE2b-256 checksum
How to use checksums
2252d4248862b2042d612c65f2010cac135e6e4c16ff010e65243f4804742ffe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for cupylma 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