Title: UNITER: LEARNING UNIVERSAL IMAGE-TEXT REPRESENTATIONS

Abstract: Joint image-text embedding is the bedrock for most Vision-and-Language (V+L) tasks, where multimodality inputs are jointly processed for visual and textual understanding. In this paper, we introduce UNITER, a UNiversal Image-TExt Representation, learned through large-scale pre-training over four image-text datasets (COCO, Visual Genome, Conceptual Captions, and SBU Captions), which can power heterogeneous downstream V+L tasks with joint multimodal embeddings. We design three pre-training tasks: Masked Language Modeling (MLM), Image-Text Matching (ITM), and Masked Region Modeling (MRM, with three variants). Different from concurrent work on multimodal pre-training that apply joint random masking to both modalities, we use conditioned masking on pre-training tasks (i.e., masked language/region modeling is conditioned on full observation of image/text). Comprehensive analysis shows that conditioned masking yields better performance than unconditioned masking. We also conduct a thorough ablation study to find an optimal setting for the combination of pre-training tasks. Extensive experiments show that UNITER achieves new state of the art across six V+L tasks (over nine datasets), including Visual Question Answering, Image-Text

1. INTRODUCTION:

Most Vision-and-Language tasks rely on joint multimodel embeddings to bridge the semantic gap between visual and textual clues in images and text, although such representations are usually tailored for specific tasks. For example, MCB (Fukui et al., 2017) , BAN (Kim et al., 2018) , DFAF (Gao et al., 2019) proposed advanced multimodal fusion methods for Visual Question Answering (VQA) (Antol et al., 2015) . SCAN (Lee et al., 2018) and MAttNet (Yu et al., 2018) studied learning latent alignment between words and image regions for Image-Text Retrieval (Wang et al., 2016) and Referring Expression Comprehension (Kazemzadeh et al., 2014) tasks. While each of these proposed models has pushed the state of the art on respective benchmarks, their architectures are diverse and the learned representations are highly task-specific, preventing them from being generalized to other tasks. This raises a million-dollar question: can we learn a universal image-text representation for all V+L tasks?

To answer this question, we introduce UNiversal Image-TExt Representations (UNITER), a largescale pre-trained model for multimodal embedding. We adopt Transformer (Vaswani et al., 2017) as the core of our model, to leverage its elegant self-attention mechanism designed for learning contextualized representations. Inspired by BERT (Devlin et al., 2019) , which has successfully applied Transformer to NLP tasks through large-scale language modeling, we pre-train UNITER through three pre-training tasks: (i) Masked Language Modeling (MLM) conditioned on image; (ii) Masked Region Modeling (MRM) conditioned on text; and (iii) joint Image-Text Matching (ITM). To further investigate the effectiveness of MRM, we propose three MRM variants: (i) Masked Region Classification (MRC); (ii) Masked Region Feature Regression (MRFR); and (iii) Masked Region Classification with KL-divergence (MRC-kl).

As shown in Figure 1 , UNITER first encodes image regions (visual features and bounding box features) and textual words (tokens and positions) into a common embedding space with Image Embedder and Text Embedder, then applies a Transformer module to learn generalizable contex- tualized embeddings for each region and word through aforementioned pre-training tasks. Compared with LXMERT (Tan & Bansal, 2019) and ViLBERT (Lu et al., 2019 ) that use two streams (one Transformer for each modality), our UNITER model can learn joint contextualized representations for image regions and textual words through a single Transformer. Besides, our masked language/region modeling is conditioned on full observation of image/text, different from other concurrent pre-trained models that apply joint random masking to both modalities. We show that the conditional masking strategy can successfully ease the missing-alignment between images and text, and obtain better joint embeddings for downstream tasks. Detailed ablation study also demonstrates that the combination of MLM+ITM+MRC-kl+MRFR yields the best pre-training performance. 

3. UNIVERSAL IMAGE-TEXT REPRESENTATIONS:

In this section, we first introduce the model architecture of UNITER (Section 3.1), then describe the designed pre-training tasks and V+L datasets used for pre-training (Section 3.2 and 3.3).

3.1. MODEL OVERVIEW:

The model architecture of UNITER is illustrated in Figure 1 . Given a pair of image and sentence, UNITER takes the visual regions of the image and textual tokens of the sentence as the input. We design an Image Embedder and a Text Embedder to extract their respective embeddings. These embeddings are then feed it into a multi-layer self-attention Transformer to learn a cross-modality contextualized embedding between visual regions and textual tokens. Note that the self-attention mechanism in Transformer is order-less, thus it is necessary to explicitly encode positions/locations of tokens/regions as additional inputs.

