Foundations and Trends® in Programming Languages > Vol 8 > Issue 2

Neurosymbolic Programming in Scallop: Principles and Practice

By Ziyang Li, University of Pennsylvania, USA, liby99@seas.upenn.edu | Jiani Huang, University of Pennsylvania, USA, jianih@seas.upenn.edu | Jason Liu, University of Pennsylvania, USA, jasonhl@seas.upenn.edu | Mayur Naik, University of Pennsylvania, USA, mhnaik@seas.upenn.edu

 
Suggested Citation
Ziyang Li, Jiani Huang, Jason Liu and Mayur Naik (2024), "Neurosymbolic Programming in Scallop: Principles and Practice", Foundations and Trends® in Programming Languages: Vol. 8: No. 2, pp 118-249. http://dx.doi.org/10.1561/2500000059

Publication Date: 30 Dec 2024
© 2024 Z. Li et al.
 
Subjects
Language paradigms,  Programming language implementation,  Deep learning,  Relational learning
 

Free Preview:

Download extract

Share

Download article
In this article:
1. Introduction
2. Basics of Programming in Scallop
3. Core Reasoning Framework
4. Scallop in Practice: End-to-End Examples
5. Programming with Foundation Models
6. Advanced Applications
7. Conclusion
References

Abstract

Neurosymbolic programming combines the otherwise complementary worlds of deep learning and symbolic reasoning. It thereby enables more accurate, interpretable, and domain-aware solutions to AI tasks. We introduce Scallop, a general-purpose language and compiler toolchain for developing neurosymbolic applications. A Scallop program specifies a suitable decomposition of an AI task's computation into separate learning and reasoning modules. Learning modules are built using existing machine learning frameworks and range from custom neural models to foundation models for language, vision, and multi-modal data. Reasoning modules are specified in a declarative logic programming language based on Datalog which supports expressive features such as recursion, aggregation, negation, and probabilistic programming over structured relations.

Scallop's compiler enables to automatically train neurosymbolic programs in a data- and compute-efficient manner using an end-to-end differentiable reasoning framework. Scallop also supports features useful for building real-world applications such as user-defined data types, and foreign interfaces. We demonstrate programming in Scallop for applications that span the domains of image and video processing, natural language processing, planning, and information retrieval in a variety of learning settings such as supervised learning, reinforcement learning, rule learning, contrastive learning, and in-context learning.

DOI:10.1561/2500000059
ISBN: 978-1-63828-484-0
146 pp. $90.00
Buy book (pb)
 
ISBN: 978-1-63828-485-7
146 pp. $155.00
Buy E-book (.pdf)
Table of contents:
1. Introduction
2. Basics of Programming in Scallop
3. Core Reasoning Framework
4. Scallop in Practice: End-to-End Examples
5. Programming with Foundation Models
6. Advanced Applications
7. Conclusion
References

Neurosymbolic Programming in Scallop: Principles and Practice

Neurosymbolic programming combines the otherwise complementary worlds of deep learning and symbolic reasoning. It thereby enables more accurate, interpretable, and domain-aware solutions to Artificial Intelligence (AI) tasks. This monograph introduces Scallop, a general-purpose language and compiler toolchain for developing neurosymbolic applications. A Scallop program specifies a suitable decomposition of an AI task’s computation into separate learning and reasoning modules. Learning modules are built using existing machine learning frameworks and range from custom neural models to foundation models for language, vision, and multi-modal data. Reasoning modules are specified in a declarative logic programming language based on Datalog which supports expressive features such as recursion, aggregation, negation, and probabilistic programming over structured relations. Scallop’s compiler enables to automatically train neurosymbolic programs in a data- and compute-efficient manner using an end-to-end differentiable reasoning framework. Scallop also supports features useful for building real-world applications such as user-defined data types, soft logic operations, and foreign interfaces.

This monograph demonstrates programming in Scallop for applications that span the domains of image and video processing, natural language processing, planning, and information retrieval in a variety of learning settings such as supervised learning, reinforcement learning, rule learning, contrastive learning, and in-context learning.

 
PGL-059