# Visual Instruction Tuning

Haotian Liu, Chunyuan Li, Qingyang Wu, Yong Jae Lee · arXiv · 2023-4-17

- **Problem** Multimodal models are seldom tuned on instruction-following data, and such data is scarce and slow to write by hand.
- **Method** Text-only GPT-4 is prompted with COCO captions and bounding boxes to write instruction data. A linear projection and then the language model are trained on CLIP features with Vicuna as the decoder.
- **Results** LLaVA reaches an overall relative score of 85.1 on LLaVA-Bench (COCO) with all three data types, and 92.53% accuracy on ScienceQA with GPT-4 as the judge.

![Table 5: Instruction-following capability comparison using relative scores on LLaV A-Bench (In-the- Wild). The results are reported in the format of mean± std.…](https://refivu.com/papers/760eaf17-9dbc-40d5-afee-d36c375c59e3/figures/figure-c3939c4b3d87aeac848d515cdf972487.png?thumb=512)

**Table 5** : Instruction-following capability comparison using relative scores on LLaV A-Bench (In-the- Wild). The results are reported in the format of mean± std. For the first three rows, we report three inference runs. LLaV A performs significantly better than others.† For a given set of LLaV A decoding sequences, we evaluate by querying GPT-4 three times; GPT-4 gives a consistent evaluation.

[Original paper](https://arxiv.org/abs/2304.08485v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Haotian Liu, Chunyuan Li, Qingyang Wu, Yong Jae Lee · Visual Instruction Tuning · Original paper figure · Extracted the figure area from page 7 of the original PDF.

## Why image-text pairs are not enough

Language models became useful assistants largely through instruction tuning, in which they are trained on instructions paired with desired answers. Multimodal data has not followed the same path, because corpora such as CC and LAION pair images with captions but say nothing about how a user might ask about the picture.

Instruction-following data for images is limited in amount, and writing it by hand is slow and hard to define. Earlier multimodal models such as BLIP-2 and OpenFlamingo were not explicitly tuned on vision-language instruction data.

## Writing instruction data from captions and boxes

The simplest conversion pairs a request to describe the image with the caption as the answer. This is cheap, but it gives little variety and little reasoning.

A text-only GPT model needs the image in textual form, so each COCO image is written as its captions, which describe the scene from several viewpoints, and its bounding boxes, which give each object's concept and location. Human-written seed examples for each data type go into the prompt as in-context examples, and they are the only human annotations used in collection.

The pipeline produces three kinds of samples: conversation, detailed description and complex reasoning. Conversation samples cover object types, counts, actions, locations and relative positions, and only questions with definite answers are kept. Detailed description samples use one question sampled per image from a curated list, while complex reasoning samples require a step-by-step logic.

The pipeline yields 158K samples in total, made of 58K conversations, 23K detailed descriptions and 77k complex reasoning samples. In early experiments the authors found GPT-4 gave higher-quality data than ChatGPT, for example on spatial reasoning.

## Connecting CLIP features to Vicuna

The language side is Vicuna, chosen because it follows instructions best among the public checkpoints the authors considered.

A trainable matrix W maps each visual feature vector into the word-embedding space of the language model, which gives a sequence of visual tokens H\_v. \\\[ H\_v = W \\cdot Z\_v, \\quad Z\_v = g(X\_v) \\\] A single linear layer is cheap to train, which lets the authors iterate on data experiments quickly. Gated cross-attention from Flamingo and the Q-former from BLIP-2 are named as alternatives that were left for future work.

Each image comes with a multi-turn conversation, and in the first turn the question and the image are placed in an order chosen at random. All answers are treated as assistant responses, and the language model is tuned with its original next-token objective, applied to the answer tokens. The system message and the stop markers follow the Vicuna-v0 format, so the loss covers the assistant answers and where each answer ends.

## Two training stages

Stage 1 uses CC3M filtered to 595K image-text pairs, and each pair becomes a single-turn exchange with a brief description request as the instruction and the original caption as the target. Only the projection matrix W is trained, while the visual encoder and the language model stay frozen, so the projection acts as a visual tokenizer for the frozen language model.

Stage 2 keeps the visual encoder frozen and updates the projection together with the language model weights, so the trainable parameters are W and the language-model weights. Two use cases are trained from this stage: a multimodal chatbot on the 158K samples, and ScienceQA, where the question and context form the instruction and the reasoning with the answer forms the target.

These settings were used on 8× A100s, following Vicuna's hyperparameters, and the ScienceQA runs train for 12 epochs as described later.

## Chatbot examples against the GPT-4 paper prompts

The chatbot was first checked on examples from the GPT-4 paper, with the prompt and response of multimodal GPT-4 quoted from that paper and BLIP-2 and OpenFlamingo queried directly. On the extreme ironing example, LLaVA explains that a man ironing on a moving vehicle is unusual and points to the balance and safety problems this raises.

BLIP-2 and OpenFlamingo mostly describe the scene, while LLaVA follows what the user asked. LLaVA was trained on ∼80K unique images, and on these out-of-domain images its reasoning is close to that of multimodal GPT-4.

These are qualitative examples, so they do not measure chatbot quality systematically, and the quantitative comparisons follow in the benchmark sections.

## LLaVA-Bench (COCO) training-data ablation

This benchmark uses 30 images from COCO-Val-2014 and three question types per image, giving 90 questions. A text-only GPT-4 that receives ground-truth captions and bounding boxes serves as the reference, and the judge rates helpfulness, relevance, accuracy and detail on a scale of 1 to 10, expressed as relative scores.

Trained on all three data types, LLaVA reaches 85.1 overall, with 83.1 on conversation, 75.3 on detailed description and 96.5 on complex reasoning. Without instruction tuning the overall score falls to 21.5. The authors describe the gain from instruction tuning as over 50 points.

Other training mixtures reach 81.9 and 80.5 overall, against 73.8 for conversation data alone.

## LLaVA-Bench (In-the-Wild) against BLIP-2 and OpenFlamingo

This benchmark has 24 images and 60 questions, covering indoor and outdoor scenes, memes, paintings and sketches, and each image has a detailed, manually written description.

LLaVA scores 67.3 ± 2.0 overall, against 38.1 ± 1.0 for BLIP-2 and 19.1 ± 0.4 for OpenFlamingo, with means and standard deviations over three inference runs. The LLaVA† row reuses one set of decoding sequences, queried three times with GPT-4, and reaches 66.7 ± 0.3. The reported margins are +29% over BLIP-2 and +48% over OpenFlamingo.

On complex reasoning questions LLaVA reaches 81.7%, and its overall score is 67.3%. Scores are relative to the text-only GPT-4 that receives textual ground-truth descriptions.

## ScienceQA accuracy and GPT-4 ensembling

ScienceQA contains 21k multimodal multiple-choice questions, split into 12726, 4241 and 4241 examples for training, validation and test. LLaVA uses visual features from before the last layer, predicts reasons before the answer, and trains for 12 epochs, reaching 90.92% accuracy. That is close to the MM-CoT Large result of 91.68, the state of the art reported in the literature.

GPT-4 with 2-shot in-context learning reaches 82.69%, a 7.52% absolute gain over 75.17% for GPT-3.5 with chain-of-thought. The GPT-3.5 and MM-CoT rows come from the literature, while the GPT-4 row is the authors' own run. Many GPT-4 failures come from replies that say the context lacks images or plots.

In the complement scheme, LLaVA's prediction replaces GPT-4 whenever GPT-4 gives no answer, which yields 90.97%, almost the same as LLaVA alone. In the judge scheme, when GPT-4 and LLaVA disagree, text-only GPT-4 is prompted again with both outcomes and gives a final answer, reaching 92.53%. The judge scheme improves over the question categories in Table 7, and the authors state that this is the first use of GPT-4 for model ensembling.

Text-only GPT-4 helps on image-context questions because some of them do not need the image for a correct answer.

## Design choices on ScienceQA

Each design choice is changed alone and compared with the best variant at 90.92. Using the last-layer CLIP features yields 89.96, which is 0.96 lower than features from before the last layer. The authors hypothesize that last-layer features focus on global and abstract properties, while earlier-layer features capture localized detail useful for specific image content.

Answer-first ordering reaches 89.77 in 12 epochs, and reasoning-first reaches the same 89.77 in 6 epochs without further gain from more training. Training for 24 epochs does not improve performance. The authors conclude that reasoning-first mainly speeds up convergence and adds little to the final accuracy.

Training from scratch on ScienceQA, without the pre-training stage, drops accuracy to 85.81, a 5.11% absolute loss. The 7B model reaches 89.84, which is 1.08% lower than the 90.92 of the 13B model. These ablations were run only on ScienceQA, so they do not show how the same choices affect the chat benchmarks.

## Failure cases on In-the-Wild

The authors designed LLaVA-Bench (In-the-Wild) to be challenging and to reveal weaknesses, and Table 6 gives two failure examples. The ramen example needs the restaurant's name and multilingual reading, and describing the side dishes may need information from the Internet. The fridge example needs high-resolution input to read the yogurt brand, along with broad knowledge.

LLaVA answers yes when asked about strawberry-flavored yogurt, although the fridge holds only yogurt and strawberries. The authors read this as the model sometimes treating the image as a bag of patches rather than grasping its semantics.

The benchmarks are small, with 90 questions on LLaVA-Bench (COCO) and 60 on LLaVA-Bench (In-the-Wild). All judgements come from a text-only GPT-4 judge, and its reference is built from ground-truth text, which the authors treat as an approximate upper bound. The projection is a single linear layer, and more sophisticated connectors are left for future work.

## Paper info

- **Authors**: Haotian Liu, Chunyuan Li, Qingyang Wu, Yong Jae Lee
- **Venue**: arXiv · Preprint
- **First published**: 2023-4-17
- **Added**: 2026-10-20
- **Updated**: 2023-12-11
- **Version**: v2
- **arXiv**: 2304.08485
- **Category**: cs.CV · cs.AI · cs.CL · cs.LG
- **Original paper terms**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **What we show**: Paper info, commentary and permitted figures from the original paper

[Original paper ↗](https://arxiv.org/abs/2304.08485v2) · [PDF ↗](https://arxiv.org/pdf/2304.08485v2)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Abstract

Instruction tuning large language models (LLMs) using machine-generated instruction-following data has improved zero-shot capabilities on new tasks, but the idea is less explored in the multimodal field. In this paper, we present the first attempt to use language-only GPT-4 to generate multimodal language-image instruction-following data. By instruction tuning on such generated data, we introduce LLaVA: Large Language and Vision Assistant, an end-to-end trained large multimodal model that connects a vision encoder and LLM for general-purpose visual and language understanding.Our early experiments show that LLaVA demonstrates impressive multimodel chat abilities, sometimes exhibiting the behaviors of multimodal GPT-4 on unseen images/instructions, and yields a 85.1% relative score compared with GPT-4 on a synthetic multimodal instruction-following dataset. When fine-tuned on Science QA, the synergy of LLaVA and GPT-4 achieves a new state-of-the-art accuracy of 92.53%. We make GPT-4 generated visual instruction tuning data, our model and code base publicly available.

## Quote from the paper

Haotian Liu, Chunyuan Li, Qingyang Wu, Yong Jae Lee (2023). Visual Instruction Tuning. arXiv:2304.08485v2. https://arxiv.org/abs/2304.08485v2

**BibTeX**

```
@misc{liu2023visual,
  title = {{Visual Instruction Tuning}},
  author = {Haotian Liu and Chunyuan Li and Qingyang Wu and Yong Jae Lee},
  year = {2023},
  eprint = {2304.08485},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2304.08485v2}
}
```

## Other paper commentary

- [Qwen2.5 Technical Report](https://refivu.com/en/papers/bbe09642-acbf-4c8a-ac5f-c376606e8d8b-qwen2-5-technical-report.md)
- [Evaluating Large Language Models Trained on Code](https://refivu.com/en/papers/10d79a8a-e539-4768-b215-b5af91ac2dbf-evaluating-large-language-models-trained-on-code.md)
- [Flamingo: a Visual Language Model for Few-Shot Learning](https://refivu.com/en/papers/0ee82fc2-fa2e-482f-ac81-6d339f94b5fd-flamingo-a-visual-language-model-for-few-shot.md)
- [Toolformer: Language Models Can Teach Themselves to Use Tools](https://refivu.com/en/papers/f48b7ceb-5adf-433c-91ec-a0e24795c172-toolformer-language-models-can-teach-themselves-to-use.md)
- [DeBERTa: Decoding-enhanced BERT with Disentangled Attention](https://refivu.com/en/papers/b1eee697-1c6e-4274-956c-048abc93c07c-deberta-decoding-enhanced-bert-with-disentangled-attention.md)
- [ReAct: Synergizing Reasoning and Acting in Language Models](https://refivu.com/en/papers/332bb0c8-840f-4238-89c1-dfa32572b3d8-react-synergizing-reasoning-and-acting-in-language-models.md)
- [Segment Anything](https://refivu.com/en/papers/da97e79e-c51b-4305-9514-76a2433c46a4-segment-anything.md)
- [WaveNet: A Generative Model for Raw Audio](https://refivu.com/en/papers/df60bc5e-602b-494d-b90e-87e94d1fe90d-wavenet-a-generative-model-for-raw-audio.md)
- [Diffusion Models Beat GANs on Image Synthesis](https://refivu.com/en/papers/c4296a34-b538-4422-b11f-4a805621a24f-diffusion-models-beat-gans-on-image-synthesis.md)
- [Robust Speech Recognition via Large-Scale Weak Supervision](https://refivu.com/en/papers/52603b17-2b8d-42a8-916e-6c06910f2ca7-robust-speech-recognition-via-large-scale-weak-supervision.md)
- [Neural Discrete Representation Learning](https://refivu.com/en/papers/111a9c5f-9d7d-4bff-bbad-a962285094a3-neural-discrete-representation-learning.md)
- [Momentum Contrast for Unsupervised Visual Representation Learning](https://refivu.com/en/papers/4093c4bb-ce8b-4d26-bded-60ec02bc0fac-momentum-contrast-for-unsupervised-visual-representation.md)

## Terms in this paper

- [GPT-4](https://refivu.com/en/terms/1e2d0d2cdc44-gpt-4)
- [CLIP](https://refivu.com/en/terms/b5b5b48d5f4e-clip)
- [ChatGPT](https://refivu.com/en/terms/96047648490a-chatgpt)
- [Chain-of-Thought (CoT)](https://refivu.com/en/terms/fb95d6ae063c-chain-of-thought-cot)
- [ScienceQA](https://refivu.com/en/terms/4deed9de0244-scienceqa)
- [BLIP-2](https://refivu.com/en/terms/d03727ce12f7-blip-2)
- [visual instruction tuning](https://refivu.com/en/terms/da1b9f19793f-visual-instruction-tuning)
- [Vicuna](https://refivu.com/en/terms/a2f9c4b5903c-vicuna)
- [projection matrix](https://refivu.com/en/terms/b70dd62f03b2-projection-matrix)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/760eaf17-9dbc-40d5-afee-d36c375c59e3-visual-instruction-tuning)
