Hostname: page-component-76d6cb85b7-5qg8f Total loading time: 0 Render date: 2026-07-14T15:11:01.446Z Has data issue: false hasContentIssue false

Accelerating NeurASP with Vectorization and Caching

Published online by Cambridge University Press:  08 July 2026

ALEXANDER PHILIPP RADER
Affiliation:
Department of Computing, Imperial College London, UK (e-mails: apr20@ic.ac.uk, a.russo@imperial.ac.uk)
ALESSANDRA RUSSO
Affiliation:
Department of Computing, Imperial College London, UK (e-mails: apr20@ic.ac.uk, a.russo@imperial.ac.uk)
Rights & Permissions [Opens in a new window]

Abstract

Neurosymbolic AI combines neural networks with symbolic programs to create robust and explainable predictions. One such framework is NeurASP, which trains a neural network to predict concepts and reasons over them using rules written in answer set programming (ASP) to solve downstream tasks. Crucially, labels are only provided for the downstream prediction produced by the symbolic rules, not for the latent concepts themselves. Backpropagation through the non-differentiable ASP component requires expensive probability and gradient calculations, which has hindered scalability to more sophisticated tasks. In this paper, we address the current limitations of NeurASP by improving its computational performance through vectorization, batch processing, and caching of intermediate computations during training. We compare computation speeds between the original and our new implementation of NeurASP and report speedups of multiple orders of magnitude for larger tasks. To this end, we propose a new dataset of difficult tasks involving playing cards, which we use to test the capabilities of NeurASP’s enhanced learning function.

Information

Type
Original Article
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (https://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© The Author(s), 2026. Published by Cambridge University Press
Figure 0

Fig. 1. Fig. 1 long description.The inference procedure of NeurASP exemplified with an MNIST addition example.

Figure 1

Fig. 2. The learning procedure of NeurASP exemplified with an MNIST addition example.

Figure 2

Fig. 3. NeurASP probability calculation function.

Figure 3

Fig. 4. Fig. 4 long description.The computation times (seconds) for the probability and gradient calculations on synthetic data, comparing the original and improved NeurASP, as well as SLASH. Each point represents the average value over five runs and the shaded area represents the standard deviation. Note the logarithmic scale on both axes.

Figure 4

Table 1. Complexity of different tasks in terms of the average number of answer sets, the number of distinct downstream labels, the number of input images per example and the number of latent concepts per input

Figure 5

Table 2. Average execution times (seconds). Bold values indicate the fastest time. *Times with an asterisk were extrapolated as follows: We ran the framework for three epochs and summed together the first epoch statistics with the average of the second two epochs multiplied by the number necessary to match the final number of epochs.$^{\dagger }$For times with a dagger, both NeurASP and SLASH took multiple hours to process a few hundred datapoints. Therefore, no meaningful extrapolation of individual times was possibleTable 2 long description.

Figure 6

Table 3. Test accuracies for various tasks. Values indicate downstream and latent accuracy averages and standard deviations over five runs. We compare our improved NeurASP implementation and Embed2Sym. T/O indicates a time-out after 24 hours

Figure 7

Fig. 5. Differences between downstream and latent validation accuracies for card prodsum 2 over 5 runs.

Supplementary material: File

Rader and Russo supplementary material

Rader and Russo supplementary material
Download Rader and Russo supplementary material(File)
File 204.7 KB