Code to the reproduce the experiments of the paper "On the Hardness of Probabilistic Neurosymbolic Learning" (ICML 2024).
Install d4 and EvalMaxSAT, for exact compilation and MaxSat solving, respectively. Furthermore, make sure the following python libraries are installed.
pip install numpy torch pycmsgen problog pysdd tqdm matplotlib scienceplots
The MCC benchmarks can be downloaded in dimacs format at:
Note that we only use the weighted model counting track (track2
). The different benchmarks should be saved in the data
folder.
The Road-R benchmark is already included.
Note that Windows is not supported. The random weights of the MCC benchmarks are generated using
python scripts/reweight_instances.py
First, generate the d-DNNF circuits with d4. (This will take a while.)
python scripts/run_d4.py
Next, we can evaluate these circuits in d4 to get the exact gradients. (This will take a while. For the largest circuits, 256GB RAM is necessary.)
python scripts/nnf_to_grads.py
Finally, we can run one of the approximate methods.
python scripts/run_approx_solver.py
You can select the specific method and hyperparameters at the bottom of the file. (To run all methods and with multiple hyperparameters, its recommended to parallize this over multiple machines.)
Similarly, the training experiments can be run using
python scripts/run_training.py
Once all experiments have finished running, the figures and table of the paper can be generated using
python scripts/aggregate_results.py
@InProceedings{maene2024hardness,
title = {{O}n the {H}ardness of {P}robabilistic {N}eurosymbolic {L}earning},
author = {Maene, Jaron and Derkinderen, Vincent and De Raedt, Luc},
booktitle = {Proceedings of the 41st International Conference on Machine Learning},
pages = {34203--34218},
year = {2024},
editor = {Salakhutdinov, Ruslan and Kolter, Zico and Heller, Katherine and Weller, Adrian and Oliver, Nuria and Scarlett, Jonathan and Berkenkamp, Felix},
volume = {235},
series = {Proceedings of Machine Learning Research},
month = {21--27 Jul},
publisher = {PMLR},
}