Skip to content

Latest commit

 

History

110 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NeurASP

This is the implementation of NeurASP: Embracing Neural Networks into Answer Set Programming.

Introduction

NeurASP is a simple extension of answer set programs by embracing neural networks. By treating the neural network output as the probability distribution over atomic facts in answer set programs, NeurASP provides a simple and effective way to integrate sub-symbolic and symbolic computation. This repository includes examples to show

  1. how NeurASP can make use of pretrained neural networks in symbolic computation and how it can improve the perception accuracy of a neural network by applying symbolic reasoning in answer set programming; and
  2. how NeurASP is used to train a neural network better by training with rules so that a neural network not only learns from implicit correlations from the data but also from the explicit complex semantic constraints expressed by ASP rules.

Installation

  1. We assume Anaconda is installed. One can install it according to its installation page.
  2. Clone this repo:
git clone https://github.com/azreasoners/NeurASP
cd NeurASP
  1. Create a virtual environment neurasp. Install clingo (ASP solver) and tqdm (progress meter).
conda create --name neurasp python=3.9
conda activate neurasp
conda install -c potassco clingo=5.5 tqdm
  1. Install Pytorch according to its Get-Started page. Below is an example command we used on Linux with cuda 10.2. (PyTorch version 1.12.0 is tested.)
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch

Examples

We provide 3 inference and 10 learning examples as shown below. Each example is stored in a separate folder with a readme file.

Inference Examples

Learning Examples

Citation

Please cite the original paper as:

@inproceedings{ijcai2020p243,
  title     = {NeurASP: Embracing Neural Networks into Answer Set Programming},
  author    = {Yang, Zhun and Ishay, Adam and Lee, Joohyung},
  booktitle = {Proceedings of the Twenty-Ninth International Joint Conference on
               Artificial Intelligence, {IJCAI-20}},
  publisher = {International Joint Conferences on Artificial Intelligence Organization},
  editor    = {Christian Bessiere},
  pages     = {1755--1762},
  year      = {2020},
  month     = {7},
  note      = {Main track},
  doi       = {10.24963/ijcai.2020/243},
  url       = {https://doi.org/10.24963/ijcai.2020/243},
}

The follow-up paper that includes the speed improvements to NeurASP and the card arithmetic dataset can be cited as:

@article{rader2026accelerating_neurasp,
    title={Accelerating NeurASP with Vectorization and Caching},
    DOI={10.1017/S1471068426100611},
    journal={Theory and Practice of Logic Programming},
    author={Rader, Alexander Philipp and Russo, Alessandra},
    year={2026},
    pages={1–16}
}

About

No description, website, or topics provided.

Resources

Stars

55 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages