NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Enhancing Visual Programming for Visual Reasoning via Probabilistic Graphs

Wentao Wan, Kaiyu Wu, Qingyang Ma, Nan Kang, Yunjie Chen, Liang Lin, Keze WangarXiv 2025 · DOI

Introduction

Visual Programming (VP) has emerged as a powerful neuro-symbolic paradigm for complex visual reasoning. In this approach, a Large Language Model (LLM) decomposes a high-level query into a sequence of modular steps, such as object detection or visual question answering (VQA). While this modularity offers transparency and interpretability, traditional VP workflows suffer from a critical limitation: they are non-differentiable. Because these programs rely on discrete operations (e.g., picking a single bounding box or label via argmax), errors in intermediate steps cannot be corrected using standard gradient-based optimization from the final task label.

This paper introduces EVPG (Enhanced Visual Programming via Probabilistic Graphs), a framework that transforms these discrete programs into differentiable probabilistic graphs. By enabling end-to-end fine-tuning using only final ground-truth answers, EVPG significantly enhances the performance of underlying vision models without requiring expensive intermediate sub-task annotations.

Methodology

Overview of the EVPG framework, illustrating the transformation of a visual program into a differentiable probabilistic graph for end-to-end learning.

Probabilistic Graph Construction

The core of EVPG is the conversion of a symbolic visual program into a directed probabilistic graph. In this graph, nodes represent input images, intermediate variables (such as bounding boxes or partial answers), and the parameters of the vision modules. Edges represent the probabilistic dependencies defined by the program logic. This structure allows the system to maintain the interpretability of a symbolic program while preparing it for mathematical optimization.

Differentiable Exact Inference

To overcome the non-differentiability of discrete selections, EVPG employs Variable Elimination. Instead of selecting a single "best" output at each step, the method calculates the exact probability distribution of the final answer by marginalizing out all intermediate variables. This process transforms the execution flow into a differentiable mathematical expression, allowing gradients to flow backward from the final loss (e.g., cross-entropy between the predicted answer distribution and the ground truth) to the weights of the vision modules.

Curriculum Learning

Optimizing multi-step reasoning chains from scratch can be unstable. To mitigate this, the authors implement a four-stage curriculum learning strategy. Training begins with simple, single-step programs and progressively introduces more complex, multi-step reasoning tasks. This staged approach ensures that the vision models learn basic concepts before attempting to solve intricate compositional queries.

Experimental Evaluation

The authors evaluated EVPG across three rigorous visual reasoning benchmarks: GQA, NLVRv2, and Open Images (Visual CoT split). Using the BLIP model as the backbone, EVPG demonstrated substantial improvements over zero-shot baselines:

  • GQA: +3.7% accuracy improvement.
  • NLVRv2: +7.6% accuracy improvement.
  • Open Images: A significant +20.0% improvement, highlighting the method's efficacy in complex, multi-step reasoning scenarios.
Qualitative comparison showing how EVPG uses cross-entropy loss from the final answer to refine intermediate VQA modules and correct reasoning errors.

Qualitative analysis reveals that EVPG effectively identifies and corrects "key steps" in the reasoning process. As shown in the comparison above, the probabilistic framework allows the model to adjust the confidence of intermediate VQA modules, shifting the final prediction from an incorrect "no" to a correct "yes" through gradient-based updates.

Discussion and Insights

Cross-Task Generalization

A key finding of the study is that training on decomposed sub-tasks improves generalization. By focusing on localized image crops (e.g., identifying a specific attribute of an object), the vision models learn features that are more consistent across different datasets than those learned from full-scene images. This suggests that the neuro-symbolic decomposition acts as a form of inductive bias that aids robust feature learning.

Robustness to Program Noise

EVPG exhibits remarkable resilience to errors in the LLM-generated programs. Experiments showed that even when a portion of the programs contained logical errors or incorrect parameters, the probabilistic framework could "smooth over" these issues and still deliver performance gains. This robustness is vital for real-world applications where LLM outputs may not always be perfectly accurate.

Conclusion and Future Work

EVPG successfully bridges the gap between interpretable symbolic programming and efficient connectionist learning. By making visual programs differentiable, it allows for the continuous improvement of modular vision systems using only task-level supervision. Future research may explore scaling this approach to longer reasoning chains and extending the probabilistic graph framework to other domains, such as robotics and multi-modal document understanding.

Summary updated

BibTeX
@misc{wan2025enhancing,
  author = {Wentao Wan and Kaiyu Wu and Qingyang Ma and Nan Kang and Yunjie Chen and Liang Lin and Keze Wang},
  title = {{Enhancing Visual Programming for Visual Reasoning via Probabilistic Graphs}},
  year = {2025},
  eprint = {2512.14257},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.14257},
}
Figure