# VisualBERT: A Simple and Performant Baseline for Vision and Language

VisualBERT feeds words and image regions into one Transformer stack

Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, Kai-Wei Chang · arXiv · 2019-8-9

- **Problem** Vision-and-language systems are usually built task by task, each with its own text encoder, image feature extractor, fusion module and answer classifier. That assembly is hard to reuse across tasks.
- **Method** VisualBERT feeds text tokens and image region features into one BERT-initialized Transformer. It pre-trains on COCO captions with masked language modeling and sentence-image prediction, then fine-tunes for each task.
- **Results** On the Flickr30K Entities test split, VisualBERT reaches 71.33 R@1 against 69.69 for BAN.

## One stack for words and image regions

Most vision-and-language systems are built for a single task, with a text encoder, an image feature extractor, a fusion module and an answer classifier assembled around it. VisualBERT replaces that assembly with one stack of Transformer layers that receives the words and the image region features together. Because self-attention runs over the combined sequence, a word can be linked to a region without a separate hand-built alignment step.

Region features from a pre-trained object detector are treated as an unordered set of tokens, so they sit alongside subword tokens in one input. Captions describe objects, attributes and relations in natural language, so the authors pre-train on caption data to teach the model those associations.

## How each token is embedded

A text embedding is the sum of a subword token embedding, a segment embedding that marks which part of the text it comes from, and a position embedding. Each image region embedding sums a visual feature from a convolutional network, a segment embedding that marks it as an image rather than text, and a position embedding. The region position embedding is used only when the input provides word-to-region alignments; it is then the sum of the position embeddings of the aligned words.

If the visual and text embeddings differ in dimension, the visual embeddings are projected into the text dimension.

Text and visual vectors then pass through the same multi-layer Transformer, which lets the model build a joint representation over both sets of inputs. The encoder keeps the BERT-Base configuration of 12 layers, a hidden size of 768 and 12 self-attention heads, with parameters initialized from the released BERT-Base weights.

## Pre-training stages and fine-tuning

The first stage uses COCO, where each image is paired with five captions, and the Karpathy train split contains about 100k images. Masked language modeling runs with the image: some text tokens are hidden and must be predicted, while the image region vectors are never masked. For sentence-image prediction, a two-caption text segment is built so that one caption describes the image and the second is either another caption of the same image or a random caption, each with a 50% chance.

Before fine-tuning, the model continues masked language modeling with the image on the target task's data so that it adapts to the new domain. Fine-tuning then adds a task-specific input, output layer and objective and trains the Transformer on that task. Training uses Adam, with warm-up set to 10% of the total steps unless stated otherwise.

COCO pre-training uses the same image features as the end task, so the features are not changed between stages.

## Results on the four benchmarks

On Test-Dev the full model scores 70.80, above Pythia v0.1 at 68.49 and Pythia v0.3 at 68.71, which the authors place in the comparable setting. Its Test-Std score is 71.00, while methods that add Visual Genome question-answer pairs, several detectors or ensembles appear in a group the authors treat as not directly comparable. Without COCO pre-training the Test-Dev score is 70.18, and without Early Fusion it is 68.18.

VCR contains 290k questions drawn from 110k movie scenes and is split into Q→A and QA→R sub-tasks. Image features come from a ResNet50 with the dataset's gold boxes and segmentations, and words are linked to regions through shared position embeddings. The full model reaches 52.4 on the Q→AR test split, against 44.0 for R2C, and 52.2 on dev, against 43.1 for R2C.

The variant without COCO pre-training reaches 47.9 on Q→AR dev; the authors note that it has the same resources as R2C. In the full setting ResNet50 is fine-tuned with the model, and the authors report 51.4 on dev for Q→AR when ResNet50 stays fixed.

For NLVR2, features come from a Detectron detector with 144 proposals per image, and the two images receive different segment embeddings. The full model reaches 67.4 dev accuracy, against 54.1 for MaxEnt, and the variants without Early Fusion (64.6) and without COCO pre-training (63.5) also sit above MaxEnt. The full model reaches 67.0 on Test-P and 67.3 on Test-U, and 26.9 on Test-U (Cons), where MaxEnt scores 12.0.

