Abstract
Vision-Language Pre-training (VLP) has advanced the performance for many vision-language tasks. However, most existing pre-trained models only excel in either understanding-based tasks or generation-based tasks. Furthermore, performance improvement has been largely achieved by scaling up the dataset with noisy image-text pairs collected from the web, which is a suboptimal source of supervision. In this paper, we propose BLIP, a new VLP framework which transfers flexibly to both vision-language understanding and generation tasks.
视觉语言预训练(VLP)提高了许多视觉语言任务的性能。然而,大多数现有的预训练模型只能在基于理解的任务或基于生成的任务中表现出色。此外,通过使用从web上收集的有噪声的图像-文本对扩展数据集,性能得到了很大程度的提高,这是一个次优的监督来源。在本文中,我们提出了一个新的VLP框架BLIP,它可以灵活地转换到视觉语言的理解和生成任务。
BLIP~effectively utilizes the noisy web data by bootstrapping the captions, where a captioner generates synthetic captions and a filter removes the noisy ones. We achieve state-of-the-art results on a wide range of vision-language tasks, such as image-text retrieval (+2.7\% in average recall@1), image captioning (+2.8\% in CIDEr), and VQA (+1.6\% in VQA score). BLIP~also demonstrates strong generalization ability when directly transferred to video-language tasks in a zero-shot manner. Code, models, and datasets are released.
BLIP~通过自举字幕有效地利用了有噪声的网络数据,其中字幕者生成合成字幕,过滤器去除有噪声的字幕。我们在广泛的视觉语言任务中取得了最先进的结果,如图像-文本检索(平均+ 2.7% \% recall@1),图像标题(+ 2.8% \%在CIDEr)和VQA(+ 1.6% \%在VQA得分)。BLIP~以零镜头的方式直接转移到视频语言任务中也表现出较强的泛化能力。发布代码、模型和数据集。
\section{Introduction}
Vision-language pre-training has recently received tremendous success on various multimodal downstream tasks.
However, existing methods have two major limitations:
近年来,视觉语言前训练在各种多模态下游任务上取得了巨大的成功。
然而,现有的方法有两个主要的局限性:
(1) Model perspective: most methods either adopt an encoder-based model~\cite{clip,ALBEF}, or an encoder-decoder~\cite{VL_T5,simvlm} model.
However, encoder-based models are less straightforward to directly transfer to text generation tasks (\eg~image captioning), whereas encoder-decoder models have not been successfully adopted for image-text retrieval tasks.
(1)模型视角:大多数方法要么采用基于编码器的模型~引用{clip,ALBEF},要么采用编码器-解码器~引用{VL_T5,simvlm}模型。
然而,基于编码器的模型不太容易直接转换到文本生成任务中(如图像标题),而编码器-解码器模型还没有被成功地用于图像-文本检索任务重要观点。
(2) Data perspective: most state-of-the-art methods (\eg, CLIP~\cite{clip}, ALBEF~\cite{ALBEF}, SimVLM~\cite{simvlm}) pre-train on image-text pairs collected from the web.
Despite the performance gain obtained by scaling up the dataset, our paper shows that the noisy web text is suboptimal for vision-language learning.
(2)数据透视:最先进的方法(如CLIP~ cite{CLIP}, ALBEF~ cite{ALBEF}, SimVLM~ cite{SimVLM})对从web收集的图像-文本对进行预训练。
尽管通过扩展数据集获得了性能增益,我们的论文表明,有噪声的网络文本对于视觉语言学习是次优的所以需要细粒度对齐或者引入知识以捕获漂浮的信息。
To this end, we propose \name: Bootstrapping Language-Image Pre-training for unified vision-language understanding and generation.
\name~is a new VLP framework which enables a wider range of downstream tasks than existing methods.
It introduces two contributions from the model and data perspective, respectively:
为此,我们提出了Bootstrapping Language-Image Pre-training for unified vision-language understanding and generation。
\name~是一个新的VLP框架,它支持比现有方法更广泛的下游任务。
它分别从模型和数据的角度介绍了两种贡献:
(a) Multimodal mixture of Encoder-Decoder (MED):
a new model architecture for effective multi-task pre-training and flexible transfer learning.
An MED can operate either as a unimodal encoder, or an image-grounded text encoder, or an image-grounded text decoder.
(a)编码器-解码器的多模态混合(MED):
一种有效的多任务前训练和灵活迁移学习的新模型架构。架构可以作为一种贡献
MED既可以作为单模态编码器,也可以作为基于图像的文本编码器,或基于图像的文本解码器。
The model is jointly pre-trained with three vision-language objectives: image-text contrastive learning, image-text matching, and image-conditioned language modeling.
该模型与三个视觉语言目标联合进行预训练:图像-文本对比学习、图像-文本匹配和图像条件语言建模。
(b) Captioning and Filtering (CapFilt):
a new dataset boostrapping method for learning from noisy image-text pairs.
We finetune a pre-trained MED into two modules: a \textit{captioner} to produce synthetic captions given web images,
and a \textit{filter} to remove noisy captions from both the original web texts and the synthetic texts.
(b)字幕及过滤(CapFilt):
一种新的从噪声图像-文本对中学习的数据集bootstrapping方法。
我们将预先训练的MED微调为两个模块:一个\文本{captioner}生成给定的网络图像的合成标题,
以及一个\textit{filter},从原始的网络文本和合成文本中去除嘈杂的标题。做细粒度对齐更有潜力

We perform extensive experiments and analysis, and make the following key observations.
\begin{itemize}[leftmargin=]
\setlength\itemsep{0pt}
\item We show that the captioner and the filter work together to achieve substantial performance improvement on various downstream tasks by bootstrapping the captions.
We also find that more diverse captions yield larger gains.
\item \name~achieves state-of-the-art performance on a wide range of vision-language tasks,
including image-text retrieval, image captioning, visual question answering, visual reasoning, and visual dialog. We also achieve state-of-the-art zero-shot performance when directly transferring our models to two video-language tasks: text-to-video retrieval and videoQA.
\end{itemize}
我们进行了大量的实验和分析,并进行了以下主要观察。
开始{逐条列记}\ [leftmargin = ]
pt \ setlength \ itemsep {0}
我们展示了字幕和过滤器一起工作,通过引导字幕,在各种下游任务上实现了显著的性能改进。
我们还发现,更多样化的标题带来更大的收益。
项目名称~在广泛的视觉语言任务中达到最先进的性能,
包括图像-文本检索、图像字幕、视觉问答、视觉推理和视觉对话。当我们将模型直接转换到两个视频语言任务:文本到视频检索和视频qa时,我们也实现了最先进的零镜头性能。
结束{逐条列记}
贡献写法:
架构,组件,实验结果
模型,数据,实验结果
\section{Related Work}