Specifically, in Image Embedder, we first use Faster R-CNN1 to extract the visual features (pooled ROI features) for each region. We also encode the location features for each region via a 7dimensional vector 2 . Both visual and location features are then fed through a fully-connected (FC) layer, to be projected into the same embedding space. The final visual embedding for each region is obtained by summing up the two FC outputs and then passing through a layer normalization (LN) layer. For Text Embedder, we follow BERT (Devlin et al., 2019) and tokenize the input sentence into WordPieces (Wu et al., 2016) . The final representation for each sub-word token 3 is obtained via summing up its word embedding and position embedding, followed by another LN layer 4 .

We introduce three main tasks to pre-train our model: Masked Language Modeling conditioned on image regions (MLM), Masked Region Modeling conditioned on input text (with three variants) (MRM), and Image-Text Matching (ITM). As shown in Figure 1 , our MRM and MLM are in analogy to BERT, where we randomly mask some words or regions from the input and learn to recover the words or regions as the output of Transformer. Specifically, word masking is realized by replacing the token with a special token [MASK], and region masking is implemented by replacing the visual feature vector with all zeros. Note that each time we only mask one modality while keeping the other modality intact, instead of randomly masking both modalities like ViLBERT and LXMERT. This prevents potential miss-alignment when a masked region happens to be described by a masked word. Empirically, we show that with conditional masking, our model is able to learn better embeddings (in Section 4.2). Lastly, we also learn an instance-level alignment (rather than token/region-level) between the whole image and the sentence via ITM. During training, we sample both positive and negative image-sentence pairs and learn their matching scores.

To pre-train UNITER with the aforementioned different tasks, we randomly sample one pre-training task for each mini-batch and train on only one objective per SGD update.

3.2. PRE-TRAINING TASKS:

Masked Language Modeling (MLM) We denote the image regions as v = {v 1 , ..., v K }, the input words as w = {w 1 , ..., w T }, and the mask indices as m ∈ N M . 5 In MLM, we randomly mask out the input words with probability of 15%, and replace the masked ones w m with special token

[MASK]6 . The goal is to predict these masked words based on the observation of their surrounding words w \m and all image regions v, by minimizing the negative log-likelihood:

EQUATION

)

where θ is the trainable parameters. Each pair (w, v) is sampled from the whole training set D.

Image-Text Matching (ITM):

In ITM, an additional special token [CLS] is fed into our model, which indicates the fused representation of both modalities. The inputs to ITM are a sentence and a set of image regions, and the output is a binary label (0 for negative match, and 1 for positive match). We extract the representation of [CLS] token as the joint representation of the input text and image, then fed into a fully connected layer and a sigmoid function to predict a score between 0 and 1. We denote the output score as s θ (w, v). The ITM supervision is over the [CLS] token. 7During training, we sample a positive or negative pair (w, v) from the dataset D at each step. The negative pair is created by replacing the image or text in a paired sample with a randomly-selected one from other samples. We denote the label as y ∈ {0, 1}, indicating if the sampled pair is a match. Then we apply a binary cross-entropy loss for optimization:

EQUATION

Masked Region Modeling (MRM) Similar to MLM, we also sample image regions and mask their visual features with a probability of 15%. The model is trained to reconstruct the masked regions v m given the remaining regions v \m and all the words w. The visual features v m of the masked region are replaced by zeros. Unlike textual tokens that are represented as discrete labels, visual features are high-dimensional and continuous, thus cannot be supervised via class likelihood. Instead, we propose three variants for Masked Region Modeling, which share the same objective base:

EQUATION

1) Masked Region Feature Regression (MRFR) MRFR learns to regress the Transformer output of each masked region v

(i)

m to its visual features. Specifically, we apply an FC layer to convert its Transformer output into a vector h θ (v

(i) m ) of same dimension as the input ROI pooled feature r(v (i) m ).

Then we apply L2 regression between the two:

f θ (v m |v \m , w) = M i=1 h θ (v (i) m ) -r(v (i) m ) 2 2 .

2) Masked Region Classification (MRC) MRC learns to predict the object semantic class for each masked region. We first feed the Transformer output of the masked region v

(i)

m into an FC layer to predict the scores of K object classes, which further goes through a softmax function to be transformed into a normalized distribution g θ (v

(i) m ) ∈ R K .

Note that there is no ground-truth label, as the object categories are not provided. Thus, we use the object detection output from Faster R-CNN, and take the detected object category (with the highest confidence score) as the label of the masked region, which will be converted into a one-hot vector c(v 3) Masked Region Classification with KL-Divergence (MRC-kl) MRC takes the most likely object class from the object detection model as the hard label (w.p. 0 or 1), which assumes the detected object class is the ground-truth label for the region. However, this may not be true, as no ground-truth label is provided for the detected region. Thus, in MRC-kl, we avoid this assumption by using soft label as supervision signal, which is the raw output from the detector (i.e., a distribution of object classes c(v

(i) m ) ∈ R K . The final objective minimizes the cross-entropy (CE) loss: f θ (v m |v \m , w) = M i=1 CE(c(v (i) m ), g θ (v (i) m )).

(i) m ))

