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.1

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.1
File Size Uploaded Provenance
klaycircuits-0.1.1.tar.gz 85.0 kB With provenance Details

Built distributions (wheels)

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

Total release size: 2.1 MB

Release files / klaycircuits-0.1.1.tar.gz

Download URL klaycircuits-0.1.1.tar.gz
Size 85.0 kB
Tags Source
SHA-256 checksum
How to use checksums
31478e4052af9dd4342963d1524dba824f1ce9c1058c7c5c3aba51339bf77efa
BLAKE2b-256 checksum
How to use checksums
dcbb2d87cd75c15bfded6afa40bc69f2b7d9d59af575e35b83d444217f04e0fa
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 22, 2026.

Transparency log

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

Download URL klaycircuits-0.1.1-cp314-cp314t-win_amd64.whl
Size 217.5 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
3dc154ce32cb7fc00e80df1e4d8ca1bbf7b0d09a6de1b0e2a76c485408173ea2
BLAKE2b-256 checksum
How to use checksums
5a332b3085c04edd5e21a4a2ccbb6f720e66c99c4f0f38177248d84d94ab09c8
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 22, 2026.

Transparency log

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

Download URL klaycircuits-0.1.1-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 167.3 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
82e6eef537f31ab6a7cc6d2e4deb368d3b3ded5487b78e8b32eb55d7391e8eee
BLAKE2b-256 checksum
How to use checksums
f964387cbfd791cae236fa2089bd4dbe67c8e70de1574c41336a02ca537eaf14
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 22, 2026.

Transparency log

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

Download URL klaycircuits-0.1.1-cp314-cp314t-macosx_11_0_arm64.whl
Size 140.3 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a74bae00b838ccf5224d2d2c28638b779ee33fc7e0aa83fa338b03a8d867b698
BLAKE2b-256 checksum
How to use checksums
ec298aeff21ff0ea6e0dbd1f69c4094257b2beca3f5be840fb51e9407cf2cb33
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 22, 2026.

Transparency log

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

Download URL klaycircuits-0.1.1-cp312-abi3-win_amd64.whl
Size 208.8 kB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
908e480636501d54c28e95269ce085bedb79788b168ab0c58e41237bdd9c52b5
BLAKE2b-256 checksum
How to use checksums
57252e904cf08eda30268122b7929b2baa324871fdcc151e024036d4cce76e92
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 22, 2026.

Transparency log

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

Download URL klaycircuits-0.1.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 160.4 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
1ffb62ec633d7750a116d05ace2980649d7deb65bf5d39ef04cdb952948df497
BLAKE2b-256 checksum
How to use checksums
63cf00933e74d48831c69880334db9046b930ee5a8b6813cedff459a00c107c2
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 22, 2026.

Transparency log

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

Download URL klaycircuits-0.1.1-cp312-abi3-macosx_11_0_arm64.whl
Size 137.5 kB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3a5d5ae58b1729fdf5225c7262478a0f9be1eb936a0cf4033ad721a46b48528a
BLAKE2b-256 checksum
How to use checksums
a2b455de8c12749aa3eca21f8250704dd16d6737952f71229ee18b21d8ff9ffc
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 22, 2026.

Transparency log

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

Download URL klaycircuits-0.1.1-cp311-cp311-win_amd64.whl
Size 209.3 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
e4c93ece6b0fab7ad26c8f6f005a7092e8675c42f749111d486c0b7fe230d4c9
BLAKE2b-256 checksum
How to use checksums
431e52d0aa51e5195aa6a0712c16148484265a4ab69aae785b62edb187be20ed
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 22, 2026.

Transparency log

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

Download URL klaycircuits-0.1.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 165.2 kB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
7045a5cc1ba19e33f50ef526758f2a20f01bdae5f92f7f09352b33151df957b4
BLAKE2b-256 checksum
How to use checksums
ebcf67b13815e00927268968f372fd6087863c25d820ac3e4bcec69e2bf3960a
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 22, 2026.

Transparency log

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

Download URL klaycircuits-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Size 139.1 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
89fd579b2adb78b80f46b96ebaf8651278fc35aab81194159112a20ed7e78c96
BLAKE2b-256 checksum
How to use checksums
6f623cfb42fec67a34d6c8384b73c5d835a8c2ad87a8917b6185830f797aef19
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 22, 2026.

Transparency log

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

Download URL klaycircuits-0.1.1-cp310-cp310-win_amd64.whl
Size 209.0 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
b7532ca679091055915b615441ef0333401b3cab21b6676e51927fef14043949
BLAKE2b-256 checksum
How to use checksums
cf33c22fb6b813c7cf4f10be5762b7ac2eb475aff73cfde09f3e0f4f602afa1d
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 22, 2026.

Transparency log

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

Download URL klaycircuits-0.1.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 165.5 kB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e6f240cac7a349b25aca756f9af8d0dd63beeee37e2684f024c2ec819e70d554
BLAKE2b-256 checksum
How to use checksums
ef80a5f4105270342ac1c5163217dfa205f87bf8913bb72e682b2ecebbaa4e90
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 22, 2026.

Transparency log

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

Download URL klaycircuits-0.1.1-cp310-cp310-macosx_11_0_arm64.whl
Size 139.5 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a1e275254fd78d33ab89a5d12cb07dd86de8dda02860496bc95e8ff34462724b
BLAKE2b-256 checksum
How to use checksums
82caa419dbf2c27ff0f860538a76b85a16f4dd42bc4f2b2bade1b311e8b44a36
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 22, 2026.

Transparency log

Security for klaycircuits 0.1.1

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 13 files in this release have been uploaded with provenance metadata.

Select from 13 files

Attestation for klaycircuits-0.1.1.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 22, 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.

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