\caption{Pre-training model architecture and objectives of \name~(same parameters have the same color). We propose multimodal mixture of encoder-decoder, a unified vision-language model which can operate in one of the three functionalities:
(1) Unimodal encoder is trained with an image-text contrastive (ITC) loss to align the vision and language representations.
(2) Image-grounded text encoder uses additional cross-attention layers to model vision-language interactions,
and is trained with a image-text matching (ITM) loss to distinguish between positive and negative image-text pairs.
(3) Image-grounded text decoder replaces the bi-directional self-attention layers with causal self-attention layers,
and shares the same cross-attention layers and feed forward networks as the encoder. The decoder is trained with a language modeling (LM) loss to generate captions given images.
}
训练前的模型架构和目标\名称~(相同参数具有相同颜色)。我们提出了编码器-解码器的多模态混合模型,这是一种统一的视觉-语言模型,可以在以下三种功能中运行:
(1)单模态编码器采用图像-文本对比(ITC)损耗训练,以对齐视觉和语言表示。
(2)基于图像的文本编码器使用额外的交叉注意层来建模视觉-语言交互,
并使用图像-文本匹配(ITM)损失进行训练,以区分正的和负的图像-文本对。
(3)基于图像的文本解码器将双向自注意层替换为因果自注意层,
并且和编码器共享相同的交叉注意层和前馈网络。用语言建模(LM)损耗训练解码器以生成给定图像的字幕。
\end{figure*}
因果注意力即单向注意力,在MINGPT里也有实现,可以重点关注一下
很多优化是基于注意力稀疏性实现的,如果底层信息就是全连接的,则不work
lightseq提供CUDA加速和八卡池化,reformer去掉激活解决内存爆炸,deepnorm解决梯度问题,performer接其他权重并提供线性注意力
https://zhuanlan.zhihu.com/p/269751265
\subsection{Vision-language Pre-training}
Vision-language pre-training (VLP) aims to improve performance of downstream vision and language tasks by pre-training the model on large-scale image-text pairs. Due to the prohibitive expense of acquiring human-annotated texts, most methods~\cite{uniter,oscar,ALBEF,simvlm,clip} use image and alt-text pairs crawled from the web~\cite{CC,cc12m,align}, Despite the use of simple rule-based filters, noise is still prevalent in the web texts.
However, the negative impact of the noise has been largely overlooked, shadowed by the performance gain obtained from scaling up the dataset.
Our paper shows that the noisy web texts are suboptimal for vision-language learning, and proposes CapFilt that utilizes web datasets in a more effective way.
视觉语言前训练(vision -language pre-training, VLP)旨在通过对大规模图像-文本对进行模型前训练,提高下游视觉和语言任务的性能。尽管使用了简单的基于规则的过滤器,但噪声仍然普遍存在于web文本中。
然而,噪声的负面影响在很大程度上被忽略了,被数据集扩展所获得的性能增益所掩盖。
我们的论文表明,嘈杂的网络文本对于视觉语言学习是次优的,并提出了一种更有效地利用网络数据集的CapFilt。
There have been many attempts to unify various vision and language tasks into a single framework~\cite{VLP,VL_T5,simvlm}.
The biggest challenge is to design model architectures that can perform both understanding-based tasks (\eg~image-text retrieval) and generation-based tasks (\eg~image captioning).
Neither encoder-based models~\cite{ALBEF,unimo,clip} nor encoder-decoder models~\cite{VL_T5,simvlm} can excel at both types of tasks,
whereas a single unified encoder-decoder~\cite{VLP} also limits the model’s capability.
Our proposed multimodal mixture of encoder-decoder model offers more flexibility and better performance on a wide range of downstream tasks,
in the meantime keeping the pre-training simple and efficient.
人们曾多次尝试将各种视觉和语言任务统一到一个框架中~引用{VLP,VL_T5,simvlm}。
最大的挑战是设计既能执行基于理解的任务(如图像-文本检索)又能执行基于生成的任务(如图像字幕)的模型架构。
无论是基于编码器的模型~引用{ALBEF,unimo,clip}还是编码器-解码器模型~引用{VL_T5,simvlm}都不能在这两种类型的任务中表现出色,
而一个统一的编码器-解码器~\引用{VLP}也限制了模型的能力。
我们提出的编码器-解码器多模式混合模型(多个训练头,参数共享,crossattention)在广泛的下游任务上提供了更大的灵活性和更好的性能,
同时保持训练前的简单和高效。
\subsection{Knowledge Distillation}
Knowledge distillation (KD)~\cite{kd_hinton} aims to improve the performance of a student model by distilling knowledge from a teacher model.
Self-distillation is a special case of KD where the teacher and student have equal sizes.
It has been shown to be effective for image classification~\cite{noisy_student}, and recently for VLP~\cite{ALBEF}.
Different from mostly existing KD methods which simply enforce the student to have the same class predictions as the teacher, our proposed CapFilt can be interpreted as a more effective way to perform KD in the context of VLP, where the captioner distills its knowledge through semantically-rich synthetic captions, and the filter distills its knowledge by removing noisy captions.
知识蒸馏(Knowledge精馏,KD)的目的是通过从教师模型中提取知识来提高学生模型的性能。
自蒸馏是KD的一种特殊情况,教师和学生的尺寸相等。
它已被证明对图像分类是有效的,最近对VLP~引用{ALBEF}。
不同于大多数现有KD方法简单执行学生有相同的类预测作为老师,我们提议CapFilt可以被视为一个更有效的方法来执行KD在车牌区域的背景下,在通过语义丰富的合成标题,标题提炼其知识滤光器通过去除嘈杂的字幕来提炼它的知识。
\subsection{Data Augmentation}
While data augmentation (DA) has been widely adopted in computer vision~\cite{DA_survey}, DA for language tasks is less straightforward.
Recently, generative language models have been used to synthesize examples for various NLP tasks~\cite{DA,DA_AAAI,DA_QA,DA_commonsense}.
Different from these methods which focus on the low-resource language-only tasks, our method demonstrates the advantage of synthetic captions in large-scale vision-language pre-training.
虽然数据扩展(DA)在计算机视觉中已被广泛采用,但用于语言任务的数据扩展却不那么直接。
最近,生成语言模型被用来合成各种NLP任务的例子~引用{DA,DA_AAAI,DA_QA,DA_commonsense}。
不同于以往专注于低资源的纯语言任务的方法,我们的方法体现了合成字幕在大规模视觉语言前训练中的优势。
\section{Method}
We propose BLIP, a unified VLP framework to learn from noisy image-text pairs.
This section first introduces our new model architecture MED and its pre-training objectives, and then delineates CapFilt for dataset bootstrapping.
我们提出了一个统一的VLP框架BLIP,用于从有噪声的图像-文本对中学习。
本节首先介绍了我们的新模型体系结构MED及其训练前目标,然后描述了用于数据集引导的CapFilt。
\subsection{Model Architecture}
We employ a visual transformer~\cite{vit} as our image encoder, which divides an input image into patches and encodes them as a sequence of embeddings, with an additional \texttt{[CLS]} token to represent the global image feature.
Compared to using pre-trained object detectors for visual feature extraction~\cite{uniter}, using a ViT is more computation-friendly and has been adopted by the more recent methods~\cite{ALBEF,ViLT}.
我们使用一个视觉转换器作为图像编码器ViT,它将输入图像分割成小块,并将它们编码为一个嵌入序列,并使用一个附加的文本{CLS]}标记来表示全局图像特征。
与使用预先训练的目标检测器进行视觉特征提取相比,使用ViT更易于计算,并已被最近的方法所采用。
In order to pre-train a unified model with both understanding and generation capabilities, we propose multimodal mixture of encoder-decoder (MED), a multi-task model which can operate in one of the three functionalities:
为了预训练一个既具有理解能力又具有生成能力的统一模型,我们提出了一种多模态编码器-解码器混合模型(multimodal mixture of encoder-decoder, MED),它是一种多任务模型,可以运行在以下三个功能之一:
(1) \textbf{Unimodal encoder}, which separately encodes image and text. The text encoder is the same as BERT~\cite{bert}, where a \texttt{[CLS]} token is appended to the beginning of the text input to summarize the sentence.
(1) \textbf{Unimodal encoder},分别对图像和文本进行编码。文本编码器与BERT~\cite{BERT}相同,其中\texttt{[CLS]}标记被附加到文本输入的开头以总结句子。
(2) \textbf{Image-grounded text encoder}, which injects visual information by inserting one additional cross-attention (CA) layer between the self-attention (SA) layer and the feed forward network (FFN) for each transformer block of the text encoder. A task-specific \texttt{[Encode]} token is appended to the text, and the output embedding of \texttt{[Encode]} is used as the multimodal representation of the image-text pair.
(2) \textbf{Image-grounded text encoder},它通过在文本编码器的每个变压器块的自注意(SA)层和前馈网络(FFN)之间插入一个额外的交叉注意(CA)层来注入视觉信息。一个任务特定的\texttt{[Encode]}标记被附加到文本中,\texttt{[Encode]}的输出嵌入被用作图像-文本对的多模态表示。
(3) \textbf{Image-grounded text decoder}, which replaces the bi-directional self-attention layers in the image-grounded text encoder with causal self-attention layers. A \texttt{[Decode]} token is used to signal the beginning of a sequence, and an end-of-sequence token is used to signal its end.
(3) \textbf{基于图像的文本解码器},将基于图像的文本编码器中的双向自注意层替换为因果自注意层。\texttt{[Decode]}标记用于表示序列的开始,序列结束标记用于表示序列的结束。
\subsection{Pre-training Objectives}
We jointly optimize three objectives during pre-training, with two understanding-based objectives and one generation-based objective.
Each image-text pair only requires one forward pass through the computational-heavier visual transformer, and three forward passes through the text transformer, where different functionalities are activated to compute the three losses as delineated below.
我们在培训前共同优化了三个目标,两个基于理解的目标和一个基于生成的目标。
每个图像-文本对只需要一个前向通过计算量大的视觉转换器,三个前向通过文本转换器,在文本转换器中激活不同的功能来计算如下所示的三个损失。
\noindent\textbf{Image-Text Contrastive Loss} (ITC) activates the unimodal encoder. It aims to align the feature space of the visual transformer and the text transformer by encouraging positive image-text pairs to have similar representations in contrast to the negative pairs.
It has been shown to be an effective objective for improving vision and language understanding~\cite{clip, ALBEF}.
We follow the ITC loss by~\citet{ALBEF}, where a momentum encoder is introduced to produce features, and soft labels are created from the momentum encoder as training targets to account for the potential positives in the negative pairs.
(ITC)激活单模态编码器。它的目的是通过鼓励正面的图像-文本对具有相似的表示而不是负面的图像-文本对来对齐视觉转换器和文本转换器的特征空间。
它已被证明是一个有效的目标,以提高视力和语言理解~引用{剪辑,ALBEF}。
我们通过~\citet{ALBEF}跟踪ITC损失,其中引入一个动量编码器产生特征,并从动量编码器创建软标签作为训练目标,以考虑负对中潜在的正例。
\noindent\textbf{Image-Text Matching Loss} (ITM) activates the image-grounded text encoder.
It aims to learn image-text multimodal representation that captures the fine-grained alignment between vision and language.
ITM is a binary classification task, where the model uses an ITM head (a linear layer) to predict whether an image-text pair is positive (matched) or negative (unmatched) given their multimodal feature.
In order to find more informative negatives, we adopt the hard negative mining strategy by~\citet{ALBEF}, where negatives pairs with higher contrastive similarity in a batch are more likely to be selected to compute the loss.
ITM (Image-Text Matching Loss)激活基于图像的文本编码器。
它的目标是学习图像-文本多模态表示,捕捉视觉和语言之间的细粒度对齐。
ITM是一个二元分类任务,其中模型使用ITM头(一个线性层)来预测图像-文本对是正的(匹配的)还是负的(不匹配的),因为它们的多模态特征。
为了寻找信息量更大的否定,我们采用了难负样本挖掘策略~\citet{ALBEF},其中一批中对比相似度较高的否定对更有可能被选择来计算损失。
参考DEEPEMD,细粒度上未必相似,所以CLIP结合博弈论的细粒度对齐大有可为
\noindent\textbf{Language Modeling Loss} (LM) activates the image-grounded text decoder, which aims to generate textual descriptions given an image.
It optimizes a cross entropy loss which trains the model to maximize the likelihood of the text in an autoregressive manner.
We apply a label smoothing of 0.1 when computing the loss.
Compared to the MLM loss that has been widely-used for VLP, LM enables the model with the generalization capability to convert visual information into coherent captions.
LM (Language Modeling Loss)激活基于图像的文本解码器,其目的是生成给定图像的文本描述。
它优化了一个交叉熵损失,该损失训练模型以一种自回归的方式使文本的可能性最大化。
在计算损耗时,我们采用了0.1的标签平滑。
与目前广泛应用于VLP的MLM损失相比,LM使模型具有泛化能力,能够将视觉信息转化为连贯的字幕。和我们实验结果一致,理论上MLM可以模拟GPT,但有很多细节需要处理,且多任务不一定收敛到最优
In order to perform efficient pre-training while leveraging multi-task learning, the text encoder and text decoder share all parameters except for the SA layers.
The reason is that the differences between the encoding and decoding tasks are best captured by the SA layers. In particular, the encoder employs \textit{bi-directional} self-attention to build representations for the \textit{current} input tokens, while the decoder employs \textit{causal} self-attention to predict \textit{next} tokens.
为了在利用多任务学习的同时进行高效的前训练,文本编码器和文本解码器共享SA层以外的所有参数。
原因是编码和解码任务之间的差异最好由SA层捕获。特别是,编码器使用\textit{双向}自我注意来为\textit{current}输入令牌构建表示,而解码器使用\textit{因果}自我注意来预测\textit{next}令牌。没有理论支持
On the other hand, the embedding layers, CA layers and FFN function similarly between encoding and decoding tasks, therefore sharing these layers can improve training efficiency while benefiting from multi-task learning, \input{figure/CapFilt}
另一方面,编码和解码任务之间的嵌入层、CA层和FFN功能相似,共享这些层可以提高训练效率,同时受益于多任务学习,\输入{figure/CapFilt}
\subsection{CapFilt}
Due to the prohibitive annotation cost, there exist a limited number of high-quality human-annotated image-text pairs ${(I_h,T_h)}$ (e.g., COCO~\cite{coco}).
Recent work~\cite{ALBEF,simvlm} utilizes a much larger number of image and alt-text pairs ${(I_w,T_w)}$ that are automatically collected from the web.
However, the alt-texts often do not accurately describe the visual content of the images, making them a noisy signal that is suboptimal for learning vision-language alignment.
由于高昂的标注成本,存在数量有限的高质量人类标注的图像-文本对$ {(I_h,T_h)}$(例如,COCO~\引用{COCO})。
最近的工作~\引用{ALBEF,simvlm}利用了大量的图像和alt-text对$ {(I_w,T_w)}$,它们是从web上自动收集的。
然而,替代文本往往不能准确描述图像的视觉内容,使其成为一个噪声信号,对学习视觉语言对齐是次优的。
We propose Captioning and Filtering (CapFilt), a new method to improve the quality of the text corpus.
Figure~\ref{fig:capfilt} gives an illustration of CapFilt.
It introduces two modules: a \textit{captioner} to generate captions given web images, and a \textit{filter} to remove noisy image-text pairs.
Both the captioner and the filter are initialized from the same pre-trained MED model, and finetuned individually on the COCO dataset.
The finetuning is a lightweight procedure.
我们提出了一种提高文本语料库质量的新方法——字幕和过滤(CapFilt)。
图~\ref{fig:capfilt}给出了capfilt的图示。
它引入了两个模块:一个texttit {captioner}生成给定web图像的标题,一个texttit {filter}删除噪声图像-文本对。
标题器和过滤器都由相同的预训练MED模型初始化,并在COCO数据集上分别进行微调。
微调是一个轻量级的过程。
直接用CLIP(甚至encoder+hilbert离群检测,dual finetuning)评估扩充样本未必不行
分别用ITC&ITM,LM微调其实反而说明这三个训练任务优化目标不一致
性能来源于扩充的web数据和去掉的噪声数据
Specifically, the \emph{captioner} is an image-grounded text decoder.
It is finetuned with the LM objective to decode texts given images.
Given the web images $I_w$, the captioner generates synthetic captions $T_s$ with one caption per image.
The \emph{filter} is an image-grounded text encoder.
It is finetuned with the ITC and ITM objectives to learn whether a text matches an image.
The filter removes noisy texts in both the original web texts $T_w$ and the synthetic texts $T_s$, where a text is considered to be noisy if the ITM head predicts it as unmatched to the image.
Finally, we combine the filtered image-text pairs with the human-annotated pairs to form a new dataset, which we use to pre-train a new model.
具体来说,该文本解码器是基于图像的文本解码器。
它与LM物镜微调,以解码文本给定的图像。
给定web图像$I_w$,标题生成合成标题$T_s$,每个图像有一个标题。
filter是一个基于图像的文本编码器。
它与ITC和ITM的目标进行微调,以了解文本是否与图像匹配。
该过滤器删除了原始web文本$T_w$和合成文本$T_s$中的噪声文本,其中一个文本被认为是噪声文本,如果ITM头预测它与图像不匹配。
最后,我们将过滤后的图像-文本对与人工标注的图像-文本对组合成一个新的数据集,并利用该数据集对新模型进行预训练。
\section{Experiments and Discussions}
\label{sec:experiment}
In this section, we first introduce pre-training details. Then we provide a detailed experimental analysis on our method.
在本节中,我们首先介绍训练前的细节。然后对该方法进行了详细的实验分析。
\subsection{Pre-training Details}
Our models are implemented in PyTorch~\cite{pytorch} and pre-trained on two 16-GPU nodes.
The image transformer is initialized from ViT pre-trained on ImageNet~\cite{deit,vit}, and the text transformer is initialized from BERT$\mathrm{base}~$\cite{bert}. We explore two variants of ViTs: ViT-B/16 and ViT-L/16.
Unless otherwise specified, all results reported in this paper as ``\name’’ uses ViT-B.
We pre-train the model for 20 epochs using a batch size of 2880 (ViT-B) / 2400 (ViT-L).
We use AdamW~\cite{adamw} optimizer with a weight decay of 0.05.
The learning rate is warmed-up to $3e$-4 (ViT-B) / $2e$-4 (ViT-L) and decayed linearly with a rate of 0.85.
We take random image crops of resolution $224\times224$ during pre-training, and increase the image resolution to $384\times384$ during finetuning.
我们的模型是在PyTorch中实现的,并在两个16-GPU节点上进行预训练。
图像转换器从在ImageNet~\cite{deit, ViT}上预训练的ViT初始化,文本转换器从BERT$\ mathm {base}~$\cite{BERT}初始化。我们探索了vit的两种变体:vitb /16和vitl /16。
除非另有说明,本论文中报告的所有结果均为’’ \name’,使用vitb。
我们使用2880 (vitd - b) / 2400 (vitd - l)的批量大小对模型进行20个epoch的预训练。
我们使用了权重衰减为0.05的AdamW引用{AdamW}优化器。
学习速率上升到$3e$-4 (vitd - b) / $2e$-4 (vitd - l),并以0.85的速率线性衰减。
我们在训练前随机选取分辨率为$224 times224$的图像作物,在微调期间将图像分辨率提高到$384 times384$。起到一定的细粒度对齐效果
We use the same pre-training dataset as~\citet{ALBEF} with 14M images in total,
including two human-annotated datasets (COCO and Visual Genome~\cite{VG}),
and three web datasets (Conceptual Captions~\cite{cc12m}, Conceptual 12M~\cite{cc12m}, SBU captions~\cite{sbu}).
We also experimented with an additional web dataset, LAION~\cite{laion}, which contains 115M images with more noisy texts\footnote{We only download images whose shorter edge is larger than 256 pixels from the original LAION400M. Due to the large size of LAION, we only use $1/5$ of it each epoch during pre-training.}.
More details about the datasets can be found in the appendix.
我们使用与~ citet{ALBEF}相同的训练前数据集,共14M幅图像,
包括两个人类标注的数据集(COCO和Visual Genome~\引用{VG}),
和三个web数据集(Conceptual Captions~ cite{cc12m}, Conceptual 12M~ cite{cc12m}, SBU Captions~ cite{SBU})。
我们还实验了一个额外的web数据集,LAION~\cite{LAION},它包含了115M的图像,其中有更多的文本噪声\脚注{我们只从原始的LAION400M下载短边缘大于256像素的图像。由于LAION的大小比较大,我们在训练前每个epoch只使用它的$1/5$。}。
关于数据集的更多细节可以在附录中找到。