. MRC-kl aims to distill such knowledge into UNITER as Hinton et al. (2015) , by minimizing the KL divergence between two distributions: To study the effects of different datasets on pre-training, we divide the four datasets into two categories. The first one consists of image captioning data from COCO and dense captioning data from VG. We call it "In-domain" data, as most V+L tasks are built on top of these two datasets. To obtain a 'fair' data split, we merge the raw training and validation splits from COCO, and exclude all validation and test images that appear in downstream tasks. We also exclude all co-occurring Flickr30K (Plummer et al., 2015) images via URL matching, as both COCO and Flickr30K images were crawled from Flickr and may have overlaps8 . The same rule was applied to Visual Genome as well. In this way, we obtain 5.6M image-text pairs for training and 131K image-text pairs for our internal validation, which is half the size of the dataset used in LXMERT (Tan & Bansal, 2019) , due to the filtering of overlapping images and the use of image-text pairs only. We also use additional Out-of-domain data from Conceptual Captions (Sharma et al., 2018) and SBU Captions (Ordonez et al., 2011) for model training 9 . The statistics on the cleaned splits are provided in Table 1 .

f θ (v m |v \m , w) = M i=1 D KL (c(v (i) m )||g θ (v (i) m )).

4. EXPERIMENTS:

We evaluate UNITER on six V+L tasks (listed in Table 2 ), by transferring the pre-trained model to each target task and finetuning through end-to-end training. We report experimental results on two model sizes: UNITER-base with 12 layers and UNITER-large with 24 layers 10 . 

4.1. DOWNSTREAM TASKS:

In VQA, VCR and NLVR 2 tasks, given an input image (or a pair of images) and a natural language question (or description), the model predicts an answer (or judges the correctness of the description) based on the visual content in the image. For Visual Entailment, we evaluate on the SNLI-VE dataset. The goal is to predict whether a given image semantically entails an input sentence. Classification accuracy over three classes ("Entailment", "Neutral" and "Contradiction") is used to measure model performance. For VQA, VCR, NLVR 2 , Visual Entailment and Image-Text Retrieval, we extract the joint embedding of the input image-text pairs via a multi-layer perceptron (MLP) from the representation of the [CLS] token. For RE Comprehension, we use the MLP to compute the region-wise alignment scores. These MLP layers are learned during the finetuning stage. Specifically, we formulate VQA, VCR, NLVR 2 , Visual Entailment and RE Comprehension as classification problems and minimize the cross-entropy loss over the ground-truth answers/responses. For Image-Text Retrieval, we formulate it as a ranking problem. During finetuning, we sample three pairs of image and text, one positive pair from the dataset and two negative pairs by randomly replacing its sentence/image with others. We compute the similarity scores (based on the joint embedding) for both positive and negative pairs, and maximize the margin between them through triplet loss.

4.2. EVALUATION ON PRE-TRAINING TASKS:

We analyze the effectiveness of different pre-training settings through ablation studies over VQA, NLVR 2 , Flickr30K and RefCOCO+ as representative V+L benchmarks. In addition to standard metrics for each benchmark (listed in Table 2 ) , we also use Meta-Sum (sum of all the scores across all the benchmarks) as a global metric.

Firstly, we establish two baselines: Line 1 (L1) in Note that LXMERT pre-trains with downstream VQA (+VG+GQA) data, which may help adapt the model to VQA task. However, when evaluated on unseen tasks such as NLVR 2 , UNITER-base achieves 3% gain over LXMERT. In addition, among all the models pre-trained on image-text pairs only, our UNITER-base outperforms the others by >1.5% on VQA.

It is also worth mentioning that both VilBERT and LXMERT observed two-stream model outperforms single-stream model, while our results show empirically that with our pre-training setting, single-stream model can achieve new state-of-the-art results, with much fewer parameters (UNITER-base: 86M, LXMERT: 183M, VilBERT: 221M) 13 .

For VCR, we propose a two-stage pre-training approach: (i) pre-train on standard pre-training datasets; and then (ii) pre-train on downstream VCR dataset. Interestingly, while VLBERT and B2T2 observed that pre-training is not very helpful on VCR, we find that the second-stage pretraining can significantly boost model performance, while the first-stage pre-training still helps but with limited effects (results shown in Table 5 ). This indicates that the proposed two-stage approach is highly effective in our pre-trained model over new data that are unseen in pre-training datasets.

Different from other tasks, NLVR 2 takes two images as input. Thus, directly finetuning UNITER pre-trained with image-sentence pairs might not lead to optimal performance, as the interactions between paired images are not learned during the pre-training stage. Thus, we experimented with three modified settings on NLVR 2 : (i) Triplet: joint embedding of images pairs and query captions;

(ii) Pair: individual embedding of each image and each query caption; and (iii) Pair-biattn: a bidirectional attention is added to the Pair model to learn the interactions between the paired images.

