From Images to Textual Prompts: Zero-shot Visual Question Answering with Frozen Large Language Models

Jiaxian Guo, Junnan Li, Dongxu Li, Anthony Meng Huat Tiong, Boyang Li, Dacheng Tao, Steven C. H. Hoi

Abstract

Large Language Models (LLMs) have demonstrated remarkable reasoning capabilities but remain limited by their text-only modality. Traditional Visual Question Answering (VQA) approaches rely on expensive end-to-end multimodal pretraining. We present Img2LLM, a plug-and-play framework that enables frozen, off-the-shelf LLMs to perform zero-shot VQA without multimodal training. By converting image content into synthetic question-answer pairs that serve as textual prompts, Img2LLM bridges the vision-language gap. Our approach outperforms massive end-to-end models like Flamingo on standard benchmarks, achieving state-of-the-art zero-shot performance on VQAv2, OK-VQA, and A-OKVQA.

Introduction

The integration of visual information into Large Language Models (LLMs) typically faces two primary challenges: the modality disconnect between pixels and tokens, and the task disconnect between next-token prediction and visual reasoning. Existing solutions often involve "end-to-end" training, which is computationally expensive and creates a rigid coupling between the vision encoder and the LLM. Img2LLM addresses these issues by treating the LLM as a frozen reasoning engine, using a specialized pipeline to translate visual information into a format the LLM can natively process.

Comparison of VQA paradigms: (a) end-to-end pretraining, (b) few-shot in-context learning, and (c) the proposed Img2LLM approach.

Methodology

Img2LLM focuses on crafting optimal textual prompts to describe visual content. The pipeline consists of four main stages:

  • Answer Extraction: Utilizing an off-the-shelf vision-language model (e.g., BLIP), the system generates captions and identifies potential answer candidates such as nouns, verbs, and adjectives.
  • Synthetic Question Generation: For each candidate answer, a corresponding question is generated using either simple templates or a neural model (T5) fine-tuned on textual QA datasets.
  • Question-Relevant Captioning: To reduce noise, GradCAM is employed to identify image regions relevant to the user's query, generating specific captions for those patches rather than generic global descriptions.
  • Prompt Design: These synthetic QA pairs and captions are bundled into an "exemplar" prompt. This effectively teaches the LLM the VQA task "in-context" without changing a single weight in the model.
Detailed pipeline of the Img2LLM framework, illustrating the conversion of visual content into textual prompts via question-relevant captioning and synthetic question generation.

Experiments and Results

The framework was evaluated on three major benchmarks: VQAv2 (general VQA), OK-VQA (outside knowledge), and A-OKVQA (commonsense reasoning).

Key results include:

  • State-of-the-Art Zero-Shot: Img2LLM achieved a score of 61.9% on VQAv2, surpassing the 80B-parameter Flamingo model by 5.6% despite using significantly fewer resources.
  • Reasoning Performance: On the challenging A-OKVQA dataset, performance more than doubled compared to previous zero-shot baselines (40.7% vs. 17.7%).
  • Scaling Laws: Performance scales positively with LLM size; moving from a 6.7B to a 175B parameter model yielded a nearly 10-point accuracy jump on OK-VQA.

Discussion and Conclusion

A critical finding of this work is that synthetic QA pairs are significantly more effective than simple captions for prompting, as they explicitly demonstrate the required task format to the LLM. Img2LLM offers a flexible, modular alternative to end-to-end training, allowing researchers to swap in newer LLMs as they become available.

However, the approach introduces a 24.4% inference overhead due to the prompt generation stage and inherits the social biases of the underlying frozen LLM. Future work will focus on prompt compression to improve speed and further refining question-relevant filtering to reduce noise in complex scenes.

Summary updated

BibTeX
@inproceedings{guo2023from,
  author = {Jiaxian Guo and Junnan Li and Dongxu Li and Anthony Meng Huat Tiong and Boyang Li and Dacheng Tao and Steven C. H. Hoi},
  title = {{From Images to Textual Prompts: Zero-shot Visual Question Answering with Frozen Large Language Models}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2023},
  doi = {10.1109/cvpr52729.2023.01046},
}
Figure