\subsection{Effect of CapFilt}
In Table~\ref{tbl:capfilt},
we compare models pre-trained on different datasets to demonstrate the efficacy of CapFilt on downstream tasks, including image-text retrieval and image captioning with finetuned and zero-shot settings. When only the captioner or the filter is applied to the dataset with 14M images, performance improvement can be observed. When applied together, their effects compliment each other, leading to substantial improvements compared to using the original noisy web texts.
表~ \ ref{台:capfilt},
我们比较了在不同数据集上预先训练的模型,以证明CapFilt对下游任务的有效性,包括图像-文本检索和经过微调和零镜头设置的图像字幕。当只有字幕或过滤器应用到有14M图像的数据集时,可以观察到性能的提高。当应用在一起,他们的效果互补,导致了实质性的改进相比使用原始嘈杂的web文本。
CapFilt can further boost performance with a larger dataset and a larger vision backbone, which verifies its scalability in both the data size and the model size.
Furthermore, by using a large captioner and filter with ViT-L, performance of the base model can also be improved.
CapFilt可以通过更大的数据集和更大的视觉骨干进一步提升性能,这验证了它在数据大小和模型大小方面的可伸缩性。
此外,通过使用带有vitl的大型配线器和滤波器,基本模型的性能也可以得到改善。
In Figure~\ref{fig:example}, we show some example captions and their corresponding images, which qualitatively demonstrate the effect of the captioner to generate new textual descriptions, and the filter to remove noisy captions from both the original web texts and the synthetic texts. More examples can be found in the appendix.
在Figure~\ \ example中,我们展示了一些示例字幕及其对应的图像,定性地展示了字幕生成新的文本描述的效果,以及过滤器从原始文本和合成文本中去除带有噪声的字幕的效果。更多的例子可以在附录中找到。
\subsection{Diversity is Key for Synthetic Captions}
In CapFilt, we employ nucleus sampling~\cite{nucleus} to generate synthetic captions.
Nucleus sampling is a stochastic decoding method, where each token is sampled from a set of tokens whose cumulative probability mass exceeds a threshold $p$ ($p=0.9$ in our experiments).
In Table~\ref{tbl:generate}, we compare it with beam search, a deterministic decoding method which aims to generate captions with the highest probability.
Nucleus sampling leads to evidently better performance, despite being more noisy as suggested by a higher noise ratio from the filter.
We hypothesis that the reason is that nucleus sampling generates more diverse and surprising captions, which contain more new information that the model could benefit from.
On the other hand, beam search tends to generate safe captions that are common in the dataset, hence offering less extra knowledge.
在CapFilt中,我们使用核采样~引用{nucleus}生成合成标题。
核抽样是一种随机解码方法,其中每个令牌都是从一组累积概率质量超过阈值$p$(在我们的实验中$p=0.9$)的令牌中采样。
在表~\ref{tbl:generate}中,我们将其与波束搜索(beam search)进行了比较。波束搜索是一种确定性译码方法,其目标是生成概率最高的字幕。
核采样导致了明显的更好的性能,尽管噪声更大,这表明从滤波器的更高的噪声比。
我们假设,这是因为核采样产生了更多样化和令人惊讶的标题,其中包含了更多的新信息,模型可以从中受益。
另一方面,光束搜索倾向于生成数据集中常见的安全标题,因此提供的额外知识较少。
似乎可以称为sump采样
\subsection{Parameter Sharing and Decoupling}

