Paper commentary
ViLBERT: Pretraining Task-Agnostic Visiolinguistic Representations for Vision-and-Language Tasks
ViLBERT learns vision and language jointly before transferring to many tasks
- Problem Vision-language models learn image-text links only during task training, so they transfer poorly.
- Method Pretrains a two-stream, BERT-style model on image regions and text, with co-attentional transformer layers, using masked multi-modal modelling and multi-modal alignment prediction on Conceptual Captions, then fine-tunes the whole model on each transfer task.
- Results ViLBERT reaches 70.55 on VQA test-dev, compared with 68.85 for the Single-Stream baseline. It also reaches 72.34 on RefCOCO+ validation, compared with 65.33 for MAttNet.
Why pretrain for visual grounding
Most vision-and-language systems start from language and vision models that were pretrained for other large-scale tasks and learn how the two relate only while training on the target task. When paired image-text data is scarce or skewed, this route tends to produce groundings that do not carry over well to new settings. The study instead asks whether the link between visual content and phrases can be learned once as a separate pretraining stage and then reused.
The pretraining signal comes from proxy tasks built from structure already present in the data, the same idea used in recent self-supervised learning. The data source is Conceptual Captions, which contains about 3.3 million images with weakly associated captions gathered from alt-text on the web.
BERT as the starting point
BERT maps a sequence of word tokens to learned encodings and passes them through L encoder-style transformer blocks to produce final representations. The attention output is followed by a small fully connected network, and both parts sit inside residual adds.
BERT is pretrained with masked language modelling, in which about 15% of tokens are masked, 80% of those are replaced with a mask token, 10% with a random word and 10% are left unchanged, and a linear layer predicts the original tokens under a cross-entropy loss. It is also pretrained with next sentence prediction, where a linear layer on the CLS representation is trained with a binary cross-entropy loss to decide whether the second segment follows the first.
Two streams joined by co-attention
A simpler option would be to cluster image features into discrete visual tokens and feed them to BERT alongside words. The authors reject this for three reasons: clustering can discard visual detail, the two modalities would be processed identically even though they differ in complexity and level of abstraction, and the extra tokens could disturb the weights learned for language.
ViLBERT instead runs two parallel streams, one over image regions and one over text, each built from transformer blocks (TRM) and co-attentional transformer layers (Co-TRM). Because the streams have their own depths, the text stream can do more processing before it meets the visual features, which fits the view that region features are already high-level and need less context aggregation than words.
In a co-attentional layer, each stream computes its own queries, but its keys and values are passed to the other stream's multi-headed attention block. As a result the visual stream attends over language-conditioned features, and the linguistic stream attends over image-conditioned features, and a residual add with the original representation follows.
Co-attention between vision and language was proposed earlier, and concurrent work has used similar co-attentional transformer structures on visual question answering.
This vector is projected to the feature dimension and added to the visual feature, and a special IMG token, carrying mean-pooled features and a spatial code for the full image, marks the start of the region sequence.
The two pretraining objectives
Masked multi-modal modelling follows masked language modelling in BERT, masking about 15% of words and image regions and asking the model to recover them from the rest. A masked region has its features zeroed out 90% of the time and is left unchanged 10% of the time. The model does not regress the masked feature values. It outputs a distribution over semantic classes for the region, and that output is matched to the distribution from the same detector used for feature extraction, using a KL divergence loss.
The argument for this choice is that language tends to name high-level semantics rather than exact appearance, so a regression target would be hard to reconstruct from text. A regression loss would also make it harder to balance the losses of masked image inputs and masked text inputs.
In multi-modal alignment prediction, the input is the IMG token and the image regions, followed by CLS, the caption tokens and SEP. The IMG and CLS outputs are multiplied element-wise, and a linear layer predicts whether the image and caption are aligned. Conceptual Captions only contains aligned pairs, so negatives are made by replacing either the image or the caption with a randomly chosen one.
Pretraining setup
After some links had broken, pretraining used about 3.1 million image-caption pairs from Conceptual Captions. The linguistic stream starts from a BERT-BASE model pretrained on BookCorpus and English Wikipedia, and the authors chose the base model because of training time, noting that the larger model could help further.
Region features come from a Faster R-CNN with a ResNet-101 backbone, pretrained on Visual Genome, and between 10 and 36 high-scoring boxes are kept per image. Each region feature is the mean-pooled convolutional feature from its box, and the visual stream uses a hidden size of 1024 with 8 attention heads.
Fine-tuning heads for each transfer task
For each task, the pretrained base is modified with a small output layer and the whole network is trained end-to-end, so the task-specific change is usually a classification layer.
For VQA 2.0, which has about 1.1 million questions on COCO images with 10 answers each, a two-layer MLP sits on the element-wise product of the IMG and CLS representations and predicts over 3,129 answers. The answers are treated as multi-label targets with soft scores, trained with binary cross-entropy for up to 20 epochs at batch size 256 with Adam at 4e-5, and inference takes a softmax.
VCR is posed as two multiple-choice problems, Q→A and QA→R, and the holistic Q→AR setting requires both to be correct. Each question is paired with each candidate response to form four text inputs, each passed through ViLBERT with the image, and a linear layer scores each pair before a softmax over the four scores. Training uses cross-entropy for 20 epochs, batch size 64 and an initial learning rate of 2e-5, and the dataset covers 290k problems from 110k movie scenes.
For referring expressions on RefCOCO+, the model reranks region proposals from a Mask R-CNN trained on COCO, using the final representation of each region passed through a learned linear layer. Each proposal is labelled by its IoU with the ground-truth box, using a threshold of 0.5, trained with binary cross-entropy for up to 20 epochs at batch size 256 with learning rate 4e-5, and the highest-scoring region is returned.
Caption-based retrieval uses Flickr30k, with 31,000 images and five captions each, and the standard splits give 1,000 images each for validation and test. Training is a 4-way multiple-choice setup in which each positive pair is compared with three distractors, drawn as random captions, random images or hard negatives from the 100 nearest neighbours of the target image.
At test time the linguistic representation is cached before the first Co-TRM layer, which freezes the text side before fusion for efficiency.
The zero-shot retrieval setting uses the pretrained alignment prediction score directly, with no fine-tuning on Flickr30k, and ranks candidates on the same test split.
Results against task-specific models and ablations
The Single-Stream baseline puts both modalities through one shared BERT stack initialized from BERT-BASE and trained like the full model, so visual processing is deeper and interaction starts earlier. The ViLBERT† variant keeps the full architecture and features but skips the Conceptual Captions pretraining tasks, while still using BERT initialization for the text stream.
On VQA test-dev, the full ViLBERT reaches 70.55, compared with 68.85 for Single-Stream and 68.93 for ViLBERT†, and the DFAF entry in the table is 70.22.
On RefCOCO+ validation, ViLBERT reaches 72.34, compared with 65.33 for MAttNet, and on VCR Q→AR validation it reaches 54.04, compared with 43.1 for R2C. The authors report that these margins for VCR, RefCOCO+ and image retrieval are 7 to 10 percentage points.
Pretraining on Conceptual Captions improves every transfer task over ViLBERT†, with gains the authors place between 2% and 13%, and they note a similar effect on the Single-Stream model. The authors also observe that the architecture improves over Single-Stream in both pretrained and non-pretrained settings, with the largest gains on VQA and RefCOCO+.
Effect of visual stream depth and pretraining data size
The depth ablation varies the number of repeated Co-TRM→TRM blocks from 2 to 8. VQA and caption-based image retrieval gain up to a depth of 6, and zero-shot retrieval keeps improving with depth, with 6 and 8 layers reaching 31.86 and 32.80 R1 respectively. VCR and RefCOCO+ do best with shallower models, so the authors read the tasks as needing different amounts of context aggregation.
The data ablation pretrains on random 25% and 50% subsets of Conceptual Captions and on the full set, using the same setup. Zero-shot R1 rises from 0.00 with no pretraining to 20.40 at 25%, 26.76 at 50% and 31.86 at 100%. Across the tested fractions the scores rise monotonically with data size, which the authors take as a sign that ViLBERT may benefit from more pretraining data; no larger corpus was tested.
What the pretrained model appears to learn
Without any Flickr30k fine-tuning, the pretrained model reaches an R1 of 31.86 on caption-based retrieval, against 58.20 for the fine-tuned ViLBERT. The table also lists 48.60 R1 for SCAN, which is higher than the zero-shot value, so the zero-shot setting does not match the prior best result. The authors read the non-zero zero-shot score as evidence that alignment between vision and language is learned during pretraining, though it is one retrieval setting.
The authors also sample captions from the pretrained model by starting with all MASK tokens and resampling tokens in a Markov Chain Monte Carlo fashion, which is a generation procedure from earlier work on BERT as a Markov random field. Many samples describe the image content, but because Conceptual Captions was collected from web alt-text, several are editorialized and refer to non-visual concepts.
Limitations
The Single-Stream baseline was not evaluated on caption-based image retrieval or zero-shot retrieval because of its high computational cost. Captioning, embodied tasks, visually grounded dialog and video captioning were not covered, and decoding text from this bidirectional model is unclear because greedy decoders such as beam search do not apply.
The sampled captions come from a model that was not fine-tuned on clean, human-written captions, so their quality is not established. The pretraining data includes noisy and sometimes non-human captions, and the base-size text model was chosen over the larger one for training time reasons, so the effect of a larger model was not measured.
The data-size trend is measured on only 25%, 50% and 100% of the dataset.
Related self-supervised work on video
The closest concurrent work learns joint representations of video and language from cooking videos with transcribed audio, using a single unified BERT architecture similar to the Single-Stream baseline. That work applies its model to zero-shot activity recognition and to blank-filling on audio transcripts, whereas this study learns from web images and descriptive text and transfers to established image-language tasks.
Paper info
- Authors
- Jiasen Lu, Dhruv Batra, Devi Parikh, Stefan Lee
- Venue
- arXiv · Preprint
- First published
- 2019-8-6
- Added
- 2026-11-12
- Updated
- 2019-8-6
- Version
- v1
- arXiv
- 1908.02265
- Category
- cs.CV · cs.CL
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
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
Jiasen Lu, Dhruv Batra, Devi Parikh, Stefan Lee (2019). ViLBERT: Pretraining Task-Agnostic Visiolinguistic Representations for Vision-and-Language Tasks. arXiv:1908.02265v1. https://arxiv.org/abs/1908.02265v1
BibTeX
@misc{lu2019vilbert,
title = {{ViLBERT: Pretraining Task-Agnostic Visiolinguistic Representations for Vision-and-Language Tasks}},
author = {Jiasen Lu and Dhruv Batra and Devi Parikh and Stefan Lee},
year = {2019},
eprint = {1908.02265},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1908.02265v1}
}