Tracing and Correcting Programs: Critic-Guided Synthesis for Visual Reasoning

Marha Midhatiey Rusli, Donghyeon Shin, Sejin Kim, Sundong KimAAAI 2026

TL;DR

This paper introduces Tracing and Correcting Programs (TCP), a novel framework that tackles the challenge of program synthesis for complex reasoning tasks. Instead of discarding flawed programs, TCP uses a "critic" module to analyze execution errors, provide structured feedback, and iteratively refine the code, achieving significant improvements with drastically fewer samples.

What Problem Does This Paper Address?

Generating correct programs for complex reasoning tasks, especially those involving visual understanding like the Abstraction and Reasoning Corpus (ARC), is notoriously difficult. Initial attempts by AI models often produce programs with subtle logical errors. Traditional approaches involve generating and testing a massive number of candidate programs, which is computationally expensive and inefficient. The paper aims to bridge this gap by proposing a more efficient and systematic method for program repair and refinement.

Methods

TCP employs an iterative "critic-guided refinement" loop. Here's a breakdown of the key components:

  • Program Generator (LLM): A Large Language Model (LLM) generates candidate Python programs based on input-output examples of an ARC task.
  • Executor: The generated program is run to produce an output.
  • Evaluator (Critic Module): This module assesses the program's output by calculating pixel-wise accuracy and providing a verdict (e.g., "exact match," "shape mismatch"). Crucially, it analyzes the execution trace to pinpoint errors.
  • Feedback and Strategy Engine: Based on the pixel-wise accuracy, the critic module generates structured feedback at different levels of detail (summary, detailed, or pixel-level). Simultaneously, it selects an appropriate "strategy" for refinement, ranging from a complete rewrite to a fine-tune.
  • Iterative Refinement: The LLM is then prompted with the original task, the flawed program, the structured feedback, and the chosen strategy to generate an improved candidate. This process repeats, with the best-performing program becoming the "champion" and guiding subsequent refinements. This "champion-challenger" approach ensures that only programs showing improvement are kept.

The system also incorporates:

  • Adaptive Sampling: The number of candidate programs generated per iteration is dynamically adjusted based on the chosen strategy.
  • Temperature Adaptation: A mechanism to control the exploration-exploitation balance during refinement, adjusting based on iteration count and accuracy.
  • Hypothesis Tracking: To prevent repetitive errors and guide exploration by remembering previously attempted hypotheses.

Datasets

The primary dataset used for evaluation is the Abstraction and Reasoning Corpus (ARC), specifically the public portion which contains 800 tasks. The authors also mention using three sizes of Qwen2.5-Coder LLM models for experiments.

Key Insights and Ideas

  • The Power of Structured Feedback: The core idea is that instead of brute-force generation, providing specific, diagnostic feedback from a "critic" is far more effective for guiding LLMs to correct their reasoning errors.
  • Iterative Repair Over Discarding: The framework shifts from a "generate-and-test" paradigm to a "trace-and-correct" one, valuing refinement over discarding flawed attempts.
  • Adaptive Granularity is Key: The system intelligently adjusts the level of feedback and the refinement strategy based on the program's current accuracy, ensuring efficient use of computational resources. More detailed feedback and drastic strategies are used for low accuracy, while fine-grained fixes are applied when the solution is nearly perfect.
  • LLMs as Debuggers: This work positions LLMs not just as code generators but as capable debuggers that can analyze their own reasoning traces and iteratively improve their output.

Key Results

  • High Improvement Rates: TCP significantly improves upon initial program synthesis attempts, achieving up to a 68.1% improvement in accuracy on the ARC benchmark.
  • Exceptional Sample Efficiency: TCP requires only an average of 7-8 samples per task to find complete solutions, a reduction of 300-400x compared to methods that evaluate hundreds or thousands of candidates.
  • Model Agnosticism and Scaling: The framework demonstrates robust performance across different LLM sizes (7B, 14B, and 32B Qwen models), with larger models generally achieving higher solve rates.
  • Competitive Solve Rate: TCP solves 159 out of 800 ARC tasks, and importantly, it significantly improves a large majority of the remaining tasks.
  • Ablation Studies Confirm Critic's Importance: Removing the critic module drastically reduces performance, highlighting its critical role in guiding effective refinement.

Limitations and Future Work

  • Efficiency vs. Solve Rate Trade-off: While TCP excels in efficiency, it solves fewer tasks than some prior methods that might rely on more extensive search or larger models. The authors position TCP as a complementary approach that can enhance existing solvers.
  • Future Work: The authors suggest exploring adaptive or learned critics, where the critic itself can be refined based on patterns of partial success. They also envision applying this trace-and-correct paradigm to other domains requiring structured reasoning and verification, such as formal proofs or robotic planning. The potential for LLMs to act as sophisticated debuggers is a key future direction.

Summary updated

BibTeX
@inproceedings{rusli2026tracing,
  author = {Marha Midhatiey Rusli and Donghyeon Shin and Sejin Kim and Sundong Kim},
  title = {{Tracing and Correcting Programs: Critic-Guided Synthesis for Visual Reasoning}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2026},
  url = {https://openreview.net/forum?id=6sB1rHJ1BN},
}
Figure