Video Question Answering with Procedural Programs

Rohan Choudhury, Koichiro Niinuma, Kris M. Kitani, László A. Jeni

Abstract

ProViQ (Procedural Video Querying) addresses the challenges of temporal reasoning and interpretability in Video Question Answering (VideoQA). By leveraging Large Language Models (LLMs) to generate and execute modular Python programs, ProViQ decomposes complex video queries into manageable sub-tasks. This approach achieves state-of-the-art zero-shot performance across multiple benchmarks, notably improving long-form video understanding by 25%.

Introduction

Traditional Video Question Answering (VideoQA) typically relies on "black-box" end-to-end neural networks. While powerful, these models often struggle with temporal reasoning—understanding when and how things happen over time—and are notoriously difficult to interpret. Recent "visual programming" approaches like ViperGPT successfully used LLMs to write code for image tasks, but they often fail on video by treating it as a simple stack of independent frames. This makes them prohibitively slow and unable to grasp high-level narratives or causal relationships in long clips. ProViQ aims to bridge this gap by providing an LLM with a "toolbox" specifically designed for video-level logic.

Methods

The core of ProViQ is a code-generation framework that transforms natural language queries into executable Python scripts.

Overview of the ProViQ architecture, showing the flow from query to generated program and final output.

The system follows a four-step process:

  1. Prompting: An LLM (GPT-3.5-turbo) is provided with an API of visual modules and a few "in-context" examples via Retrieval-Augmented Generation (RAG).
  2. Program Generation: The LLM writes a Python script that calls specific modules to solve sub-tasks.
  3. Execution: A Python interpreter runs the code, calling pre-trained vision models for each step.
  4. Answer Extraction: The final result of the script is returned as the answer.

The Video-Centric API

Unlike previous methods, ProViQ introduces modules specifically designed for temporal data:

  • video_query: Uses BLIP-2 to answer questions across a collection of frames using a voting mechanism.
  • get_summary: For long videos, it partitions the video into chunks, captions them using LaViLa, and then uses an LLM to fuse those captions into a coherent narrative paragraph.
  • filter_object & track_objects: Uses GroundingDINO and ByteTrack to locate and follow objects through time.
  • get_script: Incorporates audio transcripts (via Whisper) for multimodal understanding.

Procedural Reasoning

A key advantage of ProViQ is that its procedural reasoning mimics human logic. For example, to answer "What color jacket was the skier wearing?", the system first finds the skier and then identifies the jacket's color.

Example of procedural reasoning where a complex query is decomposed into sequential steps using the visual module API.

This modularity makes the process highly interpretable and allows the system to handle long time horizons by creating "textual proxies" of video content through summarization.

Results and Discussion

The authors evaluated ProViQ on eight diverse benchmarks without any task-specific fine-tuning (zero-shot).

Key Performance Metrics

  • EgoSchema: Achieved a 25% accuracy gain over previous methods on long-form egocentric videos.
  • TGIF-QA: Improved accuracy by 15% compared to prior zero-shot methods.
  • Generalization: ProViQ demonstrated versatility beyond QA, performing multi-object tracking and basic video editing simply by changing the prompt.

Insights

Surprisingly, ProViQ's modular approach outperformed state-of-the-art supervised models on datasets like iVQA and NeXT-QA. This suggests that general-purpose reasoning combined with specialized tools can be more robust than end-to-end training. Furthermore, by using filter modules to find relevant segments first, the system avoids the computational cost of running heavy vision-language models on every single frame.

Limitations and Future Work

Despite its successes, ProViQ faces several challenges:

  • Latency: Sequential execution of multiple models is slower than a single end-to-end forward pass.
  • Module Dependency: The system's accuracy is capped by the performance of its underlying tools.
  • Prompt Sensitivity: The model can still occasionally "hallucinate" methods not present in the API.

Future work will focus on exploring more complex video editing tasks and optimizing the speed of the execution pipeline.

Summary updated

BibTeX
@inproceedings{choudhury2024video,
  author = {Rohan Choudhury and Koichiro Niinuma and Kris M. Kitani and László A. Jeni},
  title = {{Video Question Answering with Procedural Programs}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-72920-1\_18},
}
Figure