Comparison results are presented in Table 6 . The Pair setting achieves better performance than the Triplet setting even without cross-attention between the image pairs. We hypothesize that it is due to the fact that our UNITER is pre-trained with image-text pairs. Thus, it is difficult to finetune a pairbased pre-trained model on triplet input. The bidirectional attention mechanism in the Pair-biattn setting, however, compensates the lack of cross-attention between images, hence yielding the best performance with a large margin. This show that with minimal surgery on the top layer of UNITER, our pre-trained model can adapt to new tasks that are very different from pre-training tasks. 

5. CONCLUSION:

In this paper, we present UNITER, a large-scale pre-trained model providing UNiversal Image-TExt Representations for Vision-and-Language tasks. Three main pre-training tasks are proposed and evaluated through extensive ablation studies. Trained with both in-domain and out-of-domain datasets, UNITER outperforms state-of-the-art models over multiple V+L tasks by a significant margin. Future work includes studying early interaction between raw image pixels and sentence tokens, as well as developing more effective pre-training tasks.

A APPENDIX A.1 DATASET COLLECTION:

As introduced, our full dataset is composed of four existing V+L datasets: COCO, Visual Genome, Conceptual Captions, and SBU Captions. The dataset collection is not simply combining them, as we need to make sure none of the downstream evaluation images are seen during pre-training. Among them, COCO is the most tricky one to clean, as several downstream tasks are built based on it. Figure 2 lists the splits from VQA, Image-Text Retrieval, COCO Captioning, Ref-COCO/RefCOCO+/RefCOCOg, and the bottom-up top-down (BUTD) detection (Anderson et al., 2018) , all from COCO images.

As observed, the validation and test splits of different tasks are scattered across the raw COCO splits. Therefore, we exclude all those evaluation images that appeared in the downstream tasks. In addition, we also exclude all co-occurring Flickr30K images via URL matching, making sure the zero-shot image-text retrieval evaluation on Flickr is fair. The remaining images become the COCO subset within our full dataset, as shown in Figure 2 bottom row. We apply the same rules to Visual Genome, Conceptual Captions, and SBU Captions. 17 for multi-node communications (on TCP connections through ethernet) with up to 4 nodes of 4x V100 server. Gradient accumulation (Ott et al., 2018) is also applied to reduce multi-GPU communication overheads.

Visual Question Answering (VQA) We follow Yu et al. (2019) to take 3129 most frequent answers as answer candidates, and assign a soft target score to each candidate based on its relevancy to the 10 human responses. To finetune on VQA dataset, we use a binary cross-entropy loss to train a multi-label classifier using batch size of 10240 input units over maximum 5K steps. We use AdamW optimizer (Loshchilov & Hutter, 2019) with a learning rate of 3e -4 and weight decay of 0.01. At inference time, the max-probable answer is selected as the predicted answer. For results on test-dev and test-std splits, both training and validation sets are used for training, and additional question-answer pairs from Visual Genome are used for data augmentation as in Yu et al. (2019) .

Visual Commonsense Reasoning (VCR) VCR can be decomposed into two multiple-choice subtasks: question-answering task (Q → A) and answer-justification task (QA → R). In the holistic setting (Q → AR), a model needs to first choose an answer from the answer choices, then select a supporting rationale from rationale choices if the chosen answer is correct. We train our model in two settings simultaneously. When testing in the holistic setting, we first apply the model to predict an answer, then obtain the rationale from the same model based on the given question and the predicted answer. To finetune on VCR dataset, we concatenate the question (the qeustion and the ground truth answer) and each answer (rationale) choice from the four possible answer (rationale) candidates. The 'modality embedding' is extended to help distinguish question, answer and rationale. Crossentropy loss is used to train a classifier over two classes (''right'' or ''wrong'') for each question-answer pair (question-answer-rationale triplet) with a batch size of 4096 input units over maximum 5K steps. We use AdamW optimizer with a learning rate of 1e -4 and weight decay of 0.01.

Since the images and text in VCR dataset are very different from our pre-training dataset, we further pre-train our model on VCR, using MLM, MRFR and MRC-kl as the pre-training tasks. ITM is discarded because the text in VCR does not explicitly describe the image. The results of both pretrainings on VCR are reported in Table 5 and discussed in the main text. In conclusion, for downstream tasks that contain new data which is very different from the pre-training datasets, secondstage pre-training helps further boost the performance.

In our implementation, the second-stage pre-training is implemented with a batch size of 4096 intput units, a learning rate of 3e -4 and a weight decay of 0.01 over maximum 60K steps. After secondstage pre-traing, we finetune our model with a learning rate of 6e -5 over maximum 8K steps.

Natural Language for Visual Reasoning for Real (NLVR 2 ) NLVR2 is a new challenging task for visual reasoning. The goal is to determine whether a natural language statement is true about the given image pair. Here we discuss the three architecture variants of NLVR 2 finetuning in detail.