Flickr30K Entities has 30k images, and the setting follows BAN with Faster R-CNN features pre-trained on Visual Genome. Fine-tuning adds one self-attention block, and a phrase is grounded to the box receiving the most attention from the phrase's last subword. On the test split VisualBERT reaches R@1 of 71.33 against 69.69 for BAN, and on dev it reaches 70.40.

The authors observe no clear gap between the variant without Early Fusion and the full model on this task, and suggest a shallower architecture may be enough here.

## Which components matter on NLVR2

For ease of computation, the ablation models use 36 features per image, including the full model. Under this setting the full model reaches 66.7 dev accuracy, and four components are tested: task-agnostic pre-training, Early Fusion, BERT initialization and the sentence-image objective.

Removing COCO pre-training entirely gives 62.9, and keeping only the caption text without images gives 63.9; both fall below the full model. The authors read this as evidence that pre-training on paired vision and language data matters.

Moving Early Fusion to the end of the stack gives 61.4 dev, the largest drop among the variants in this table. Random initialization in place of BERT gives 64.7, and the authors say the drop is smaller than they expected, which they attribute to COCO pre-training teaching much of the same grounded language.

Removing the sentence-image prediction objective gives 64.9, a positive but smaller effect than the other components. The authors conclude that task-agnostic pre-training and Early Fusion are the most important design choices, and that both the extra COCO data and the use of images alongside captions matter.

## Attention heads and grounding

Before any fine-tuning, each of the 144 attention heads is checked on Flickr30K entities: attention to other words is masked, and the region with the most attention is compared with the annotation. This entity grounding accuracy is compared with a baseline that always picks the region with the highest detection confidence.

Accuracy varies by layer and tends to peak in higher layers, and some heads reach high accuracy. The authors read the rise as the model being less certain when it combines the two inputs in lower layers and then becoming more aware of the alignment higher up. Heads that put only a small share of their attention on image regions are drawn with smaller dots in the figure, so the accuracy of such heads should be read with that in mind.

For syntactic grounding, sentences are parsed with AllenNLP's dependency parser, and for each word pair linked by a dependency relation with one ground-truth region, the head's attention is checked. At least one head per relation beats the most-confident-region baseline, and many heads link verbs with the regions of their arguments for pobj, nsubj and dobj.

Figure 4 reports four relations, pobj, amod, nsubj and dobj, and the baseline is drawn as a grey line.

Figures 1 and 5 show selected heads over six layers, and the authors describe alignments being refined layer by layer, for example from a mix of the woman and husband in lower layers to a separation of the two. Regions are grouped by hand, so these examples illustrate behavior rather than provide a measured score. The authors also point to syntactic alignments, such as teased linking to both the man and the woman, and the pronoun her resolved to the woman.

## Limitations

The ablations use 36 features per image, while the main NLVR2 results use 144, so the ablation numbers are not the main results. A separate test of proposal counts (9, 18, 36, 72 and 144) reaches 64.8 to 67.4 on dev, and this is the only proposal-count evidence reported.

The comparison with ViLBERT is only partial, since that work uses Conceptual Captions and different visual representations and pre-training resources. Each benchmark uses its own standard detector, so the scores do not come from one shared feature setting.

The grounding and syntactic analyses use only Flickr30K annotations. The authors leave open extensions to image-only tasks and to larger caption datasets such as Visual Genome and Conceptual Captions.

## Paper info

- **Authors**: Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, Kai-Wei Chang
- **Venue**: arXiv · Preprint
- **First published**: 2019-8-9
- **Added**: 2026-11-12
- **Updated**: 2019-8-9
- **Version**: v1
- **arXiv**: 1908.03557
- **Category**: cs.CV · cs.CL · cs.LG
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

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

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.

## Quote from the paper

Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, Kai-Wei Chang (2019). VisualBERT: A Simple and Performant Baseline for Vision and Language. arXiv:1908.03557v1. https://arxiv.org/abs/1908.03557v1

**BibTeX**

```
@misc{li2019visualbert,
  title = {{VisualBERT: A Simple and Performant Baseline for Vision and Language}},
  author = {Liunian Harold Li and Mark Yatskar and Da Yin and Cho-Jui Hsieh and Kai-Wei Chang},
  year = {2019},
  eprint = {1908.03557},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1908.03557v1}
}
```

