Accelerating NeurASP with vectorization and caching
Abstract Overview
This paper studies the computational bottlenecks of NeurASP, a neuro-symbolic framework that trains neural networks through ASP-based reasoning when only downstream labels are available. The authors target the expensive answer-set, probability, and gradient computations used during semantic-loss training by redesigning the implementation around vectorization, batch processing, and caching. A central observation is that answer sets depend on the downstream label rather than the individual input, enabling reuse across many examples with the same label. To evaluate the revised system, the paper reports synthetic timing tests, benchmark experiments on MNIST-based tasks, and a new playing-card reasoning benchmark with 52 latent concepts.
Novelty
The main novelty is an implementation-level reworking of NeurASP that combines tensorized probability/gradient computation with label-level answer set caching instead of example-level caching. The paper also introduces the Card arithmetic benchmark, which expands evaluation beyond small MNIST-style settings and exposes issues such as reasoning shortcuts in semantic-loss training.
Results
The improved implementation delivers substantial speed gains: synthetic tests show roughly two orders of magnitude acceleration for probability calculations and three orders for gradients relative to the original NeurASP, with reported 100x average improvement over SLASH. On end-to-end benchmarks, runtimes drop from minutes to seconds on easier tasks and from days or more to hours on harder card tasks, while the system remains trainable on problems with tens of thousands of answer sets. In accuracy terms, the improved NeurASP matches Embed2Sym on MNIST addition and Member tasks, and completes the card tasks where Embed2Sym times out after 24 hours.
Key Points
- NeurASP's main scalability limits come from repeated ASP calls and loop-based probability/gradient computations during semantic-loss training.
- The proposed optimizations include vectorized tensor operations, batched data loading, and caching answer sets once per unique downstream label, which sharply reduces Clingo calls and training cost.
- The new Card arithmetic benchmark shows that improved NeurASP can handle larger latent spaces and more complex reasoning tasks, while also revealing shortcut behavior where downstream correctness can hide incorrect latent predictions.