Since UNITER only handles one image and one text input at pre-training, the 'modality embedding' is extended to help distinguish the additional image presented in the NLVR 2 task. For the Triplet setup, we concatenate the image regions and then feed into the UNITER model. An MLP transform is applied on the [CLS] output for binary classification. For the Pair setup, we treat one input example as two text-image pairs by repeating the text. The two [CLS] outputs from UNITER are then depth concatenated as the joint embedding for the example. Another MLP further transform this embedding for the final classification. For the Pair-biattn setup, the input format is the same as the Pair setup. As for the joint representation, instead of rely on only two [CLS] outputs, we apply a multi-head attention layer (Vaswani et al., 2017) on one sequence of joint image-text embeddings to attend to the other sequence of embeddings, and vice versa. After this 'bidirectional' attention interactions, a simple attentional pooling is applied on each output sequences and then a final con-cat+MLP layer transforms the cross-attended joint representation for true/false classification.

We finetune UNITER on NLVR 2 for 8K steps with a batch size of 10K input units. AdamW optimizer is used with learning rate of 1e -4 and weight decay of 0.01. To obtain the final results in Table 4 , we further sample hard negatives to facilitate the finetuning. For every N steps, we randomly sample 128 negative images per text input and obtain a sparse scoring matrix for the whole training set. For each image, we choose the top 20 ranked negative sentences as hard negative samples. Similarly, we get 20 hard negative images for each sentence according to their scores. The hard negatives are sent to the model as additional negative samples. Referring Expression Comprehension We use three referring expression datasets: RefCOCO, RefCOCO+, and RefCOCOg for the evaluation, all collected on COCO images. To finetune UNITER on this task, we add a MLP layer on top of the region outputs from Transformer, to compute the alignment score between the query phrase/sentence and each region. Since only one object is paired with the query phrase/sentence, we apply cross-entropy loss on the normalized alignment scores. The finetuning is efficient -we train the model with a batch size of 64 examples and a learning rate of 5e -5 for only 5 epochs, and achieve state-of-the-art performance.

Image-Text Retrieval:

Note all works including ours use off-the-shelf object detectors trained on COCO (and Visual Genome) to extract the visual features. While this does not affect other downstream tasks, it raises an issue for RE comprehension, as the val/test images of RefCOCO, RefCOCO+, and RefCOCOg are a subset of COCO's training split. Strictly, our object detector is not allowed to train with these val/test images. However, just for a "fair" comparison with concurrent works, we ignore this issue and use the same features (Anderson et al., 2018) as the others. We also update the results of MAttNet using this "contaminated" features, whose accuracy is 1.5% higher than the original one.

As aforementioned, the interaction between sentence and image could start from tokens and pixels instead of the extracted features. We leave this study and RE comprehension with strictly correct features to future work. operates in both inter-and intra-modalitiy manners. For completeness, we briefly discuss each pattern here:

• Vertical: attention to special tokens [CLS] or [SEP];

• Diagonal: attention to the token/region itself or preceding/following tokens/regions;

• Vertical + Diagonal: mixture of vertical and diagonal;

• Block: intra-modality attention, i.e., textual self-attention and visual self-attention;

• Heterogeneous: diverse attentions that cannot be categorized and is highly dependent on actual input;

• Reversed Block: inter-modality attention, i.e., text-to-image and image-to-text attention.

Note that Reversed Block (Fig. 3f ) shows cross-modality alignment between tokens and regions. In 

:

Our Faster R-CNN was pre-trained on Visual Genome object+attribute data(Anderson et al.,

2018).2 [x1, y1, x2, y2, w, h, w * h] (normalized top/left/bottom/right coordinates, width, height, and area.)3 We use word/sub-word and token interchangeably throughout the rest of the paper.4 We also use a special modality embedding to help the model distinguish between textual and visual input, which is similar to the 'segment embedding' in BERT. This embedding is also summed before the LN layer in each embedder. For simplicity, this modality embedding is omitted in Figure1.

N is the natural numbers, M is the number of masked tokens, and m is the set of masked indices.

Following BERT, we decompose this 15% into 10% random word, 10% unchanged, and 80% [MASK].

The supervision over the[CLS] token in pretraining also alleviates the input mismatch problem between pretraining tasks and downstream finetuning tasks, since most of the downstream tasks take the representation of [CLS] token as the joint representation.

A total of 222 images were eliminated through this process.

We apply the same URL matching method, excluding

images from the training set. 10 UNITER-base: L=12, H=768, A=12, Total Parameters=86M. UNITER-large: L=24, H=1024, A=16, Total Parameters=303M (L: number of stacked Transformer blocks; H: hidden activation dimension; A: number of attention heads). 882 and 3645 V100 GPU hours were used for pre-training UNITER-base and UNITER-large.

The evaluation splits of RE comprehension using detected proposals are denoted as val d , test d , etc.

MAttNet results are updated using the same features as the others. More details are provided in Appendix.

The word embedding layer contains excessive rare words, thus excluded from the parameter counts.

https://pytorch.org/

https://github.com/NVIDIA/apex

https://github.com/horovod/horovod

https://github.com/NVIDIA/nccl

