← Latest papers
🤖 AI

Accelerating NeurASP with vectorization and caching

This paper enhances the scalability of the neurosymbolic framework NeurASP by implementing vectorization, batch processing, and caching to achieve multi-order-of-magnitude speedups in training, validated through a new challenging card-playing dataset.

Original authors: Alexander Philipp Rader, Alessandra Russo

Published 2026-06-10
📖 5 min read🧠 Deep dive

Original authors: Alexander Philipp Rader, Alessandra Russo

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

The Big Picture: Teaching a Robot to Think

Imagine you are trying to teach a robot to play a card game. You have a Neural Network (the robot's "intuition") that looks at pictures of cards and guesses what they are. You also have a set of Logic Rules (the robot's "brain" or "rulebook") that takes those guesses and figures out the final score.

The problem is that you only know the final score (e.g., "The total is 15"). You don't know what the robot guessed for each individual card (e.g., "Is that a 7 of Hearts or a 3 of Spades?").

In the past, the framework called NeurASP tried to learn this by guessing every possible combination of cards that could result in a score of 15, checking which ones worked, and then adjusting the robot's intuition. However, this process was like trying to count every grain of sand on a beach one by one. It was so slow that for complex tasks, the computer would simply give up and time out before finishing.

This paper introduces a supercharged version of NeurASP that makes this process thousands of times faster, allowing the robot to learn complex card games that were previously impossible.


The Three Bottlenecks (and how they were fixed)

The authors identified three main reasons why the original system was so slow, and they fixed each one with a clever trick.

1. The "Calculator" Problem (Vectorization)

The Old Way: Imagine a teacher asking a student to multiply numbers. The old NeurASP code asked the student to do the math one number at a time, in a long line. "Multiply 2 by 3. Okay, now multiply that by 4. Okay, now multiply that by 5..." This is very slow.
The New Way: The authors taught the computer to use Vectorization. Instead of doing math one by one, they gave the computer a giant calculator that can multiply a whole stack of numbers all at once. It's like switching from a single-lane dirt road to a 10-lane highway.

  • Result: Calculating probabilities and gradients (the math needed to learn) became 100 to 1,000 times faster.

2. The "Library" Problem (Caching)

The Old Way: Imagine you are solving a puzzle. Every time you see a puzzle piece, you walk to a library, find the solution for that specific piece, write it down, and then walk back. Even if you see the same piece 1,000 times, you walk to the library 1,000 times.
The New Way: The authors realized that the solution to a puzzle piece depends only on the final score, not on the specific picture of the card. If the final score is "15," the possible card combinations are always the same, no matter what the cards look like.
They built a Cache (a personal notebook). The first time they see a score of "15," they walk to the library, find the answer, and write it in the notebook. The next 999 times they see a "15," they just look in the notebook.

  • Result: Instead of asking the library for answers 30,000 times, they only asked 19 times (once for every possible score). This saved massive amounts of time.

3. The "Delivery" Problem (Batching)

The Old Way: The original code was like a delivery driver who dropped off one package, went back to the warehouse, picked up the next package, and drove back out.
The New Way: The new code uses Batch Processing. It loads a whole truck full of packages (data) and delivers them all in one trip. This is much more efficient for large datasets.


The New Challenge: "Card Arithmetic"

To prove their new system works, the authors created a new, difficult test called Card Arithmetic.

  • The Old Tests: Previous tests used simple numbers (like adding two digits from 0-9). It was like adding 2 + 3.
  • The New Test: They used real photos of playing cards. There are 52 different cards (Ace of Spades, 2 of Hearts, etc.), and the rules involve multiplying and adding their values.
  • The Difficulty: For a single game, there could be tens of thousands of different ways the cards could be arranged to get the right total.

The Results

When they ran the experiments:

  1. Speed: The new system finished tasks in minutes that the old system would have taken days, weeks, or months to complete. In some cases, the old system simply crashed (timed out) because it was too slow.
  2. Accuracy: The new system successfully learned the card games, achieving high accuracy even with the massive complexity of 52 different cards.
  3. Comparison: They compared their system to another framework called Embed2Sym. While Embed2Sym was good at simple tasks, it failed completely on the card games because it got stuck trying to solve the massive number of possibilities. NeurASP handled it easily.

A Quirk: "Reasoning Shortcuts"

The paper also noticed something interesting. Sometimes, the robot got the final score right but guessed the individual cards wrong.

  • Analogy: Imagine the rule is "3 of Clubs (value 6) + 2 of Spades (value 6) = 12." The robot might guess "6 of Hearts + 6 of Diamonds = 12." It got the math right, but the cards were wrong.
  • Because different cards can have the same mathematical value, the robot found a "shortcut" to get the right answer without learning the true identity of the cards. This shows that while the system is fast, it sometimes finds clever, but technically incorrect, ways to solve the puzzle.

Summary

The authors took a slow, clunky system for teaching AI to reason with logic and rules, and they turbocharged it. By organizing the math better (vectorization) and remembering past answers (caching), they turned a system that could barely handle simple addition into one that can master complex card games in a fraction of the time.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →