Abstract
We introduce FlexCap, a vision-language model that generates region-specific descriptions of varying lengths. FlexCap is trained to produce length-conditioned captions for input boxes, enabling control over information density, with descriptions ranging from concise object labels to detailed captions. To achieve this, we create large-scale training datasets of image region descriptions with varying lengths from captioned web images. We demonstrate FlexCap's effectiveness in several applications: first, it achieves strong performance in dense captioning tasks on the Visual Genome dataset. Second, we show how FlexCap's localized descriptions can serve as input to a large language model to create a visual question answering (VQA) system, achieving state-of-the-art zero-shot performance on multiple VQA benchmarks. Our experiments illustrate FlexCap's utility for tasks including image labeling, object attribute recognition, and visual dialog.
Introduction
Current vision-language models (VLMs) typically fall into two camps: image captioners that provide a general "gist" of a scene but miss fine-grained details, and object detectors that pinpoint locations but offer a very limited vocabulary, usually restricted to simple class labels. FlexCap bridges this gap by introducing a model capable of generating region-specific descriptions with user-controllable length, ranging from simple object labels to rich, detailed captions.
Architecture and Length Conditioning
FlexCap utilizes a SOViT-400M image encoder and a 12-layer transformer text decoder. The core innovation is length conditioning: the model receives a bounding box and a specific "length token" (e.g., LENGTH-7) as input. This forces the model to modulate its information density to fit the requested word count.
By prepending the desired length, the model's initial state is better conditioned, significantly reducing "prefix matching" conflicts where a model might otherwise get stuck between short and long valid descriptions of the same visual region. This allows a single model to serve multiple roles, from a simple object labeler to a dense captioner.
Scalable Data Generation
A major highlight of this work is the scale of its training data. The authors created a massive dataset of 32 billion image-box-caption triplets from WebLI and 200 million from YFCC100M. This was achieved through an automated "Localize-then-Describe" pipeline: extracting n-grams from existing web captions and using an open-vocabulary detector (OWL-ViT) to ground those phrases to specific boxes within the images. This automated grounding allows the model to learn from vast amounts of unannotated web data.
Visual Question Answering via Localized Descriptions
FlexCap enables a modular approach to Visual Question Answering (VQA). Instead of feeding raw visual tokens—which are uninterpretable to humans—into a Large Language Model (LLM), the system first uses an open-vocabulary detector to find interesting regions, then uses FlexCap to describe them. These human-readable descriptions and their coordinates are fed as a text prompt to a frozen LLM (PaLM2-S), which reasons over the visual evidence to answer questions.
This "Localize-then-Describe" approach leads to much higher recall, especially for small and medium-sized objects that global models often overlook. Furthermore, it allows the vision model and the reasoning model to be improved independently.
Key Results
FlexCap demonstrates state-of-the-art performance across several benchmarks:
- Zero-Shot VQA: The FlexCap-LLM system achieved 65.6% on VQAv2, outperforming BLIPv2 (65.2%) and Flamingo (56.3%) without being explicitly trained on VQA data.
- Dense Captioning: On the Visual Genome benchmark, FlexCap reached 16.2 mAP, surpassing the previous state-of-the-art model, GRiT (15.5 mAP).
- Length Compliance: The model is remarkably precise at following instructions. For a target length of 8 words, the model produced an average of 8.02 words.
- Video Understanding: By captioning multiple frames of a video and feeding the sequence to an LLM, the system outperformed Flamingo on video-based question answering tasks.
Limitations and Future Work
While the modular pipeline is highly interpretable and effective, it is not currently "end-to-end" trainable, which may limit its ultimate reasoning ceiling. Additionally, the system's performance is heavily dependent on the initial region proposal model; if an object is not detected initially, the LLM will never receive information about it. Future work may involve fine-tuning the entire stack together or expanding the prefixing capability to extract specific attributes like material, texture, or OCR text more reliably.
Summary updated