When validating on MRC-kl accuracy, we simply pick the most confident category from the predicted probability and measure its correctness.

The balanced and unbalanced evaluations were introduced in Suhr & Artzi (2019).

Figures and Tables:

Figure 1: Overview of the proposed UNITER model (best viewed in color), consisting of an Image Embedder, a Text Embedder and a multi-layer self-attention Transformer, learned through three pre-training tasks.

PRE-TRAINING DATASETS We construct our pre-training dataset based on four existing V+L datasets: COCO (Lin et al., 2014), Visual Genome (VG) (Krishna et al., 2017), Conceptual Captions (CC) (Sharma et al., 2018), and SBU Captions (Ordonez et al., 2011). Only image and sentence pairs are used for our pre-training purpose, which makes the model framework more scalable, as additional image-sentence pairs are easy to harvest for further pre-training.

For Image-Text Retrieval, we consider two datasets (COCO and Flickr30K) and evaluate the model in two settings: Image Retrieval (IR) and Text Retrieval (TR). Referring Expression (RE) Comprehension requires the model to select the target from a set of image region proposals given the query description. Models are evaluated on both ground-truth objects and detected proposals 11 (MAttNet(Yu et al., 2018)).

Figure 2: Different data splits from downstream tasks based on COCO images. Our UNITER pretraining avoids seeing any downstream evaluation images.

Two datasets are considered for this task: COCO and Flickr30K. COCO consists of 123K images, each accompanied with five human-written captions. We follow Karpathy & Fei-Fei (2015) to split the data into 82K/5K/5K training/validation/test images. Additional 30K images from MSCOCO validation set are also included to improve training as in Lee et al. (2018). Flickr30K dataset contains 31K images collected from the Flickr website, with five textual descriptions per image. We follow Karpathy & Fei-Fei (2015) to split the data into 30K/1K/1K training/validation/test splits. During finetuning, we sample two negative image-text pairs per positive sample from image and text sides, respectively. For COCO, we use batch size of 60 examples, learning rate of 2e -5 and finetune our model for 20K steps. For Flickr30K, we finetune our model with a batch size of 120 examples and a learning rate of 5e -5 over maximum 16K steps.

Figure 3: Attention heatmaps of UNITER

Similar to Kovaleva et al. (2019), we observe several patterns in the attention maps of the UNITER model, as shown in Fig. 3. Note that different from Kovaleva et al. (2019), our attention mechanism

Figure 4: Text-to-image attention visualization example.

Figure 5: Text-to-image attention visualization example.

Figure 6: Text-to-image attention visualization example.

and 6, we visualize several examples of text-to-image attention to demonstrate the local cross-modality alignment between regions and tokens.

Tan & Bansal, 2019) introduced the two-stream architecture, where two Transformers are applied to images and text independently, which will be fused by a third Transformer in a later stage. On the other hand, VisualBERT(Li et al., 2019b), Unicoder-VL(Li  et al., 2019a), VL-BERT(Su et al., 2019) and B2T2(Alberti et al., 2019) proposed the singlestream architecture, where a single Transformer is applied to both image and text.

Table content: <table><tr><td>Specifically,</td></tr><tr><td>LXMERT model was pre-trained with downstream tasks such as VQA (Antol et al., 2015) and</td></tr><tr><td>GQA (Hudson &amp; Manning, 2019), while the others were pre-trained on image-text pairs only. Our</td></tr><tr><td>UNITER model belongs to the second family. One key difference between UNITER and the other</td></tr><tr><td>methods is the masking approach on pre-training tasks. Instead of randomly masking both image</td></tr><tr><td>regions and sentence words, we use conditional masking, i.e., masking only one modality while</td></tr><tr><td>keeping the other untainted. In addition, we examine the best combination of pre-training tasks</td></tr><tr><td>through a thorough ablation study on the effects of each pre-training task and dataset on downstream</td></tr><tr><td>tasks.</td></tr><tr><td>Another related work is DDAF (Gao et al., 2019), which proposed a novel architecture of inter-</td></tr><tr><td>modality and intra-modality attention modules to learn the latent alignment between two modalities</td></tr><tr><td>for VQA. Compared with Gao et al. (2019), UNITER learns a relatively more generic V+L repre-</td></tr><tr><td>sentation via pre-training.</td></tr><tr><td>2 RELATED WORK</td></tr><tr><td>Self-supervised learning utilizes original data as its own source of supervision, which has been</td></tr><tr><td>applied to many Computer Vision tasks, such as image colorization (Zhang et al., 2016), solving</td></tr><tr><td>jigsaw puzzles (Noroozi &amp; Favaro, 2016; Trinh et al., 2019), inpainting (Pathak et al., 2016), ro-</td></tr><tr><td>tation prediction (Gidaris et al., 2018), and relative location prediction (Doersch et al., 2015). Re-</td></tr><tr><td>cently, pre-trained language models such as ELMo (Peters et al., 2018), BERT (Devlin et al., 2019),</td></tr><tr><td>GPT2 (Radford et al., 2019), and XLNet (Yang et al., 2019) have shown great advances for NLP</td></tr></table>