During pre-training, the text encoder and decoder share all parameters except for the self-attention layers.
In Table~\ref{tbl:med}, we evaluate models pre-trained with different parameter sharing strategies, where pre-training is performed on the 14M images with web texts.
As the result shows, sharing all layers except for SA leads to better performance compared to not sharing, while also reducing the model size thus improveing training efficiency.
If the SA layers are shared, the model’s performance would degrade due to the conflict between the encoding task and the decoding task.
在训练前,文本编码器和解码器共享除自注意层外的所有参数。
在表~\ref{tbl:med}中,我们评估了使用不同参数共享策略进行预训练的模型,其中预训练是在14M幅带有web文本的图像上进行的。
结果表明,除SA外的所有层都共享比不共享性能更好,同时也减少了模型的大小,从而提高了训练效率。
如果SA层是共享的,则编码任务和解码任务之间的冲突会导致模型性能下降。
本文比较有价值的结论之一

During CapFilt, the captioner and the filter are end-to-end finetuned individually on COCO.
In Table~\ref{tbl:independent}, we study the effect if the captioner and filter share parameters in the same way as pre-training.
The performance on the downstream tasks decreases, which we mainly attribute to \textit{confirmation bias}.
Due to parameter sharing, noisy captions produced by the captioner are less likely to be filtered out by the filter, as indicated by the lower noise ratio (8\% compared to 25\%).
在CapFilt期间,字幕和过滤器端到端分别在COCO上微调。
在表~\ref{tbl:independent}中,我们研究了字幕和过滤器以与前训练相同的方式共享参数的效果。
下游任务的性能下降,我们主要归因于\文本{确认偏倚}。
由于参数共享,字幕产生的噪声字幕不太可能被过滤器过滤掉,这可以从较低的噪声比(8\%比25\%)看出。
\section{Comparison with State-of-the-arts}
\label{sec:downstream}


