|
1 | 1 | # KLay |
2 | 2 |
|
3 | | -C++ implementation of the Knowledge Layers. Includes support for: |
4 | | -- SDD and d-DNNF circuits compiled by PySDD and D4. |
5 | | -- Evaluation in Jax and PyTorch, on CPU and GPU. |
6 | | -- Evaluation in various semirings (e.g. real, log, tropical). |
7 | | - |
8 | | -## Installation |
| 3 | +_KLay is a Python library for evaluating sparse arithmetic circuits on the GPU._ |
9 | 4 |
|
10 | | -KLay has been tested on Linux (x86) and Mac (x86/ARM), no guarantees are made for Windows. KLay requires a C++ compiler and Python 3.9 or higher. |
11 | | -```bash |
12 | | -pip install . |
13 | | -``` |
| 5 | +To get started, install KLay using pip or check out [the documentation](todo). |
14 | 6 |
|
15 | | -Most dependencies are optional. However, to replicate all the experiments, make sure to install the following: |
16 | 7 | ```bash |
17 | | -pip install jax torch torchvision matplotlib numpy pysdd tqdm graphviz |
| 8 | +pip install klaycircuits |
18 | 9 | ``` |
19 | 10 |
|
20 | | -## Experiments |
21 | | - |
22 | | -The experiments in the paper can be replicated as follows. |
23 | | - |
24 | | -### Synthetic |
25 | | -The synthetic experiments take a couple of hours to run. |
26 | | - |
27 | | -To run all the synthetic experiments of Figure 6. |
28 | | -```bash |
29 | | -bash experiments/synthetic/run_sdd.sh |
30 | | -``` |
| 11 | +Features include: |
| 12 | +- Evaluation in Jax and PyTorch, on CPU and GPU. |
| 13 | +- Loading SDD and d-DNNF circuits compiled by PySDD or D4. |
| 14 | +- Evaluation in various semirings (e.g. real, log, tropical). |
| 15 | +- Propagating constants and merging duplicate nodes. |
31 | 16 |
|
32 | | -Similarly, to run all the same synthetic experiments with d4 (as in Figure 7). |
33 | | -```bash |
34 | | -bash experiments/synthetic/run_d4.sh |
35 | | -``` |
36 | | -And for the synthetic experiments in the real semiring (as in Figure 8). |
37 | | -```bash |
38 | | -bash experiments/synthetic/run_real.sh |
39 | | -``` |
40 | 17 |
|
41 | | -To run the juice baseline, install [Julia](https://julialang.org/) and the [LogicCircuits.jl](https://github.com/Tractables/LogicCircuits.jl) package. |
42 | | -Then run: |
43 | | -```bash |
44 | | -julia experiments/synthetic/benchmark_juice.jl |
45 | | -``` |
| 18 | +## 📃 Paper |
46 | 19 |
|
47 | | -You can reproduce the plots of the paper using: |
48 | | -```bash |
49 | | -python experiments/synthetic/plot_figure.py |
50 | | -``` |
| 20 | +If you use KLay in your research, consider citing [our paper](https://openreview.net/pdf?id=Zes7Wyif8G). |
51 | 21 |
|
52 | | -### NeSy experiments |
53 | | -```bash |
54 | | -python experiments/nesy/run.py |
55 | | -``` |
| 22 | +To replicate the exact results and figures of the paper, use [this code](https://github.com/ML-KULeuven/klay/tree/d3b81491c34603ba9271d25af7c789d3ba368ede). |
56 | 23 |
|
57 | | -### MNIST-addition experiments |
58 | | -```bash |
59 | | -python experiments/mnist_addition/run.py -d cuda -b 128 -n 2 |
60 | | -``` |
| 24 | +```bibtex |
| 25 | +@inproceedings{ |
| 26 | + maene2025klay, |
| 27 | + title={{KL}ay: Accelerating Arithmetic Circuits for Neurosymbolic {AI}}, |
| 28 | + author={Jaron Maene and Vincent Derkinderen and Pedro Zuidberg Dos Martires}, |
| 29 | + booktitle={The Thirteenth International Conference on Learning Representations}, |
| 30 | + year={2025}, |
| 31 | + url={https://openreview.net/forum?id=Zes7Wyif8G} |
| 32 | +} |
| 33 | +``` |
0 commit comments