Procedural Refinement by LLM-driven Algorithmic Debugging for ARC-AGI-2

Yuning Qiu, Linfeng Zou, Jiong-Da Wang, Xue-Rong Yuan, Wang-Zhou DaiNeurIPS 2026

TL;DR

When Large Language Models (LLMs) write code to solve abstract reasoning puzzles and fail, telling them "your output was wrong" rarely helps them fix the underlying flaw in their logic. By reviving a classic 1982 AI debugging technique using Prolog, the authors turn messy program failures into structured "proof trees" of intermediate decisions. This neuro-symbolic approach lets LLMs pinpoint exactly where their hypothesized rule went off the rails, substantially boosting performance on notoriously tough reasoning benchmarks like ARC-AGI-2.

What Problem Does This Paper Address?

Imagine trying to deduce a hidden rule from just two or three visual examples—say, how colored shapes transform on a grid—and applying it to a new case. LLMs often tackle this abstract rule induction by writing executable programs. Naturally, their first draft is frequently wrong.

Standard "self-correction" loops feed the compiler error or the wrong final grid back to the LLM and ask it to try again. The catch? A program can run without syntax errors and still encode the wrong abstraction (for instance, checking if two nodes are two steps apart instead of checking if they are connected by a path of any length). Outcome-level feedback tells the model that it failed, not which logical assumption caused the failure. Without structured diagnostic evidence, iterative code repair often stalls or even makes the code worse.

Methods

The authors introduce Abduction-Based Procedural Refinement (ABPR), a neuro-symbolic loop that treats an LLM's candidate program as a formal, testable hypothesis about the hidden rule.

Instead of Python, ABPR has the LLM write rules in Prolog, a declarative logic programming language. Why Prolog? Because it evaluates queries by breaking big goals into smaller subgoals (a process called SLD resolution). The authors pair the LLM with a lightweight Prolog meta-interpreter—a program that watches the candidate program run and builds a compact, tree-structured map of every goal, subgoal, and variable binding along the way.

Figure 1: ABPR refinement and an illustrative local diagnosis. The meta-interpreter exposes goal– subgoal derivations for semantic inspection. Diagnosis and repair share one model request in the ARC implementation.

What’s classic here is the foundation: Ehud Shapiro’s 1982 Algorithmic Program Debugging (APD), which traverses proof trees to isolate a "locally faulty" step (where sub-computations are right, but the parent conclusion is wrong). What’s novel is approximating both the diagnostic oracle and the repair engine with an LLM via abductive reasoning—inferring the minimal local tweak needed to make the proof tree match the training examples. To handle the randomness of LLM sampling, ABPR runs 8 parallel search threads up to a depth of 10 iterations, keeping the best-performing hypotheses.

Datasets

  • ARC-AGI-2 (Public Evaluation Set): The primary testbed, featuring 120 few-shot visual grid-transformation tasks designed to resist simple memorization.
  • Adapted I-RAVEN-X & A-I-RAVEN: To ensure the method isn't just a grid-hacking trick, the authors created supplementary, text-based symbolic adaptations of these analogical matrix-reasoning benchmarks. Rather than picking from multiple-choice images, models must generate the hidden panel's symbolic attributes from scratch.
Example of an ARC-AGI-2 grid transformation task.

Key Insights and Ideas

  • Debugging derivations beats debugging outcomes: Exposing intermediate logical commitments (goal–subgoal trees) turns a daunting whole-program rewrite into a localized, low-entropy verification problem—playing directly to the known strength of LLMs being better verifiers than generators.
  • Refinement is local (garbage in, stuck out): Cross-model experiments revealed a sharp boundary condition. Models like Claude-Sonnet-4.5 and Qwen3-Max struggled miserably when refining their own weak initial Prolog programs. Yet, when handed stronger initial programs generated by Gemini-3-Pro, those exact same models became highly effective debuggers! ABPR needs an initial hypothesis that lands in a "repairable neighborhood" of the true rule.

Key Results

On ARC-AGI-2 (scored via Pass@2, where two selected programs get a shot at the test grid), adding semantic derivation traces consistently outperformed standard iterative repair (which only sees wrong outputs and runtime errors):

  • Gemini-3-Flash jumped from 34.17% (first pass) to 49.17% (execution-feedback repair), reaching 56.67% with ABPR (+7.50 percentage points over standard repair).
  • Gemini-3-Pro rose from 31.11% to 43.33% with execution feedback, hitting 53.33% with ABPR (+10.00 points).
  • GPT-5.2 (low reasoning) climbed from 8.33% to 19.17%, and reached 30.00% with ABPR (+10.83 points).
  • Cross-model boosts: Using Qwen3-Max alone yielded just 2.50% after repair, but pairing Qwen3-Max's ABPR repair with Gemini-3-Pro's initial programs boosted accuracy from 30.83% to 48.33%.
  • Transfer to RAVEN: On symbolic I-RAVEN-X and A-I-RAVEN-style suites, Prolog ABPR hit 88.60% and 93.60% accuracy, respectively—vaulting past Prolog execution-feedback baselines (39.60% and 34.00%) and even edging out strong Python repair baselines (81.60% and 88.60%).

Limitations and Future Work

Because the LLM acts as an approximate oracle, formal execution traces don't guarantee infallible diagnoses or minimal code edits. The approach is also bottlenecked by the LLM's ability to write decent initial Prolog code, relies heavily on proprietary models, and incurs higher compute costs—on Gemini-3-Pro, ABPR costs roughly 23% more per task in tokens than standard execution-feedback repair. Furthermore, the authors note that potential training-data contamination on public ARC tasks cannot be ruled out simply by switching languages to Prolog. For future work, they suggest testing ABPR on new domains like string-rewrite induction (PBEBench) and synthesized logical reasoning tasks (SLR).

Summary updated

Abstract

In high-complexity abstract reasoning, a system must infer a latent rule from a few examples or structured observations and apply it to unseen instances. Large language models (LLMs) can express such rules as programs, but ordinary conversation-based refinement is largely outcome-level: it observes that an answer or output is wrong without formally re-checking which abstraction, relation, or transformation justified that outcome. We propose Abduction-Based Procedural Refinement (ABPR), a neuro-symbolic refinement approach that couples an LLM with a Prolog meta-interpreter. ABPR treats each candidate program as an executable declarative hypothesis of the latent rule and reifies its selective linear definite-clause (SLD) resolution into compact goal–subgoal derivations, following Shapiro's algorithmic program debugging (APD). The resulting traces expose intermediate decisions in the model's hypothesised rule for semantic re-checking. We evaluate ABPR primarily on ARC-AGI-2, a challenging few-shot abstract rule induction benchmark over grid transformations. On the public evaluation set, ABPR improves Pass@2 over outcome-level execution-feedback repair by 7.50, 10.00, and 10.83 percentage points for Gemini-3-Flash, Gemini-3-Pro, and GPT-5.2 low, respectively. Python checkpoint controls and resource accounting clarify the language and compute boundaries of these gains. Supplementary symbolic, generative adaptations of I-RAVEN-X and A-I-RAVEN test transfer to a second program-induction setting. The evidence is limited by public-benchmark exposure, initializer quality, and additional token cost.
BibTeX
@inproceedings{qiu2026procedural,
  author = {Yuning Qiu and Linfeng Zou and Jiong-Da Wang and Xue-Rong Yuan and Wang-Zhou Dai},
  title = {{Procedural Refinement by LLM-driven Algorithmic Debugging for ARC-AGI-2}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=kEvf2Ms1q9},
}
Figure