Saturday, December 5, 2026
HomeData ScienceVision-Language Models and Visual Question Answering – CLIP, BLIP-2, LLaVA and PaLI...

Vision-Language Models and Visual Question Answering – CLIP, BLIP-2, LLaVA and PaLI Explained

Table of Content

📋 KEY INSIGHTS

  • VLMs learn a shared embedding space for images and text, enabling zero-shot tasks like image classification, retrieval, and VQA without task-specific training.
  • CLIP achieves 76.2% ImageNet zero-shot accuracy by encoding class names as text templates and finding the most similar image embedding — no ImageNet training required.
  • BLIP-2’s Q-Former bridges any frozen vision encoder and any frozen LLM using just 32 learnable query tokens, making it highly parameter-efficient.
  • LLaVA demonstrates that a simple linear bridge + high-quality GPT-4-generated instruction data outperforms far more complex architectures on 11 benchmarks.
  • Hallucination is the primary failure mode: VLMs confidently describe objects not in the image. POPE and visual contrastive decoding directly target this problem.
  • Real-world VLM applications span radiology report generation, e-commerce visual search, industrial defect detection, and language-conditioned robot navigation.

Vision-language models (VLMs) learn a shared representation for images and text, enabling tasks that cross the visual-language boundary: image captioning, visual question answering, text-driven image retrieval, and language-conditioned robot navigation.

Before VLMs, computer vision and NLP were separate silos with incompatible representations. CLIP (2021) changed this by showing that contrastive pre-training on 400 million internet image-text pairs produces visual representations that generalise to 30+ downstream tasks zero-shot — no fine-tuning required.

VLM Architecture: Vision Encoder, Language Model, and Bridge

All modern VLMs share three components: a vision encoder (ViT or CNN) that maps images to patch tokens, a language model that generates or encodes text, and a cross-modal bridge that projects visual tokens into the language model’s input space.

The bridge design determines the model’s trade-offs. A simple linear projection (LLaVA) is cheap to train but requires a powerful LLM for complex reasoning. A Q-Former (BLIP-2) uses learnable query tokens that attend to image patches, producing a compact fixed-length visual representation that adapts to different LLM backbones more flexibly.

  • Dual encoder (CLIP): separate image and text encoders, trained with contrastive loss. Retrieval only — no generation.
  • Encoder-decoder (BLIP): adds an autoregressive decoder for captioning and VQA generation.
  • Q-Former bridge (BLIP-2): 32 learnable queries extract a compact visual summary from a frozen ViT, feeding any frozen LLM.
  • Linear projection (LLaVA): single MLP maps CLIP patch embeddings directly into the LLM’s token space.

CLIP: Contrastive Language-Image Pre-training

the word language spelled with scrabble tiles on a table
Photo by Ling App on Unsplash

CLIP (Radford et al., OpenAI 2021) jointly trains a visual encoder (ViT-B/32 to ViT-L/14) and a text encoder (transformer) on 400 million internet image-caption pairs. The contrastive objective maximises cosine similarity between matched pairs and minimises it for all non-matching pairs within the mini-batch.

Zero-shot classification: encode all N class names as “a photo of a {class}” and assign the image to the class with the highest cosine similarity. This achieves 76.2% on ImageNet without any ImageNet training — competitive with a supervised ResNet-50.

CLIP embeddings power downstream systems including semantic image search via vector database retrieval, text-guided generation (DALL-E 2 conditions its diffusion prior on CLIP embeddings), and open-vocabulary object detection where classes are described in free text rather than a fixed label set.

BLIP and BLIP-2: Bootstrapped Language-Image Pre-training

BLIP (Li et al., Salesforce 2022) adds an autoregressive text decoder to the dual-encoder architecture, enabling captioning and VQA as generation tasks. Its bootstrapping step removes low-quality image-text pairs using the model’s own predictions — a data-centric AI improvement that improves performance without collecting new data.

BLIP-2 (Li et al., 2023) introduces the Querying Transformer (Q-Former): 32 learnable query tokens cross-attend to image patches and produce a 32-token visual summary. Only the Q-Former is trained — both the image encoder (EVA-CLIP ViT-g/14, 1.8B params) and the LLM (OPT-6.7B, FlanT5-XL) remain frozen, making BLIP-2 highly parameter-efficient.

Visual Question Answering: Tasks and Datasets

black flat screen computer monitor
Photo by John Cameron on Unsplash

VQA is the task of answering natural language questions about an image — “How many dogs are in this photo?”, “What colour is the car?”, “Is it raining?”. Modern VLMs treat VQA as open-ended text generation rather than classification over a fixed answer vocabulary, handling rare and compositional answers that a closed vocabulary would miss.

VQAv2 (265K images, 1.1M questions) is the standard open-domain benchmark covering yes/no, counting, attribute recognition, and spatial reasoning. TextVQA tests reading text embedded in images; GQA tests compositional reasoning over scene graphs; OK-VQA requires external knowledge beyond the image.

BenchmarkFocusKey MetricSOTA Score
VQAv2Open-domain QASoft accuracy~86% (PaLI-17B)
TextVQAReading text in imagesExact match~75%
GQACompositional reasoningAccuracy~65%
POPEHallucination rateF1>88% (top models)

Large-Scale VLMs: Flamingo, PaLI, and PaLM-E