In this section, we compare \name~to existing VLP methods on a wide range of vision-language downstream tasks\footnote{we omit SNLI-VE from the benchmark because its test data has been reported to be noisy~\cite{ve-2.0}}.
Next we briefly introduce each task and finetuning strategy.
More details can be found in the appendix.
在本节中,我们比较了在各种视觉语言下游任务上的\name~和现有的VLP方法。\脚注{我们在基准测试中省略了SNLI-VE,因为它的测试数据被报告为有噪声的~\引用{ve-2.0}}。
接下来,我们简要介绍每个任务和微调策略。
更多细节可以在附录中找到。
\subsection{Image-Text Retrieval}
We evaluate \name~for both image-to-text retrieval (TR) and text-to-image retrieval (IR) on COCO and Flickr30K~\cite{flickr} datasets.
We finetune the pre-trained model using ITC and ITM losses.
To enable faster inference speed, we follow~\citet{ALBEF} and first select $k$ candidates based on the image-text feature similarity, and then rerank the selected candidates based on their pairwise ITM scores.
We set $k=256$ for COCO and $k=128$ for Flickr30K.
我们评估了在COCO和Flickr30K数据集上的图像到文本检索(TR)和文本到图像检索(IR)的名称~。
我们使用ITC和ITM损失对预先训练的模型进行微调。
为了提高推理速度,我们遵循~\citet{ALBEF},首先根据图像-文本特征相似度选择$k$候选,然后根据其成对的ITM分数对所选候选进行重新排序。等价于集成或者粗排+精排
我们为COCO设置$k=256$,为Flickr30K设置$k=128$。
As shown in Table~\ref{tbl:retrieval},
\name~achieves substantial performance improvement compared with existing methods.
Using the same 14M pre-training images,\name~outperforms the previous best model ALBEF by +2.7\% in average recall@1 on COCO.
We also perform zero-shot retrieval by directly transferring the model finetuned on COCO to Flickr30K.
The result is shown in Table~\ref{tbl:retrieval_zs},where \name~also outperforms existing methods by a large margin.
如表~\ref{tbl:retrieval},
与现有方法相比,\name~实现了实质性的性能改进。
使用相同的14M的训练前图像,\name~在COCO上的recall@1平均性能比以前的最佳模型ALBEF高出2.7% \%。
我们还通过直接将在COCO上经过微调的模型转移到Flickr30K来执行零镜头检索。
结果显示在表~\ref{tbl:retrieval_zs}中,其中\name~也比现有方法有很大的优势。
\subsection{Image Captioning}

