Introduction
While end-to-end trainable models have made massive strides in computer vision, they often struggle with "compositional" reasoning—tasks that require multiple logical steps, external knowledge, or precise spatial manipulation. Training a single model to handle every possible niche task is computationally expensive and requires massive, curated datasets for every new scenario.
VisProg (Visual Programming) is a neuro-symbolic system designed to address these challenges by solving complex, multi-step visual reasoning tasks without any task-specific training. Instead of a monolithic "black box" model, VisProg decomposes natural language instructions into a sequence of simpler, executable steps that existing specialized tools can handle.
Methods
VisProg operates through a three-stage pipeline that leverages the in-context learning capabilities of Large Language Models (LLMs) like GPT-3 to orchestrate various off-the-shelf computer vision models and image processing subroutines.
- Program Generation: Using GPT-3’s in-context learning, the system is provided with a few examples of natural language instructions paired with corresponding "visual programs." When a new instruction arrives, GPT-3 generates a similar Python-like program.
- Program Execution: A dedicated interpreter runs the generated code line-by-line. Each line invokes a specific module.
- Modular Architecture: The system supports over 20 modules, including neural modules (like OWL-ViT for localization and CLIP for classification) and symbolic subroutines (Python functions for arithmetic and OpenCV for image processing).
A standout feature is the Visual Rationale. As the program executes, each module produces an HTML-based summary of its input and output. This creates an interpretable "trace" that allows users to see exactly where a reasoning chain succeeded or failed.
Evaluation and Key Results
The authors evaluated VisProg across four diverse tasks using several benchmarks: GQA (compositional VQA), NLVRv2 (reasoning on image pairs), Factual Knowledge Object Tagging, and Language-guided Image Editing.
- Compositional VQA: On GQA, VisProg achieved 50.5% accuracy, outperforming the base ViLT model by 2.7 points without any task-specific fine-tuning.
- Zero-Shot Reasoning: On NLVRv2, it reached 62.4% accuracy in a zero-shot setting, demonstrating a strong ability to reason across multiple images.
- Knowledge Tagging: It achieved an impressive 63.7% F1 score for tagging objects that require external knowledge (e.g., identifying specific TV characters), a task where standard object detectors typically fail.
- Interpretability Gains: By using visual rationales to "tune" instructions, accuracy jumped from 59.8% to 66.4% in image editing tasks.
Key Insights and Discussion
VisProg demonstrates that neuro-symbolic synergy—combining the linguistic understanding of LLMs with the precise execution of symbolic logic—provides a flexible, training-free alternative to traditional models. Because the system is interpretable, users can perform "instruction tuning": if a visual rationale shows a failure due to a vague query, the user can tweak the prompt to improve performance without retraining the underlying models.
However, the system has limitations. It is highly dependent on the accuracy of its underlying modules; if a face detector fails, the entire reasoning chain may collapse. Additionally, roughly 16% of errors in GQA were attributed to GPT-3 generating incorrect program logic. Future work may involve incorporating automated user feedback to allow the system to self-correct its programs over time.
Summary updated