Statistics on datasets used for pre-training. Each cell shows #image-text pairs (#images).

Table content: <table><tr><td/><td colspan="2">In-domain</td><td/><td colspan="2">Out-of-domain</td></tr><tr><td colspan="7">Split COCO Captions VG Dense Captions Conceptual Captions SBU Captions</td></tr><tr><td>train</td><td>533K (106K)</td><td colspan="2">5.06M (101K)</td><td>3.0M (3.0M)</td><td colspan="2">990K (990K)</td></tr><tr><td>val</td><td>25K (5K)</td><td colspan="2">106K (2.1K)</td><td>14K (14K)</td><td colspan="2">10K (10K)</td></tr><tr><td>Task</td><td/><td>Datasets</td><td>Image Src.</td><td colspan="3">#Images #Text Metric</td></tr><tr><td>1 VQA</td><td/><td>VQA</td><td>COCO</td><td>204K</td><td colspan="2">1.1M VQA-score</td></tr><tr><td>2 VCR</td><td/><td>VCR</td><td>Movie Clips</td><td>110K</td><td colspan="2">290K Accuracy</td></tr><tr><td>3 NLVR 2</td><td/><td>NLVR 2</td><td>Web Crawled</td><td>214K</td><td colspan="2">107K Accuracy</td></tr><tr><td colspan="2">4 Visual Entailment</td><td>SNLI-VE</td><td>Flickr30K</td><td>31K</td><td colspan="2">507K Accuracy</td></tr><tr><td colspan="2">5 Image-Text Retrieval</td><td>COCO Flickr30K</td><td>COCO Flickr30K</td><td>92K 32K</td><td colspan="2">460K Recall@1,5,10 160K</td></tr><tr><td/><td/><td>RefCOCO</td><td/><td>20K</td><td>142K</td></tr><tr><td colspan="2">6 RE Comprehension</td><td>RefCOCO+</td><td>COCO</td><td>20K</td><td>142K</td><td>Accuracy</td></tr><tr><td/><td/><td>RefCOCOg</td><td/><td>26K</td><td>95K</td></tr></table>

Statistics on the datasets of downstream tasks.

Table content: <table/>

Evaluation on pre-training tasks and datasets using VQA, Image-Text Retrieval on Flickr30K, NLVR 2 , and RefCOCO+ as benchmarks. All results are obtained from UNITER-base. Averages of R@1, R@5 and R@10 on Flickr30K for Image Retrieval (IR) and Text Retrieval (TR) are reported. Dark and light grey colors highlight the top and second best results across all the tasks trained with In-domain data.

Table content: <table/>

SBU Captions). A performance drop (395.45 in L12) from the model trained on In-domain data (COCO + Visual Genome) (399.97 in L10) shows that although Out-of-domain data contain more images, the model still benefits more from being exposed to similar downstream images during pretraining. We further pre-train our model on both In-domain and Out-of-domain data. With doubled data size, the model continues to improve (402.50 in L13).4.3 RESULTS ON DOWNSTREAM TASKSTable4presents the results of UNITER on all downstream tasks. Both our base and large models are pre-trained on In-domain+Out-of-domain datasets, with the optimal pre-training setting: MLM+ITM+MRC-kl+MRFR. The implementation details of each task are provided in Appendix A.2. We compare with both task-specific models and concurrent pre-trained models on each downstream task. SOTA task-specific models include: MCAN(Yu et al., 2019) for VQA, MaxEnt (Suhr et al., 2019) for NLVR 2 , B2T2 (Alberti et al., 2019) for VCR, SCAN (Lee et al., 2018) for Image-Text Retrieval, EVE-Image (Xie et al., 2019) for SNLI-VE, and MAttNet for RE Comprehension (RefCOCO, RefCOCO+ and RefCOCOg)12 . Concurrent pre-trained models include: ViLBERT, LXMERT, Unicoder-VL, VisualBERT and VLBERT.Results show that our UNITER-large model achieves new state of the art across all the benchmarks. UNITER-base model also outperforms the others by a large margin across all tasks except VQA.