We consider two datasets for image captioning: NoCaps~\cite{nocaps} and COCO, both evaluated using the model finetuned on COCO with the LM loss.
Similar as~\citet{simvlm}, we add a prompt ``a picture of’’ at the beginning of each caption, which leads to slightly better results.
As shown in Table~\ref{tbl:caption}, \name~with 14M pre-training images substantially outperforms methods using a similar amount of pre-training data.
\name~with 129M images achieves competitive performance as LEMON with 200M images.
Note that LEMON requires a computational-heavy pre-trained object detector and higher resolution (800$\times$1333) input images, leading to substantially slower inference time than the detector-free \name~which uses lower resolution (384$\times$384) input images.
我们考虑两个用于图像配字的数据集:NoCaps~\cite{NoCaps}和COCO,这两个数据集都是使用在COCO上进行精细调优的模型进行评估的。
类似于~\citet{simvlm},我们在每个标题的开头添加了一个提示’’ a picture of’’,这样会带来更好的结果。
如表~\ref{tbl:caption}, \name~所示,使用14M预训练图像的方法显著优于使用相似数量的预训练数据的方法。
\name~与129M图像达到竞争性能的柠檬与200万图像。
请注意,LEMON需要一个计算量大的预先训练过的物体检测器和更高的分辨率(800美元\倍$1333)的输入图像,这比没有检测器的\名~使用更低分辨率(384美元\倍$384)的输入图像的推理时间要慢得多。
\subsection{Visual Question Answering (VQA)}


