Skip to main content
QUICK REVIEW

[Paper Review] Visual Programming: Compositional visual reasoning without training

Tanmay Gupta, Aniruddha Kembhavi|arXiv (Cornell University)|Nov 18, 2022
Multimodal Machine Learning ApplicationsComputer Science7 citations
TL;DR

VisProg introduces a neuro-symbolic framework that generates executable, interpretable Python-like programs from natural language instructions to solve complex visual tasks without task-specific training. By leveraging in-context learning in GPT-3 and composing off-the-shelf vision and language models into modular programs, VisProg achieves strong zero-shot performance across diverse tasks such as visual question answering, knowledge tagging, and image editing, while producing comprehensive visual rationales for interpretability and error diagnosis.

ABSTRACT

We present VISPROG, a neuro-symbolic approach to solving complex and compositional visual tasks given natural language instructions. VISPROG avoids the need for any task-specific training. Instead, it uses the in-context learning ability of large language models to generate python-like modular programs, which are then executed to get both the solution and a comprehensive and interpretable rationale. Each line of the generated program may invoke one of several off-the-shelf computer vision models, image processing routines, or python functions to produce intermediate outputs that may be consumed by subsequent parts of the program. We demonstrate the flexibility of VISPROG on 4 diverse tasks - compositional visual question answering, zero-shot reasoning on image pairs, factual knowledge object tagging, and language-guided image editing. We believe neuro-symbolic approaches like VISPROG are an exciting avenue to easily and effectively expand the scope of AI systems to serve the long tail of complex tasks that people may wish to perform.

Motivation & Objective

  • To address the long-tail challenge of deploying AI systems on complex, compositional visual tasks that lack sufficient training data.
  • To enable zero-shot reasoning on visual tasks by decomposing natural language instructions into executable, modular programs.
  • To improve interpretability and user control in vision AI by generating visual rationales through intermediate program execution.
  • To demonstrate that no task-specific fine-tuning is required, relying instead on in-context learning and modular composition of pre-trained models.
  • To enable user-driven performance improvement through instruction tuning guided by visual rationales.

Proposed method

  • Uses in-context learning in GPT-3 to generate modular, executable programs from natural language instructions and a few demonstration examples.
  • Each line of the generated program invokes a specialized module—such as object detectors, CLIP for zero-shot classification, or OpenCV functions—processing intermediate outputs step-by-step.
  • Leverages pre-trained models like ViLT-vqa, OWL-ViT, and Stable Diffusion as off-the-shelf modules without fine-tuning.
  • Executes the program on input images to produce predictions and simultaneously logs intermediate outputs as a visual rationale for interpretability.
  • Supports modular extensibility by allowing new modules to be added via simple code integration.
  • Employs visual rationales to diagnose errors and guide instruction tuning for improved performance.

Experimental results

Research questions

  • RQ1Can a neuro-symbolic system generate accurate and interpretable programs for complex visual tasks without any task-specific fine-tuning?
  • RQ2How effective is in-context learning with LLMs in composing programs that orchestrate diverse pre-trained models for visual reasoning?
  • RQ3To what extent can visual rationales improve user understanding and performance through instruction tuning?
  • RQ4What are the dominant failure modes in such a system, and how can they be diagnosed and mitigated?
  • RQ5Can the system generalize zero-shot to tasks like image editing, knowledge-based tagging, and reasoning over image pairs?

Key findings

  • VisProg achieves a 63.7% F1 score on the knowledge tagging task, localizing and naming objects correctly without any fine-tuning.
  • On the GQA benchmark, VisProg achieves strong zero-shot performance, with error analysis revealing that incorrect program generation affects 16% of samples.
  • Instruction tuning based on visual rationales leads to significant performance gains in knowledge tagging and image editing tasks by refining queries and module inputs.
  • Replacing the ViLT-vqa model with a better VQA model could improve NLVR performance by up to 24%, highlighting the impact of module quality.
  • The system demonstrates strong zero-shot performance on NLVRv2 using only a single-image VQA model and an LLM for reasoning, outperforming random and voting baselines.
  • Visual rationales enable error diagnosis by revealing failures in module execution, such as incorrect localization or knowledge retrieval, and guide targeted instruction refinement.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.