Lemma
Lemma is a tiny PyTorch-style ML library. It uses an LLM as a stochastic compiler that writes optimized CUDA kernels, and it formally verifies that each kernel is correct.
This is a proof of concept, not a production-ready ML library.
pip install "lemma-ml[cuda]" # NVIDIA driver with CUDA 13
pip install "lemma-ml[cuda12]" # drivers that only support CUDA 12
lemma doctor # checks the GPU, clang, Bend and the LLM agent
The package installs as lemma-ml and is imported as lemma.
How it works
- You write Python code with Lemma. It looks like PyTorch.
- Lemma compiles it twice: to a naive intermediate representation (IR), and to a CUDA kernel written by an LLM.
- The LLM's CUDA is parsed by clang and lifted to the same IR.
- Bend proves the two IRs equal, over real arithmetic.
- Only a kernel that passes the proof is installed and run on the GPU. If none passes, compilation raises
lemma.verify.Rejected.
The literature calls this translation validation: proving that optimized code is equivalent to the spec it was compiled from.
License: Apache-2.0. Copyright 2026 Francesco Sacco.
Metadata
Release files for lemma-ml 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lemma_ml-0.1.0.tar.gz | 594.2 kB | With provenance | Details for lemma_ml-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lemma_ml-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for lemma_ml-0.1.0-py3-none-any.whl |
Total release size: 947.0 kB
Release files / lemma_ml-0.1.0.tar.gz
| Download URL | lemma_ml-0.1.0.tar.gz |
|---|---|
| Size | 594.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
325eaac1dc9a45331a1a77e19562d9be06530d9aecc9cd5461743ee295001088
|
|
BLAKE2b-256 checksum How to use checksums |
dd9a49146792e83e1d2f0c0b1923d9b168e407011db9d2e24ebf1b1d4c6ddd98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 4, 2026.
Transparency logRelease files / lemma_ml-0.1.0-py3-none-any.whl
| Download URL | lemma_ml-0.1.0-py3-none-any.whl |
|---|---|
| Size | 352.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6d7fbd96238e7976fd23ef3df464baae580440c998c5bf3229f396c876950bdd
|
|
BLAKE2b-256 checksum How to use checksums |
29f5e261cd6d468b415009ac9de9a6fcdec2283a4a9393821c820aa832fe068d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 4, 2026.
Transparency logSecurity for lemma-ml 0.1.0
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
Both files in this release have been uploaded with provenance metadata.
Attestation for lemma_ml-0.1.0.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 Dec 4, 2026.
Transparency logA 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.