TL;DR
Neurosymbolic Visual Question Answering (VQA) systems combine deep learning for perception with formal logic for reasoning, but manually updating their logic rules as task requirements change is a major developer bottleneck. This paper introduces a framework that automatically distills Answer-Set Programming (ASP) rules from Large Language Models (LLMs) using an ASP solver feedback loop. By leveraging just a handful of examples for guidance, validation, and automated rule mending, the approach successfully extends reasoning modules with near-perfect accuracy.
What Problem Does This Paper Address?
Visual Question Answering (VQA) requires a system to understand an image and execute complex chains of reasoning to answer a text-based question. While end-to-end deep learning models can do this, modular neurosymbolic systems are highly favored because they are transparent and interpretable. They typically use neural networks to parse images into "scene graphs" and questions into "functional programs," then hand these symbolic representations over to a logic engine—like an Answer-Set Programming (ASP) solver—to compute the final answer.
However, these systems suffer from a maintenance bottleneck. If a user introduces a new type of question or a new reasoning operator, a developer must manually write or modify the underlying ASP rules. Traditional data-driven rule learning (like Inductive Logic Programming) struggles here because it requires massive amounts of training data or highly rigid, manually defined search spaces. The authors tackle this challenge by asking: Can we use LLMs as interactive copilots to automatically generate and refine these formal logic rules?
Methods
The authors propose a declarative knowledge distillation framework that operates via an iterative, solver-driven feedback loop (Algorithm 1):
- Prompting with Context: The LLM is given a comprehensive "preprompt" detailing ASP syntax, the dataset's scene/question representations, and the initial, incomplete ASP theory.
- Candidate Generation: To maximize the chances of success, the framework uses three synergetic prompting strategies simultaneously: multi-prompting (asking for 5 alternative rule sets at once) and two variations of Chain-of-Thought (CoT) prompting (instructing the model to map out if-then conditions before writing code).
- Syntactic & Semantic Mending: The generated rules are tested using an actual ASP solver (
clingo). If the solver returns a syntax error, the error message is fed back to the LLM for syntactic mending. If the rules run but yield the wrong answer, the incorrect output is sent back for semantic mending. - Regression Testing: To prevent the LLM from fixing the current problem while breaking past logic, new rules must pass a regression test against all previously validated examples.
- Redundancy Pruning: Because LLMs often generate superfluous or overly specific rules, the authors introduce a post-processing heuristic (Algorithm 2) that systematically drops rules and checks if the dataset accuracy remains unchanged, yielding a compact, interpretable final theory.
Datasets
The framework was evaluated across three distinct and diverse VQA datasets:
- GQA: Real-world images depicting complex visual scenes paired with structured, multi-step questions.
- CLEVR: A standard benchmark featuring synthetic geometric objects (cubes, spheres) designed to test compositional spatial reasoning.
- CLEGR$^V$: A recently introduced dataset consisting of transit network graphs, requiring complex, recursive graph-based reasoning (e.g., finding the shortest path between stations).
Key Insights and Ideas
- Soft vs. Hard Search Spaces: Unlike traditional Inductive Logic Programming (ILP) which relies on strictly defined "mode declarations" to restrict the rule search space, LLMs operate within a soft search space implicitly encoded via natural language prompts. This makes the framework highly adaptable without requiring developers to mathematically define language biases.
- The Few-Shot "Fixpoint": The distillation process is incredibly data-efficient. The LLM typically reaches a "fixpoint" after seeing just 1 to 4 examples. Once it hits upon a rule general enough to cover the underlying logic of a question type, presenting more examples yields no further changes.
- Model Archetypes: The authors identified three distinct behaviors based on the LLM's size and capability:
- Overburdened Models (e.g., LLaMA3-70b, Mistral-Large): Complex prompting strategies like CoT actually hindered performance, as the prompt overhead overwhelmed their reasoning limits.
- Balanced Models (e.g., GPT-4o, DeepSeek): These models effectively leveraged the full pipeline (mending, CoT, multi-prompting) to bridge reasoning gaps.
- Saturated Models (e.g., Gemini-3 Pro): Equipped with a native "high-reasoning" mode, Gemini-3 was so precise it targeted the exact logic immediately, rendering mending and complex prompts redundant and producing zero redundant rules.
Key Results
The authors simulated an incomplete system by intentionally removing specific primitive predicates (like select, exist, count, or shortest_path) from the ASP theories and tasking the framework with recovering them.
- Near-Perfect Restoration: Top-tier models like GPT-4o and Gemini-3 consistently restored the missing logic, achieving 98% to 100% accuracy on the full test suites for GQA and CLEVR.
- Conquering Recursion: The graph-based CLEGR$^V$ dataset proved the most challenging due to its reliance on recursive rules. While smaller models failed entirely, Gemini-3 achieved 100% accuracy on complex predicates like
shortest_pathandcycle. - Pruning Efficiency: The redundancy heuristic successfully minimized the rule sets. For instance, while GPT-4o explored widely and required heavy pruning (dropping up to 8.8 redundant rules for CLEVR's
uniquepredicate), Gemini-3 directly generated clean, minimal code blocks.
Limitations and Future Work
While powerful, the method assumes that the target VQA dataset features decomposable, compositional question semantics that can be cleanly mapped to logic. It remains highly sensitive to how prompts are structured. Furthermore, rule correctness is validated empirically through dataset testing rather than via formal verification.
Moving forward, the authors plan to explore prompt tuning to better specialize LLMs for ASP generation. They also aim to extend this framework beyond static VQA to dynamic and temporal domains (such as biomedical knowledge bases and real-time monitoring systems) using temporal logic extensions like telingo.
Summary updated