LLaVA: Visual Instruction Tuning
Large Language-and-Vision Assistant
Haotian Liu, Chunyuan Li, Qingyang Wu, Yong Jae Lee
Read the Paper on arXivPaper Overview
LLaVA (Large Language-and-Vision Assistant) introduced a surprisingly simple yet powerful recipe for building multimodal AI: connect a pre-trained vision encoder (CLIP ViT-L/14) to a large language model (Vicuna/LLaMA) through a lightweight projection layer, then train in two stages — first align visual and language representations, then instruction-tune for general-purpose visual understanding.
The core insight: You don't need complex cross-attention modules, Q-Formers, or perceiver architectures to build a strong vision-language model. A simple linear projection (LLaVA 1.0) or 2-layer MLP (LLaVA 1.5) connecting frozen CLIP features to the LLM's embedding space is sufficient — when combined with high-quality instruction-following data.
A second key contribution: Using language-only GPT-4 to generate multimodal instruction-following data from image captions and bounding boxes. This produced 158K high-quality training samples (conversations, detailed descriptions, complex reasoning) without any human annotation of visual instruction data.
LLaVA 1.5 improved on the original with three targeted changes — an MLP projection, higher-resolution CLIP (336px), and academic VQA data — achieving state-of-the-art on 11 benchmarks while training on a single 8-A100 node in ~1 day.
Model configurations:
| LLaVA 1.0 (13B) | LLaVA 1.5 (13B) | |
|---|---|---|
| Vision Encoder | CLIP ViT-L/14 (224px) | CLIP ViT-L/14 (336px) |
| Visual Tokens | 16 x 16 = 256 | 24 x 24 = 576 |
| Projection | Linear (1024 to 5120) | 2-layer MLP (1024 to 5120) |
| LLM | Vicuna-13B v1.3 | Vicuna-13B v1.5 |
| Stage 1 Data | 595K CC3M filtered | 558K LAION-CC-SBU |
| Stage 2 Data | 158K LLaVA-Instruct | 665K mixed |
| Training | 8x A100, ~14 hours | 8x A100, ~26 hours |
LLaVA demonstrated that the data and training recipe matter more than architectural complexity — a lesson that influenced subsequent multimodal models including LLaVA-NeXT, InternVL, and Qwen-VL.
Chapter Roadmap
Click any topic to jump in
Visual Tokenization
CLIP ViT-L/14 encodes a 336-px image into 576 visual tokens — the raw substrate for multimodal reasoning.
Vision-Language Projection
A single MLP maps 1024-d CLIP features into the 4096-d LLM embedding space, the sole bridge between modalities.
Multimodal Input
Projected visual tokens are concatenated with text tokens — no architectural change to the transformer.
GPT-4 Instruction Data
GPT-4 distills captions and bounding boxes into 158K multimodal conversations, descriptions, and reasoning samples.
Two-Stage Training
Stage 1 aligns the projector on captions; Stage 2 jointly tunes projector + LLM on instruction data.
LLaVA 1.5
Higher resolution (336²), MLP projector, and VQA data push LLaVA to SOTA on 11 benchmarks with ~1.2M samples.
Benchmarks & Ablations
85.1% relative GPT-4 score shows data quality and a minimal architecture beat raw scale.
LLaVA converts images into a sequence of visual tokens using a frozen CLIP vision encoder. These tokens are then projected into the language model's embedding space, allowing the LLM to "see" images as naturally as it reads text.
The Problem
Large language models process sequences of discrete text tokens, but images are continuous 2D grids of pixels. To build a multimodal model, we need to convert images into a format the LLM can process:
- Images are high-dimensional: A 336x336 RGB image has values — far too many to feed directly into an LLM
- Semantic gap: Raw pixels don't carry semantic meaning. The color value at pixel (100, 200) tells the LLM nothing about objects, scenes, or concepts in the image
- Training from scratch is prohibitive: Learning visual representations from image-text pairs requires billions of training examples (CLIP was trained on 400M pairs) and massive compute
Previous approaches used complex bridging architectures:
- Flamingo: Gated cross-attention layers interleaved with LLM layers — expensive and tightly coupled
- BLIP-2: Q-Former with 32 learned queries + cross-attention to frozen vision features — complex, requires pre-training the Q-Former itself
- These approaches add significant architectural complexity and training overhead, and their cross-attention mechanisms make them harder to scale
The Solution
LLaVA's approach is radically simple: use CLIP ViT-L/14 as a frozen feature extractor, take the grid features (not the [CLS] token), and project them into the LLM's word embedding space.
Step 1: Image to patches
The image is divided into non-overlapping patches:
-
LLaVA 1.0: Input image, patch size pixels
- Grid: patches per side
- Total: visual tokens
- Each patch covers pixels
-
LLaVA 1.5: Input image, patch size pixels
- Grid: patches per side
- Total: visual tokens
- 2.25x more visual tokens = finer spatial detail
Step 2: Patch embedding
Each patch is linearly embedded into a -dimensional vector:
A learnable [CLS] token is prepended, and positional embeddings are added.
Step 3: ViT Transformer processing
The patch tokens pass through 24 Transformer layers (ViT-L has 24 layers, 16 heads, ):
Critical choice: LLaVA uses features from the second-to-last layer (layer 23 of 24), not the final layer. The final layer of CLIP is trained with a contrastive loss that produces abstract, global features optimized for image-text matching. The penultimate layer retains more localized, spatial information — individual objects, textures, spatial relationships — which is more useful for visual question answering.
Step 4: Grid features output
The [CLS] token is discarded. The remaining grid features become the visual token sequence:
- LLaVA 1.0: (256 tokens, each 1024-dim)
- LLaVA 1.5: (576 tokens, each 1024-dim)
These visual tokens are now ready for projection into the LLM's embedding space. Each token represents a pixel region of the image and carries rich semantic features learned from CLIP's 400M image-text training pairs.
Why CLIP specifically?
CLIP's vision encoder is trained with a contrastive language-image objective, so its features are already aligned with language semantics. A dog patch produces features that are close (in CLIP space) to the word "dog" — this makes the projection layer's job much easier than starting from a vision-only encoder like ImageNet-trained ViTs.
Key Points
CLIP ViT-L/14 is kept completely frozen during both training stages — no gradients flow back to the vision encoder. This preserves CLIP's robust visual representations learned from 400M image-text pairs
Grid features, not [CLS]: LLaVA uses all spatial tokens ( or ), discarding the global [CLS] token. This preserves spatial layout — the LLM knows where things are, not just what the image contains
Penultimate layer features (layer 23/24) retain localized spatial properties. The final layer is too abstract (optimized for global contrastive matching) — ablations showed a 0.96% accuracy drop using final-layer features on ScienceQA
Resolution matters: Moving from 224px (256 tokens) to 336px (576 tokens) in LLaVA 1.5 improved performance across all benchmarks by capturing finer details — especially for text-heavy and detail-oriented visual questions
Each visual token represents a pixel patch ( 4-6% of image width) — roughly the granularity of a single word in text. This makes the image-as-tokens metaphor surprisingly apt
Mathematical Formulation
Patch Embedding
Each 14×14×3 = 588-dimensional flattened patch is projected to 1024 dimensions. Positional embedding E_pos is added to encode spatial location in the grid.
Visual Feature Extraction
ViT_{L-1} denotes the penultimate layer output. For 224px: n=256, for 336px: n=576. These 1024-dim features carry both semantic and spatial information from CLIP pre-training.
A image is cut into non-overlapping patches. Each patch is flattened to a vector in and linearly projected, yielding a grid of visual tokens that the frozen CLIP ViT-L/14 encoder refines into rich semantic features .