Skip to main content

KLay

Python 3.11 License PyPI Downloads

KLay is a Python library for evaluating sparse circuits on the GPU.

To get started, install KLay using pip and check out the documentation. You can also refer to this video or the paper for more information.

pip install klaycircuits

KLay features include:

  • GPU acceleration of circuits using Jax or PyTorch.
  • Loading SDD and d-DNNF circuits compiled by PySDD or D4.
  • Evaluation in various semirings (e.g. real, log, tropical).
  • Propagating constants and merging duplicate nodes.

🧪 Tests

Run the test suite from the project root:

pytest tests/

Tests are split by backend. They are automatically skipped if the required backend is not installed:

  • tests/test_manual.py, tests/fuzzer_torch.py, tests/fuzzer_torch_multi.py, tests/fuzzer_creation.py — require PyTorch
  • tests/fuzzer_jax.py — requires JAX
  • tests/test_compression.py — no backend required

📊 Benchmarks

Benchmarks live in the benchmark/ directory. Run from the project root with:

python -m benchmark.benchmark_wmc --benchmark sdd --target torch -v 100 200 500
python -m benchmark.benchmark_wmc --benchmark sdd --target jax   -v 100 200 500
python -m benchmark.benchmark_wmc --benchmark sdd --target pysdd -v 100 200 500

Key options:

Flag Description
-b / --benchmark Circuit type: sdd or d4
-t / --target Backend: torch, jax, or pysdd
-v / --nb_vars Number of variables (one or more)
-d / --device Device: cpu, cuda, cuda:0, etc.
-s / --semiring Semiring: log (default) or real
-r / --nb_repeats Number of seeds to average over (default: 1)

Results are saved as JSON files under results/.

📃 Paper

If you use KLay in your research, consider citing our paper.

To replicate the exact results and figures of the paper, use this code.