Table content: <table><tr><td colspan="2">Tasks</td><td colspan="3">SOTA ViLBERT VLBERT</td><td colspan="3">Unicoder VisualBERT LXMERT -VL</td><td colspan="2">UNITER BASE LARGE</td></tr><tr><td>VQA</td><td colspan="2">test-dev 70.63 test-std 70.90</td><td>70.55 70.92</td><td>70.50 70.83</td><td>--</td><td>70.80 71.00</td><td>72.42 72.54</td><td>72.27 72.46</td><td>73.24 73.40</td></tr><tr><td/><td>Q→A</td><td>72.60</td><td>73.30</td><td>74.00</td><td>-</td><td>71.60</td><td>-</td><td>75.00</td><td>77.30</td></tr><tr><td>VCR</td><td colspan="2">QA→R 75.70</td><td>74.60</td><td>74.80</td><td>-</td><td>73.20</td><td>-</td><td>77.20</td><td>80.80</td></tr><tr><td/><td colspan="2">Q→AR 55.00</td><td>54.80</td><td>55.50</td><td>-</td><td>52.40</td><td>-</td><td>58.20</td><td>62.80</td></tr><tr><td>NLVR 2</td><td>dev test-P</td><td>54.80 53.50</td><td>--</td><td>--</td><td>--</td><td>67.40 67.00</td><td>74.90 74.50</td><td>77.14 77.87</td><td>78.40 79.50</td></tr><tr><td>SNLI-</td><td>val</td><td>71.56</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>78.56</td><td>79.28</td></tr><tr><td>VE</td><td>test</td><td>71.16</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>78.02</td><td>78.98</td></tr><tr><td>ZS IR (Flickr)</td><td>R@1 R@5 R@10</td><td>---</td><td>31.86 61.12 72.80</td><td>---</td><td>42.40 71.80 81.50</td><td>---</td><td>---</td><td>62.34 85.62 91.48</td><td>65.82 88.88 93.52</td></tr><tr><td>IR (Flickr)</td><td>R@1 R@5 R@10</td><td>48.60 77.70 85.20</td><td>58.20 84.90 91.52</td><td>---</td><td>68.30 90.30 94.60</td><td>---</td><td>---</td><td>71.50 91.16 95.20</td><td>73.66 93.06 95.98</td></tr><tr><td>IR (COCO)</td><td>R@1 R@5 R@10</td><td>38.60 69.30 80.40</td><td>---</td><td>---</td><td>44.50 74.40 84.00</td><td>---</td><td>---</td><td>48.42 76.68 85.90</td><td>51.72 78.41 86.93</td></tr><tr><td>ZS TR (Flickr)</td><td>R@1 R@5 R@10</td><td>---</td><td>---</td><td>---</td><td>61.60 84.80 90.10</td><td>---</td><td>---</td><td>75.10 93.70 95.50</td><td>77.50 96.30 98.50</td></tr><tr><td>TR (Flickr)</td><td>R@1 R@5 R@10</td><td>67.90 90.30 95.80</td><td>---</td><td>---</td><td>82.30 95.10 97.80</td><td>---</td><td>---</td><td>84.70 97.10 99.00</td><td>88.20 98.40 99.00</td></tr><tr><td>TR (COCO)</td><td>R@1 R@5 R@10</td><td>50.40 82.20 90.00</td><td>---</td><td>---</td><td>59.60 85.10 91.80</td><td>---</td><td>---</td><td>63.28 87.04 93.08</td><td>66.60 89.42 94.26</td></tr></table>

Experiments on two-stage pre-training for VCR. Results are from UNITER-base on VCR val split. Stage I and Stage II denote first-stage and second-stage pre-training.

Table content: <table><tr><td colspan="5">Stage I Stage II Q→A QA→ R Q → AR</td><td>Setting</td><td>dev</td><td>test-P</td></tr><tr><td>N</td><td>N</td><td>72.44</td><td>73.71</td><td>53.52</td><td>Triplet</td><td colspan="2">72.76 73.55</td></tr><tr><td>N</td><td>Y</td><td>73.52</td><td>75.34</td><td>55.6</td><td>Pair</td><td colspan="2">75.37 75.97</td></tr><tr><td>Y</td><td>N</td><td>72.83</td><td>75.25</td><td>54.94</td><td colspan="3">Pair-biattn 77.14 77.87</td></tr><tr><td>Y</td><td>Y</td><td>74.56</td><td>77.03</td><td>57.76</td><td/><td/></tr></table>

Experiments on three modified settings for NLVR 2 .

Table content: <table><tr><td>All models use pre-trained</td></tr><tr><td>UNITER-base.</td></tr></table>

Peer review (iclr2020):
This paper presents a novel method for image-text representations called UNITER. The proposed method has been subsequently tested in many downstream tasks. A detailed ablation study helps to understand the role of each pretrained task in the proposed model. Although the empirical results are nice, performing the intensive set of experiments on many different tasks is definitely time-consuming and needs a lot of engineering efforts, the technical contribution does not seem significant to me. The paper modifies an existing pre-training procedure by conditional masking (Section 2). I agree this is well-motivated but it has little novelty and a similar idea is there in VQA (See “Dynamic fusion with intra and inter-modality attention flow for visual question answering”). MLM and MRM are not new training procedure either, they are basically extending the BERT’s training procedure with the consideration of multiple modalities. I have some questions for the authors: (1) What are the advantages of using single-stream transformer over two-stream transformer (page 2). I guess it leads to fewer parameters but I don’t think this is a big problem. (2) Some visualization of attention weights would be helpful. Minor • In “m e N^M” (equation 1), what is N and M?