Flamingo (Alayrac et al., DeepMind 2022) uses a Perceiver Resampler to convert variable-length visual features into 64 fixed visual tokens, injected into a frozen Chinchilla LLM via cross-attention gating at every layer. Interleaving text and images in the context window enables 4-shot or 8-shot VQA by example, following the in-context learning pattern of foundation models.

PaLI (Google 2022) scales aggressively: a 4-billion parameter ViT image encoder feeds a 32-billion parameter mT5 language model, trained on WebLI (10 billion image-text pairs in 109 languages). PaLI achieves 84.3% on VQAv2 and sets records on 10+ vision-language benchmarks.

PaLM-E extends the multi-modal approach to embodied AI — injecting robot sensor readings (images, joint angles) as tokens into PaLM, enabling natural language-conditioned manipulation planning without task-specific reward engineering.

Instruction-Tuned VLMs: LLaVA and InstructBLIP

LLaVA (Liu et al., 2023) demonstrates that architectural simplicity combined with high-quality instruction data works surprisingly well: CLIP ViT-L/14 + a linear projection + Vicuna-13B, trained on 158K GPT-4-generated visual instruction examples. This matches or exceeds far more complex models on multiple benchmarks.

LLaVA-1.5 replaces the linear projection with a 2-layer MLP and adds academic VQA datasets, outperforming larger models on 11 benchmarks. The finding aligns with efficient fine-tuning research: data quality and instruction diversity matter more than raw architectural complexity.

✦ SUMMARIZE THIS ARTICLE WITH AI

Benchmarks and Evaluation Metrics

Standard VLM benchmarks include VQAv2, GQA, TextVQA, NoCaps (captioning with novel objects), and MMBench (holistic evaluation across 20 dimensions). Evaluation goes beyond accuracy — calibration, reasoning chain quality, and robustness to adversarial perturbations are increasingly measured.

Hallucination is the primary failure mode: VLMs generate plausible-sounding but incorrect descriptions of objects not in the image. POPE (Polling-based Object Probing Evaluation) tests this directly by asking “Is there a [object] in the image?” for absent objects, measuring the false positive rate. Visual contrastive decoding amplifies the difference between full-image and masked-image logits to suppress hallucinated tokens.

Real-World Applications

Medical imaging: BioViL-T and GlassAI combine radiology reports with chest X-rays to generate structured diagnostic summaries, flag abnormalities, and track disease progression across temporal series.

E-commerce: CLIP-based product search lets customers upload a photo and retrieve visually similar items. Multimodal recommendation systems combine product images with purchase histories for personalised suggestions.

Industrial inspection: VLMs detect defects by grounding natural language descriptions (“surface scratch longer than 2 mm”) to precise image regions, replacing hand-coded detection rules with flexible language-driven inspection criteria that generalise to new defect types without retraining.

Frequently Asked Questions

What is the main difference between CLIP and BLIP-2?

CLIP is a dual-encoder model that maps images and text to a shared embedding space for retrieval — it cannot generate text. BLIP-2 adds a Querying Transformer (Q-Former) that bridges a frozen vision encoder and a frozen LLM, enabling both retrieval and open-ended text generation such as captioning and VQA.

How does visual question answering differ from image captioning?

Image captioning generates a free-form description of an image with no constraints. VQA answers a specific question about an image — the model must localise relevant objects, understand spatial relationships, and produce a targeted answer rather than a general description.

What datasets are used to train large-scale VLMs?

CLIP was trained on WIT (400M image-text pairs from Wikipedia and the web). BLIP-2 uses LAION-400M. PaLI uses WebLI (10 billion image-text pairs in 109 languages). LLaVA uses 158K GPT-4-generated visual instruction examples derived from COCO images.

Can VLMs be fine-tuned for domain-specific tasks like medicine?

Yes. Parameter-efficient fine-tuning methods (LoRA, QLoRA) adapt pre-trained VLMs to medical imaging, industrial inspection, and satellite imagery with as few as a few thousand domain-specific examples. The pre-trained visual and language representations transfer effectively to specialised domains.

How do VLMs handle hallucinations?

VLMs frequently generate plausible but incorrect captions or answers about objects not present in the image. Mitigation strategies include RLHF-style preference fine-tuning on human-annotated correctness feedback, decoding with visual contrastive decoding (amplifying differences between full-image and masked-image logits), and evaluation with POPE to measure the hallucination rate directly.

Conclusion

Vision-language models have bridged the gap between visual perception and language understanding that defined computer vision and NLP as separate fields for decades. CLIP established that contrastive pre-training at scale produces transferable visual representations; BLIP-2 showed that a lightweight Q-Former bridges any vision encoder and LLM without retraining either; LLaVA demonstrated that high-quality GPT-4-generated instruction data can match much more expensive training regimes.

The frontier moves towards real-time embodied agents that see, reason, and act — combining the perceptual grounding of VLMs with the planning capabilities of agentic systems and the safety constraints of foundation model alignment.

Leave feedback about this

  • Rating

Durgesh Kekare
Durgesh Kekarehttps://www.dataexpertise.in
Durgesh Kekare is a data science educator and founder of DataExpertise.in. With expertise in Python, machine learning, and analytics, he helps 10,000+ learners break into data careers.

Latest Posts

List of Categories