VQA~\cite{VQA} requires the model to predict an answer given an image and a question.
Instead of formulating VQA as a multi-answer classification task~\cite{uniter,oscar}, we follow~\citet{ALBEF} and consider it as an answer generation task,
which enables open-ended VQA.
As shown in Figure~\ref{fig:vqa_visdial_nlvr}(a), during finetuning, we rearrange the pre-trained model, where an image-question is first encoded into multimodal embeddings and then given to an answer decoder.
The VQA model is finetuned with the LM loss using ground-truth answers as targets.
VQA要求模型预测给定图像和问题的答案。
我们没有将VQA定义为一个多答案分类任务~\cite{uniter,oscar},而是遵循~\citet{ALBEF},将其视为一个答案生成任务,
它支持开放的VQA。
如图~\ref{fig:vqa_visdial_nlvr}(a)所示,在微调过程中,我们重新安排了预先训练的模型,其中图像问题首先被编码成多模态嵌入,然后给一个答案解码器。
VQA模型使用地面真实答案作为目标,对LM损耗进行微调。
The results are shown in Table~\ref{tbl:vqa_nlvr}.
Using 14M images, \name~outperforms ALBEF by +1.64\% on the test set.
Using 129M images, \name~achieves better performance than SimVLM which uses $13\times$ more pre-training data and a larger vision backbone with an additional convolution stage.
结果见表~\ref{tbl:vqa_nlvr}。
使用14M图像,\name~在测试集中比ALBEF性能好+1.64\%。
使用129M图像,\name~获得比SimVLM更好的性能,SimVLM使用更多$13\倍的训练前数据和更大的视觉支柱与额外的卷积阶段。
\subsection{Natural Language Visual Reasoning (NLVR$^2$)}
NLVR$^2$~\cite{NLVR} asks the model to predict whether a sentence describes a pair of images.
In order to enable reasoning over two images, we make a simple modification to our pre-trained model which leads to a more computational-efficient architecture than previous approaches~\cite{ALBEF,simvlm}.
As shown in Figure~\ref{fig:vqa_visdial_nlvr}(b), for each transformer block in the image-grounded text encoder, there exist two cross-attention layers to process the two input images, and their outputs are merged and fed to the FFN.
The two CA layers are intialized from the same pre-trained weights.
The merge layer performs simple average pooling in the first 6 layers of the encoder, and performs concatenation followed by a linear projection in layer 6-12.
An MLP classifier is applied on the output embedding of the \texttt{[Encode]} token.
As shown in Table~\ref{tbl:vqa_nlvr}, \name~outperforms all existing methods except for ALBEF which performs an extra step of customized pre-training.
Interestingly, performance on NLVR$^2$ does not benefit much from additional web images, possibly due to the domain gap between web data and downstream data.
NLVR$^2$~\cite{NLVR}要求模型预测一个句子是否描述了一对图像。
为了能够对两幅图像进行推理,我们对我们的预训练模型做了一个简单的修改,这导致了一个比以前的方法计算效率更高的架构~引用{ALBEF,simvlm}。
如图~\ref{fig:vqa_visdial_nlvr}(b)所示,在基于图像的文本编码器中,每个变压器块都存在两个交叉注意层来处理两幅输入图像,并将其输出合并馈送给FFN。
这两个CA层由相同的预训练权值初始化。
合并层在编码器的前6层执行简单的平均池,并在6-12层执行连接,然后进行线性投影。
MLP分类器应用于\texttt{Encode]}标记的输出嵌入。
如表~\ref{tbl:vqa_nlvr}所示,\name~优于除ALBEF外的所有现有方法,ALBEF执行了额外的自定义预训练步骤。
有趣的是,NLVR$^2$的性能并没有从额外的网络图像中得到太多的好处,这可能是由于网络数据和下游数据之间的域差距。
\subsection{Visual Dialog (VisDial)}
VisDial~\cite{VisDial} extends VQA in a natural conversational setting, where the model needs to predict an answer not only based on the image-question pair, but also considering the dialog history and the image’s caption.
We follow the discriminative setting where the model ranks a pool of answer candidates~\cite{ReDAN,VD-BERT,visdial_eccv}.
As shown in Figure~\ref{fig:vqa_visdial_nlvr}(c), we concatenate image and caption embeddings, and pass them to the dialog encoder through cross-attention.
The dialog encoder is trained with the ITM loss to discriminate whether the answer is true or false for a question, given the entire dialog history and the image-caption embeddings.
As shown in Table~\ref{tbl:visdial}, our method achieves state-of-the-art performance on VisDial v1.0 validation set.
VisDial扩展了VQA的自然会话设置,其中模型不仅需要根据图像-问题对预测答案,还需要考虑对话历史和图像的标题。
我们遵循区分设置,其中模型对一组答案候选人进行排序~\引用{ReDAN,VD-BERT,visdial_eccv}。
如图~\ref{fig:vqa_visdial_nlvr}(c)所示,我们将图像和标题嵌入连接起来,通过交叉注意传递给对话框编码器。
在给定整个对话历史和图像-标题嵌入的情况下,对话编码器使用ITM损失进行训练,以区分问题的答案是真还是假。
如表~\ref{tbl:visdial}所示,我们的方法在visdial v1.0验证集上实现了最先进的性能。
\subsection{Zero-shot Transfer to Video-Language Tasks}



Our image-language model has strong generalization ability to video-language tasks.
In Table~\ref{tbl:video_retrieval} and Table~\ref{tbl:video_qa}, we perform zero-shot transfer to \textit{text-to-video retrieval} and \textit{video question answering}, where we directly evaluate the models trained on COCO-retrieval and VQA, respectively.
To process video input, we uniformly sample $n$ frames per video ($n=8$ for retrieval and $n=16$ for QA), and concatenate the frame features into a single sequence.
Note that this simple approach ignores all temporal information.
我们的图像语言模型对视频语言任务具有很强的泛化能力。
在Table~\ref{tbl:video_retrieval}和Table~\ref{tbl:video_qa}中,我们将零镜头转换为\textit{text-to-video retrieval}和\textit{video questions answer},分别直接评估COCO-retrieval和VQA训练的模型。
为了处理视频输入,我们对每个视频统一采样$n$帧(检索$n=8$, QA $n=16$),并将帧特征串联成一个序列。
注意,这种简单的方法忽略了所有的时间信息。
Despite the domain difference and lack of temporal modeling, our models achieve state-of-the-art performance on both video-language tasks.
For text-to-video retrieval, zero-shot \name~even outperforms models finetuned on the target video dataset by +12.4\% in recall@1.
Further performance improvement can be achieved if the \name~model is used to initialize a video-language model with temporal modeling (\eg~replace our ViT with a TimeSformer~\cite{timesformer}) and finetuned on video data.
尽管领域差异和缺乏时间建模,我们的模型在两种视频语言任务上都取得了最先进的性能。
对于文本到视频检索,zero-shot \name~甚至比在recall@1中对目标视频数据集进行微调的模型的性能好+12.4\%。
如果使用\name~模型来初始化一个视频语言模型,并对视频数据进行微调,可以进一步提高性能。


