# Scallop: A Language for Neurosymbolic Programming

**Authors:** Ziyang Li, Jiani Huang, Mayur Naik  
**arXiv:** [2304.04812](https://arxiv.org/abs/2304.04812)  
**Date:** 2023-04-10  
**Summary page:** https://www.summarizepaper.com/en/arxiv-id/2304.04812v1/

## Key points

- Scallop is a novel language that combines deep learning and logical reasoning for neurosymbolic applications
- Three key features of Scallop: flexible symbolic representation, declarative logic programming language, and framework for automatic and efficient differentiable reasoning
- Scallop's benchmarks cover various tasks involving perception and reasoning, including image recognition, natural language processing, knowledge base inference, arithmetic operations, comparison operations, negation operations, counting operations over images or digits from MNIST dataset
- Scallop provides machine learning programmers with a succinct interface to integrate logical domain knowledge while yielding solutions comparable or superior to state-of-the-art models in terms of accuracy and outperforming them in aspects such as runtime efficiency, data efficiency, interpretability, and generalizability
- The paper presents an illustrative overview of Scallop using an RL-based planning application called PacMan-Maze

## Summary

Scallop is a novel language that combines the advantages of deep learning and logical reasoning to enable users to write a wide range of neurosymbolic applications and train them in a data- and compute-efficient manner. The language achieves this through three key features: a flexible symbolic representation based on the relational data model, a declarative logic programming language based on Datalog that supports recursion, aggregation, and negation, and a framework for automatic and efficient differentiable reasoning based on the theory of provenance semirings. In this paper, the authors present an overview of their benchmarks covering a wide spectrum of tasks involving perception and reasoning. These tasks include image recognition, natural language processing, knowledge base inference, arithmetic operations, comparison operations, negation operations, counting operations over images or digits from MNIST dataset. The authors evaluate Scallop's performance on these benchmarks using various state-of-the-art models as baselines. The authors demonstrate that Scallop is capable of expressing algorithmic reasoning in diverse and challenging AI tasks while providing machine learning programmers with a succinct interface to integrate logical domain knowledge. Moreover, Scallop yields solutions that are comparable or superior to state-of-the-art models in terms of accuracy while outperforming these models in aspects such as runtime efficiency, data efficiency, interpretability, and generalizability. Additionally, the paper presents an illustrative overview of Scallop using an RL-based planning application called PacMan-Maze. This application involves an intelligent agent realizing a sequence of actions in a simplified version of the PacMan maze game. The authors demonstrate how Scallop can be used to solve this problem efficiently. Overall, this paper presents Scallop as an innovative approach towards combining deep learning with logical reasoning for developing neurosymbolic applications. The results presented in this paper show that Scallop has great potential for advancing research in AI by enabling more efficient training and development of complex systems that require both symbolic reasoning capabilities and deep learning.