## Other paper commentary

- [Towards Robust Monocular Depth Estimation: Mixing Datasets for Zero-shot Cross-dataset Transfer](https://refivu.com/en/papers/8f3933a0-30e6-41a0-8d25-597109ee5170-towards-robust-monocular-depth-estimation-mixing-datasets.md)
- [Simple Baselines for Human Pose Estimation and Tracking](https://refivu.com/en/papers/1bfa3990-5650-4254-9d74-6addde0897ee-simple-baselines-for-human-pose-estimation-and-tracking.md)
- [ResUNet-a: a deep learning framework for semantic segmentation of remotely sensed data](https://refivu.com/en/papers/e379f4f3-b44b-4709-bcbb-3cde82b7fd42-resunet-a-a-deep-learning-framework-for-semantic.md)
- [Center-based 3D Object Detection and Tracking](https://refivu.com/en/papers/b992611c-4688-4646-b792-a65eff7bf099-center-based-3d-object-detection-and-tracking.md)
- [An overview of deep learning in medical imaging focusing on MRI](https://refivu.com/en/papers/32ea4d5e-6c76-4049-bb47-28e2173246b5-an-overview-of-deep-learning-in-medical-imaging.md)
- [Multi-Stage Progressive Image Restoration](https://refivu.com/en/papers/a0d55708-eafa-400b-8906-c56a935d39eb-multi-stage-progressive-image-restoration.md)
- [Diffusion Models: A Comprehensive Survey of Methods and Applications](https://refivu.com/en/papers/88553d75-09f1-48d0-a32d-bbb93fe0b6e8-diffusion-models-a-comprehensive-survey-of-methods-and.md)
- [UNITER: UNiversal Image-TExt Representation Learning](https://refivu.com/en/papers/c2b71a61-22ad-48f9-af71-922539fd9eab-uniter-universal-image-text-representation-learning.md)
- [CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation](https://refivu.com/en/papers/eb07d47d-3eb5-4fba-ba4e-7d3bd33335aa-codet5-identifier-aware-unified-pre-trained-encoder-decoder.md)
- [DreamFusion: Text-to-3D using 2D Diffusion](https://refivu.com/en/papers/8748788c-c1b0-47b9-a624-78c1f27630e6-dreamfusion-text-to-3d-using-2d-diffusion.md)
- [Two-Stream Adaptive Graph Convolutional Networks for Skeleton-Based Action Recognition](https://refivu.com/en/papers/34b4bb2a-43de-4874-9031-6b02160d4003-two-stream-adaptive-graph-convolutional-networks-for.md)
- [Generative AI](https://refivu.com/en/papers/20462cc3-15fd-4b36-8393-33848e90e0dd-generative-ai.md)

## Terms in this paper

- [Transformer](https://refivu.com/en/terms/48e8be2570bc-transformer)
- [ADAM](https://refivu.com/en/terms/0e9ad0199e08-adam)
- [COCO](https://refivu.com/en/terms/41f3215c4f4a-coco)
- [masked language modeling](https://refivu.com/en/terms/5df1a60d4f18-masked-language-modeling)
- [Faster-RCNN](https://refivu.com/en/terms/7399dfe3365a-faster-rcnn)
- [Visual Question Answering](https://refivu.com/en/terms/fc0a624b0e20-visual-question-answering)
- [self-attention mechanism](https://refivu.com/en/terms/a86abb2cdf86-self-attention-mechanism)
- [Early fusion](https://refivu.com/en/terms/1fab36eaa264-early-fusion)
- [Visual Genome](https://refivu.com/en/terms/278e846f67fc-visual-genome)
- [R@1](https://refivu.com/en/terms/8690f4d58f6d-r-1)
- [VQA 2.0](https://refivu.com/en/terms/36b9f2e2b271-vqa-2-0)
- [Visual Commonsense Reasoning](https://refivu.com/en/terms/5f969b24359f-visual-commonsense-reasoning)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/146a7bb6-3ad9-4579-98f2-9a180a30f10a-visualbert-a-simple-and-performant-baseline-for-vision)
