Skip to main content
QUICK REVIEW

[Paper Review] ViperGPT: Visual Inference via Python Execution for Reasoning

Dídac Surís, Sachit Menon|arXiv (Cornell University)|Mar 14, 2023
Multimodal Machine Learning ApplicationsComputer Science12 citations
TL;DR

ViperGPT uses a code-generation model to compose vision-language modules into Python programs that are executed to answer visual queries, achieving strong zero-shot performance across grounding, VQA, and video reasoning without task-specific training.

ABSTRACT

Answering visual queries is a complex task that requires both visual processing and reasoning. End-to-end models, the dominant approach for this task, do not explicitly differentiate between the two, limiting interpretability and generalization. Learning modular programs presents a promising alternative, but has proven challenging due to the difficulty of learning both the programs and modules simultaneously. We introduce ViperGPT, a framework that leverages code-generation models to compose vision-and-language models into subroutines to produce a result for any query. ViperGPT utilizes a provided API to access the available modules, and composes them by generating Python code that is later executed. This simple approach requires no further training, and achieves state-of-the-art results across various complex visual tasks.

Motivation & Objective

  • Motivate a modular, interpretable alternative to end-to-end vision models for complex visual queries.
  • Propose a framework that uses a code-generation model to synthesize Python programs calling modular vision/language tools via an API.
  • Demonstrate zero-shot, state-of-the-art performance across visual grounding, VQA, and video reasoning without task-specific training.
  • Provide a reusable Python library to accelerate program synthesis for visual tasks and promote research in modular visual reasoning.

Proposed method

  • Define an API of modular vision and knowledge components (e.g., find, exists, compute_depth, best_text_match) backed by pretrained models.
  • Use a large language model (Codex) to generate Python code that composes these modules into a program from a textual query.
  • Execute the generated Python program with a standard Python interpreter to obtain the final answer, enabling clear intermediate values for interpretability.
  • Provide API specification and docstrings to guide code generation while keeping the module implementations abstracted from the LLM context window.
  • Enable multiprocessing and batched execution to handle multiple programs efficiently on GPUs.

Experimental results

Research questions

  • RQ1Can zero-shot program synthesis via an LLM effectively compose vision-language modules to answer complex queries without task-specific training?
  • RQ2How interpretable and faithful are the intermediate steps produced by the generated programs when solving visual reasoning tasks?
  • RQ3What is the impact of modular perception and external knowledge components on performance across grounding, VQA, and video reasoning tasks?
  • RQ4Can a Python-based execution framework scale to video data and support temporal/causal reasoning without specialized interpreters?

Key findings

  • Achieves strong zero-shot performance across visual grounding, image question answering, external knowledge QA, and video temporal/causal reasoning.
  • Interpretable step-by-step execution is obtained because the answer is constructed from explicit intermediate values produced by modular components.
  • The framework benefits from combining perception modules (e.g., GLIP, X-VLM, MiDaS) with Python-level logic and external knowledge queries (e.g., GPT-3) to handle diverse tasks.
  • The approach supports open-world queries and does not require task-specific training, with improvements tied to the underlying modules and coding constructs.
  • Video reasoning emerges through sequential perception and reasoning over ordered frames, achieving competitive results despite using perception modules primarily for images.

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.