\section{Additional Ablation Study}
In this section, we provide additional ablation experiments on CapFilt.
\noindent\textbf{Improvement with CapFilt is not due to longer training.}
Since the bootstrapped dataset contains more texts than the original dataset, training for the same number of epochs takes longer with the bootstrapped dataset.
To verify that the effectiveness of CapFilt is not due to longer training, we replicate the web text in the original dataset so that it has the same number of training samples per epoch as the bootstrapped dataset.
As shown in Table~\ref{tbl:longer}, longer training using the noisy web texts does not improve performance.
由于引导的数据集比原始数据集包含更多的文本,因此使用引导的数据集训练相同数量的epoch需要更长的时间。
为了验证CapFilt的有效性不是由于较长的训练,我们在原始数据集中复制web文本,使其在每个epoch中具有与bootstrapped数据集相同的训练样本数量。
如表~\ref{tbl:longer}所示,使用有噪声的web文本进行更长的训练并不能提高性能。
\noindent\textbf{A new model should be trained on the bootstrapped dataset.}
The bootstrapped dataset is used to pre-train a new model.
We investigate the effect of continue training from the previous pre-trained model, using the bootstrapped dataset.
Table~\ref{tbl:continue} hows that continue training does not help.
This observation agrees with the common practice in knowledge distillation, where the student model cannot be initialized from the teacher.
一个新的模型应该在引导的数据集上进行训练。}
引导的数据集用于对新模型进行预训练。
我们使用bootstrapped数据集来研究从先前的预训练模型中继续训练的效果。
表~\ref{tbl:continue}说明继续培训没有帮助。
这一观察结果与知识蒸馏中的普遍做法一致,即学生模型不能由教师初始化。
\section{Conclusion}
We propose \name, a new VLP framework with state-of-the-art performance on a wide range of downstream vision-language tasks, including understanding-based and generation-based tasks.
\name~pre-trains a multimodal mixture of encoder-decoder model using a dataset bootstrapped from large-scale noisy image-text pairs by injecting diverse synthetic captions and removing noisy captions.
Our bootstrapped dataset are released to facilitate future vision-language research.
我们提出了一个新的VLP框架,该框架在一系列下游视觉语言任务上具有最先进的性能,包括基于理解和基于生成的任务。
\name~使用从大规模有噪声的图像-文本对中引导的数据集,通过注入各种合成标题和去除有噪声的标题,预训练编码器-解码器模型的多模态混合。
我们发布的bootstrapped数据集是为了促进未来的视觉语言研究。
There are a few potential directions that can further enhance the performance of \name:
(1) Multiple rounds of dataset bootstrapping;
(2) Generate multiple synthetic captions per image to further enlarge the pre-training corpus;
(3) Model ensemble by training multiple different captioners and filters and combining their forces in CapFilt.
We hope that our paper motivates future work to focus on making improvements in both the model aspect and the data aspect,
the bread and butter of vision-language research.
有几个潜在的方向可以进一步提高\name的性能:
(1)多轮数据集bootstrapping;
(2)为每幅图像生成多个合成字幕,进一步扩大训练前的语料;
(3)在CapFilt中,通过训练多个不同的capfilter和CapFilt,并将它们的力量进行组合,实现模型集成。
我们希望我们的论文能够推动未来的工作,专注于模型方面和数据方面的改进,
这是视觉语言研究的主要内容。
\clearpage
\appendix
\section{Downstream Task Details}
Table~\ref{tbl:paramter} shows the hyperparameters that we use for finetuning on the downstream vision-language tasks.
All tasks uses AdamW optimizer with a weight decay of 0.05 and a cosine learning rate schedule.
We use an image resolution of $384\times384$, except for VQA where we follow~\citet{simvlm} and use $480\times480$ images.
Next we delineate the dataset details.
表~\ref{tbl: parameter}显示了我们用于对下游视觉语言任务进行微调的超参数。
所有的任务都使用了权重衰减为0.05的AdamW优化器和一个余弦学习速率计划。
我们使用$384\时384$的图像分辨率,除了VQA,我们跟随~\citet{simvlm}使用$480\时480$的图像。
接下来,我们描述数据集的细节。
\noindent\textbf{Image-Text Retrieval.}
We use the Karpathy split~\cite{karpathy} for both COCO and Flickr30K.
COCO contains 113/5k/5k images for train/validation/test, and Flickr30K contains 29k/1k/1k images for train/validation/test.
我们在COCO和Flickr30K中都使用了Karpathy分割~引用{Karpathy}。
COCO包含113/5k/5k图像用于训练/验证/测试,Flickr30K包含29k/1k/1k图像用于训练/验证/测试。
\noindent\textbf{Image Captioning.}
We finetune on COCO’s Karpathy train split, and evaluate on COCO’s Karpathy test split and NoCaps validation split.
During inference, we use beam search with a beam size of 3, and set the maximum generation length as 20.
对COCO的卡帕西训练分割进行了优化,并对COCO的卡帕西测试分割和NoCaps验证分割进行了评价。
在推理过程中,我们使用波束大小为3的波束搜索,并将最大生成长度设置为20。?不是nuclear?
\noindent\textbf{VQA.}
We experiment with the VQA2.0 dataset~\cite{VQA2}, which contains 83k/41k/81k images for training/validation/test.
Following~\citet{ALBEF}, we use both training and validation splits for training, and include additional training samples from Visual Genome.
During inference on VQA, we use the decoder to rank the 3,128 candidate answers~\cite{ALBEF,bilinear}.
我们使用VQA2.0数据集~\引用{VQA2}进行实验,该数据集包含83k/41k/81k图像,用于训练/验证/测试。
在~\citet{ALBEF}之后,我们使用训练和验证分割进行训练,并包括来自Visual Genome的额外训练样本。
在VQA推理过程中,我们使用解码器对3128个候选答案进行排序~\引用{ALBEF,bilinear}。
\noindent\textbf{NLVR$^2$.}
We conduct experiment on the official split~\cite{NLVR}.
\noindent\textbf{VisDial.}
We finetune on the training split of VisDial v1.0 and evaluate on its validation set.


\vspace{-0.5ex}
\section{Additional Examples of Synthetic Captions}
In Figure~\ref{fig:more_example}, we show additional examples of images and texts where the web captions are filtered out, and the synthetic captions are kept as clean training samples.
在图~\ref{fig:more_example}中,我们展示了额外的图片和文本示例,其中web标题被过滤掉,而合成的标题被保留为干净的训练样本。
\section{Pre-training Dataset Details}
Table~\ref{tbl:pretrain_data} shows the statistics of the pre-training datasets.