@inproceedings{
    maene2025klay,
    title={{KL}ay: Accelerating Arithmetic Circuits for Neurosymbolic {AI}},
    author = {Maene, Jaron and Derkinderen, Vincent and Zuidberg Dos Martires, Pedro},
    booktitle={The Thirteenth International Conference on Learning Representations},
    year={2025},
    url={https://openreview.net/forum?id=Zes7Wyif8G}
}

🚀 Impact

Examples of papers that use KLay include:

Metadata

Release files for klaycircuits 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 klaycircuits 0.1.2
File Size Uploaded Provenance Actions
klaycircuits-0.1.2.tar.gz 85.4 kB With provenance Details for klaycircuits-0.1.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for klaycircuits 0.1.2
File Actions
klaycircuits-0.1.2-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details for klaycircuits-0.1.2-cp314-cp314t-win_amd64.whl
klaycircuits-0.1.2-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for klaycircuits-0.1.2-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
klaycircuits-0.1.2-cp314-cp314t-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 Details for klaycircuits-0.1.2-cp314-cp314t-macosx_11_0_arm64.whl
klaycircuits-0.1.2-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for klaycircuits-0.1.2-cp312-abi3-win_amd64.whl
klaycircuits-0.1.2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for klaycircuits-0.1.2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
klaycircuits-0.1.2-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for klaycircuits-0.1.2-cp312-abi3-macosx_11_0_arm64.whl
klaycircuits-0.1.2-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for klaycircuits-0.1.2-cp311-cp311-win_amd64.whl
klaycircuits-0.1.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for klaycircuits-0.1.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
klaycircuits-0.1.2-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for klaycircuits-0.1.2-cp311-cp311-macosx_11_0_arm64.whl

Total release size: 1.6 MB

Release files / klaycircuits-0.1.2.tar.gz

Download URL klaycircuits-0.1.2.tar.gz
Size 85.4 kB
Tags Source
SHA-256 checksum
How to use checksums
be91f8d30617f1d407096f841d6fbcbf244796458993ac1e900136b8698a1fcf
BLAKE2b-256 checksum
How to use checksums
9aadd25feedd09306be4035362b0e25b38d079cb4f548b42a076eaa3a0c95b6c
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 Oct 26, 2026.

Transparency log

Release files / klaycircuits-0.1.2-cp314-cp314t-win_amd64.whl

Download URL klaycircuits-0.1.2-cp314-cp314t-win_amd64.whl
Size 217.6 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
1c8dece3d15c47f65b1519f5d31139216163ed2b31811d2deec53eec3da781a9
BLAKE2b-256 checksum
How to use checksums
0f6cb89128caccf045b325fe50ff14acce3d9397e68ab2bad4e7dbc6a1700a39
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 Oct 26, 2026.

Transparency log

Release files / klaycircuits-0.1.2-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL klaycircuits-0.1.2-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 163.7 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
c268090c90814bd6c4262b4e3fd16806afa72f0153fc1bd9ffc3fe0a411e00c4
BLAKE2b-256 checksum
How to use checksums
973cc943439a2be981308313dac247ecd69fb46338aa6080a0e1ee05cebfcb65
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 Oct 26, 2026.

Transparency log

Release files / klaycircuits-0.1.2-cp314-cp314t-macosx_11_0_arm64.whl

Download URL klaycircuits-0.1.2-cp314-cp314t-macosx_11_0_arm64.whl
Size 137.4 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b895eb61778d104448e08f7ac78e0a45ff2ed1e5e18a480cc55991fb1f117905
BLAKE2b-256 checksum
How to use checksums
fd37c717b0eee971f02e76198d57df89eb18e981abd024e4540d05b304e868bd
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 Oct 26, 2026.

Transparency log

Release files / klaycircuits-0.1.2-cp312-abi3-win_amd64.whl

Download URL klaycircuits-0.1.2-cp312-abi3-win_amd64.whl
Size 208.9 kB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
27914058e8fa23858c5cf143592a4940c600b9f7f48085012fc1bf0223e31ef6
BLAKE2b-256 checksum
How to use checksums
e11eb2b799c9b043625e01b9088a9462b3df3d4aec35a6578b3a5d5f5bc8529d
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 Oct 26, 2026.

Transparency log

Release files / klaycircuits-0.1.2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL klaycircuits-0.1.2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 156.7 kB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
b5b81d1548a1737404d3faae2f207c39c1167eb98d0a5dec06c8d91142577e60
BLAKE2b-256 checksum
How to use checksums
78c6eb1359c490fd2568865e1679e37b7946ea52976f9c75fefa156e898acab7
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 Oct 26, 2026.

Transparency log

Release files / klaycircuits-0.1.2-cp312-abi3-macosx_11_0_arm64.whl

Download URL klaycircuits-0.1.2-cp312-abi3-macosx_11_0_arm64.whl
Size 134.6 kB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4edc263ef844c62ab92a115f68172745f3976f3d3f168a4a3926661b425be77a
BLAKE2b-256 checksum
How to use checksums
f71ad50d88b2f712c785c6ec11c49197f097f71419c5fdbe0b28cd1bbae4372f
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 Oct 26, 2026.

Transparency log

Release files / klaycircuits-0.1.2-cp311-cp311-win_amd64.whl

Download URL klaycircuits-0.1.2-cp311-cp311-win_amd64.whl
Size 209.5 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
09f3e223fbd37786430534bf7983aafb1cab2079d916dd38178a2a139a0ffe9e
BLAKE2b-256 checksum
How to use checksums
de350add24f9e91c1992165b12d604fd9b8e81af24723ef09a26a9887d551ef1
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 Oct 26, 2026.

Transparency log

Release files / klaycircuits-0.1.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL klaycircuits-0.1.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 161.6 kB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
48787533fcbf9b43bd652fff7e2c982eccd63ce5f7d3a6be84493617147b6557
BLAKE2b-256 checksum
How to use checksums
4e106a58a600a7f55ade87f64f30659347622dd84d95207debb569a5ef44fc0f
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 Oct 26, 2026.

Transparency log

Release files / klaycircuits-0.1.2-cp311-cp311-macosx_11_0_arm64.whl

Download URL klaycircuits-0.1.2-cp311-cp311-macosx_11_0_arm64.whl
Size 136.2 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
12cd6e77e490e82208c8bdb6505079fe5623d3917da1e83a37a4f606f2201034
BLAKE2b-256 checksum
How to use checksums
3abd0d2976eecbf9dd7dbf47ea7468b081459ded2d8fb906002cc83a84bbd573
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 Oct 26, 2026.

Transparency log

Security for klaycircuits 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.

Full provenance

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

Select from 10 files

Attestation for klaycircuits-0.1.2.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 Oct 26, 2026.

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