Skip to main content

KLay

Python 3.10 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.0

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.0
File Size Uploaded
klaycircuits-0.1.0.tar.gz 84.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for klaycircuits 0.1.0
File
klaycircuits-0.1.0-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
klaycircuits-0.1.0-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
klaycircuits-0.1.0-cp314-cp314t-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 Details
klaycircuits-0.1.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details
klaycircuits-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
klaycircuits-0.1.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details
klaycircuits-0.1.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
klaycircuits-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
klaycircuits-0.1.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
klaycircuits-0.1.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
klaycircuits-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
klaycircuits-0.1.0-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details

Total release size: 2.0 MB

Release files / klaycircuits-0.1.0.tar.gz

Download URL klaycircuits-0.1.0.tar.gz
Size 84.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c444c28b106745e0bf61ac82bbd95d5e70f57342581e005fb86b4b60bc087276
BLAKE2b-256 checksum
How to use checksums
62f94d5edc6d53b19ca0f166970523932ac2f62ceccf43f9d8b9848325359da5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 18, 2026.

Transparency log

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

Download URL klaycircuits-0.1.0-cp314-cp314t-win_amd64.whl
Size 186.8 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
0f238066294cdc3d6963a8247d2483b88e910401cc1a4d8fe95ce1b54bd05928
BLAKE2b-256 checksum
How to use checksums
d3dfcc113719fe8ab6769684e69232fcd18226de0ecd34f1fcdcf1578c76f50c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 18, 2026.

Transparency log

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

Download URL klaycircuits-0.1.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 158.6 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
87e254b5e6c46931e246db06d5ce81f1988f36b1f9cdda04fd3f92a986207a19
BLAKE2b-256 checksum
How to use checksums
56fd9ed3f09d7b4001bc058ac866e5189d84d722c1347960463d6c4d96bff2db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 18, 2026.

Transparency log

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

Download URL klaycircuits-0.1.0-cp314-cp314t-macosx_11_0_arm64.whl
Size 129.1 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7fffd6e9cd0619dae7cc849aa44bc9fbff84dfd0b72219f5296174dbad4b3828
BLAKE2b-256 checksum
How to use checksums
cd3481db653f8678a162ee4c65b809f2443cae9f7e40395da98b9d1bba27c807
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 18, 2026.

Transparency log

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

Download URL klaycircuits-0.1.0-cp312-abi3-win_amd64.whl
Size 179.9 kB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
9d92e624d358f029d35b9a044f48a2310f243ac94bfdfe8f44fac91627af40dc
BLAKE2b-256 checksum
How to use checksums
8684514a8df964c624ce844fdb2aa5a132cc96004d2d569914d81da7f8640da1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 18, 2026.

Transparency log

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

Download URL klaycircuits-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 152.3 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
79f357d23c7792d70a5727caa311d308478f19de544ec28fa0d580487c63e0c6
BLAKE2b-256 checksum
How to use checksums
40233eac82db474d8d978a092ac4886b98fc4e11c76bf8c999e41efdda9addc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 18, 2026.

Transparency log

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

Download URL klaycircuits-0.1.0-cp312-abi3-macosx_11_0_arm64.whl
Size 126.0 kB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e00c4f51c80e4f3b0f6f8b667556c96af439adb9c133c108107c9da2e31171c0
BLAKE2b-256 checksum
How to use checksums
7c4858c276ba802cee0b5f336b440ffca787bff78b449180472f74caa6e7fcb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 18, 2026.

Transparency log

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

Download URL klaycircuits-0.1.0-cp311-cp311-win_amd64.whl
Size 181.9 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
a36a7dd98f0ea73c8d2ae3f3a12cf8f47c644c1a50210aae838a04a44f2db884
BLAKE2b-256 checksum
How to use checksums
19f63f65169f0452fa9dd33e6f7b8dc02840e915a44868e3c525dec94667cfc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 18, 2026.

Transparency log

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

Download URL klaycircuits-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 156.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
ed29237d3445effc7a8c6cbcb2e4745a108f76e89500d36dae561b2c23ad0666
BLAKE2b-256 checksum
How to use checksums
93ba8ed27adcbed46b180a297c1cd8732871d1f4dd7dc1971e907d8e70b49a5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 18, 2026.

Transparency log

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

Download URL klaycircuits-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Size 128.4 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4f132085faabc60a38e51dbe78ca624ca1922b399db5bb5f667a44b225e5a110
BLAKE2b-256 checksum
How to use checksums
244b58cf41082788f17e56c8fc2680465585e1d0ca47bd114c01452c31766965
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 18, 2026.

Transparency log

Release files / klaycircuits-0.1.0-cp310-cp310-win_amd64.whl

Download URL klaycircuits-0.1.0-cp310-cp310-win_amd64.whl
Size 182.1 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
168f22da5a44d81498f4404dce9e5dbcd284723ba922afbc99f9a07d318206b6
BLAKE2b-256 checksum
How to use checksums
62e04fadace91b5bfbda7af5f738e20257b406be39b3a3c4c459fa63d6ecc181
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 18, 2026.

Transparency log

Release files / klaycircuits-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL klaycircuits-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 156.9 kB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b894c1d535bba7b61bb58fa14321376a8b67165b68c3dc83cf5001db7b49c1c0
BLAKE2b-256 checksum
How to use checksums
75143a60cca8e110ee8d587223711c69a892ea1b411bcf1abf1235f4e128ac26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 18, 2026.

Transparency log

Release files / klaycircuits-0.1.0-cp310-cp310-macosx_11_0_arm64.whl

Download URL klaycircuits-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Size 128.7 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
18b1336320c9d19139024bbd845b7459826578fa1ac8c928c978d71c53ec21ec
BLAKE2b-256 checksum
How to use checksums
5b7e29dc3e0af8cea746dadbf879244ea4ccfa47f16b4389b3f2e2cb607cee45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

13 release files

0.0.4

16 release files

0.0.3

10 release files

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