{"id":47075983,"url":"https://github.com/ml-kuleuven/klay","last_synced_at":"2026-03-12T06:42:03.088Z","repository":{"id":287038096,"uuid":"817682519","full_name":"ML-KULeuven/klay","owner":"ML-KULeuven","description":"Sparse Circuits on the GPU (ICLR2025)","archived":false,"fork":false,"pushed_at":"2026-03-05T15:38:56.000Z","size":9858,"stargazers_count":21,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-03-05T16:14:51.417Z","etag":null,"topics":["arithmetic-circuits","neurosymbolic","neurosymbolic-ai","probabilistic-circuits","probabilistic-inference","tractable-inference","tractable-models"],"latest_commit_sha":null,"homepage":"https://klaycircuits.readthedocs.io/en/latest/index.html","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ML-KULeuven.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-06-20T08:19:18.000Z","updated_at":"2026-03-05T15:45:17.000Z","dependencies_parsed_at":"2025-05-19T01:24:10.387Z","dependency_job_id":"bde0d6fa-c11c-4b89-b488-c319ff6ec78e","html_url":"https://github.com/ML-KULeuven/klay","commit_stats":null,"previous_names":["ml-kuleuven/klay"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ML-KULeuven/klay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ML-KULeuven%2Fklay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ML-KULeuven%2Fklay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ML-KULeuven%2Fklay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ML-KULeuven%2Fklay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ML-KULeuven","download_url":"https://codeload.github.com/ML-KULeuven/klay/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ML-KULeuven%2Fklay/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30417588,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T06:40:58.731Z","status":"ssl_error","status_checked_at":"2026-03-12T06:40:40.296Z","response_time":114,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arithmetic-circuits","neurosymbolic","neurosymbolic-ai","probabilistic-circuits","probabilistic-inference","tractable-inference","tractable-models"],"created_at":"2026-03-12T06:42:02.619Z","updated_at":"2026-03-12T06:42:03.083Z","avatar_url":"https://github.com/ML-KULeuven.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KLay\n\n[![Python 3.10](https://img.shields.io/badge/python-3.10+-green.svg)](https://www.python.org/downloads/release/python-3100/)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Build](https://github.com/ML-KULeuven/klay/actions/workflows/main.yml/badge.svg)](https://github.com/ML-KULeuven/klay/actions/workflows/main.yml)\n[![PyPI Downloads](https://static.pepy.tech/personalized-badge/klaycircuits?period=total\u0026units=INTERNATIONAL_SYSTEM\u0026left_color=BLACK\u0026right_color=GREEN\u0026left_text=downloads)](https://pepy.tech/projects/klaycircuits)\n\n__KLay is a Python library for evaluating sparse circuits on the GPU.__\n\nTo get started, install KLay using pip and check out the [documentation](https://klaycircuits.readthedocs.io/en/latest/). You can also refer to [this video](https://www.youtube.com/watch?v=ZCpDenbGoJ4) or [the paper](https://openreview.net/pdf?id=Zes7Wyif8G) for more information.\n\n```bash\npip install klaycircuits\n```\n\nKLay features:\n- GPU acceleration of circuits using Jax or PyTorch. \n- Loading SDD and d-DNNF circuits compiled by [PySDD](https://github.com/ML-KULeuven/PySDD) or [D4](https://github.com/crillab/d4).\n- Evaluation in various semirings (e.g. real, log, tropical).\n- Propagating constants and merging duplicate nodes.\n\n\n## 🧪 Tests\n\nRun the test suite from the project root:\n\n```bash\npytest tests/\n```\n\nTests are split by backend. They are automatically skipped if the required backend is not installed:\n- `tests/test_manual.py`, `tests/fuzzer_torch.py`, `tests/fuzzer_torch_multi.py`, `tests/fuzzer_creation.py` — require PyTorch\n- `tests/fuzzer_jax.py` — requires JAX\n- `tests/test_compression.py` — no backend required\n\n## 📊 Benchmarks\n\nBenchmarks live in the `benchmark/` directory. Run from the project root with:\n\n```bash\npython -m benchmark.benchmark_wmc --benchmark sdd --target torch -v 100 200 500\npython -m benchmark.benchmark_wmc --benchmark sdd --target jax   -v 100 200 500\npython -m benchmark.benchmark_wmc --benchmark sdd --target pysdd -v 100 200 500\n```\n\nKey options:\n\n| Flag | Description |\n|------|-------------|\n| `-b` / `--benchmark` | Circuit type: `sdd` or `d4` |\n| `-t` / `--target` | Backend: `torch`, `jax`, or `pysdd` |\n| `-v` / `--nb_vars` | Number of variables (one or more) |\n| `-d` / `--device` | Device: `cpu`, `cuda`, `cuda:0`, etc. |\n| `-s` / `--semiring` | Semiring: `log` (default) or `real` |\n| `-r` / `--nb_repeats` | Number of seeds to average over (default: 1) |\n\nResults are saved as JSON files under `results/`.\n\n## 📃 Paper\n\nIf you use KLay in your research, consider citing [our paper](https://openreview.net/pdf?id=Zes7Wyif8G).\n\nTo replicate the exact results and figures of the paper, use [this code](https://github.com/ML-KULeuven/klay/tree/d3b81491c34603ba9271d25af7c789d3ba368ede).\n\n```bibtex\n@inproceedings{\n    maene2025klay,\n    title={{KL}ay: Accelerating Arithmetic Circuits for Neurosymbolic {AI}},\n    author = {Maene, Jaron and Derkinderen, Vincent and Zuidberg Dos Martires, Pedro},\n    booktitle={The Thirteenth International Conference on Learning Representations},\n    year={2025},\n    url={https://openreview.net/forum?id=Zes7Wyif8G}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fml-kuleuven%2Fklay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fml-kuleuven%2Fklay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fml-kuleuven%2Fklay/lists"}