Back to Feed
Reasoning / Multimodal

Teaching AI to Write Logical Rules for Visual Questions

Original: Distilling Answer Set Programming Theories from Large Language Models

Listen to the summary

Uses a voice available on your device

Audio options
On this page

Key Takeaways

  • Frontier artificial intelligence models like Claude Sonnet 4.6 and Opus 4.7 can successfully derive one hundred percent accurate logical theories for visual reasoning datasets from scratch.
  • The evaluation uses a fixed open source agent environment where the model edits theory files and runs a logic solver inside a secure container.
  • Providing pre-written reference logic theories from other datasets helps some models slightly, but significantly hurts the performance of GPT-5.
  • Smaller or open weight models struggle with basic tasks, frequently failing to format tool calls correctly or generating malformed code.

Summary & Methodology Analysis

The paper explores a novel method for tackling visual question answering, which involves answering questions about images using a combination of perception and logical reasoning. Traditionally, neurosymbolic pipelines, meaning systems that combine neural networks with symbolic logic, require manual effort to write logical rules. Instead, this paper uses an automated loop where an artificial intelligence agent starts with an empty rule file and interacts with a solver to learn how to solve the task. The agent has access to file editing tools and a command line interface to run a logic solver called clingo and check for syntax errors. Each model is given a one-hour time limit to read a small batch of training examples, test its logic rules, and refine them before being evaluated on hidden validation data. This entire setup runs inside isolated secure containers to keep the environment safe and controlled. The methodology relies on a dataset agnostic protocol, meaning the exact same prompt and interaction structure are used regardless of the underlying visual dataset.

When testing different artificial intelligence models, the researchers found a stark divide between frontier and sub-frontier systems. Top models like Claude Sonnet 4.6, Claude Opus 4.7, and DeepSeek V4 Pro achieved near perfect accuracy on visual reasoning benchmarks such as CLEVR, scoring around one hundred percent. However, other models exhibited significant failure modes. For instance, GPT-5 experienced major performance drops when given pre-written reference theories from other datasets, sometimes seeing its accuracy plummet by nearly twenty percentage points. Smaller open weight models struggled with basic execution; some generated malformed tool names that the system rejected, while others failed to parse valid code or simply terminated their sessions after only one or two tool calls without writing any rules. This highlights that successful logical theory distillation requires robust instruction following and tool use capabilities, not just raw scale.

The study comes with notable limitations that point toward areas for future work. The evaluation was restricted to a small number of samples per configuration, specifically three seeds per setup with two hundred validation examples each, limiting statistical power. The one-hour time limit might also truncate longer reasoning refinements that could otherwise succeed. Furthermore, the exact reason why GPT-5 performs worse when provided with reference theories remains unconfirmed, though observations suggest that longer references might consume valuable context budget and lead to shorter, less effective generated rules. Finally, the agent protocol was only tested on visual question answering benchmarks, leaving its ability to generalize to other logical reasoning domains untested.

Interactive System Flowchart

Click diagram to expand and zoom

Cross-Examination & FAQs

A deeper dive clarifying mechanics, constraints, and baseline evaluations.

Q1. What is the main goal of this research?

The paper investigates whether large language models can automatically write complete and correct Answer Set Programming theories from scratch to solve visual question answering tasks.

Q2. What is visual question answering?

Visual question answering is a task where an artificial intelligence must answer questions about images by combining visual perception with logical reasoning.

Q3. Which models performed the best in this study?

Claude Sonnet 4.6, Claude Opus 4.7, and DeepSeek V4 Pro achieved the highest scores, reaching up to one hundred percent accuracy on the CLEVR dataset.

Q4. What is a neurosymbolic pipeline?

A neurosymbolic pipeline is a standard system that combines neural perception modules to extract scene facts with a semantic parser and a symbolic logic engine to execute programs.

Q5. How are the artificial intelligence agents given access to the logic solver?

The agent runs inside an isolated Docker container and uses a restricted command line tool to run clingo, a solver that computes stable models from logic rules.

Q6. How does the iterative loop work?

The model reads training examples, runs the solver on its candidate logic rules, identifies errors, edits the rule file, and repeats this process until validation accuracy plateaus or a one-hour time limit is reached.

Q7. What happens when pre-written reference theories are provided to the models?

Adding handwritten reference theories from other datasets moves the accuracy of most frontier models by at most three point four percentage points, but it sharply reduces GPT-5 accuracy by three to nineteen percentage points.

Q8. How did smaller or open weight models perform?

Smaller models struggled significantly, with some models failing to format tool calls correctly, rarely emitting valid code, or terminating their sessions early without writing any rules.

Q9. What are the limitations regarding sample size and evaluation scope?

The study uses only three samples per configuration with two hundred validation examples each, and the protocol is only tested on visual question answering benchmarks without evaluating broader generalization.