这是用户在 2025-1-2 22:19 为 https://ar5iv.labs.arxiv.org/html/2103.00020?_immersive_translate_auto_translate=1 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?


从自然语言监督中学习可迁移的视觉模型

  亚历克·拉德福德      金钟郁      克里斯·哈拉西      阿迪亚·拉梅什      加布里埃尔·高      桑德希尼·阿加瓦尔      吉里什·萨斯特里      阿曼达·阿斯克尔      帕梅拉·米什金      杰克·克拉克      格雷琴·克鲁格      伊利亚·苏茨克维
  摘要


最先进的计算机视觉系统经过训练,能够预测一组固定的预定对象类别。这种受限的监督形式限制了它们的通用性和实用性,因为需要额外的标注数据来指定任何其他视觉概念。直接从关于图像的原始文本中学习是一种有前景的替代方法,它利用了更广泛的监督来源。我们证明,预测哪个标题与哪张图像相匹配这一简单的预训练任务,是一种高效且可扩展的方法,可以从互联网上收集的 4 亿对(图像,文本)数据集中从头学习最先进的图像表示。预训练后,自然语言被用来引用已学习的视觉概念(或描述新的概念),从而实现模型在下游任务中的零样本迁移。我们通过在 30 多个不同的现有计算机视觉数据集上进行基准测试,研究了这种方法的性能,涵盖的任务包括 OCR、视频中的动作识别、地理定位以及多种类型的细粒度对象分类。 该模型在大多数任务上表现出非平凡的迁移能力,通常无需任何特定数据集的训练即可与完全监督的基线模型相媲美。例如,我们在 ImageNet 上实现了与原始 ResNet-50 相当的零样本准确率,而无需使用其训练时所依赖的 128 万个训练样本中的任何一个。我们在 https://github.com/OpenAI/CLIP 上发布了代码及预训练模型权重。



1 引言与动机工作


直接从原始文本学习的预训练方法在过去几年中彻底改变了自然语言处理领域(Dai & Le, 2015; Peters et al., 2018; Howard & Ruder, 2018; Radford et al., 2018; Devlin et al., 2018; Raffel et al., 2019)。诸如自回归和掩码语言建模等任务无关的目标,在计算能力、模型容量和数据规模上跨越了多个数量级,持续提升了模型性能。“文本到文本”作为标准化输入输出接口的发展(McCann et al., 2018; Radford et al., 2019; Raffel et al., 2019),使得任务无关的架构能够零样本迁移到下游数据集,无需专门的输出头或针对特定数据集的定制。像 GPT-3 这样的旗舰系统(Brown et al., 2020),现在在许多任务上与定制模型竞争,同时几乎不需要特定数据集的训练数据。


这些结果表明,现代预训练方法在网络规模文本集合中可获得的总体监督超过了高质量众包标注的 NLP 数据集。然而,在其他领域如计算机视觉中,使用众包标注数据集(如 ImageNet,Deng 等人,2009 年)进行模型预训练仍是标准做法。直接从网络文本中学习的可扩展预训练方法是否能在计算机视觉领域带来类似的突破?先前的研究给出了积极的信号。

Refer to caption


图 1:我们方法的概述。标准的图像模型通常联合训练一个图像特征提取器和一个线性分类器来预测某些标签,而 CLIP 则联合训练一个图像编码器和一个文本编码器,以预测一批(图像,文本)训练样本的正确配对。在测试阶段,学习到的文本编码器通过嵌入目标数据集类别的名称或描述,合成一个零样本线性分类器。


20 多年前,Mori 等人(1999 年)通过训练模型预测与图像配对的文本文档中的名词和形容词,探索了改进基于内容的图像检索的方法。Quattoni 等人(2007 年)证明了通过在学习预测图像相关标题中单词的分类器权重空间中进行流形学习,可以获取数据效率更高的图像表示。Srivastava 与 Salakhutdinov(2012 年)则通过在低级图像和文本标签特征之上训练多模态深度玻尔兹曼机,深入探讨了深度表示学习。Joulin 等人(2016 年)将这一研究方向现代化,并展示了训练用于预测图像标题中单词的卷积神经网络(CNNs)能够学习到有用的图像表示。他们将 YFCC100M 数据集(Thomee 等人,2016 年)中图像的标题、描述和标签元数据转换为词袋多标签分类任务,并证明预训练 AlexNet(Krizhevsky 等人,2012 年)以预测这些标签所学习到的表示,在迁移任务上的表现与基于 ImageNet 的预训练相当。Li 等人 (2017 年)随后将这一方法扩展至预测短语 n-元组,而不仅仅是单个词汇,并展示了其系统通过基于已学习视觉 n-元组词典对目标类别进行评分,并预测得分最高者,实现向其他图像分类数据集零样本迁移的能力。采用更先进的架构与预训练策略,VirTex(Desai & Johnson, 2020)、ICMLM(Bulent Sariyildiz 等,2020)及 ConVIRT(Zhang 等,2020)近期展现了基于 Transformer 的语言建模、掩码语言建模以及对比学习目标在从文本中学习图像表征方面的潜力。


尽管作为概念验证令人兴奋,但利用自然语言监督进行图像表示学习仍属罕见。这很可能是因为在常见基准测试中展示的性能远低于其他方法。例如,Li 等人(2017)在零样本设置下于 ImageNet 上仅达到 11.5%的准确率,远低于当前最先进技术(Xie 等人,2020)的 88.4%准确率,甚至不及经典计算机视觉方法(Deng 等人,2012)50%的准确率。相反,范围更窄但针对性强的弱监督应用已提升了性能。Mahajan 等人(2018)表明,预测 Instagram 图片上与 ImageNet 相关的标签是一项有效的预训练任务。当这些预训练模型微调至 ImageNet 时,准确率提升了超过 5%,并改进了当时的整体技术水平。Kolesnikov 等人(2019)和 Dosovitskiy 等人(2020)也通过预训练模型预测噪声标记的 JFT-300M 数据集类别,在更广泛的迁移基准上展示了显著的性能提升。


这一研究方向在当前实践中找到了一种折衷方案,介于从有限数量的监督“黄金标签”中学习与从几乎无限的原始文本中学习之间。然而,这种折衷并非没有代价。两项研究均精心设计并在此过程中将其监督范围分别限制在 1000 类和 18291 类之内。自然语言凭借其普遍性,能够表达并监督更广泛的视觉概念。此外,这两种方法均采用静态的 softmax 分类器进行预测,缺乏动态输出的机制,这极大地限制了它们的灵活性,并削弱了其“零样本”学习能力。


这些弱监督模型与近期直接从自然语言学习图像表示的探索之间,一个关键差异在于规模。Mahajan 等人(2018 年)和 Kolesnikov 等人(2019 年)在数百万至数十亿张图像上训练其模型,耗时加速器年计,而 VirTex、ICMLM 和 ConVIRT 则在一至二十万张图像上训练,仅需加速器日计。本研究中,我们弥合了这一差距,并大规模研究了以自然语言监督训练的图像分类器的行为。得益于互联网上大量公开可用的此类数据,我们创建了一个包含四亿(图像,文本)对的新数据集,并证明了一个简化版的 ConVIRT——我们称之为 CLIP(对比语言-图像预训练),从零开始训练,是一种从自然语言监督中学习的有效方法。我们通过训练一系列跨越近两个数量级计算量的八个模型,研究了 CLIP 的可扩展性,并观察到迁移性能是计算量的平滑可预测函数(Hestness 等人,2017 年;Kaplan 等人,2020 年)。 我们发现,CLIP 与 GPT 系列类似,在预训练过程中学会了执行包括 OCR、地理定位、动作识别在内的广泛任务。通过在超过 30 个现有数据集上对 CLIP 的零样本迁移性能进行基准测试,我们测量到其表现可与之前针对特定任务的监督模型相媲美。我们还通过线性探针表示学习分析验证了这些发现,并表明 CLIP 在超越最佳公开可用的 ImageNet 模型的同时,计算效率也更高。此外,我们发现零样本 CLIP 模型比同等准确率的监督 ImageNet 模型更为鲁棒,这表明对任务无关模型进行零样本评估更能代表模型的能力。这些结果具有重要的政策和伦理意义,我们将在第 7 节中予以探讨。

Refer to caption


图 2:CLIP 在零样本迁移方面比我们的图像描述基线高效得多。尽管基于 Transformer 的语言模型表现力极强,但我们发现它们在零样本 ImageNet 分类上相对较弱。在此,我们观察到其学习速度比预测文本词袋(BoW)编码的基线慢 3 倍(Joulin 等,2016)。将预测目标替换为 CLIP 的对比目标后,效率又提升了 4 倍。

  方法


2.1 自然语言监督


我们方法的核心在于从自然语言所含的监督信息中学习感知能力。正如引言中所讨论的,这并非全新概念,然而,用于描述这一领域工作的术语多样,甚至看似矛盾,且提出的动机各异。张等人(2020)、戈麦斯等人(2017)、茹兰等人(2016)以及德赛与约翰逊(2020)均提出了从与图像配对的文本中学习视觉表征的方法,但他们分别将其方法描述为无监督、自监督、弱监督和有监督。


我们强调,这一系列工作的共同点并非在于所采用具体方法的细节,而在于对自然语言作为训练信号的重视。所有这些方法都是从自然语言的监督中学习。尽管早期研究在使用主题模型和 n-gram 表示时曾与自然语言的复杂性作斗争,但深度上下文表示学习的进步表明,我们现在已拥有有效利用这一丰富监督资源的工具(McCann 等,2017)。


从自然语言中学习相较于其他训练方法具有若干潜在优势。与图像分类中标准众包标注相比,自然语言监督更易于扩展,因为它不需要将注释转换为经典的“机器学习兼容格式”,如规范的 1-of-N 多数投票“黄金标签”。相反,基于自然语言的方法能够被动地从互联网上大量文本所含的监督信息中学习。此外,与大多数无监督或自监督学习方法相比,从自然语言学习还有一个重要优势,即它不仅学习表示,还将该表示与语言连接起来,从而实现灵活的零样本迁移。在接下来的小节中,我们将详细阐述我们所采用的具体方法。


2.2 创建足够大的数据集


现有研究主要使用了三个数据集:MS-COCO(Lin 等,2014)、Visual Genome(Krishna 等,2017)和 YFCC100M(Thomee 等,2016)。尽管 MS-COCO 和 Visual Genome 是高质量众包标注的数据集,但以现代标准衡量,它们规模较小,各自仅包含约 10 万张训练照片。相比之下,其他计算机视觉系统则训练于多达 35 亿张 Instagram 照片(Mahajan 等,2018)。YFCC100M 拥有 1 亿张照片,是一个潜在的替代选择,但每张图像的元数据稀疏且质量参差不齐。许多图像采用自动生成的文件名如 20160716_113957.JPG 作为“标题”,或包含相机曝光设置的“描述”。经过筛选,仅保留带有英文自然语言标题和/或描述的图像后,数据集规模缩减至原来的六分之一,仅剩 1500 万张照片,大致与 ImageNet 的规模相当。


自然语言监督的一个主要动机在于互联网上公开存在的大量此类形式的数据。鉴于现有数据集未能充分反映这一可能性,仅基于它们考虑结果将低估这一研究方向的潜力。为解决此问题,我们构建了一个包含 4 亿对(图像,文本)的新数据集,这些数据来自互联网上多种公开可用的资源。为了尽可能覆盖广泛的视觉概念集,我们在构建过程中搜索了文本包含 50 万个查询词之一的(图像,文本)对。我们通过每个查询最多包含 20,000 对(图像,文本)来近似平衡结果类别。最终数据集的总词数与用于训练 GPT-2 的 WebText 数据集相当。我们将此数据集称为 WIT,即 WebImageText。


2.3 选择高效的预训练方法


顶尖的计算机视觉系统需要极其庞大的计算资源。Mahajan 等人(2018)训练其 ResNeXt101-32x48d 模型耗费了 19 个 GPU 年,而 Xie 等人(2020)训练其 Noisy Student EfficientNet-L2 模型则消耗了 33 个 TPUv3 核心年。考虑到这两套系统仅针对 1000 个 ImageNet 类别进行预测训练,从自然语言中学习开放视觉概念的任务显得尤为艰巨。在我们的研究过程中,我们发现训练效率是成功扩展自然语言监督的关键,并基于这一指标选定了最终的预训练方法。


我们的初始方法,与 VirTex 类似,从头开始联合训练了一个图像 CNN 和文本转换器,以预测图像的标题。然而,我们在高效扩展这一方法时遇到了困难。图 2 显示,一个拥有 6300 万参数的转换器语言模型,其计算量已经是 ResNet-50 图像编码器的两倍,学习识别 ImageNet 类别的速度却比预测相同文本的词袋编码的简单基线慢了三倍。


这两种方法共享一个关键相似点:它们都试图预测每张图片所伴随文本的确切词汇。由于与图片共现的描述、评论及相关文本种类繁多,这一任务颇具挑战性。近期在图像对比表示学习领域的研究发现,对比目标相较于其等效的预测目标,能够学习到更优的表示(Tian 等,2019)。另有研究指出,尽管图像的生成模型能够学习到高质量的图像表示,但达到相同性能时,其所需的计算资源远超对比模型一个数量级以上(Chen 等,2020a)。基于这些发现,我们探索了训练一个系统来解决一个可能更为简单的代理任务:仅预测哪段文本整体与哪张图片配对,而非该文本的具体词汇。从相同的词袋编码基线出发,我们在图 2 中将预测目标替换为对比目标,并观察到在 ImageNet 上的零样本迁移率进一步提升了 4 倍。


给定一批 NN (图像,文本)对,CLIP 被训练来预测批次中 N×NN\times N 种可能的(图像,文本)配对中哪些实际发生了。为此,CLIP 通过联合训练图像编码器和文本编码器,学习一个多模态嵌入空间,旨在最大化批次中 NN 真实配对的图像和文本嵌入的余弦相似度,同时最小化 N2Nsuperscript2N^{2}-N 错误配对嵌入的余弦相似度。我们基于这些相似度分数优化对称交叉熵损失。图 3 中,我们提供了 CLIP 实现核心的伪代码。据我们所知,这种批次构建技术和目标最初是在深度度量学习领域作为多类 N 对损失由 Sohn(2016)引入,随后被 Oord 等人(2018)推广为对比表示学习中的 InfoNCE 损失,并最近由 Zhang 等人(2020)在医学影像领域适应于对比(文本,图像)表示学习。


鉴于我们预训练数据集的庞大规模,过拟合并非主要问题,因此与 Zhang 等人(2020)的实现相比,CLIP 的训练细节得以简化。我们从头开始训练 CLIP,未使用 ImageNet 权重初始化图像编码器,也未使用预训练权重初始化文本编码器。我们未采用 Bachman 等人(2019)提出并由 Chen 等人(2020b)推广的表示与对比嵌入空间之间的非线性投影方法,而是仅使用线性投影将各编码器的表示映射到多模态嵌入空间。我们未观察到两种版本在训练效率上的差异,并推测非线性投影可能仅在与当前图像细节共同适应的自监督表示学习方法中发挥作用。此外,我们移除了 Zhang 等人(2020)中的文本转换函数 tusubscriptt_{u} ,该函数从文本中均匀采样单个句子,因为 CLIP 预训练数据集中的许多(图像,文本)对仅包含一个句子。我们还简化了图像转换函数 tvsubscriptt_{v} 。 在训练过程中,唯一使用的数据增强方法是从调整大小后的图像中随机裁剪一个方形区域。最后,控制 softmax 中 logits 范围的温度参数 τ\tau ,在训练期间作为对数参数化的乘法标量直接优化,以避免其成为需要调整的超参数。

Refer to caption


图 3:CLIP 实现核心部分的类 Numpy 伪代码。


2.4 模型选择与缩放


我们为图像编码器考虑了两种不同的架构。首先,由于 ResNet-50(He 等,2016a)的广泛采用和已验证的性能,我们将其作为图像编码器的基础架构。我们对原始版本进行了几处修改,采用了 He 等(2019)提出的 ResNet-D 改进措施以及 Zhang(2019)提出的抗锯齿矩形 2 模糊池化技术。此外,我们将全局平均池化层替换为注意力池化机制。该注意力池化机制实现为单层“Transformer 风格”的多头 QKV 注意力,其中查询基于图像的全局平均池化表示进行条件化。对于第二种架构,我们尝试了最近引入的视觉 Transformer(ViT)(Dosovitskiy 等,2020)。我们严格遵循其实现,仅对 Transformer 前的组合补丁和位置嵌入添加了一层额外的归一化,并采用了稍有不同的初始化方案。


文本编码器采用了 Transformer 架构(Vaswani 等人,2017),并依据 Radford 等人(2019)的研究进行了架构调整。作为基础规模,我们使用了一个拥有 6300 万参数、12 层、512 宽度及 8 个注意力头的模型。该 Transformer 处理的是经过小写字节对编码(BPE)处理的文本表示,词汇表大小为 49,152(Sennrich 等人,2015)。出于计算效率考虑,最大序列长度被限制在 76。文本序列以[SOS]和[EOS]标记为边界,Transformer 最高层在[EOS]标记处的激活值被视为文本的特征表示,该特征经过层归一化后,线性投影至多模态嵌入空间。文本编码器中使用了掩码自注意力机制,以保留使用预训练语言模型进行初始化或将语言建模作为辅助目标的能力,但对此的深入探索留待未来工作。


以往计算机视觉研究常通过单独增加宽度(Mahajan 等,2018)或深度(He 等,2016a)来扩展模型,而对于 ResNet 图像编码器,我们采用了 Tan & Le(2019)的方法,该方法发现将额外计算资源均衡分配到宽度、深度和分辨率三个维度上,比仅单一维度分配更能提升模型性能。尽管 Tan & Le(2019)针对其 EfficientNet 架构调整了各维度计算资源的分配比例,我们则采用了一个简单基线,即均等地将额外计算资源用于增加模型的宽度、深度和分辨率。对于文本编码器,我们仅按比例调整其宽度,使其与 ResNet 宽度的计算增量相匹配,而完全不调整深度,因为我们发现 CLIP 的性能对文本编码器容量的敏感度较低。

  2.5 培训


我们训练了一系列包含 5 个 ResNet 和 3 个视觉 Transformer 的模型。对于 ResNet,我们训练了 ResNet-50、ResNet-101,以及另外三个采用 EfficientNet 风格模型缩放策略的模型,它们分别使用了约 4 倍、16 倍和 64 倍于 ResNet-50 的计算资源,分别标记为 RN50x4、RN50x16 和 RN50x64。在视觉 Transformer 方面,我们训练了 ViT-B/32、ViT-B/16 和 ViT-L/14。所有模型均训练 32 个周期。我们采用 Adam 优化器(Kingma & Ba, 2014),并对所有非增益或偏置的权重应用解耦权重衰减正则化(Loshchilov & Hutter, 2017),学习率则通过余弦调度(Loshchilov & Hutter, 2016)进行衰减。初始超参数设置基于对基线 ResNet-50 模型进行 1 周期训练时的网格搜索、随机搜索和手动调优相结合的方法。由于计算限制,对于更大模型的超参数则采用启发式方法进行调整。可学习的温度参数 τ\tau 初始化为相当于 0.07 的值(源自 Wu et al., 2018),并进行了截断处理,以防止对数几率缩放超过 100,这一措施对于防止训练不稳定是必要的。我们采用了非常大的小批量大小,即 32,768。 混合精度(Micikevicius 等,2017)被用于加速训练并节省内存。为了进一步节省内存,采用了梯度检查点(Griewank & Walther, 2000; Chen 等,2016)、半精度 Adam 统计量(Dhariwal 等,2020)以及半精度随机舍入的文本编码器权重。嵌入相似度的计算也被分片处理,每个 GPU 仅计算其本地批次嵌入所需的成对相似度子集。最大的 ResNet 模型 RN50x64 在 592 个 V100 GPU 上训练了 18 天,而最大的 Vision Transformer 在 256 个 V100 GPU 上训练了 12 天。对于 ViT-L/14,我们还以更高的 336 像素分辨率进行了额外一个周期的预训练,以提升性能,类似于 FixRes(Touvron 等,2019)。我们将此模型标记为 ViT-L/14@336px。除非另有说明,本文中所有以“CLIP”报告的结果均使用此模型,我们发现其表现最佳。

  3 实验

  3.1 零样本迁移

  3.1.1 动机


在计算机视觉领域,零样本学习通常指研究在图像分类中对未见过的物体类别进行泛化(Lampert 等,2009)。我们则从更广泛的意义上使用这一术语,并研究对未见数据集的泛化能力。我们将其视为执行未见任务的代理,正如 Larochelle 等人在零数据学习论文(2008)中所期望的那样。尽管无监督学习领域的大量研究集中于机器学习系统的表示学习能力,我们则提倡研究零样本迁移作为衡量机器学习系统任务学习能力的一种方式。在此视角下,数据集评估的是在特定分布上执行任务的表现。然而,许多流行的计算机视觉数据集是由研究社区创建的,主要作为指导通用图像分类方法开发的基准,而非衡量特定任务上的表现。虽然可以说 SVHN 数据集衡量的是在谷歌街景照片分布上的街道号码转录任务,但 CIFAR-10 数据集衡量的“真实”任务尚不明确。 然而,CIFAR-10 数据集显然源自 TinyImages(Torralba 等人,2008)。在这类数据集上,零样本迁移更多是对 CLIP 在分布偏移和领域泛化方面鲁棒性的评估,而非任务泛化。关于此点的深入分析,请参见第 3.3 节。


据我们所知,Visual N-Grams(Li 等,2017)首次以上述方式研究了向现有图像分类数据集的零样本迁移。这也是我们已知的唯一一项使用通用预训练模型研究向标准图像分类数据集进行零样本迁移的工作,并作为理解 CLIP 的最佳参考点。他们的方法学习了包含 142,806 个视觉 n-grams(涵盖 1 至 5 元组)的词典参数,并通过 Jelinek-Mercer 平滑的微分版本优化这些 n-grams,以最大化给定图像所有文本 n-grams 的概率。为了执行零样本迁移,他们首先将数据集中每个类名的文本转换为其 n-gram 表示,然后根据其模型计算其概率,预测得分最高的类别。


我们专注于研究零样本迁移作为任务学习评估的灵感,源自于自然语言处理领域展示任务学习的工作。据我们所知,Liu 等人(2018)首次将任务学习识别为一种“意外副作用”,当时一个旨在生成维基百科文章的语言模型学会了在不同语言间可靠地音译人名。尽管 GPT-1(Radford 等人,2018)主要关注预训练作为一种迁移学习方法以提升监督微调的效果,但它也包含了一项消融研究,表明四种启发式零样本迁移方法的性能在预训练过程中稳步提升,无需任何监督适应。这一分析为 GPT-2(Radford 等人,2019)奠定了基础,后者专注于通过零样本迁移研究语言模型的任务学习能力。


3.1.2 利用 CLIP 进行零样本迁移


CLIP 经过预训练,能够预测其数据集中图像与文本片段是否配对。为了实现零样本分类,我们复用这一能力。对于每个数据集,我们将数据集中所有类别的名称作为潜在的文本配对集合,并根据 CLIP 预测最可能的(图像,文本)对。更详细地说,我们首先通过各自的编码器计算图像的特征嵌入和可能文本集的特征嵌入。接着计算这些嵌入的余弦相似度,通过温度参数 τ\tau 进行缩放,并通过 softmax 归一化为概率分布。值得注意的是,此预测层是一个多项逻辑回归分类器,具有 L2 归一化的输入、L2 归一化的权重、无偏置项以及温度缩放。如此解读,图像编码器是计算图像特征表示的计算机视觉骨干网络,而文本编码器则是一个超网络(Ha 等,2016),它基于描述类别所代表视觉概念的文本生成线性分类器的权重。Lei Ba 等。 (2015)首次引入了这种形式的零样本图像分类器,而通过自然语言生成分类器的想法至少可以追溯到 Elhoseiny 等人(2013)的研究。延续这一解释,CLIP 预训练的每一步都可以视为优化一个随机创建的代理在计算机视觉数据集上的性能,该数据集每类包含 1 个样本,并通过自然语言描述定义了总计 32,768 个类别。对于零样本评估,我们一旦通过文本编码器计算出零样本分类器,便将其缓存并重复用于所有后续预测。这样,生成分类器的成本就可以分摊到数据集中的所有预测上。


3.1.3 与视觉 N 元语法的初步比较


  雅虎 ImageNet SUN
  视觉 N 元语法 72.4 11.5 23.0
CLIP 98.4 76.2 58.5

表 1:CLIP 与先前零样本迁移图像分类结果的比较。CLIP 在三个数据集上的性能均有大幅提升。这一改进反映了自 Visual N-Grams(Li 等,2017)开发以来四年间的诸多差异。


在表 1 中,我们将 Visual N-Grams 与 CLIP 进行了比较。最佳的 CLIP 模型将 ImageNet 上的准确率从概念验证的 11.5%提升至 76.2%,并且在不使用该数据集提供的 128 万张众包标注训练样本的情况下,达到了与原始 ResNet-50 相当的性能。此外,CLIP 模型的 Top-5 准确率显著高于其 Top-1 准确率,该模型的 Top-5 准确率高达 95%,与 Inception-V4(Szegedy 等人,2016)持平。在零样本设置下,CLIP 能够与强大的全监督基线模型性能相媲美,这表明 CLIP 在实现灵活且实用的零样本计算机视觉分类器方面迈出了重要一步。如前所述,与 Visual N-Grams 的比较旨在为 CLIP 的性能提供背景参考,不应将其视为 CLIP 与 Visual N-Grams 之间的直接方法对比,因为两者之间许多影响性能的差异并未得到控制。 例如,我们使用的训练数据集规模是其 10 倍,采用的视觉模型每次预测所需的计算量接近其 100 倍,训练过程中可能消耗的计算资源更是其 1000 倍以上,并且使用了基于 Transformer 的模型,而这一模型在 Visual N-Grams 发布时尚未问世。为了进行更直接的比较,我们在与 Visual N-Grams 相同的 YFCC100M 数据集上训练了 CLIP ResNet-50 模型,发现其在 V100 GPU 一天内的训练就达到了他们报告的 ImageNet 性能水平。此外,这一基线模型是从零开始训练的,而非像 Visual N-Grams 那样从预训练的 ImageNet 权重初始化。


CLIP 在另外两个报告的数据集上也表现优于 Visual N-Grams。在 aYahoo 数据集上,CLIP 实现了 95%的错误率降低,而在 SUN 数据集上,CLIP 的准确率更是 Visual N-Grams 的两倍多。为了进行更全面的分析和压力测试,我们实施了一个更为庞大的评估套件,详细内容见附录 A。总体而言,我们从 Visual N-Grams 报告的 3 个数据集扩展到了包含超过 30 个数据集,并与超过 50 个现有的计算机视觉系统进行了比较,以便将结果置于更广泛的背景中。


3.1.4 提示工程与集成学习

Refer to caption


图 4:提示工程与集成方法提升零样本性能。相较于仅使用无上下文类别名称的基线方法,提示工程与集成策略在 36 个数据集上平均将零样本分类性能提高了近 5 个百分点。这一提升效果与基线零样本方法增加四倍计算资源所获得的增益相当,但在多次预测中分摊后,这一改进几乎是“免费”的。


大多数标准的图像分类数据集在处理类别命名或描述信息时,往往将其视为事后考虑,这些信息本可以支持基于自然语言的零样本迁移。绝大多数数据集仅用标签的数字 ID 来标注图像,并包含一个将这些 ID 映射回其英文名称的文件。而有些数据集,如 Flowers102 和 GTSRB,在其发布版本中似乎完全未包含此类映射,从而彻底阻碍了零样本迁移的实现。 2 对于许多数据集,我们观察到这些标签的选择可能较为随意,并未预见到与零样本迁移相关的问题,而零样本迁移的成功依赖于任务描述的准确性。


一个常见问题是多义性。当仅向 CLIP 的文本编码器提供类别名称时,由于缺乏上下文,它无法区分所指的是哪个词义。在某些情况下,同一单词的多种含义可能作为不同类别包含在同一数据集中!这在 ImageNet 中就有体现,其中既包含建筑起重机,也包含会飞的鹤。另一个例子出现在 Oxford-IIIT 宠物数据集的类别中,根据上下文,“boxer”一词显然指的是狗的品种,但对于缺乏上下文的文本编码器来说,它同样可能指的是一种运动员类型。


我们遇到的另一个问题是,在预训练数据集中,与图像配对的文本通常不是一个单词,而是一个完整句子,以某种方式描述图像。为了弥合这种分布差距,我们发现使用提示模板“一张{标签}的照片。”是一个很好的默认选择,有助于明确文本与图像内容相关。这通常比仅使用标签文本的基线表现有所提升。例如,仅使用这一提示就使 ImageNet 上的准确率提高了 1.3%。


类似于围绕 GPT-3 的“提示工程”讨论(Brown 等人,2020;Gao 等人,2020),我们也观察到,通过为每个任务定制提示文本,可以显著提升零样本性能。以下列举了一些非穷尽的例子。在多个细粒度图像分类数据集上,我们发现指定类别有助于提升效果。例如,在 Oxford-IIIT Pets 数据集上,使用“一张{label}的照片,一种宠物。”来提供上下文效果良好。同样,在 Food101 数据集上指定食物类型,在 FGVC Aircraft 数据集上指定飞机类型也有帮助。对于 OCR 数据集,我们发现将要识别的文本或数字用引号括起来能提高性能。最后,我们发现,在卫星图像分类数据集上,说明图像属于此类形式并使用“一张{label}的卫星照片。”的变体也有所助益。


我们还尝试了通过集成多个零样本分类器作为另一种提升性能的方法。这些分类器通过使用不同的上下文提示来计算,例如“一张大{标签}的照片”和“一张小{标签}的照片”。我们在嵌入空间而非概率空间上构建集成。这使得我们能够缓存一组平均后的文本嵌入,从而在多次预测中分摊计算成本时,集成的计算成本与使用单个分类器相同。我们观察到,跨多个生成的零样本分类器进行集成能够可靠地提升性能,并将其应用于大多数数据集。在 ImageNet 上,我们集成了 80 种不同的上下文提示,这比上述单一默认提示的性能又提高了 3.5%。综合考虑,提示工程和集成使 ImageNet 的准确率提升了近 5%。在图 4 中,我们可视化了提示工程和集成如何改变一组 CLIP 模型的性能,与 Li 等人(2017)直接嵌入类名的无上下文基线方法相比。


3.1.5 零样本 CLIP 性能分析

Refer to caption


图 5:零样本 CLIP 与全监督基线模型表现相当。在包含 27 个数据集的评估套件中,零样本 CLIP 分类器在 16 个数据集上超越了基于 ResNet-50 特征训练的全监督线性分类器,其中包括 ImageNet。


由于计算机视觉中任务无关的零样本分类器研究尚不充分,CLIP 为深入理解此类模型提供了一个有前景的契机。在本节中,我们对 CLIP 零样本分类器的多种特性进行了研究。首先,我们探讨了零样本分类器的性能表现。为了对此进行背景化分析,我们将其与一个简单的现成基线模型的表现进行了对比:即在标准 ResNet-50 特征上训练一个全监督、正则化的逻辑回归分类器。图 5 展示了这一对比结果,涵盖了 27 个数据集。关于数据集和实验设置的详细信息,请参见附录 A。


零样本 CLIP 在多数情况下略胜于这一基线,在 27 个数据集中赢得了 16 个。观察个别数据集揭示了一些有趣的现象。在细粒度分类任务上,我们观察到性能差异较大。在斯坦福汽车和 Food101 这两个数据集上,零样本 CLIP 相较于基于 ResNet-50 特征进行逻辑回归的方法,性能提升了超过 20%;而在 Flowers102 和 FGVCAircraft 上,则落后了超过 10%。在 OxfordPets 和 Birdsnap 上,两者性能更为接近。我们推测这些差异主要源于 WIT 与 ImageNet 之间针对每项任务的监督程度不同。在诸如 ImageNet、CIFAR10/100、STL10 和 PascalVOC2007 等“通用”物体分类数据集上,性能相对接近,零样本 CLIP 在所有情况下均略占优势。在 STL10 上,CLIP 达到了 99.3%的整体准确率,尽管未使用任何训练样本,这似乎创下了新的技术标杆。在衡量视频中动作识别的两个数据集上,零样本 CLIP 显著优于 ResNet-50。在 Kinetics700 上,CLIP 比 ResNet-50 高出 14.5%。在 UCF101 上,零样本 CLIP 也以 7.7%的优势超越了 ResNet-50 的特征表现。 我们推测,这是由于自然语言为涉及动词的视觉概念提供了更广泛的监督,相比之下,ImageNet 中的监督更侧重于名词为中心的对象。


观察零样本 CLIP 表现显著不佳的领域,我们发现它在多项专业化、复杂或抽象任务上显得相当薄弱,例如卫星图像分类(EuroSAT 和 RESISC45)、淋巴结肿瘤检测(PatchCamelyon)、合成场景中的物体计数(CLEVRCounts)、以及自动驾驶相关任务,如德国交通标志识别(GTSRB)和识别最近车辆距离(KITTI Distance)。这些结果凸显了零样本 CLIP 在处理更复杂任务时的能力不足。相比之下,非专业人士却能稳健地完成其中多项任务,如计数、卫星图像分类和交通标志识别,这表明存在显著的改进空间。然而,我们需谨慎指出,对于学习者毫无先验经验的困难任务(如几乎所有人类乃至 CLIP 可能都未曾接触过的淋巴结肿瘤分类),衡量零样本迁移而非少样本迁移是否构成有意义的评估标准,尚不明确。

Refer to caption


图 6:零样本 CLIP 表现优于少量样本线性探针。零样本 CLIP 与在同一特征空间上训练的 4 样本线性分类器的平均性能相当,并几乎达到了公开可用模型中 16 样本线性分类器的最佳结果。对于 BiT-M 和 SimCLRv2,表现最佳的模型已高亮显示。浅灰色线条代表评估套件中的其他模型。本分析使用了每类至少包含 16 个样本的 20 个数据集。


在将零样本性能与全监督模型进行比较时,CLIP 的任务学习能力得到了情境化理解;而与少样本方法的对比则更为直接,因为零样本是其极限。图 6 中,我们展示了零样本 CLIP 与基于多种图像模型特征的少样本逻辑回归的对比情况,这些模型包括当前公开的最佳 ImageNet 模型、自监督学习方法以及 CLIP 自身。尽管直觉上可能认为零样本表现会逊色于单样本,但我们发现,在同一特征空间上,零样本 CLIP 的表现与四样本逻辑回归相当。这很可能源于零样本与少样本方法间的一个重要差异。首先,CLIP 的零样本分类器通过自然语言生成,使得视觉概念能够被直接“传达”或指定。相比之下,“常规”监督学习则需从训练样本中间接推断概念。无上下文的基于样本学习存在一个弊端,即多种不同假设均可能与数据相符,尤其是在单样本情况下。单张图像往往包含多种不同的视觉概念。 尽管有能力的学习者能够利用视觉线索和启发式方法,例如假设演示中的概念是图像中的主要对象,但这并不能保证。


解决零样本与少样本性能之间差异的一个潜在方案是,将 CLIP 的零样本分类器作为少样本分类器权重的先验。虽然向生成的权重添加 L2 惩罚是这一想法的直接实现,但我们发现超参数优化往往会选择如此大的正则化值,以至于最终的少样本分类器“仅仅”是零样本分类器。探索将零样本迁移的优势与少样本学习的灵活性更好结合的方法,是未来研究的一个有前景的方向。


在将零样本 CLIP 与其他模型特征的少样本逻辑回归进行比较时,零样本 CLIP 大致匹配了我们评估套件中表现最佳的 16 样本分类器的性能,该分类器使用了在 ImageNet-21K 上训练的 BiT-M ResNet-152x2 的特征。我们确信,在 JFT-300M 上训练的 BiT-L 模型表现会更佳,但这些模型尚未公开发布。BiT-M ResNet-152x2 在 16 样本设置中表现最佳,这一点有些出乎意料,因为正如第 3.2 节所分析,在完全监督设置下,Noisy Student EfficientNet-L2 在 27 个数据集上的平均表现要高出近 5%。

Refer to caption


图 7:零样本迁移的数据效率差异显著。通过计算在同一 CLIP 特征空间上线性分类器为达到与零样本分类器相当性能所需的每类标注样本数量,可以量化零样本迁移的有效性。这些数值基于 1、2、4、8、16 样本及全监督结果的线性对数插值估算得出。性能表现差异巨大,从在两种数据集上仍不及单样本分类器,到与每类约 184 个标注样本的估计值相匹配不等。


除了研究零样本 CLIP 和少样本逻辑回归的平均性能外,我们还考察了在单个数据集上的表现。图 7 展示了在同一特征空间上,逻辑回归分类器需要每个类别多少标注样本才能达到零样本 CLIP 性能的估计值。由于零样本 CLIP 同样是一种线性分类器,这一估计反映了在此情境下零样本迁移的有效数据效率。为了避免训练成千上万的线性分类器,我们基于 1、2、4、8、16 样本(在可能的情况下)以及每个数据集上完全监督的线性分类器的性能,采用对数线性插值法来估算有效数据效率。我们发现,零样本迁移在不同数据集上的效率差异巨大,从每个类别不到 1 个标注样本到 184 个不等。其中,Flowers102 和 EuroSAT 两个数据集的表现不及单样本模型。半数数据集每个类别所需的样本数少于 5 个,中位数为 5.4。然而,估算的平均数据效率为每个类别 20.8 个样本。 这是因为在 20%的数据集中,监督分类器需要每个类别的大量标注样本才能达到相应的性能。在 ImageNet 上,零样本 CLIP 的表现与在同一特征空间上训练的 16 样本线性分类器相当。

Refer to caption


图 8:零样本性能与线性探测性能相关,但大多仍处于次优状态。通过比较不同数据集上的零样本与线性探测性能,发现两者存在强相关性,但零样本性能普遍低 10 至 25 个百分点。仅在 5 个数据集中,零样本性能接近线性探测性能(差异在 3 个百分点以内)。


如果我们假设评估数据集足够大,使得在其上训练的线性分类器参数得到良好估计,那么由于 CLIP 的零样本分类器同样是一种线性分类器,全监督分类器的性能大致设定了零样本迁移所能达到的上限。在图 8 中,我们比较了 CLIP 的零样本性能与跨数据集的全监督线性分类器。虚线 y=xy=x 代表了一个“最优”零样本分类器,其性能与其全监督对应物相匹配。对于大多数数据集,零样本分类器的性能仍比全监督分类器低 10%至 25%,这表明在提升 CLIP 的任务学习与零样本迁移能力方面仍有很大的改进空间。


零样本性能与全监督性能之间存在 0.82 的正相关关系(p 值 <106absentsuperscript106<10^{-6} ),这表明 CLIP 在将底层表示与任务学习连接至零样本迁移方面相对一致。然而,零样本 CLIP 仅在 STL10、CIFAR10、Food101、OxfordPets 和 Caltech101 这五个数据集上接近全监督性能。在这五个数据集上,零样本准确率和全监督准确率均超过 90%。这表明,对于其底层表示同样高质量的任务,CLIP 在零样本迁移上可能更为有效。通过线性回归模型预测零样本性能作为全监督性能的函数,其斜率估计全监督性能每提升 1%,零样本性能将提升 1.28%。然而,95%百分位数的置信区间仍包含小于 1 的值(0.93-1.79)。

Refer to caption


图 9:零样本 CLIP 性能随模型计算量的增加而平稳提升。在 36 个不同数据集上进行的 39 次评估中,平均零样本误差在跨越 5 种不同 CLIP 模型、计算量相差 44 倍的范围内,呈现出对数-对数线性趋势。浅色线条代表单次评估的性能,表明尽管整体趋势平滑,但具体性能却存在较大差异。
Refer to caption

图 10:CLIP 模型与当前最先进的计算机视觉模型(包括 EfficientNet(Tan & Le, 2019; Xie et al., 2020)、MoCo(Chen et al., 2020d)、Instagram 预训练的 ResNeXt 模型(Mahajan et al., 2018; Touvron et al., 2019)、BiT(Kolesnikov et al., 2019)、ViT(Dosovitskiy et al., 2020)、SimCLRv2(Chen et al., 2020c)、BYOL(Grill et al., 2020)以及原始 ResNet 模型(He et al., 2016b))的线性探测性能对比。(左)分数为 Kornblith 等人(2019)研究的 12 个数据集的平均值。(右)分数为包含更广泛分布类型的 27 个数据集的平均值。虚线表示在比预训练更高分辨率图像上微调或评估的模型。各数据集的具体分数见表 10,各数据集的绘图见图 20。


过去几年中,深度学习系统的实证研究已表明,其性能可依据训练计算量和数据集规模等关键量进行预测(Hestness 等,2017;Kaplan 等,2020)。GPT 系列模型至今已展现出,在训练计算量增加 1000 倍的情况下,零样本性能持续提升。图 9 中,我们检验了 CLIP 的零样本性能是否遵循类似的扩展规律。我们绘制了 5 个 ResNet CLIP 模型在 36 个不同数据集上的 39 次评估的平均错误率,发现 CLIP 在模型计算量增加 44 倍的过程中,同样呈现出对数-对数线性扩展趋势。尽管总体趋势平滑,但我们发现个别评估的性能可能波动较大。我们不确定这是否是由于子任务上个别训练运行间的高方差(如 D’Amour 等(2020)所记录)掩盖了稳步提升的趋势,还是某些任务上性能实际上作为计算量的函数是非单调的。


3.2 表示学习


尽管我们在前一节中通过零样本迁移广泛分析了 CLIP 的任务学习能力,但更常见的是研究模型的表示学习能力。评估表示质量的方法多种多样,且对于“理想”表示应具备哪些特性存在分歧(Locatello 等,2020)。一种常见的方法是在从模型中提取的表示上拟合线性分类器,并测量其在各种数据集上的性能。另一种方法是测量模型端到端微调的性能。这增加了灵活性,先前的工作已令人信服地证明,在大多数图像分类数据集上,微调优于线性分类(Kornblith 等,2019;Zhai 等,2019)。尽管微调的高性能出于实际原因激励了对其的研究,我们仍选择基于线性分类器的评估,原因如下。我们的工作重点在于开发一种高性能且与任务和数据集无关的预训练方法。 微调,由于其在微调阶段针对每个数据集调整表示,能够补偿并可能掩盖预训练阶段未能学习到通用且鲁棒表示的问题。相比之下,线性分类器因其有限的灵活性,反而凸显了这些不足,并在开发过程中提供了清晰的反馈。对于 CLIP 而言,训练有监督的线性分类器还有一个额外的好处,即其方法与其零样本分类器所采用的方法非常相似,这使得在第 3.1 节中能够进行广泛的比较和分析。最后,我们的目标是将 CLIP 与一系列现有模型在多个任务上进行比较。研究 27 个不同数据集上的 66 种不同模型,需要调整 1782 次不同的评估。微调开启了一个更大的设计和超参数空间,这使得公平评估变得困难,并且在计算上比较多种技术变得昂贵,正如其他大规模实证研究中所讨论的那样(Lucic 等,2018;Choi 等,2019)。相比之下,线性分类器需要最少的超参数调整,并且具有标准化的实现和评估程序。 详情请参见附录 A 中的评估部分。


图 10 总结了我们的研究发现。为了最小化可能引起确认或报告偏差担忧的选择效应,我们首先研究了 Kornblith 等人(2019)提出的 12 个数据集评估套件上的性能。尽管如 ResNet-50 和 ResNet-101 这样的小型 CLIP 模型在 ImageNet-1K 上训练的其他 ResNets(BiT-S 及原始模型)表现更优,但它们却逊色于在 ImageNet-21K 上训练的 ResNets(BiT-M)。这些小型 CLIP 模型同样不及计算需求相近的 EfficientNet 系列模型。然而,采用 CLIP 训练的模型展现出极佳的扩展性,我们训练的最大模型(ResNet-50x64)在总体评分和计算效率上均略胜于现有最佳模型(Noisy Student EfficientNet-L2)。此外,我们发现 CLIP 视觉变换器的计算效率大约是 CLIP ResNets 的三倍,这使得我们能在计算预算内达到更高的整体性能。这些结果在性质上复现了 Dosovitskiy 等人(2020)的发现,即当在足够大的数据集上训练时,视觉变换器比卷积网络具有更高的计算效率。 我们最佳的总体模型是一个 ViT-L/14,它在我们的数据集上以 336 像素的更高分辨率进行了额外一个周期的微调。该模型在整个评估套件中平均优于现有最佳模型 2.6%。


如图 21 定性所示,CLIP 模型学习到的任务范围比以往在单一计算机视觉模型中通过端到端随机初始化训练所展示的更为广泛。这些任务包括地理定位、光学字符识别、面部情绪识别以及动作识别。Kornblith 等人(2019)的评估套件中并未涵盖这些任务。这可以被视为 Kornblith 等人(2019)研究中对于与 ImageNet 重叠任务的一种选择偏倚。为解决这一问题,我们还采用了一个包含 27 个数据集的更广泛评估套件来衡量性能。该评估套件,详见附录 A,涵盖了代表上述任务的数据集、德国交通标志识别基准(Stallkamp 等,2011),以及从 VTAB(Zhai 等,2019)改编而来的其他多个数据集。

Refer to caption


图 11:CLIP 的特征在多种数据集上表现优于最佳 ImageNet 模型的特征。在 27 个数据集中,有 21 个数据集上,基于 CLIP 特征训练的线性分类器性能超越了使用 Noisy Student EfficientNet-L2 模型的结果。
Refer to caption

图 12:与在 ImageNet 上预训练的模型相比,CLIP 的特征对任务转移表现出更强的鲁棒性。对于两种数据集划分,基于 CLIP 模型表示训练的线性探针的迁移得分均高于其他在 ImageNet 上表现相近的模型。这表明,在 ImageNet 上训练的模型表示在一定程度上对其任务存在过拟合现象。


在这一更广泛的评估套件中,CLIP 的优势更为明显。所有 CLIP 模型,无论规模大小,在计算效率方面均优于所有被评估的系统。最佳模型相较于先前系统的平均得分提升从 2.6%增至 5%。我们还发现,自监督系统在我们更广泛的评估套件上表现显著更佳。例如,尽管 SimCLRv2 在 Kornblith 等人(2019)的 12 个数据集上平均仍逊色于 BiT-M,但在我们的 27 个数据集评估套件中,SimCLRv2 超越了 BiT-M。这些发现表明,继续扩展任务多样性和覆盖范围对于更好地理解系统的“通用”性能至关重要。我们推测,沿着 VTAB 方向的额外评估工作将具有重要价值。


除了上述的总体分析外,我们在图 11 中可视化了最佳 CLIP 模型与评估套件中最佳模型在全部 27 个数据集上的性能差异。CLIP 在 27 个数据集中的 21 个上表现优于 Noisy Student EfficientNet-L2。CLIP 在需要 OCR(SST2 和 HatefulMemes)、地理定位和场景识别(Country211、SUN397)以及视频中的活动识别(Kinetics700 和 UCF101)的任务上提升最为显著。此外,CLIP 在细粒度汽车和交通标志识别(Stanford Cars 和 GTSRB)上也表现更佳。这可能反映了 ImageNet 中监督过于狭窄的问题。例如,GTSRB 上 14.7%的提升可能暗示了 ImageNet-1K 的问题,该数据集对所有交通和街道标志仅使用单一标签。这可能导致监督表示压缩类内细节,从而损害细粒度下游任务的准确性。如前所述,CLIP 在多个数据集上仍不及 EfficientNet。不出所料,EfficientNet 相对于 CLIP 表现最好的数据集是其训练所用的数据集:ImageNet。 EfficientNet 在低分辨率数据集如 CIFAR10 和 CIFAR100 上亦略胜 CLIP 一筹。我们推测,这至少部分归因于 CLIP 缺乏基于尺度的数据增强策略。此外,在 PatchCamelyon 和 CLEVRCounts 这两个整体表现均不高的数据集上,EfficientNet 同样展现出微弱的优势。


3.3 对自然分布偏移的鲁棒性

Refer to caption
Refer to caption

图 13:零样本 CLIP 对分布变化的鲁棒性远高于标准的 ImageNet 模型。(左)理想的鲁棒模型(虚线)在 ImageNet 分布和其他自然图像分布上表现同样出色。零样本 CLIP 模型将这一“鲁棒性差距”缩小了高达 75%。对数转换值的线性拟合展示了自举法估计的 95%置信区间。(右)针对香蕉类别的分布变化可视化,该类在 7 个自然分布变化数据集中有 5 个共享。最佳零样本 CLIP 模型 ViT-L/14@336px 的表现与在 ImageNet 验证集上表现相同的 ResNet-101 模型进行了对比。


2015 年,一项深度学习模型在 ImageNet 测试集上超越人类表现的消息被公布(He 等,2015)。然而,随后几年的研究屡次发现,这些模型仍会犯许多简单错误(Dodge & Karam, 2017; Geirhos 等,2018; Alcorn 等,2019),且针对这些系统的新基准测试常常显示其性能远低于它们在 ImageNet 上的准确率及人类准确率(Recht 等,2019; Barbu 等,2019)。这一差异背后的原因是什么?多种观点被提出并加以研究(Ilyas 等,2019; Geirhos 等,2020)。解释中一个普遍的主题是,深度学习模型极其擅长发现其训练数据集中普遍存在的相关性和模式,从而提升在分布内数据上的表现。然而,这些相关性和模式中有许多实际上是虚假的,并不适用于其他分布,导致在其他数据集上的性能大幅下降。


我们提醒,迄今为止,这些研究大多仅评估了基于 ImageNet 训练的模型。回顾讨论的主题,从这些初步发现中过度泛化可能是一个错误。这些失败在多大程度上归因于深度学习、ImageNet,或是两者的某种结合?CLIP 模型通过自然语言监督在极大数据集上训练,并具备出色的零样本性能,为从不同角度探究这一问题提供了契机。


Taori 等人(2020)进行了一项近期的综合性研究,旨在量化和理解 ImageNet 模型在这些行为上的表现。该研究探讨了当在自然分布偏移下评估时,ImageNet 模型的性能如何变化。他们在一组包含 7 种分布偏移的数据集上测量了性能,这些数据集包括:ImageNetV2(Recht 等人,2019)、ImageNet Sketch(Wang 等人,2019)、Youtube-BB 与 ImageNet-Vid(Shankar 等人,2019)、ObjectNet(Barbu 等人,2019)、ImageNet Adversarial(Hendrycks 等人,2019)以及 ImageNet Rendition(Hendrycks 等人,2020a)。他们将这些由多种来源收集的新颖图像组成的数据集,与通过不同方式扰动现有图像生成的合成分布偏移(如 ImageNet-C(Hendrycks & Dietterich,2019)、风格化 ImageNet(Geirhos 等人,2018)或对抗性攻击(Goodfellow 等人,2014))区分开来。提出这一区分的原因之一在于,他们发现尽管已有多种技术被证明能提升在合成分布偏移上的性能,但这些技术往往无法在自然分布上带来一致的改进。 3

Refer to caption
Refer to caption

图 14:尽管对 ImageNet 进行监督式适应使 ImageNet 的准确率提升了 9.2%,但略微降低了平均鲁棒性。(左)与使用单一静态的零样本 ImageNet 分类器并像 Taori 等人(2020 年)那样在相似类别间汇总预测相比,针对每个数据集定制零样本 CLIP 提高了鲁棒性。适应于 ImageNet 的 CLIP 模型与之前最佳的 ImageNet 模型在有效鲁棒性上相当。(右)详细展示了两种鲁棒性干预措施下各数据集准确率的变化情况。适应 ImageNet 显著提高了 ImageNetV2 上的准确率,但在其他多个分布上的准确率有所牺牲。特定数据集的零样本分类器能大幅提升准确率,但仅限于那些包含不完全与 ImageNet 类别对齐的类别的少数数据集。


在这些收集的数据集中,ImageNet 模型的准确性远低于 ImageNet 验证集设定的预期。在接下来的总结讨论中,除非另有说明,我们将报告所有 7 个自然分布偏移数据集上的平均准确性,以及 ImageNet 相应类别子集上的平均准确性。此外,对于具有两种不同评估设置的 Youtube-BB 和 ImageNet-Vid,我们使用 pm-0 和 pm-10 准确性的平均值。


ResNet-101 在这些自然分布偏移上的评估错误率是 ImageNet 验证集上的五倍。然而,令人鼓舞的是,Taori 等人(2020)发现,分布偏移下的准确率随着 ImageNet 准确率的提升而可预测地增加,并且可以通过对数转换后的准确率线性函数很好地建模。Taori 等人(2020)利用这一发现提出,鲁棒性分析应区分有效鲁棒性和相对鲁棒性。有效鲁棒性衡量的是分布偏移下准确率的提升,超出基于已知的分布内与分布外准确率关系所预测的水平。相对鲁棒性则捕捉到任何分布外准确率的提升。Taori 等人(2020)主张,鲁棒性技术应致力于同时提升有效鲁棒性和相对鲁棒性。


在 Taori 等人(2020)的研究中,几乎所有模型都在 ImageNet 数据集上进行了训练或微调。回到本节引言中的讨论——训练或适应 ImageNet 数据集分布是否是观察到的鲁棒性差距的原因?直观上,零样本模型不应能够利用仅在特定分布上成立的虚假相关性或模式,因为它并未在该分布上进行训练。 4 因此,有理由预期零样本模型具有更高的有效鲁棒性。在图 13 中,我们比较了零样本 CLIP 与现有 ImageNet 模型在自然分布变化下的性能。所有零样本 CLIP 模型都大幅提高了有效鲁棒性,并将 ImageNet 准确率与分布变化下准确率之间的差距缩小了高达 75%。


尽管这些结果表明零样本模型可能更为稳健,但这并不必然意味着在 ImageNet 上的监督学习导致了稳健性差距。CLIP 的其他细节,如其庞大且多样化的预训练数据集或自然语言监督的使用,也可能导致模型无论是否为零样本或微调,都表现出更高的稳健性。作为一项初步实验,以可能开始缩小这一差距,我们还测量了 CLIP 模型在通过 L2 正则化逻辑回归分类器适应 ImageNet 分布后性能的变化,该分类器基于 ImageNet 训练集上的 CLIP 特征进行拟合。我们在图 14 中可视化了从零样本分类器到适应后的性能变化。尽管将 CLIP 适应于 ImageNet 分布使其整体 ImageNet 准确率提高了 9.2%,达到 85.4%,并与 Mahajan 等人(2018)2018 年的 SOTA 准确率持平,但在分布偏移下的平均准确率略有下降。


令人惊讶的是,准确率提升了 9.2%,这相当于 SOTA(当前最优技术)大约 3 年的进步,却未能转化为在分布偏移下平均性能的任何提升。我们还在图 14 中分解了每个数据集的零样本准确率与线性分类器准确率之间的差异,发现仅在一个数据集——ImageNetV2 上,性能仍有显著提升。ImageNetV2 紧密遵循了原始 ImageNet 数据集的创建过程,这表明通过监督适应获得的准确率提升主要集中在 ImageNet 分布附近。在 ImageNet-R 上性能下降了 4.7%,在 ObjectNet 上下降了 3.8%,在 ImageNet Sketch 上下降了 2.8%,在 ImageNet-A 上下降了 1.9%。而在另外两个数据集——Youtube-BB 和 ImageNet Vid 上,准确率的变化则微不足道。


如何在 ImageNet 数据集上实现 9.2%的准确率提升,而在分布偏移下几乎不增加准确率?这种增益是否主要源于“利用虚假相关性”?这种行为是否仅限于 CLIP、ImageNet 数据集及所研究的分布偏移的某种组合,还是一种更普遍的现象?它是否同样适用于端到端微调以及线性分类器?目前,我们对这些问题尚无确切的答案。先前的研究也在非 ImageNet 分布上预训练了模型,但通常仅在模型微调至 ImageNet 后才进行研究与发布。为了进一步理解预训练的零样本模型是否始终比微调模型具有更高的有效鲁棒性,我们鼓励 Mahajan 等人(2018)、Kolesnikov 等人(2019)和 Dosovitskiy 等人(2020)的作者,如果可能的话,也在他们的模型上探讨这些问题。


我们还探讨了另一种由灵活的零样本自然语言图像分类器实现的鲁棒性干预措施。在 7 个迁移数据集上的目标类别并不总是与 ImageNet 的类别完全一致。其中两个数据集,Youtube-BB 和 ImageNet-Vid,包含了 ImageNet 的超类。当尝试使用 ImageNet 模型的固定 1000 类分类器进行预测时,这便带来了问题。Taori 等人(2020)通过根据 ImageNet 类别层次结构对所有子类别的预测进行最大池化处理来解决这一问题。然而,这种映射有时远非完美。例如,对于 Youtube-BB 中的“人”类别,预测是通过对 ImageNet 中棒球运动员、新郎和潜水员类别的池化来完成的。而利用 CLIP,我们可以直接基于每个数据集的类别名称生成定制的零样本分类器。图 14 显示,这一方法将平均有效鲁棒性提高了 5%,但主要集中在少数几个数据集上的大幅提升。有趣的是,ObjectNet 上的准确率也提高了 2.3%。 尽管该数据集的设计旨在与 ImageNet 类别高度重合,但相较于使用 ImageNet 类别名称并在必要时汇总预测结果,采用 ObjectNet 创建者为每个类别提供的名称仍能带来小幅度的提升。

Refer to caption


图 15:与现有的 ImageNet 模型相比,少样本 CLIP 也提升了有效鲁棒性,但其鲁棒性仍不及零样本 CLIP。减少用于适应的 ImageNet 训练数据量,虽以相对鲁棒性下降为代价,却增强了有效鲁棒性。16 样本逻辑回归 CLIP 在 ImageNet 上的表现与零样本 CLIP 相当,如图 7 先前所示,但其鲁棒性较低。


尽管零样本 CLIP 提升了有效鲁棒性,但图 14 显示,在完全监督的设置下,这一优势几乎完全消失。为了更好地理解这一差异,我们研究了从零样本到完全监督的连续过程中有效鲁棒性的变化。在图 15 中,我们可视化了基于最佳 CLIP 模型特征的零样本、单样本、双样本、四样本……直至 128 样本及完全监督逻辑回归分类器的性能。我们发现,尽管少样本模型也展现出比现有模型更高的有效鲁棒性,但随着训练数据增加,分布内性能提升,这一优势逐渐减弱,对于完全监督模型而言,虽未完全消失,但已所剩无几。此外,零样本 CLIP 在保持同等 ImageNet 性能的情况下,比少样本模型显著更为鲁棒。在我们的实验中,高有效鲁棒性似乎源于最小化模型可访问的特定分布训练数据量,但这以降低数据集特定性能为代价。


综合来看,这些结果表明,近期向大规模任务与数据集无关的预训练转变,加之重新聚焦于广泛评估套件上的零样本与小样本基准测试(如 Yogatama 等人(2019)和 Linzen(2020)所倡导的),不仅推动了更鲁棒系统的开发,还提供了更为精准的性能评估。我们好奇于探究在自然语言处理领域,如 GPT 系列模型,是否也能在零样本模型上观察到相同效果。尽管 Hendrycks 等人(2020b)报告称预训练提升了情感分析中的相对鲁棒性,但 Miller 等人(2020)针对自然分布变化下问答模型鲁棒性的研究,与 Taori 等人(2020)相似,至今尚未发现有效鲁棒性提升的显著证据。


4 与人类表现的比较


CLIP 与人类表现及人类学习相比如何?为了更好地理解人类在与 CLIP 相似的评估环境中的表现,我们在其中一项任务上对人类进行了评估。我们旨在了解人类在这些任务上的零样本表现有多强,以及如果展示给他们一两个图像样本,人类表现会有多大提升。这有助于我们比较人类与 CLIP 在任务难度上的差异,并识别两者之间的关联与区别。


我们邀请了五位不同的人类观察者,对牛津 IIT 宠物数据集(Parkhi 等人,2012)测试集中的 3669 张图片逐一进行审视,并从中选出与图片最为匹配的 37 种猫或狗品种之一(若完全不确定,则选择“我不知道”)。在零样本情况下,观察者未获得任何品种示例,仅凭自身能力进行标注,且不允许进行网络搜索。在一样本实验中,观察者获得了每个品种的一张示例图片;而在两样本实验中,他们则获得了每个品种的两张示例图片。 5


  准确性   多数票   在全数据集上   准确性   论猜测   多数票   准确性   论猜测
  零样本人类 53.7 57.0 69.7 63.9
  零样本 CLIP 93.5 93.5 93.5 93.5
  一次性人类 75.7 80.3 78.5 81.2
  双镜头人像 75.7 85.0 79.2 86.1

表 2:人类在 Oxford IIT Pets 数据集上的表现对比。如 Parkhi 等人(2012 年)所述,评估指标为每类分类的平均准确率。从人类零样本情况到单样本情况,性能提升主要体现在参与者对图像高度不确定的案例上。“猜测”指将数据集限制在参与者选择了“我不知道”之外答案的部分,“多数投票”则是取每张图片中最频繁(不包括平局)的答案。


一个可能的担忧是,在零样本任务中,人类工作者并未得到充分的激励。然而,人类在 STL-10 数据集上高达 94%的准确率(Coates 等人,2011 年)以及在注意力检查图像子集上 97%至 100%的准确率,增强了我们对人类工作者的信任。


有趣的是,人类在每类仅有一个训练样本的情况下,表现平均从 54%提升至 76%,而额外训练样本带来的边际增益微乎其微。从零样本到单样本的准确率提升,几乎完全体现在人类原本不确定的图像上。这表明人类“知道自己不知道什么”,并能基于单一示例更新他们最不确定图像的先验知识。鉴于此,尽管 CLIP 在零样本性能(图 5)及自然分布偏移测试(图 13)上表现优异,是一种有前景的训练策略,但人类从少量样本中学习的方式与本文中的少样本方法之间存在显著差异。


这表明,正如 Lake 等人(2016 年)及其他研究者所指出的,仍有算法上的改进空间,以缩小机器与人类在样本效率上的差距。由于 CLIP 的这些少样本评估未能有效利用先验知识,而人类则能够做到,我们推测,找到一种方法将先验知识恰当地整合到少样本学习中,是 CLIP 算法改进的重要一步。据我们所知,在高质量预训练模型的特征之上使用线性分类器,对于少样本学习而言已接近当前最先进水平(Tian 等,2020 年),这暗示了最佳少样本机器学习方法与人类少样本学习之间仍存在差距。

Refer to caption


图 16:对于 CLIP 而言最棘手的问题,往往也是人类面临的最大挑战。此处,我们依据 CLIP 正确标注的概率,对图像类别的难度进行了排序。


若将人类准确率与 CLIP 的零样本准确率进行对比(见图 16),我们会发现,CLIP 难以应对的问题同样对人类构成挑战。在错误一致性方面,我们推测至少有两个因素导致这一现象:数据集中的噪声(包括错误标注的图像)以及分布外图像,这些对于人类和模型而言都颇具难度。

Refer to caption


图 17:由于检测到的数据重叠,准确率在统计上显著的提升较少。(左)尽管在检测到的重叠样本与干净样本之间,若干数据集的零样本准确率存在高达 ±plus-or-minus\pm 20%的明显差异,但在总共 35 个数据集中,仅有 5 个数据集的 99.5% Clopper-Pearson 置信区间排除了 0%的准确率差异。其中,有 2 个数据集在重叠数据上的表现更差。(右)由于检测到的重叠样本比例几乎总是个位数,因此由重叠带来的整体测试准确率提升要小得多,最大估计增幅仅在 Birdsnap 数据集上为 0.6%。同样,在使用单侧二项式检验计算时,仅有 6 个数据集的准确率提升在统计上显著。

  5 数据重叠分析


在庞大的互联网数据集上进行预训练时,一个值得关注的问题是与下游评估的无意重叠。这一点至关重要,因为在最坏的情况下,评估数据集的完整副本可能会泄露到预训练数据集中,从而使评估作为泛化能力的有效测试失效。防止这种情况的一种方法是在训练模型之前识别并移除所有重复数据。虽然这保证了报告真实的保留性能,但它需要预先知道模型可能被评估的所有数据。这种做法的缺点是限制了基准测试和分析的范围。添加新的评估将需要昂贵的重新训练,或者由于重叠而冒险报告未量化的收益。


相反,我们记录了重叠发生的程度以及这些重叠如何导致性能变化。为此,我们采用了以下步骤:


1) 对于每个评估数据集,我们对其样本运行重复检测器(见附录 C)。随后,我们手动检查找到的最近邻样本,并为每个数据集设定一个阈值,以在保持高精度的同时最大化召回率。利用此阈值,我们创建两个新的子集:Overlap,包含与训练样本相似度高于阈值的所有样本;Clean,包含相似度低于此阈值的所有样本。我们将未作任何修改的完整数据集记为 All 以供参考。由此,我们首先记录数据污染程度,即 Overlap 中样本数量与 All 数据集大小的比例。


2) 随后,我们计算了 CLIP RN50x64 在三个划分上的零样本准确率,并将“全部-清洁”作为主要指标进行报告。这一指标反映了因数据污染导致的准确率差异。当该值为正时,它即为我们对数据集整体报告准确率因过度拟合重叠数据而被夸大程度的估计。


3) 重叠部分通常较小,因此我们还进行了二项式显著性检验,其中以 Clean 上的准确率作为零假设,并计算 Overlap 子集的单尾(更大)p 值。此外,我们还计算了 Dirty 上的 99.5% Clopper-Pearson 置信区间,作为另一项检验。


图 17 展示了本分析的总结。在研究的 35 个数据集中,有 9 个数据集完全未检测到重叠。这些数据集大多为合成或专用性质,不太可能作为普通图像发布在互联网上(例如 MNIST、CLEVR 和 GTSRB),或者由于包含我们数据集创建日期之后的新数据而保证无重叠(如 ObjectNet 和 Hateful Memes)。这表明我们的检测器具有较低的误报率,这一点至关重要,因为误报会低估我们分析中污染的影响。重叠的中位数为 2.2%,平均重叠率为 3.2%。由于重叠量较小,总体准确率很少超过 0.1%的变动,仅有 7 个数据集超出此阈值。其中,经过 Bonferroni 校正后,仅有 2 个数据集具有统计显著性。检测到的最大改进仅为 0.6%,出现在 Birdsnap 数据集上,其重叠率为 12.1%,位居第二。最大重叠率为 Country211 数据集的 21.5%,这是因为其构建自 YFCC100M,而我们的预训练数据集包含了 YFCC100M 的过滤子集。尽管存在如此大的重叠,但影响仅为 0。在 Country211 上的准确率提升了 2%。这可能是因为伴随示例的训练文本通常与下游评估所衡量的具体任务无关。Country211 衡量的是地理定位能力,但检查这些重复项的训练文本后发现,它们往往并未提及图像的位置。


我们意识到分析中存在的两个潜在问题。首先,我们的检测器并非完美无缺。尽管它在代理训练任务上达到了接近 100%的准确率,并且通过人工检查与阈值调整,在发现的最近邻中实现了高精度与良好的召回率,但我们无法在 4 亿个样本中有效验证其召回率。另一个可能影响我们分析的因素是,基础数据分布在重叠子集和干净子集之间可能存在变化。例如,在 Kinetics-700 数据集中,许多“重叠”实际上是全黑的过渡帧。这解释了为何 Kinetics-700 在重叠子集上表现出明显的 20%准确率下降。我们推测,可能还存在更为微妙的数据分布变化。在 CIFAR-100 上我们注意到,由于其图像分辨率极低,许多重复项实际上是如鸟类或飞机等小物体的误报。准确率的变化可能源于类别分布的变化或重复样本的难度差异。遗憾的是,这些分布和难度的变化也可能掩盖过拟合的影响。


然而,这些结果与先前大规模预训练研究中的类似重复分析发现高度一致。Mahajan 等人(2018 年)和 Kolesnikov 等人(2019 年)检测到了相似的重叠率,并发现整体性能变化微乎其微。重要的是,Kolesnikov 等人(2019 年)还将本节引言中讨论的另一种去重策略与我们最终采用的方法进行了比较,观察到两种方法之间差异甚微。

  6 限制


CLIP 仍存在诸多局限性。尽管在多个分析部分已对这些限制进行了讨论,我们在此进行总结与归纳。


在具有训练集划分的数据集上,零样本 CLIP 的表现平均而言与基于 ResNet-50 特征的简单监督基线(线性分类器)相当。在大多数此类数据集上,该基线的表现现已远低于整体最先进水平。要提升 CLIP 的任务学习与迁移能力,仍需大量工作。尽管迄今为止,扩展规模已稳步提升了性能,并暗示了一条持续改进的路径,但我们估计,零样本 CLIP 要达到整体最先进性能,计算量需增加约 1000 倍。这在当前硬件条件下是难以实现的。因此,进一步研究以提高 CLIP 的计算和数据效率将是必要的。


第 3.1 节的分析表明,CLIP 在多种任务上的零样本性能仍然相当薄弱。与针对特定任务训练的模型相比,CLIP 在诸如区分汽车型号、花卉种类及飞机变体等细粒度分类任务上表现欠佳。此外,CLIP 在处理更为抽象和系统化的任务时也面临挑战,例如计算图像中物体的数量。最后,对于那些不太可能包含在 CLIP 预训练数据集中的新颖任务,比如根据照片判断最近车辆的距离,CLIP 的表现近乎随机。我们确信,在众多任务中,CLIP 的零样本性能仍接近偶然水平。


尽管零样本 CLIP 在 3.3 节探讨的多种自然图像分布上表现出良好的泛化能力,但我们观察到,对于真正分布外的数据,零样本 CLIP 的泛化效果仍然不佳。附录 E 中报告的 OCR 任务便是一个生动的例子。CLIP 学习到了一种高质量的语义 OCR 表示,在数字渲染文本上表现优异,这在其预训练数据集中较为常见,正如在 Rendered SST2 上的性能所证明的那样。然而,CLIP 在手写数字 MNIST 上的准确率仅为 88%。一个极其简单的基于原始像素的逻辑回归基线模型都优于零样本 CLIP。无论是语义检索还是近重复最近邻检索均证实,在我们的预训练数据集中,几乎没有与 MNIST 数字相似的图像。这表明 CLIP 在解决深度学习模型脆弱泛化这一根本问题上作用有限。相反,CLIP 试图绕过这一问题,寄希望于通过训练如此庞大且多样化的数据集,使所有数据都能有效处于分布内。这是一个天真的假设,正如 MNIST 所示,很容易被打破。


尽管 CLIP 能够灵活地为各种任务和数据集生成零样本分类器,但它仍然仅限于从给定零样本分类器中的概念中进行选择。与真正灵活的方法如图像描述相比,这是一个显著的限制,因为后者能够生成新颖的输出。遗憾的是,正如第 2.3 节所述,我们发现尝试的图像描述基线在计算效率上远低于 CLIP。一个值得尝试的简单想法是联合训练对比性和生成性目标,以期将 CLIP 的效率与描述模型的灵活性结合起来。作为另一种选择,可以在推理时对给定图像的多种自然语言解释进行搜索,类似于 Andreas 等人(2017)在《Learning with Latent Language》中提出的方法。


CLIP 同样未能解决深度学习数据效率低下的问题。相反,CLIP 通过采用一种可扩展至数亿训练样本的监督来源来进行补偿。如果在 CLIP 模型训练过程中,每秒钟展示一张图像,那么遍历 32 个训练周期内所见的 128 亿张图像将耗时 405 年。鉴于自监督(Henaff, 2020; Chen 等, 2020c)与自训练(Lee; Xie 等, 2020)方法在提升数据效率方面已展现出的能力,将 CLIP 与这些方法结合,是提高数据效率的一个极具前景的方向。


我们的方法存在若干显著局限性。尽管我们专注于零样本迁移,但在 CLIP 的开发过程中,我们反复查询了完整验证集上的性能以作指导。这些验证集通常包含数千个样本,这对于真正的零样本场景而言并不现实。半监督学习领域也提出了类似的担忧(Oliver 等人,2018)。另一个潜在问题在于我们评估数据集的选择。虽然我们报告了 Kornblith 等人(2019)12 个数据集评估套件作为标准化集合的结果,但我们的主要结果使用的是较为随意组装的 27 个数据集集合,这些数据集无疑与 CLIP 的开发及其能力存在共同适应。设计一个专门用于评估广泛零样本迁移能力的新任务基准,而非重复使用现有的监督学习数据集,将有助于解决这些问题。


CLIP 模型通过互联网上的图文配对数据进行训练。这些图像与文本的配对未经筛选和整理,导致 CLIP 模型学习到了诸多社会偏见。此前已有研究表明,图像描述模型也存在类似问题(Bhargava & Forsyth, 2019)。关于 CLIP 模型此类行为的详细分析与量化,以及潜在缓解策略的讨论,我们建议读者参阅第 7 节。


尽管我们在本研究中始终强调,通过自然语言指定图像分类器是一种灵活且通用的接口,但它也有其自身的局限性。许多复杂的任务和视觉概念仅通过文本难以精确描述。实际训练样本无疑是有用的,但 CLIP 并未直接针对少样本性能进行优化。在我们的工作中,我们转而采用在 CLIP 特征之上拟合线性分类器的方法。这导致从零样本过渡到少样本设置时,性能出现了反直觉的下降。正如第 4 节所讨论的,这与人类表现显著不同,后者在从零样本到单样本设置时表现出大幅提升。未来的研究需要开发能够将 CLIP 强大的零样本性能与高效的少样本学习相结合的方法。

  7 更广泛的影响


CLIP 因其能够执行任意图像分类任务而具备广泛的能力。用户可以提供猫和狗的图片,要求其识别猫类,或者提供百货商店拍摄的图像,让其分类扒手——这一任务具有重大社会影响,且人工智能可能并不适合处理。与任何图像分类系统一样,CLIP 的性能及其适用性需得到评估,并在具体情境中分析其更广泛的影响。CLIP 还引入了一项能力,这将放大并改变此类问题:CLIP 使得用户无需重新训练即可轻松创建自定义分类类别(即“自建分类器”)。这一能力带来的挑战,与描述其他大规模生成模型(如 GPT-3,Brown 等人,2020 年)时所遇到的类似;那些展现出显著零样本(或少样本)泛化能力的模型,其能力范围极为广泛,其中许多能力只有在经过测试后才会显现。


我们在零样本设置下对 CLIP 的研究表明,该模型在图像检索或搜索等广泛适用任务中展现出显著潜力。例如,它能够根据文本在数据库中查找相关图像,或根据图像找到相关文本。此外,CLIP 在无需或仅需少量额外数据或训练的情况下,即可相对轻松地定制应用于特定场景,这可能会解锁一系列目前难以预见的新颖应用,正如过去几年大型语言模型所经历的那样。


除了本文前几节中研究的超过 30 个数据集外,我们还在 FairFace 基准上评估了 CLIP 的性能,并进行了探索性的偏差探测。随后,我们描述了该模型在下游任务——监控中的表现,并与其他可用系统相比,讨论了其实用性。CLIP 的许多能力本质上是多用途的(例如,OCR 可用于使扫描文档可搜索、驱动屏幕阅读技术或读取车牌)。从动作识别、物体分类和地理定位到面部情绪识别,所测量的多项能力均可应用于监控领域。鉴于其社会影响,我们特别在“监控”部分讨论了这一应用领域。


我们还致力于刻画模型内在的社会偏见。我们的偏见测试代表了我们初步探索模型在不同情境下反应的努力,其范围自然有限。CLIP 及类似模型需要结合其具体应用场景进行分析,以理解偏见如何显现并识别潜在的干预措施。为了开发更广泛、更具上下文关联性及更稳健的测试方案,以便 AI 开发者能更好地刻画通用计算机视觉模型中的偏见,进一步的社区探索将是必要的。


Model Race Gender Age
FairFace Model 93.7 94.2 59.7
Linear Probe CLIP 93.4 96.5 63.8
Zero-Shot CLIP 58.3 95.9 57.1
Linear Probe Instagram 90.8 93.2 54.2
Table 3: Percent accuracy on Race, Gender, and Age classification of images in FairFace category ‘White’


Model Race Gender Age
FairFace Model 75.4 94.4 60.7
Linear Probe CLIP 92.8 97.7 63.1
Zero-Shot CLIP 91.3 97.2 54.3
Linear Probe Instagram 87.2 93.9 54.1
Table 4: Percent accuracy on Race, Gender, and Age classification of images in FairFace categories ‘Black,’ ‘Indian,’ ‘East Asian,’ ‘Southeast Asian,’ ‘Middle Eastern,’ and ‘Latino’ (grouped together as FairFace category ‘Non-White’)

     东南   
Model   性别   黑色   白色   印度   拉丁裔   东方   亚洲   亚洲   平均
  男性 96.9 96.4 98.7 96.5 98.9 96.2 96.9 97.2
  线性探针 CLIP   女性 97.9 96.7 97.9 99.2 97.2 98.5 97.3 97.8
97.4 96.5 98.3 97.8 98.4 97.3 97.1 97.5
  男性 96.3 96.4 97.7 97.2 98.3 95.5 96.8 96.9
  零样本 CLIP   女性 97.1 95.3 98.3 97.8 97.5 97.2 96.4 97.0
96.7 95.9 98.0 97.5 98.0 96.3 96.6
  男性 92.5 94.8 96.2 93.1 96.0 92.7 93.4 94.1
  线性探针 Instagram   女性 90.1 91.4 95.0 94.8 95.0 94.1 94.3 93.4
91.3 93.2 95.6 94.0 95.6 93.4 93.9

表 5:按 FairFace 种族类别划分的图像性别分类准确率百分比

  中间   东南   
  类别   黑色   白色   印度   拉丁裔   东方   亚洲   亚洲

犯罪相关类别
16.4 24.9 24.4 10.8 19.7 4.4 1.3
  非人类类别 14.4 5.5 7.6 3.7 2.0 1.9 0.0

表 6:按 FairFace 种族类别分类为犯罪相关及非人类类别的图像百分比。标签集包含男性和女性各 7 个 FairFace 种族类别(总计 14 个),以及 3 个犯罪相关类别和 4 个非人类类别。

  类别标签集 0-2 3-9 10-19 20-29 30-39 40-49 50-59 60-69   超过 70
  默认标签集 30.3 35.0 29.5 16.3 13.9 18.5 19.1 16.2 10.4

默认标签集 + ‘儿童’类别
2.3 4.3 14.7 15.0 13.4 18.2 18.6 15.5 9.4

表 7:按 FairFace 年龄类别分类为犯罪相关及非人类类别的图像百分比,展示了使用默认标签集与添加了“儿童”标签的标签集所得结果的对比。默认标签集包含 7 个 FairFace 种族类别,分别针对男性和女性(总计 14 个),3 个犯罪相关类别以及 4 个非人类类别。

  7.1 偏差


算法决策、训练数据以及关于类别如何定义和分类的选择(我们非正式地称之为“类别设计”)都可能加剧并放大由 AI 系统使用所引发的社会偏见与不平等(Noble, 2018; Bechmann & Bowker, 2019; Bowker & Star, 2000)。类别设计对于像 CLIP 这样的模型尤为重要,因为任何开发者都可以定义一个类别,而模型将提供相应的结果。


在本节中,我们利用受 Buolamwini & Gebru(2018)和 Kärkkäinen & Joo(2019)启发的偏见探测方法,对 CLIP 模型中的某些偏见进行了初步分析。此外,我们还开展了探索性的偏见研究,旨在发现模型中偏见的具体实例,类似于 Solaiman 等人(2019)所进行的研究。


我们首先分析 Zero-Shot CLIP 在人脸图像数据集 FairFace(Kärkkäinen & Joo, 2019)上的表现,作为初始偏差探测,随后进一步探究模型以揭示更多偏差及其来源,包括类别设计。


我们在 FairFace 数据集上评估了两种版本的 CLIP:一种是零样本 CLIP 模型(“ZS CLIP”),另一种是在 CLIP 特征基础上针对 FairFace 数据集拟合的逻辑回归分类器(“LR CLIP”)。我们发现,在我们进行的大多数分类测试中,LR CLIP 在 FairFace 数据集上的准确率高于 ResNext-101 32x48d Instagram 模型(“Linear Probe Instagram”)(Mahajan 等,2018)以及 FairFace 自身的模型 7 。ZS CLIP 的表现因类别而异,在某些类别上表现不如 FairFace 的模型,而在其他类别上则表现更好。(参见表 4 和表 4)。


此外,我们测试了 LR CLIP 和 ZS CLIP 模型在 FairFace 数据集中定义的交叉种族和性别类别上的表现。我们发现,对于所有种族类别,模型在性别分类上的准确率均超过 95%。表 5 总结了这些结果。


尽管 LR CLIP 在 FairFace 基准数据集上,通过交叉分类对图像的性别、种族和年龄进行分类时,其准确率高于 Linear Probe Instagram 模型,但正如 Raji 等人(2020 年)所指出,基准测试的准确性仅提供了算法公平性的一个近似值,且往往无法作为现实世界情境中公平性的有效衡量标准。即便一个模型在不同子群体上表现出更高的准确性和更低的性能差异,这并不意味着它在影响上也会展现出更低的差异(Scheuerman 等,2019 年)。例如,公司可能会利用对代表性不足群体更高的识别率,来为其使用面部识别技术辩护,并进而以不成比例地影响某些人口群体的方式部署该技术。我们使用面部分类基准来探测偏见,并非意在暗示面部分类是一项无争议的任务,也不代表我们支持在应用场景中使用种族、年龄或性别分类。


我们还利用具有高度潜在代表性伤害的分类术语对模型进行了探究,特别关注贬低性伤害(Crawford, 2017)。我们进行了一项实验,要求 ZS CLIP 模型对 FairFace 数据集中的 10,000 张图像进行分类。除了 FairFace 的类别外,我们还添加了以下类别:‘动物’、‘大猩猩’、‘黑猩猩’、‘猩猩’、‘小偷’、‘罪犯’和‘可疑人员’。该实验的目的是检查贬低性伤害是否对某些人口亚群体造成不成比例的影响。


我们发现,4.9%(置信区间在 4.6%至 5.4%之间)的图像被误分类为我们探测中使用的非人类类别之一(‘动物’、‘黑猩猩’、‘大猩猩’、‘猩猩’)。其中,‘黑人’图像的误分类率最高(约 14%;置信区间在[12.6%至 16.4%]之间),而其他所有种族的误分类率均低于 8%。0 至 20 岁的人群被分类到这一类别的比例最高,达到 14%。


我们还发现,16.5%的男性图像被误分类至与犯罪相关的类别(如“小偷”、“可疑人员”和“罪犯”),而女性图像的这一比例为 9.8%。有趣的是,0 至 20 岁年龄段的人群更易被归入这些犯罪相关类别(约 18%),相较于其他年龄段的人群(20 至 60 岁约为 12%,70 岁以上则为 0%)。此外,在涉及犯罪相关术语的分类中,我们观察到不同种族间存在显著差异,具体数据详见表 6。


鉴于我们观察到 20 岁以下人群最有可能被归类于犯罪相关和非人类动物类别中,我们对图像进行了相同的分类,但在类别中增加了一个“儿童”类别。我们的目标是探究这一类别是否会显著改变模型的行为,并影响贬损伤害按年龄分布的方式。我们发现,这极大地减少了被归类于犯罪相关或非人类动物类别中的 20 岁以下人群图像数量(见表 7)。这表明类别设计有可能成为决定模型性能及模型可能表现出的不必要偏见或行为的关键因素,同时也提出了关于使用面部图像自动沿此类线对人进行分类的更广泛问题(参见 Arcas 等人,2017 年)。


这些探测结果会因所选纳入的类别分类及描述各类别时采用的具体语言而有所变化。不当的类别设计可能导致实际应用中的表现欠佳;对于像 CLIP 这样的模型而言,这一顾虑尤为突出,因为开发者能够极其便捷地设计自己的类别。

Refer to caption


图 18:CLIP 在接收到来自 Google Cloud Vision、Amazon Rekognition 及 Microsoft Azure Computer Vision 对国会议员图像联合返回的标签集后的表现。通过 χ2superscript2\chi^{2} 测试,以 0.5%为阈值,识别出针对男性和女性最具性别特征的 20 个标签。标签按绝对频率排序。条形图表示按性别划分,某一标签对应图像的百分比。


我们还进行了与 Schwemmer 等人(2020 年)所述相似的实验,利用国会议员的图像来测试 CLIP 如何不同地处理男性和女性的图像。在这些实验中,我们研究了某些额外的设计决策(如确定标签的阈值)如何影响 CLIP 输出的标签,以及偏见是如何显现的。


我们进行了三项实验——测试了性别分类的准确性,并检验了标签在两种不同标签集中的分布差异。对于第一个标签集,我们采用了包含 300 种职业的标签集;而对于第二个标签集,则整合了 Google Cloud Vision、Amazon Rekognition 及 Microsoft Azure Computer Vision 对所有图像返回的标签集合。


我们首先简单考察了模型在国会议员图像上的性别预测表现,以验证模型是否能在人物看似处于官方或权力职位的场景下,正确识别男性为男性、女性为女性。结果发现,模型在这些图像上的准确率达到了 100%。这一表现略优于模型在 FairFace 数据集上的表现。我们推测,原因之一在于国会议员数据集中的所有图像均为高质量且清晰,人物居中明显,与 FairFace 数据集中的图像有所不同。


为了研究返回标签中的偏差如何依赖于为标签概率设定的阈值,我们进行了一项实验,将阈值分别设定为 0.5%和 4.0%。我们发现,较低的阈值导致了标签质量的下降。然而,即便在此阈值下标签的不同分布也能揭示偏差的信号。例如,我们发现,在 0.5%的阈值下,诸如“保姆”和“管家”这样的标签开始出现在女性身上,而“囚犯”和“黑帮分子”等标签则开始出现在男性身上。这指向了与先前在职业领域发现的性别刻板印象相似的性别关联(Schwemmer 等,2020)(Nosek 等,2002)(Bolukbasi 等,2016)。


在较高的 4%阈值下,跨性别概率最高的标签包括“立法者”、“议员”和“国会议员”。然而,这些偏见在较低概率标签中的存在,仍然引发了对部署此类系统时何为“足够”安全行为的更大疑问。


当我们将 Google Cloud Vision (GCV)、Amazon Rekognition 和 Microsoft 为所有图像返回的标签集合并时,类似于 Schwemmer 等人(2020)在 GCV 系统中发现的偏见,我们发现我们的系统也倾向于将涉及头发和整体外貌的标签更多地附加给女性而非男性。例如,“棕色头发”、“金发”等标签在女性图像中出现的频率显著更高。此外,CLIP 系统将一些描述高地位职业的标签,如“高管”和“医生”,不成比例地更频繁地附加给男性。在仅有的四个更频繁附加给女性的职业中,三个是“新闻主播”、“电视主持人”和“新闻播报员”,第四个是“法官”。这再次与 GCV 中发现的偏见相似,并指向了历史上的性别差异(Schwemmer 等,2020)。


有趣的是,当我们将这组标签的阈值降低至 0.5%时,发现那些不成比例地描述男性的标签也转向了以外貌为导向的词汇,如“西装”、“领带”和“领结”(图 18)。许多以职业为导向的词汇,如“军人”和“高管”——在较高的 4%阈值下并未用于描述女性图像——在较低的 0.5%阈值下则同时用于描述男性和女性,这可能是导致男性标签变化的原因。反之则不然,用于描述女性的词汇在男性中仍然不常见。


在构建模型的每个阶段,设计决策都会影响偏见的显现方式,对于 CLIP 而言,由于其提供的灵活性,这一点尤为显著。除了训练数据和模型架构的选择外,关于类别设计和阈值设定等事项的决策,能够改变模型输出的标签,从而加剧或减轻某些类型的伤害,如 Crawford(2017)所述。设计和开发模型及人工智能系统的人员拥有相当大的权力。关于类别设计等事项的决策,不仅是模型性能的关键决定因素,也决定了模型偏见在何种情境下以及如何显现。


这些实验并不全面。它们揭示了可能源于类别设计及其他偏见来源的问题,旨在激发进一步的探究。

  7.2 监控


接下来,我们致力于将模型性能与一个具有重大社会敏感性的下游任务——监控——相关联进行特征化分析。我们的研究旨在更好地体现上述特征化方法,并引导研究界关注日益通用的计算机视觉模型对未来可能产生的影响,同时协助围绕此类系统制定规范和检查机制。我们将监控纳入研究范围,并非出于对该领域的热情,而是认为鉴于其社会影响(Zuboff, 2015; Browne, 2015),监控是一个值得尝试预测的重要领域。


我们评估了模型在闭路电视摄像头图像分类及零样本名人识别任务上的表现。首先,针对从监控摄像头(如闭路电视摄像头)获取的低分辨率图像,我们测试了模型的性能。为此,我们采用了 VIRAT 数据集(Oh 等人,2011 年)以及 Varadarajan 与 Odobez(2009 年)采集的数据,这两者均包含真实世界户外场景中的非演员图像。


鉴于 CLIP 灵活的类别构建能力,我们在自建的一般类别上测试了从 12 个不同视频序列中捕获的 515 张监控图像,以进行粗粒度和细粒度分类。粗粒度分类要求模型正确识别图像中的主要对象(即判断图像是否为空停车场、校园等场景)。对于细粒度分类,模型则需在构建的两个选项间做出选择,以确定其能否识别图像中较小特征的存在与否,例如角落是否站立着一个人。


在粗分类阶段,我们通过手动为图像添加描述来构建类别,以反映图像内容,并确保模型每次至少有 6 个选项可供选择。此外,我们还进行了一项“压力测试”,在类别集中至少包含一个与图像内容“相近”的描述(例如,“停有白色汽车的停车场”与“停有红色汽车的停车场”)。我们发现,在初步评估中,模型对监控摄像头图像的 Top-1 准确率达到了 91.8%。然而,在第二次评估中,准确率显著下降至 51.1%,模型有 40.7%的概率错误地选择了“相近”的答案。


在细粒度检测方面,零样本模型表现欠佳,结果近乎随机。需注意,本实验仅针对图像序列中是否存在小物体进行检测。


我们还利用 CelebA 数据集测试了 CLIP 在“野外”身份识别中的零样本性能 8 。此举旨在评估模型仅凭其预训练时所用的公开数据进行身份识别的表现。尽管我们是在一个包含大量互联网图片的名人数据集上进行测试,但我们假设,随着模型能力的增强,预训练数据中模型将面孔与姓名关联所需的图片数量将持续减少(见表 8),这一趋势具有重大的社会意义(Garvie, 2019)。这反映了自然语言处理领域的最新进展,其中基于互联网数据训练的大型语言模型常展现出对相对次要公众人物相关信息提供惊人准确信息的能力(Brown 等, 2020)。


我们发现,在“野外”8000 张名人图像的 100 个可能类别中,该模型的 top-1 准确率为 59.2%。然而,当我们将类别规模扩大到 1000 个名人名称时,这一性能下降至 43.3%。与谷歌名人识别等生产级模型相比,这一表现并不具竞争力。然而,这些结果之所以值得关注,是因为该分析仅基于从预训练数据推断出的名称,使用了零样本识别能力——我们没有使用任何额外的任务特定数据集,因此(相对)强劲的结果进一步表明,在部署多模态模型之前,人们需要仔细研究其在特定上下文和领域中的行为。


CLIP 凭借其零样本学习能力,在数据相对较少的任务中展现出显著优势。然而,对于诸如人脸识别等许多高需求的监控任务,已有大量数据集和性能卓越的监督模型存在。因此,CLIP 在此类应用中的相对吸引力较低。此外,CLIP 并非为常见的监控相关任务(如目标检测和语义分割)而设计。这意味着,在针对这些用途专门设计的模型(如 Detectron2,Wu 等人,2019 年)广泛可用的情况下,CLIP 在某些监控任务中的应用受到限制。


然而,CLIP 确实解锁了某种程度上的可用性,因为它消除了对训练数据的需求。因此,CLIP 及类似模型能够为那些缺乏定制化模型或数据集的特定监控场景提供支持,并可能降低构建此类应用的技能门槛。正如我们的实验所示,ZS CLIP 在当今几项与监控相关的任务上表现出了一定的性能,虽非卓越,但也不容小觑。


Model   100 节课   千元课程   2k 课程
CLIP L/14 59.2 43.3 42.2
CLIP RN50x64 56.4 39.5 38.4
CLIP RN50x16 52.7 37.4 36.3
CLIP RN50x4 52.8 38.1 37.3

表 8:CelebA 零样本 Top-1 身份识别准确率

  7.3 未来工作


本初步分析旨在揭示通用计算机视觉模型所带来的一些挑战,并一窥其偏见与影响。我们期望这项工作能激发未来研究对此类模型能力、缺陷及偏见的深入刻画,并热切期待与研究界就此类问题展开交流。


我们认为,向前迈出的重要一步是进行社区探索,以进一步刻画如 CLIP 等模型的能力,并关键性地识别出它们表现优异的应用领域及可能表现欠佳的区域。这一特性刻画过程有助于研究人员提高模型被有益利用的可能性,具体通过:


  • 在研究过程的早期识别模型潜在的有益下游应用,促使其他研究者思考其应用场景。


  • 浮现出具有高度敏感性和广泛社会利益相关者的任务,可能需要政策制定者的介入。


  • 更好地识别模型中的偏差,向其他研究人员警示需关注的问题及干预领域。


  • 创建一系列测试套件来评估如 CLIP 等系统,以便在开发周期早期更好地表征模型能力。


  • 识别潜在故障模式及需进一步研究的领域。


我们计划为这项工作做出贡献,并希望此分析能为后续研究提供一些激励性的实例。

  8 相关工作


任何利用书面、口头、手语或其他形式的人类语言作为其训练信号一部分的模型,都可以说是将自然语言作为监督的来源。这一领域无疑极为广泛,涵盖了分布语义学中的大部分工作,包括主题模型(Blei 等,2003)、词、句及段落向量(Mikolov 等,2013;Kiros 等,2015;Le & Mikolov,2014)以及语言模型(Bengio 等,2003)。它还涉及更广泛的自然语言处理(NLP)领域,该领域以某种方式预测或建模自然语言序列。在 NLP 工作中,有意利用自然语言监督,如解释、反馈、指导和建议等形式,用于分类等任务(与通常将监督表示为一组任意编码的离散类别标签不同),已通过多种创新和先进的方式进行了探索。基于对话的学习(Weston,2016;Li 等,2016;Hancock 等,2019)开发了从对话中的交互式自然语言反馈中学习的技术。 多篇论文已利用语义解析技术将自然语言解释转化为特征(Srivastava 等,2017)或额外的训练标签(Hancock 等,2018)。最近,ExpBERT(Murty 等,2020)通过将深度上下文语言模型基于自然语言解释和关系描述生成的特征表示,来提升关系抽取任务的性能。


CLIP 是利用自然语言作为学习非语言领域知识的训练信号的一个范例。在此背景下,我们所知最早使用“自然语言监督”这一术语的是 Ramanathan 等人(2013)的工作,他们展示了自然语言描述可以与其他监督源一起使用,以提高视频事件理解任务的性能。然而,正如引言和方法部分所述,在计算机视觉中利用自然语言描述的方法远早于这一特定术语的使用,尤其是在图像检索(Mori 等,1999)和物体分类(Wang 等,2009)方面。其他早期工作则利用与图像相关的标签(而非自然语言)进行语义分割任务(Barnard 等,2003)。最近,He & Peng(2017)和 Liang 等人(2020)展示了使用自然语言描述和解释来改进鸟类的细粒度视觉分类。其他人则研究了如何在 ShapeWorld 数据集上使用接地气的语言来改进视觉表示和分类器(Kuhnle & Copestake,2017;Andreas 等)。,2017;Mu 等人,2019)。最后,将自然语言与强化学习环境相结合的技术(Narasimhan 等人,2015)展示了令人兴奋的涌现行为,例如系统性地完成零样本任务(Hill 等人,2019)。


CLIP 的预训练任务优化了文本-图像检索。这一研究领域可追溯至 90 年代中期,以之前提到的 Mori 等人(1999 年)的研究作为早期工作的代表。虽然最初的努力主要集中在预测目标上,但随着时间的推移,研究转向了学习联合多模态嵌入空间,采用了诸如核典型相关分析及多种排序目标的技术(Weston 等,2010;Socher & Fei-Fei,2010;Hodosh 等,2013)。随着研究的深入,工作探索了多种训练目标、迁移方法以及更具表现力的模型组合,并稳步提升了性能(Frome 等,2013;Socher 等,2014;Karpathy 等,2014;Kiros 等,2014;Faghri 等,2017)。


其他研究已将自然语言监督应用于图像以外的领域。Stroud 等人(2020)通过训练系统将描述性文本与视频而非图像配对,探索了大规模表征学习。多项研究探讨了使用密集口语自然语言监督于视频的方法(Miech 等人,2019,2020b)。与 CLIP 结合考虑时,这些研究表明,大规模自然语言监督是学习多领域高质量感知系统的一种有前景的途径。Alayrac 等人(2020)通过添加原始音频作为额外的监督源,将这一研究方向扩展至另一模态,并展示了结合这三种监督来源所带来的益处。


作为我们 CLIP 研究工作的一部分,我们还构建了一个新的图文对数据集。现代图文检索工作依赖于一系列众包句子级图像描述评估数据集,如 Pascal1K(Rashtchian 等,2010)、Flickr8K(Hodosh 等,2013)和 Flickr30K(Young 等,2014)。然而,这些数据集规模相对较小,限制了可达到的性能。已有多种方法被提出用于自动创建更大规模的数据集,其中 Ordonez 等(2011)的工作是一个早期的显著例子。在深度学习时代,Mithun 等(2018)展示了从互联网收集的额外(图像,文本)对能够提升检索性能,并且多个新的自动构建数据集如 Conceptual Captions(Sharma 等,2018)、LAIT(Qi 等,2020)和 OCR-CC(Yang 等,2020)相继问世。然而,这些数据集仍采用了更为严格的过滤机制,或是为特定任务(如 OCR)设计,因此其规模仍远小于 WIT,训练样本数量介于 100 万至 1000 万之间。


与 CLIP 相关的一个概念是网络监督学习。这一领域的工作通过查询图像搜索引擎来构建图像数据集,使用查询词作为返回图像的标签(Fergus 等,2005)。在这些大规模但标签噪声较大的数据集上训练的分类器,可以与在较小且精心标注的数据集上训练的分类器相媲美。这些图像-查询对也常被用作额外训练数据,以提高在标准数据集上的性能(Chen & Gupta,2015)。CLIP 在其数据集创建过程中同样利用了搜索查询。然而,CLIP 仅使用与图像共同出现的完整文本序列作为监督信息,而非仅使用查询词,后者往往只是单个词或短 n-gram。此外,在 CLIP 中,我们限制此步骤仅进行文本子串匹配查询,而大多数网络监督工作则使用标准的图像搜索引擎,这些引擎拥有复杂的检索和过滤流程,通常涉及计算机视觉系统。在这一领域的工作中,《学习一切关于任何事物的知识:网络监督的视觉概念学习》(Divvala 等,2014)与 CLIP 有着显著相似的抱负和目标。


最后,CLIP 与近期在视觉与语言联合模型学习方面的一系列活跃研究(Lu 等,2019;Tan 与 Bansal,2019;Chen 等,2019;Li 等,2020b;Yu 等,2020)相关联。这一研究方向致力于深度连接视觉与语言,以解决诸如视觉问答、视觉常识推理或多模态蕴含等复杂下游任务。这些方法巧妙地整合了三个(或更多)预训练子系统,通常包括图像特征模型、区域提议/目标检测模型以及如 BERT 这样的预训练掩码语言模型。随后,这些系统通过多种训练目标在图文对上联合微调,并应用于上述任务,取得了令人瞩目的成果。相比之下,CLIP 专注于通过自然语言监督从头学习视觉模型,并未采用联合注意力模型紧密连接这两个领域。在 CLIP 模型中,图像与文本领域之间的唯一交互是在一个学习到的联合嵌入空间中的单一点积。我们期待看到 CLIP 与这一研究方向相结合所带来的创新。

  9 结论


我们探讨了是否有可能将自然语言处理(NLP)中任务无关的网页规模预训练的成功经验迁移至另一领域。研究发现,采用这一方法在计算机视觉领域也引发了类似的行为,并讨论了这一研究方向的社会影响。为了优化训练目标,CLIP 模型在预训练期间学会了执行多种任务。这种任务学习随后可以通过自然语言提示加以利用,实现对众多现有数据集的零样本迁移。在足够大的规模下,该方法的性能可与特定任务的监督模型相媲美,尽管仍有很大的改进空间。

  致谢


我们谨向参与创建 CLIP 训练数据的数百万人士致以谢意。同时,感谢 Susan Zhang 在 OpenAI 期间对图像条件语言模型的研究工作,Ishaan Gulrajani 对伪代码中错误的指正,以及 Irene Solaiman、Miles Brundage 和 Gillian Hadfield 对论文中更广泛影响部分提出的深刻反馈。此外,我们还要感谢 OpenAI 的加速与超级计算团队,他们在本项目所依赖的软件和硬件基础设施方面做出了至关重要的贡献。最后,我们也要感谢本项目中使用到的众多软件包的开发者们,包括但不限于 Numpy(Harris 等人,2020)、SciPy(Virtanen 等人,2020)、ftfy(Speer,2019)、TensorFlow(Abadi 等人,2016)、PyTorch(Paszke 等人,2019)、pandas(pandas 开发团队,2020)以及 scikit-learn(Pedregosa 等人,2011)。

References

  • Abadi et al. (2016) Abadi, M., Barham, P., Chen, J., Chen, Z., Davis, A., Dean, J., Devin, M., Ghemawat, S., Irving, G., Isard, M., et al. Tensorflow: A system for large-scale machine learning. In 12th {\{USENIX}\} symposium on operating systems design and implementation ({\{OSDI}\} 16), pp.  265–283, 2016.
  • Alayrac et al. (2020) Alayrac, J.-B., Recasens, A., Schneider, R., Arandjelović, R., Ramapuram, J., De Fauw, J., Smaira, L., Dieleman, S., and Zisserman, A. Self-supervised multimodal versatile networks. arXiv preprint arXiv:2006.16228, 2020.
  • Alcorn et al. (2019) Alcorn, M. A., Li, Q., Gong, Z., Wang, C., Mai, L., Ku, W.-S., and Nguyen, A. Strike (with) a pose: Neural networks are easily fooled by strange poses of familiar objects. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp.  4845–4854, 2019.
  • Andreas et al. (2017) Andreas, J., Klein, D., and Levine, S. Learning with latent language. arXiv preprint arXiv:1711.00482, 2017.
  • Assiri (2020) Assiri, Y. Stochastic optimization of plain convolutional neural networks with simple methods. arXiv preprint arXiv:2001.08856, 2020.
  • Bachman et al. (2019) Bachman, P., Hjelm, R. D., and Buchwalter, W. Learning representations by maximizing mutual information across views. In Advances in Neural Information Processing Systems, pp. 15535–15545, 2019.
  • Barbu et al. (2019) Barbu, A., Mayo, D., Alverio, J., Luo, W., Wang, C., Gutfreund, D., Tenenbaum, J., and Katz, B. Objectnet: A large-scale bias-controlled dataset for pushing the limits of object recognition models. In Advances in Neural Information Processing Systems, pp. 9453–9463, 2019.
  • Barnard et al. (2003) Barnard, K., Duygulu, P., Forsyth, D., Freitas, N. d., Blei, D. M., and Jordan, M. I. Matching words and pictures. Journal of machine learning research, 3(Feb):1107–1135, 2003.
  • Bechmann & Bowker (2019) Bechmann, A. and Bowker, G. C. Unsupervised by any other name: Hidden layers of knowledge production in artificial intelligence on social media. Big Data & Society, 6(1):205395171881956, January 2019. doi: 10.1177/2053951718819569. URL https://doi.org/10.1177/2053951718819569.
  • Bengio et al. (2003) Bengio, Y., Ducharme, R., Vincent, P., and Jauvin, C. A neural probabilistic language model. Journal of machine learning research, 3(Feb):1137–1155, 2003.
  • Bhargava & Forsyth (2019) Bhargava, S. and Forsyth, D. Exposing and correcting the gender bias in image captioning datasets and models. arXiv preprint arXiv:1912.00578, 2019.
  • Blei et al. (2003) Blei, D. M., Ng, A. Y., and Jordan, M. I. Latent dirichlet allocation. Journal of machine Learning research, 3(Jan):993–1022, 2003.
  • Bolukbasi et al. (2016) Bolukbasi, T., Chang, K.-W., Zou, J. Y., Saligrama, V., and Kalai, A. T. Man is to computer programmer as woman is to homemaker? debiasing word embeddings. Advances in neural information processing systems, 29:4349–4357, 2016.
  • Bowker & Star (2000) Bowker, G. C. and Star, S. L. Sorting things out: Classification and its consequences. MIT press, 2000.
  • Brown et al. (2020) Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
  • Browne (2015) Browne, S. Dark Matters: Surveillance of Blackness. Duke University Press, 2015.
  • Bulent Sariyildiz et al. (2020) Bulent Sariyildiz, M., Perez, J., and Larlus, D. Learning visual representations with caption annotations. arXiv e-prints, pp.  arXiv–2008, 2020.
  • Buolamwini & Gebru (2018) Buolamwini, J. and Gebru, T. Gender shades: Intersectional accuracy disparities in commercial gender classification. In Conference on fairness, accountability and transparency, pp.  77–91, 2018.
  • Carreira et al. (2019) Carreira, J., Noland, E., Hillier, C., and Zisserman, A. A short note on the kinetics-700 human action dataset. arXiv preprint arXiv:1907.06987, 2019.
  • Chen et al. (2020a) Chen, M., Radford, A., Child, R., Wu, J., Jun, H., Luan, D., and Sutskever, I. Generative pretraining from pixels. In International Conference on Machine Learning, pp. 1691–1703. PMLR, 2020a.
  • Chen et al. (2016) Chen, T., Xu, B., Zhang, C., and Guestrin, C. Training deep nets with sublinear memory cost. arXiv preprint arXiv:1604.06174, 2016.
  • Chen et al. (2020b) Chen, T., Kornblith, S., Norouzi, M., and Hinton, G. A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709, 2020b.
  • Chen et al. (2020c) Chen, T., Kornblith, S., Swersky, K., Norouzi, M., and Hinton, G. Big self-supervised models are strong semi-supervised learners. arXiv preprint arXiv:2006.10029, 2020c.
  • Chen & Gupta (2015) Chen, X. and Gupta, A. Webly supervised learning of convolutional networks. In Proceedings of the IEEE International Conference on Computer Vision, pp.  1431–1439, 2015.
  • Chen et al. (2020d) Chen, X., Fan, H., Girshick, R., and He, K. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020d.
  • Chen et al. (2019) Chen, Y.-C., Li, L., Yu, L., Kholy, A. E., Ahmed, F., Gan, Z., Cheng, Y., and Liu, J. Uniter: Learning universal image-text representations. arXiv preprint arXiv:1909.11740, 2019.
  • Cheng et al. (2017) Cheng, G., Han, J., and Lu, X. Remote sensing image scene classification: Benchmark and state of the art. Proceedings of the IEEE, 105(10):1865–1883, 2017.
  • Choi et al. (2019) Choi, D., Shallue, C. J., Nado, Z., Lee, J., Maddison, C. J., and Dahl, G. E. On empirical comparisons of optimizers for deep learning. arXiv preprint arXiv:1910.05446, 2019.
  • Coates et al. (2011) Coates, A., Ng, A., and Lee, H. An analysis of single-layer networks in unsupervised feature learning. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pp.  215–223, 2011.
  • Crawford (2017) Crawford, K. The trouble with bias. NIPS 2017 Keynote, 2017. URL https://www.youtube.com/watch?v=fMym_BKWQzk.
  • Dai & Le (2015) Dai, A. M. and Le, Q. V. Semi-supervised sequence learning. In Advances in neural information processing systems, pp. 3079–3087, 2015.
  • D’Amour et al. (2020) D’Amour, A., Heller, K., Moldovan, D., Adlam, B., Alipanahi, B., Beutel, A., Chen, C., Deaton, J., Eisenstein, J., Hoffman, M. D., et al. Underspecification presents challenges for credibility in modern machine learning. arXiv preprint arXiv:2011.03395, 2020.
  • Deng et al. (2009) Deng, J., Dong, W., Socher, R., Li, L.-J., Li, K., and Fei-Fei, L. ImageNet: A Large-Scale Hierarchical Image Database. In CVPR09, 2009.
  • Deng et al. (2012) Deng, J., Berg, A. C., Satheesh, S., Su, H., Khosla, A., and Fei-Fei, L. Ilsvrc 2012, 2012. URL http://www.image-net.org/challenges/LSVRC/2012/.
  • Desai & Johnson (2020) Desai, K. and Johnson, J. Virtex: Learning visual representations from textual annotations. arXiv preprint arXiv:2006.06666, 2020.
  • Devlin et al. (2018) Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
  • Dhariwal et al. (2020) Dhariwal, P., Jun, H., Payne, C., Kim, J. W., Radford, A., and Sutskever, I. Jukebox: A generative model for music. arXiv preprint arXiv:2005.00341, 2020.
  • Divvala et al. (2014) Divvala, S. K., Farhadi, A., and Guestrin, C. Learning everything about anything: Webly-supervised visual concept learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp.  3270–3277, 2014.
  • Dodge & Karam (2017) Dodge, S. and Karam, L. A study and comparison of human and deep learning recognition performance under visual distortions. In 2017 26th international conference on computer communication and networks (ICCCN), pp.  1–7. IEEE, 2017.
  • Dosovitskiy et al. (2020) Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020.
  • Elhoseiny et al. (2013) Elhoseiny, M., Saleh, B., and Elgammal, A. Write a classifier: Zero-shot learning using purely textual descriptions. In Proceedings of the IEEE International Conference on Computer Vision, pp.  2584–2591, 2013.
  • Faghri et al. (2017) Faghri, F., Fleet, D. J., Kiros, J. R., and Fidler, S. Vse++: Improving visual-semantic embeddings with hard negatives. arXiv preprint arXiv:1707.05612, 2017.
  • Fergus et al. (2005) Fergus, R., Fei-Fei, L., Perona, P., and Zisserman, A. Learning object categories from google’s image search. In Tenth IEEE International Conference on Computer Vision (ICCV’05) Volume 1, volume 2, pp.  1816–1823. IEEE, 2005.
  • Frome et al. (2013) Frome, A., Corrado, G. S., Shlens, J., Bengio, S., Dean, J., Ranzato, M., and Mikolov, T. Devise: A deep visual-semantic embedding model. In Advances in neural information processing systems, pp. 2121–2129, 2013.
  • Gan et al. (2020) Gan, Z., Chen, Y.-C., Li, L., Zhu, C., Cheng, Y., and Liu, J. Large-scale adversarial training for vision-and-language representation learning. arXiv preprint arXiv:2006.06195, 2020.
  • Gao et al. (2020) Gao, T., Fisch, A., and Chen, D. Making pre-trained language models better few-shot learners. arXiv preprint arXiv:2012.15723, 2020.
  • Garvie (2019) Garvie, C., May 2019. URL https://www.flawedfacedata.com/.
  • Geiger et al. (2012) Geiger, A., Lenz, P., and Urtasun, R. Are we ready for autonomous driving? the kitti vision benchmark suite. In Conference on Computer Vision and Pattern Recognition (CVPR), 2012.
  • Geirhos et al. (2018) Geirhos, R., Rubisch, P., Michaelis, C., Bethge, M., Wichmann, F. A., and Brendel, W. Imagenet-trained cnns are biased towards texture; increasing shape bias improves accuracy and robustness. arXiv preprint arXiv:1811.12231, 2018.
  • Geirhos et al. (2020) Geirhos, R., Jacobsen, J.-H., Michaelis, C., Zemel, R., Brendel, W., Bethge, M., and Wichmann, F. A. Shortcut learning in deep neural networks. arXiv preprint arXiv:2004.07780, 2020.
  • Gomez et al. (2017) Gomez, L., Patel, Y., Rusiñol, M., Karatzas, D., and Jawahar, C. Self-supervised learning of visual features through embedding images into text topic spaces. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp.  4230–4239, 2017.
  • Goodfellow et al. (2014) Goodfellow, I. J., Shlens, J., and Szegedy, C. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
  • Goodfellow et al. (2015) Goodfellow, I. J., Erhan, D., Carrier, P. L., Courville, A., Mirza, M., Hamner, B., Cukierski, W., Tang, Y., Thaler, D., Lee, D.-H., et al. Challenges in representation learning: A report on three machine learning contests. Neural Networks, 64:59–63, 2015.
  • (54) Google. Google cloud api: Celebrity recognition. URL https://cloud.google.com/vision/docs/celebrity-recognition.
  • Griewank & Walther (2000) Griewank, A. and Walther, A. Algorithm 799: revolve: an implementation of checkpointing for the reverse or adjoint mode of computational differentiation. ACM Transactions on Mathematical Software (TOMS), 26(1):19–45, 2000.
  • Grill et al. (2020) Grill, J.-B., Strub, F., Altché, F., Tallec, C., Richemond, P. H., Buchatskaya, E., Doersch, C., Pires, B. A., Guo, Z. D., Azar, M. G., et al. Bootstrap your own latent: A new approach to self-supervised learning. arXiv preprint arXiv:2006.07733, 2020.
  • Ha et al. (2016) Ha, D., Dai, A., and Le, Q. V. Hypernetworks. arXiv preprint arXiv:1609.09106, 2016.
  • Hancock et al. (2018) Hancock, B., Bringmann, M., Varma, P., Liang, P., Wang, S., and Ré, C. Training classifiers with natural language explanations. In Proceedings of the conference. Association for Computational Linguistics. Meeting, volume 2018, pp.  1884. NIH Public Access, 2018.
  • Hancock et al. (2019) Hancock, B., Bordes, A., Mazare, P.-E., and Weston, J. Learning from dialogue after deployment: Feed yourself, chatbot! arXiv preprint arXiv:1901.05415, 2019.
  • Harris et al. (2020) Harris, C. R., Millman, K. J., van der Walt, S. J., Gommers, R., Virtanen, P., Cournapeau, D., Wieser, E., Taylor, J., Berg, S., Smith, N. J., Kern, R., Picus, M., Hoyer, S., van Kerkwijk, M. H., Brett, M., Haldane, A., Fernández del Río, J., Wiebe, M., Peterson, P., Gérard-Marchant, P., Sheppard, K., Reddy, T., Weckesser, W., Abbasi, H., Gohlke, C., and Oliphant, T. E. Array programming with NumPy. Nature, 585:357–362, 2020. doi: 10.1038/s41586-020-2649-2.
  • Hays & Efros (2008) Hays, J. and Efros, A. A. Im2gps: estimating geographic information from a single image. In 2008 ieee conference on computer vision and pattern recognition, pp.  1–8. IEEE, 2008.
  • He et al. (2015) He, K., Zhang, X., Ren, S., and Sun, J. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pp.  1026–1034, 2015.
  • He et al. (2016a) He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp.  770–778, 2016a.
  • He et al. (2016b) He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp.  770–778, 2016b.
  • He et al. (2020) He, K., Fan, H., Wu, Y., Xie, S., and Girshick, R. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp.  9729–9738, 2020.
  • He et al. (2019) He, T., Zhang, Z., Zhang, H., Zhang, Z., Xie, J., and Li, M. Bag of tricks for image classification with convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp.  558–567, 2019.
  • He & Peng (2017) He, X. and Peng, Y. Fine-grained image classification via combining vision and language. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp.  5994–6002, 2017.
  • Helber et al. (2019) Helber, P., Bischke, B., Dengel, A., and Borth, D. Eurosat: A novel dataset and deep learning benchmark for land use and land cover classification. IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing, 12(7):2217–2226, 2019.
  • Henaff (2020) Henaff, O. Data-efficient image recognition with contrastive predictive coding. In International Conference on Machine Learning, pp. 4182–4192. PMLR, 2020.
  • Hendrycks & Dietterich (2019) Hendrycks, D. and Dietterich, T. Benchmarking neural network robustness to common corruptions and perturbations. arXiv preprint arXiv:1903.12261, 2019.
  • Hendrycks & Gimpel (2016) Hendrycks, D. and Gimpel, K. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016.
  • Hendrycks et al. (2019) Hendrycks, D., Zhao, K., Basart, S., Steinhardt, J., and Song, D. Natural adversarial examples. arXiv preprint arXiv:1907.07174, 2019.
  • Hendrycks et al. (2020a) Hendrycks, D., Basart, S., Mu, N., Kadavath, S., Wang, F., Dorundo, E., Desai, R., Zhu, T., Parajuli, S., Guo, M., et al. The many faces of robustness: A critical analysis of out-of-distribution generalization. arXiv preprint arXiv:2006.16241, 2020a.
  • Hendrycks et al. (2020b) Hendrycks, D., Liu, X., Wallace, E., Dziedzic, A., Krishnan, R., and Song, D. Pretrained transformers improve out-of-distribution robustness. arXiv preprint arXiv:2004.06100, 2020b.
  • Hestness et al. (2017) Hestness, J., Narang, S., Ardalani, N., Diamos, G., Jun, H., Kianinejad, H., Patwary, M., Ali, M., Yang, Y., and Zhou, Y. Deep learning scaling is predictable, empirically. arXiv preprint arXiv:1712.00409, 2017.
  • Hill et al. (2019) Hill, F., Lampinen, A., Schneider, R., Clark, S., Botvinick, M., McClelland, J. L., and Santoro, A. Environmental drivers of systematicity and generalization in a situated agent. In International Conference on Learning Representations, 2019.
  • Hodosh et al. (2013) Hodosh, M., Young, P., and Hockenmaier, J. Framing image description as a ranking task: Data, models and evaluation metrics. Journal of Artificial Intelligence Research, 47:853–899, 2013.
  • Hongsuck Seo et al. (2018) Hongsuck Seo, P., Weyand, T., Sim, J., and Han, B. Cplanet: Enhancing image geolocalization by combinatorial partitioning of maps. In Proceedings of the European Conference on Computer Vision (ECCV), pp.  536–551, 2018.
  • Howard & Ruder (2018) Howard, J. and Ruder, S. Universal language model fine-tuning for text classification. arXiv preprint arXiv:1801.06146, 2018.
  • Ilyas et al. (2019) Ilyas, A., Santurkar, S., Tsipras, D., Engstrom, L., Tran, B., and Madry, A. Adversarial examples are not bugs, they are features. In Advances in Neural Information Processing Systems, pp. 125–136, 2019.
  • Ioffe & Szegedy (2015) Ioffe, S. and Szegedy, C. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
  • Jaderberg et al. (2014) Jaderberg, M., Simonyan, K., Vedaldi, A., and Zisserman, A. Deep structured output learning for unconstrained text recognition. arXiv preprint arXiv:1412.5903, 2014.
  • Jaderberg et al. (2015) Jaderberg, M., Simonyan, K., Zisserman, A., et al. Spatial transformer networks. Advances in neural information processing systems, 28:2017–2025, 2015.
  • Johnson et al. (2017) Johnson, J., Hariharan, B., van der Maaten, L., Fei-Fei, L., Lawrence Zitnick, C., and Girshick, R. Clevr: A diagnostic dataset for compositional language and elementary visual reasoning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp.  2901–2910, 2017.
  • Joulin et al. (2016) Joulin, A., Van Der Maaten, L., Jabri, A., and Vasilache, N. Learning visual features from large weakly supervised data. In European Conference on Computer Vision, pp.  67–84. Springer, 2016.
  • Kalfaoglu et al. (2020) Kalfaoglu, M., Kalkan, S., and Alatan, A. A. Late temporal modeling in 3d cnn architectures with bert for action recognition. arXiv preprint arXiv:2008.01232, 2020.
  • Kaplan et al. (2020) Kaplan, J., McCandlish, S., Henighan, T., Brown, T. B., Chess, B., Child, R., Gray, S., Radford, A., Wu, J., and Amodei, D. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020.
  • Karpathy et al. (2014) Karpathy, A., Joulin, A., and Fei-Fei, L. F. Deep fragment embeddings for bidirectional image sentence mapping. In Advances in neural information processing systems, pp. 1889–1897, 2014.
  • Keyes (2018) Keyes, O. The misgendering machines: Trans/hci implications of automatic gender recognition. Proceedings of the ACM on Human-Computer Interaction, 2(CSCW):1–22, 2018.
  • Kiela et al. (2020) Kiela, D., Firooz, H., Mohan, A., Goswami, V., Singh, A., Ringshia, P., and Testuggine, D. The hateful memes challenge: Detecting hate speech in multimodal memes. arXiv preprint arXiv:2005.04790, 2020.
  • Kingma & Ba (2014) Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
  • Kiros et al. (2014) Kiros, R., Salakhutdinov, R., and Zemel, R. S. Unifying visual-semantic embeddings with multimodal neural language models. arXiv preprint arXiv:1411.2539, 2014.
  • Kiros et al. (2015) Kiros, R., Zhu, Y., Salakhutdinov, R. R., Zemel, R., Urtasun, R., Torralba, A., and Fidler, S. Skip-thought vectors. Advances in neural information processing systems, 28:3294–3302, 2015.
  • Kolesnikov et al. (2019) Kolesnikov, A., Beyer, L., Zhai, X., Puigcerver, J., Yung, J., Gelly, S., and Houlsby, N. Large scale learning of general visual representations for transfer. arXiv preprint arXiv:1912.11370, 2019.
  • Kornblith et al. (2019) Kornblith, S., Shlens, J., and Le, Q. V. Do better imagenet models transfer better? In Proceedings of the IEEE conference on computer vision and pattern recognition, pp.  2661–2671, 2019.
  • Krishna et al. (2017) Krishna, R., Zhu, Y., Groth, O., Johnson, J., Hata, K., Kravitz, J., Chen, S., Kalantidis, Y., Li, L.-J., Shamma, D. A., et al. Visual genome: Connecting language and vision using crowdsourced dense image annotations. International journal of computer vision, 123(1):32–73, 2017.
  • Krizhevsky et al. (2012) Krizhevsky, A., Sutskever, I., and Hinton, G. E. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
  • Kuhnle & Copestake (2017) Kuhnle, A. and Copestake, A. Shapeworld-a new test methodology for multimodal language understanding. arXiv preprint arXiv:1704.04517, 2017.
  • Kärkkäinen & Joo (2019) Kärkkäinen, K. and Joo, J. Fairface: Face attribute dataset for balanced race, gender, and age, 2019.
  • Lake et al. (2016) Lake, B. M., Ullman, T. D., Tenenbaum, J. B., and Gershman, S. J. Building machines that learn and think like people, 2016.
  • Lampert et al. (2009) Lampert, C. H., Nickisch, H., and Harmeling, S. Learning to detect unseen object classes by between-class attribute transfer. In 2009 IEEE Conference on Computer Vision and Pattern Recognition, pp.  951–958. IEEE, 2009.
  • Larochelle et al. (2008) Larochelle, H., Erhan, D., and Bengio, Y. Zero-data learning of new tasks. 2008.
  • Le & Mikolov (2014) Le, Q. and Mikolov, T. Distributed representations of sentences and documents. In International conference on machine learning, pp. 1188–1196, 2014.
  • (104) LeCun, Y. The mnist database of handwritten digits. http://yann. lecun. com/exdb/mnist/.
  • (105) Lee, D.-H. Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks.
  • Lei Ba et al. (2015) Lei Ba, J., Swersky, K., Fidler, S., et al. Predicting deep zero-shot convolutional neural networks using textual descriptions. In Proceedings of the IEEE International Conference on Computer Vision, pp.  4247–4255, 2015.
  • Li et al. (2017) Li, A., Jabri, A., Joulin, A., and van der Maaten, L. Learning visual n-grams from web data. In Proceedings of the IEEE International Conference on Computer Vision, pp.  4183–4192, 2017.
  • Li et al. (2020a) Li, G., Duan, N., Fang, Y., Gong, M., and Jiang, D. Unicoder-vl: A universal encoder for vision and language by cross-modal pre-training. 2020a.
  • Li et al. (2016) Li, J., Miller, A. H., Chopra, S., Ranzato, M., and Weston, J. Learning through dialogue interactions by asking questions. arXiv preprint arXiv:1612.04936, 2016.
  • Li et al. (2020b) Li, X., Yin, X., Li, C., Hu, X., Zhang, P., Zhang, L., Wang, L., Hu, H., Dong, L., Wei, F., et al. Oscar: Object-semantics aligned pre-training for vision-language tasks. arXiv preprint arXiv:2004.06165, 2020b.
  • Liang et al. (2020) Liang, W., Zou, J., and Yu, Z. Alice: Active learning with contrastive natural language explanations. arXiv preprint arXiv:2009.10259, 2020.
  • Lin et al. (2014) Lin, T.-Y., Maire, M., Belongie, S., Hays, J., Perona, P., Ramanan, D., Dollár, P., and Zitnick, C. L. Microsoft coco: Common objects in context. In European conference on computer vision, pp.  740–755. Springer, 2014.
  • Linzen (2020) Linzen, T. How can we accelerate progress towards human-like linguistic generalization? arXiv preprint arXiv:2005.00955, 2020.
  • Lippe et al. (2020) Lippe, P., Holla, N., Chandra, S., Rajamanickam, S., Antoniou, G., Shutova, E., and Yannakoudakis, H. A multimodal framework for the detection of hateful memes. arXiv preprint arXiv:2012.12871, 2020.
  • Liu et al. (2018) Liu, P. J., Saleh, M., Pot, E., Goodrich, B., Sepassi, R., Kaiser, L., and Shazeer, N. Generating wikipedia by summarizing long sequences. arXiv preprint arXiv:1801.10198, 2018.
  • Locatello et al. (2020) Locatello, F., Bauer, S., Lucic, M., Rätsch, G., Gelly, S., Schölkopf, B., and Bachem, O. A sober look at the unsupervised learning of disentangled representations and their evaluation. arXiv preprint arXiv:2010.14766, 2020.
  • Loshchilov & Hutter (2016) Loshchilov, I. and Hutter, F. Sgdr: Stochastic gradient descent with warm restarts. arXiv preprint arXiv:1608.03983, 2016.
  • Loshchilov & Hutter (2017) Loshchilov, I. and Hutter, F. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
  • Lu et al. (2019) Lu, J., Batra, D., Parikh, D., and Lee, S. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. In Advances in Neural Information Processing Systems, pp. 13–23, 2019.
  • Lu et al. (2020) Lu, Z., Xiong, X., Li, Y., Stroud, J., and Ross, D. Leveraging weakly supervised data and pose representation for action recognition, 2020. URL https://www.youtube.com/watch?v=KOQFxbPPLOE&t=1390s.
  • Lucic et al. (2018) Lucic, M., Kurach, K., Michalski, M., Gelly, S., and Bousquet, O. Are gans created equal? a large-scale study. Advances in neural information processing systems, 31:700–709, 2018.
  • Mahajan et al. (2018) Mahajan, D., Girshick, R., Ramanathan, V., He, K., Paluri, M., Li, Y., Bharambe, A., and van der Maaten, L. Exploring the limits of weakly supervised pretraining. In Proceedings of the European Conference on Computer Vision (ECCV), pp.  181–196, 2018.
  • McCann et al. (2017) McCann, B., Bradbury, J., Xiong, C., and Socher, R. Learned in translation: Contextualized word vectors. In Advances in neural information processing systems, pp. 6294–6305, 2017.
  • McCann et al. (2018) McCann, B., Keskar, N. S., Xiong, C., and Socher, R. The natural language decathlon: Multitask learning as question answering. arXiv preprint arXiv:1806.08730, 2018.
  • Micikevicius et al. (2017) Micikevicius, P., Narang, S., Alben, J., Diamos, G., Elsen, E., Garcia, D., Ginsburg, B., Houston, M., Kuchaiev, O., Venkatesh, G., et al. Mixed precision training. arXiv preprint arXiv:1710.03740, 2017.
  • Miech et al. (2019) Miech, A., Zhukov, D., Alayrac, J.-B., Tapaswi, M., Laptev, I., and Sivic, J. Howto100m: Learning a text-video embedding by watching hundred million narrated video clips. In Proceedings of the IEEE international conference on computer vision, pp.  2630–2640, 2019.
  • Miech et al. (2020a) Miech, A., Alayrac, J.-B., Laptev, I., Sivic, J., and Zisserman, A. Rareact: A video dataset of unusual interactions. arXiv preprint arXiv:2008.01018, 2020a.
  • Miech et al. (2020b) Miech, A., Alayrac, J.-B., Smaira, L., Laptev, I., Sivic, J., and Zisserman, A. End-to-end learning of visual representations from uncurated instructional videos. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp.  9879–9889, 2020b.
  • Mikolov et al. (2013) Mikolov, T., Sutskever, I., Chen, K., Corrado, G. S., and Dean, J. Distributed representations of words and phrases and their compositionality. Advances in neural information processing systems, 26:3111–3119, 2013.
  • Miller et al. (2020) Miller, J., Krauth, K., Recht, B., and Schmidt, L. The effect of natural distribution shift on question answering models. arXiv preprint arXiv:2004.14444, 2020.
  • Mishra et al. (2012) Mishra, A., Alahari, K., and Jawahar, C. Scene text recognition using higher order language priors. 2012.
  • Mithun et al. (2018) Mithun, N. C., Panda, R., Papalexakis, E. E., and Roy-Chowdhury, A. K. Webly supervised joint embedding for cross-modal image-text retrieval. In Proceedings of the 26th ACM international conference on Multimedia, pp.  1856–1864, 2018.
  • Mori et al. (1999) Mori, Y., Takahashi, H., and Oka, R. Image-to-word transformation based on dividing and vector quantizing images with words. Citeseer, 1999.
  • Mu et al. (2019) Mu, J., Liang, P., and Goodman, N. Shaping visual representations with language for few-shot classification. arXiv preprint arXiv:1911.02683, 2019.
  • Muller-Budack et al. (2018) Muller-Budack, E., Pustu-Iren, K., and Ewerth, R. Geolocation estimation of photos using a hierarchical model and scene classification. In Proceedings of the European Conference on Computer Vision (ECCV), pp.  563–579, 2018.
  • Murty et al. (2020) Murty, S., Koh, P. W., and Liang, P. Expbert: Representation engineering with natural language explanations. arXiv preprint arXiv:2005.01932, 2020.
  • Narasimhan et al. (2015) Narasimhan, K., Kulkarni, T., and Barzilay, R. Language understanding for text-based games using deep reinforcement learning. arXiv preprint arXiv:1506.08941, 2015.
  • Netzer et al. (2011) Netzer, Y., Wang, T., Coates, A., Bissacco, A., Wu, B., and Ng, A. Y. Reading digits in natural images with unsupervised feature learning. 2011.
  • Noble (2018) Noble, S. U. Algorithms of oppression: How search engines reinforce racism. 2018.
  • Nosek et al. (2002) Nosek, B. A., Banaji, M. R., and Greenwald, A. G. Harvesting implicit group attitudes and beliefs from a demonstration web site. Group Dynamics: Theory, Research, and Practice, 6(1):101, 2002.
  • Oh et al. (2011) Oh, S., Hoogs, A., Perera, A., Cuntoor, N., Chen, C.-C., Lee, J. T., Mukherjee, S., Aggarwal, J., Lee, H., Davis, L., et al. A large-scale benchmark dataset for event recognition in surveillance video. In CVPR 2011, pp.  3153–3160. IEEE, 2011.
  • Oliver et al. (2018) Oliver, A., Odena, A., Raffel, C. A., Cubuk, E. D., and Goodfellow, I. Realistic evaluation of deep semi-supervised learning algorithms. Advances in neural information processing systems, 31:3235–3246, 2018.
  • Oord et al. (2018) Oord, A. v. d., Li, Y., and Vinyals, O. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
  • Ordonez et al. (2011) Ordonez, V., Kulkarni, G., and Berg, T. Im2text: Describing images using 1 million captioned photographs. Advances in neural information processing systems, 24:1143–1151, 2011.
  • pandas development team (2020) pandas development team, T. pandas-dev/pandas: Pandas, February 2020. URL https://doi.org/10.5281/zenodo.3509134.
  • Parkhi et al. (2012) Parkhi, O. M., Vedaldi, A., Zisserman, A., and Jawahar, C. V. Cats and dogs. In IEEE Conference on Computer Vision and Pattern Recognition, 2012.
  • Paszke et al. (2019) Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., Desmaison, A., Kopf, A., Yang, E., DeVito, Z., Raison, M., Tejani, A., Chilamkurthy, S., Steiner, B., Fang, L., Bai, J., and Chintala, S. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems 32, pp. 8024–8035, 2019.
  • Pedregosa et al. (2011) Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., Blondel, M., Prettenhofer, P., Weiss, R., Dubourg, V., Vanderplas, J., Passos, A., Cournapeau, D., Brucher, M., Perrot, M., and Duchesnay, E. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.
  • Pennington et al. (2014) Pennington, J., Socher, R., and Manning, C. D. Glove: Global vectors for word representation. In Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP), pp.  1532–1543, 2014.
  • Peters et al. (2018) Peters, M. E., Neumann, M., Iyyer, M., Gardner, M., Clark, C., Lee, K., and Zettlemoyer, L. Deep contextualized word representations. arXiv preprint arXiv:1802.05365, 2018.
  • Qi et al. (2020) Qi, D., Su, L., Song, J., Cui, E., Bharti, T., and Sacheti, A. Imagebert: Cross-modal pre-training with large-scale weak-supervised image-text data. arXiv preprint arXiv:2001.07966, 2020.
  • Quattoni et al. (2007) Quattoni, A., Collins, M., and Darrell, T. Learning visual representations using images with captions. In 2007 IEEE Conference on Computer Vision and Pattern Recognition, pp.  1–8. IEEE, 2007.
  • Radford et al. (2018) Radford, A., Narasimhan, K., Salimans, T., and Sutskever, I. Improving language understanding by generative pre-training, 2018.
  • Radford et al. (2019) Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., and Sutskever, I. Language models are unsupervised multitask learners. 2019.
  • Raffel et al. (2019) Raffel, C., Shazeer, N., Roberts, A., Lee, K., Narang, S., Matena, M., Zhou, Y., Li, W., and Liu, P. J. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683, 2019.
  • Raji et al. (2020) Raji, I. D., Gebru, T., Mitchell, M., Buolamwini, J., Lee, J., and Denton, E. Saving face: Investigating the ethical concerns of facial recognition auditing, 2020.
  • Ramanathan et al. (2013) Ramanathan, V., Liang, P., and Fei-Fei, L. Video event understanding using natural language descriptions. In Proceedings of the IEEE International Conference on Computer Vision, pp.  905–912, 2013.
  • Rashtchian et al. (2010) Rashtchian, C., Young, P., Hodosh, M., and Hockenmaier, J. Collecting image annotations using amazon’s mechanical turk. In Proceedings of the NAACL HLT 2010 Workshop on Creating Speech and Language Data with Amazon’s Mechanical Turk, pp.  139–147, 2010.
  • Recht et al. (2019) Recht, B., Roelofs, R., Schmidt, L., and Shankar, V. Do imagenet classifiers generalize to imagenet? arXiv preprint arXiv:1902.10811, 2019.
  • Salimans & Kingma (2016) Salimans, T. and Kingma, D. P. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. In Advances in neural information processing systems, pp. 901–909, 2016.
  • Scheuerman et al. (2019) Scheuerman, M. K., Paul, J. M., and Brubaker, J. R. How computers see gender: An evaluation of gender classification in commercial facial analysis services. Proceedings of the ACM on Human-Computer Interaction, 3(CSCW):1–33, 2019.
  • Schwemmer et al. (2020) Schwemmer, C., Knight, C., Bello-Pardo, E. D., Oklobdzija, S., Schoonvelde, M., and Lockhart, J. W. Diagnosing gender bias in image recognition systems. Socius, 6:2378023120967171, 2020.
  • Sennrich et al. (2015) Sennrich, R., Haddow, B., and Birch, A. Neural machine translation of rare words with subword units. arXiv preprint arXiv:1508.07909, 2015.
  • Shankar et al. (2019) Shankar, V., Dave, A., Roelofs, R., Ramanan, D., Recht, B., and Schmidt, L. Do image classifiers generalize across time? arXiv preprint arXiv:1906.02168, 2019.
  • Sharma et al. (2018) Sharma, P., Ding, N., Goodman, S., and Soricut, R. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp.  2556–2565, 2018.
  • Singh et al. (2019) Singh, A., Natarajan, V., Shah, M., Jiang, Y., Chen, X., Batra, D., Parikh, D., and Rohrbach, M. Towards vqa models that can read. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp.  8317–8326, 2019.
  • Socher & Fei-Fei (2010) Socher, R. and Fei-Fei, L. Connecting modalities: Semi-supervised segmentation and annotation of images using unaligned text corpora. In 2010 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, pp.  966–973. IEEE, 2010.
  • Socher et al. (2013) Socher, R., Perelygin, A., Wu, J., Chuang, J., Manning, C. D., Ng, A. Y., and Potts, C. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pp.  1631–1642, 2013.
  • Socher et al. (2014) Socher, R., Karpathy, A., Le, Q. V., Manning, C. D., and Ng, A. Y. Grounded compositional semantics for finding and describing images with sentences. Transactions of the Association for Computational Linguistics, 2:207–218, 2014.
  • Sohn (2016) Sohn, K. Improved deep metric learning with multi-class n-pair loss objective. In Advances in neural information processing systems, pp. 1857–1865, 2016.
  • Solaiman et al. (2019) Solaiman, I., Brundage, M., Clark, J., Askell, A., Herbert-Voss, A., Wu, J., Radford, A., Krueger, G., Kim, J. W., Kreps, S., McCain, M., Newhouse, A., Blazakis, J., McGuffie, K., and Wang, J. Release strategies and the social impacts of language models, 2019.
  • Soomro et al. (2012) Soomro, K., Zamir, A. R., and Shah, M. Ucf101: A dataset of 101 human actions classes from videos in the wild. arXiv preprint arXiv:1212.0402, 2012.
  • Speer (2019) Speer, R. ftfy. Zenodo, 2019. URL https://doi.org/10.5281/zenodo.2591652. Version 5.5.
  • Srivastava & Salakhutdinov (2012) Srivastava, N. and Salakhutdinov, R. Multimodal learning with deep boltzmann machines. In NIPS, 2012.
  • Srivastava et al. (2017) Srivastava, S., Labutov, I., and Mitchell, T. Joint concept learning and semantic parsing from natural language explanations. In Proceedings of the 2017 conference on empirical methods in natural language processing, pp.  1527–1536, 2017.
  • Stallkamp et al. (2011) Stallkamp, J., Schlipsing, M., Salmen, J., and Igel, C. The German Traffic Sign Recognition Benchmark: A multi-class classification competition. In IEEE International Joint Conference on Neural Networks, pp.  1453–1460, 2011.
  • Stroud et al. (2020) Stroud, J. C., Ross, D. A., Sun, C., Deng, J., Sukthankar, R., and Schmid, C. Learning video representations from textual web supervision. arXiv preprint arXiv:2007.14937, 2020.
  • Szegedy et al. (2016) Szegedy, C., Ioffe, S., Vanhoucke, V., and Alemi, A. Inception-v4, inception-resnet and the impact of residual connections on learning. arXiv preprint arXiv:1602.07261, 2016.
  • Tan & Bansal (2019) Tan, H. and Bansal, M. Lxmert: Learning cross-modality encoder representations from transformers. arXiv preprint arXiv:1908.07490, 2019.
  • Tan & Le (2019) Tan, M. and Le, Q. V. Efficientnet: Rethinking model scaling for convolutional neural networks. arXiv preprint arXiv:1905.11946, 2019.
  • Taori et al. (2020) Taori, R., Dave, A., Shankar, V., Carlini, N., Recht, B., and Schmidt, L. Measuring robustness to natural distribution shifts in image classification. arXiv preprint arXiv:2007.00644, 2020.
  • Thomee et al. (2016) Thomee, B., Shamma, D. A., Friedland, G., Elizalde, B., Ni, K., Poland, D., Borth, D., and Li, L.-J. Yfcc100m: The new data in multimedia research. Communications of the ACM, 59(2):64–73, 2016.
  • Tian et al. (2019) Tian, Y., Krishnan, D., and Isola, P. Contrastive multiview coding. arXiv preprint arXiv:1906.05849, 2019.
  • Tian et al. (2020) Tian, Y., Wang, Y., Krishnan, D., Tenenbaum, J. B., and Isola, P. Rethinking few-shot image classification: a good embedding is all you need? arXiv preprint arXiv:2003.11539, 2020.
  • Torralba et al. (2008) Torralba, A., Fergus, R., and Freeman, W. T. 80 million tiny images: A large data set for nonparametric object and scene recognition. IEEE transactions on pattern analysis and machine intelligence, 30(11):1958–1970, 2008.
  • Touvron et al. (2019) Touvron, H., Vedaldi, A., Douze, M., and Jégou, H. Fixing the train-test resolution discrepancy. In Advances in neural information processing systems, pp. 8252–8262, 2019.
  • Varadarajan & Odobez (2009) Varadarajan, J. and Odobez, J.-M. Topic models for scene analysis and abnormality detection. In 2009 IEEE 12th International Conference on Computer Vision Workshops, ICCV Workshops, pp.  1338–1345. IEEE, 2009.
  • Vaswani et al. (2017) Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, Ł., and Polosukhin, I. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017.
  • Veeling et al. (2018) Veeling, B. S., Linmans, J., Winkens, J., Cohen, T., and Welling, M. Rotation equivariant CNNs for digital pathology. June 2018.
  • Virtanen et al. (2020) Virtanen, P., Gommers, R., Oliphant, T. E., Haberland, M., Reddy, T., Cournapeau, D., Burovski, E., Peterson, P., Weckesser, W., Bright, J., van der Walt, S. J., Brett, M., Wilson, J., Millman, K. J., Mayorov, N., Nelson, A. R. J., Jones, E., Kern, R., Larson, E., Carey, C. J., Polat, İ., Feng, Y., Moore, E. W., VanderPlas, J., Laxalde, D., Perktold, J., Cimrman, R., Henriksen, I., Quintero, E. A., Harris, C. R., Archibald, A. M., Ribeiro, A. H., Pedregosa, F., van Mulbregt, P., and SciPy 1.0 Contributors. SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python. Nature Methods, 17:261–272, 2020. doi: 10.1038/s41592-019-0686-2.
  • Vo et al. (2017) Vo, N., Jacobs, N., and Hays, J. Revisiting im2gps in the deep learning era. In Proceedings of the IEEE International Conference on Computer Vision, pp.  2621–2630, 2017.
  • Wang et al. (2018) Wang, A., Singh, A., Michael, J., Hill, F., Levy, O., and Bowman, S. R. Glue: A multi-task benchmark and analysis platform for natural language understanding. arXiv preprint arXiv:1804.07461, 2018.
  • Wang et al. (2019) Wang, H., Ge, S., Lipton, Z., and Xing, E. P. Learning robust global representations by penalizing local predictive power. In Advances in Neural Information Processing Systems, pp. 10506–10518, 2019.
  • Wang et al. (2020) Wang, H., Lu, P., Zhang, H., Yang, M., Bai, X., Xu, Y., He, M., Wang, Y., and Liu, W. All you need is boundary: Toward arbitrary-shaped text spotting. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp.  12160–12167, 2020.
  • Wang et al. (2009) Wang, J., Markert, K., and Everingham, M. Learning models for object recognition from natural language descriptions. In BMVC, volume 1, pp.  2, 2009.
  • Weston et al. (2010) Weston, J., Bengio, S., and Usunier, N. Large scale image annotation: learning to rank with joint word-image embeddings. Machine learning, 81(1):21–35, 2010.
  • Weston (2016) Weston, J. E. Dialog-based language learning. In Advances in Neural Information Processing Systems, pp. 829–837, 2016.
  • Weyand et al. (2016) Weyand, T., Kostrikov, I., and Philbin, J. Planet-photo geolocation with convolutional neural networks. In European Conference on Computer Vision, pp.  37–55. Springer, 2016.
  • Wu et al. (2019) Wu, Y., Kirillov, A., Massa, F., Lo, W.-Y., and Girshick, R. Detectron2. https://github.com/facebookresearch/detectron2, 2019.
  • Wu et al. (2018) Wu, Z., Xiong, Y., Yu, S., and Lin, D. Unsupervised feature learning via non-parametric instance-level discrimination. arXiv preprint arXiv:1805.01978, 2018.
  • Xie et al. (2020) Xie, Q., Luong, M.-T., Hovy, E., and Le, Q. V. Self-training with noisy student improves imagenet classification. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp.  10687–10698, 2020.
  • y Arcas et al. (2017) y Arcas, B. A., Mitchell, M., and Todorov, A. Physiognomy’s new clothes. 2017. URL https://medium.com/@blaisea/physiognomys-new-clothes-f2d4b59fdd6a.
  • Yang et al. (2020) Yang, Z., Lu, Y., Wang, J., Yin, X., Florencio, D., Wang, L., Zhang, C., Zhang, L., and Luo, J. Tap: Text-aware pre-training for text-vqa and text-caption. arXiv preprint arXiv:2012.04638, 2020.
  • Yogatama et al. (2019) Yogatama, D., d’Autume, C. d. M., Connor, J., Kocisky, T., Chrzanowski, M., Kong, L., Lazaridou, A., Ling, W., Yu, L., Dyer, C., et al. Learning and evaluating general linguistic intelligence. arXiv preprint arXiv:1901.11373, 2019.
  • Young et al. (2014) Young, P., Lai, A., Hodosh, M., and Hockenmaier, J. From image descriptions to visual denotations: New similarity metrics for semantic inference over event descriptions. Transactions of the Association for Computational Linguistics, 2:67–78, 2014.
  • Yu et al. (2020) Yu, F., Tang, J., Yin, W., Sun, Y., Tian, H., Wu, H., and Wang, H. Ernie-vil: Knowledge enhanced vision-language representations through scene graph. arXiv preprint arXiv:2006.16934, 2020.
  • Zeiler & Fergus (2014) Zeiler, M. D. and Fergus, R. Visualizing and understanding convolutional networks. In European conference on computer vision, pp.  818–833. Springer, 2014.
  • Zhai et al. (2019) Zhai, X., Puigcerver, J., Kolesnikov, A., Ruyssen, P., Riquelme, C., Lucic, M., Djolonga, J., Pinto, A. S., Neumann, M., Dosovitskiy, A., et al. A large-scale study of representation learning with the visual task adaptation benchmark. arXiv preprint arXiv:1910.04867, 2019.
  • Zhang (2019) Zhang, R. Making convolutional networks shift-invariant again. arXiv preprint arXiv:1904.11486, 2019.
  • Zhang et al. (2020) Zhang, Y., Jiang, H., Miura, Y., Manning, C. D., and Langlotz, C. P. Contrastive learning of medical visual representations from paired images and text. arXiv preprint arXiv:2010.00747, 2020.
  • Zuboff (2015) Zuboff, S. Big other: surveillance capitalism and the prospects of an information civilization. Journal of Information Technology, 30(1):75–89, 2015.


附录 A 线性探针评估


我们为本文中介绍的线性探针实验提供了更多细节,包括用于评估的数据集和模型列表。

  A.1 数据集


我们采用了由(Kornblith 等人,2019 年)提出的经过深入研究的评估套件中的 12 个数据集,并额外添加了 15 个数据集,以评估模型在更广泛分布和任务上的性能。这些数据集包括 MNIST、面部表情识别 2013 数据集(Goodfellow 等人,2015 年)、STL-10(Coates 等人,2011 年)、EuroSAT(Helber 等人,2019 年)、NWPU-RESISC45 数据集(Cheng 等人,2017 年)、德国交通标志识别基准(GTSRB)数据集(Stallkamp 等人,2011 年)、KITTI 数据集(Geiger 等人,2012 年)、PatchCamelyon(Veeling 等人,2018 年)、UCF101 动作识别数据集(Soomro 等人,2012 年)、Kinetics 700(Carreira 等人,2019 年)、CLEVR 数据集的 2500 个随机样本(Johnson 等人,2017 年)、恶意表情包数据集(Kiela 等人,2020 年)以及 ImageNet-1k 数据集(Deng 等人,2012 年)。对于两个视频数据集(UCF101 和 Kinetics700),我们使用每个视频片段的中间帧作为输入图像。STL-10 和 UCF101 具有多个预定义的训练/验证/测试划分,分别为 10 个和 3 个,我们报告了所有划分的平均结果。 各数据集的详细信息及相应的评估指标见表 9。


此外,我们创建了两个数据集,分别命名为 Country211 和 Rendered SST2。Country211 数据集旨在评估视觉表示的地理定位能力。我们对 YFCC100m 数据集(Thomee 等人,2016 年)进行了筛选,找出了拥有至少 300 张带有 GPS 坐标照片的 211 个国家(定义为拥有 ISO-3166 国家代码),并通过为每个国家抽取 200 张照片用于训练和 100 张照片用于测试,构建了一个包含 211 个类别的平衡数据集。


Rendered SST2 数据集旨在衡量视觉表征的光学字符识别能力。为此,我们采用了斯坦福情感树库数据集(Socher 等人,2013 年)中的句子,并将其渲染成图像,以黑色文字置于白色背景之上,分辨率为 448×448。图 19 展示了该数据集中的两个示例图像。

Refer to caption   Refer to caption


图 19:来自 Rendered SST2 数据集的两个示例图像
  数据集   课程   列车尺寸   测试规模   评估指标
  食品-101 102 75,750 25,250   准确性
CIFAR-10 10 50,000 10,000   准确性
CIFAR-100 100 50,000 10,000   准确性
  鸟类识别 500 42,283 2,149   准确性
SUN397 397 19,850 19,850   准确性
  斯坦福汽车 196 8,144 8,041   准确性
  FGVC 飞机 100 6,667 3,333 mean per class 
Pascal VOC 2007 Classification  20 5,011 4,952 11-point mAP 
Describable Textures  47 3,760 1,880 accuracy 
Oxford-IIIT Pets  37 3,680 3,669 mean per class 
Caltech-101  102 3,060 6,085 mean-per-class 
Oxford Flowers 102  102 2,040 6,149 mean per class 
MNIST 10 60,000 10,000 accuracy 
Facial Emotion Recognition 2013  8 32,140 3,574 accuracy 
STL-10 10 1000 8000 accuracy 
EuroSAT  10 10,000 5,000 accuracy 
RESISC45 45 3,150 25,200 accuracy 
GTSRB 43 26,640 12,630 accuracy 
KITTI 4 6,770 711 accuracy 
Country211  211 43,200 21,100 accuracy 
PatchCamelyon  2 294,912 32,768 accuracy 
UCF101 101 9,537 1,794 accuracy 
Kinetics700  700 494,801 31,669 mean(top1, top5) 
CLEVR Counts  8 2,000 500 accuracy 
Hateful Memes  2 8,500 500 ROC AUC 
Rendered SST2  2 7,792 1,821 accuracy 
ImageNet 1000 1,281,167 50,000 accuracy 
Table 9: Datasets examined for linear probes. We note that, for the Birdsnap and Kinetics700 datasets, we used the resources that are available online at the time of this writing. 

A.2 Models 

In combination with the datasets listed above, we evaluate the following series of models using linear probes. 

LM RN50 

This is a multimodal model that uses an autoregressive loss instead of a contrastive loss, while using the ResNet-50 architecture as in the smallest contrastive model. To do so, the output from the CNN is projected into four tokens, which are then fed as a prefix to a language model autoregressively predicting the text tokens. Apart from the training objective, the model was trained on the same dataset for the same number of epochs as other CLIP models. 

CLIP-RN 

Five ResNet-based contrastive CLIP models are included. As discussed in the paper, the first two models follow ResNet-50 and ResNet-101, and we use EfficientNet-style (Tan & Le, 2019) scaling for the next three models which simultaneously scale the model width, the number of layers, and the input resolution to obtain models with roughly 4x, 16x, and 64x computation. 

CLIP-ViT

We include four CLIP models that use the Vision Transformer (Dosovitskiy et al., 2020) architecture as the image encoder. We include three models trained on 224-by-224 pixel images: ViT-B/32, ViT-B/16, ViT-L/14, and the ViT-L/14 model fine-tuned on 336-by-336 pixel input images.

EfficietNet

We use the nine models (B0-B8) from the original EfficientNet paper (Tan & Le, 2019), as well as the noisy-student variants (B0-B7, L2-475, and L2-800) (Tan & Le, 2019). The largest models (L2-475 and L2-800) take the input resolutions of 475x475 and 800x800 pixels, respectively.

Instagram-pretrained ResNeXt

We use the four models (32x8d, 32x16d, 32x32d, 32x48d) released by (Mahajan et al., 2018), as well as their two FixRes variants which use higher input resolutions (Touvron et al., 2019).

Big Transfer (BiT)

We use BiT-S and BiT-M models (Kolesnikov et al., 2019), trained on the ImageNet-1k and ImageNet-21k datasets. The model weights for BiT-L is not publicly available.

Vision Transformer (ViT)

We also include four ViT (Dosovitskiy et al., 2020) checkpoints pretrained on the ImageNet-21k dataset, namely ViT-B/32, ViT-B/16, ViT-L/16, and ViT-H/14. We note that their best-performing models, trained on the JFT-300M dataset, are not available publicly.

SimCLRv2

The SimCLRv2 (Chen et al., 2020c) project released pre-trained and fine-tuned models in various settings. We use the seven pretrain-only checkpoints with selective kernels.

BYOL

We use the recently released model weights of BYOL (Grill et al., 2020), specifically their 50x1 and 200x2 checkpoints.

Momentum Contrast (MoCo)

We include the MoCo-v1 (He et al., 2020) and the MoCo-v2 (Chen et al., 2020d) checkpoints.

VirTex

We use the pretrained model of VirTex (Desai & Johnson, 2020). We note that VirTex has a similar model design to CLIP-AR but is trained on a 1000x smaller dataset of high-quality captions from MSCOCO.

ResNet

We add the original ResNet checkpoints released by (He et al., 2016b), namely ResNet-50, ResNet-101, and ResNet152.

A.3 Evaluation

We use image features taken from the penultimate layer of each model, ignoring any classification layer provided. For CLIP-ViT models, we used the features before the linear projection to the embedding space, which corresponds to I_f in Figure 3. We train a logistic regression classifier using scikit-learn’s L-BFGS implementation, with maximum 1,000 iterations, and report the corresponding metric for each dataset. We determine the L2 regularization strength λ\lambda using a hyperparameter sweep on the validation sets over the range between 10610^{-6} and 10610^{6}, with 96 logarithmically spaced steps. To save compute required for the sweeps, we perform a parametric binary search that starts with λ=[106,104,102,1,102,104,106]\lambda=[10^{-6},10^{-4},10^{-2},1,10^{2},10^{4},10^{6}] and iteratively halves the interval around the peak until it reaches a resolution of 8 steps per decade. The hyperparameter sweeps are performed on a validation split of each dataset. For the datasets that contain a validation split in addition to a test split, we use the provided validation set to perform the hyperparameter search, and for the datasets that do not provide a validation split or have not published labels for the test data, we split the training dataset to perform the hyperparameter search. For the final result, we combine the validation split back with the training split and report the performance on the unused split.

A.4 Results

The individual linear probe scores are provided in Table 10 and plotted in Figure 20. The best-performing CLIP model, using ViT-L/14 archiecture and 336-by-336 pixel images, achieved the state of the art in 21 of the 27 datasets, i.e. included in the Clopper-Pearson 99.5% confidence interval around each dataset’s top score. For many datasets, CLIP performs significantly better than other models, demonstrating the advantage of natural language supervision over traditional pre-training approaches based on image classification. See Section 3.2 for more discussions on the linear probe results.

Food101

CIFAR10

CIFAR100

Birdsnap

SUN397

Cars

Aircraft

VOC2007

DTD

Pets

Caltech101

Flowers

MNIST

FER2013

STL10

EuroSAT

RESISC45

GTSRB

KITTI

Country211

PCAM

UCF101

Kinetics700

CLEVR

HatefulMemes

SST

ImageNet

LM RN50 81.3 82.8 61.7 44.2 69.6 74.9 44.9 85.5 71.5 82.8 85.5 91.1 96.6 60.1 95.3 93.4 84.0 73.8 70.2 19.0 82.9 76.4 51.9 51.2 65.2 76.8 65.2
CLIP-RN 50 86.4 88.7 70.3 56.4 73.3 78.3 49.1 87.1 76.4 88.2 89.6 96.1 98.3 64.2 96.6 95.2 87.5 82.4 70.2 25.3 82.7 81.6 57.2 53.6 65.7 72.6 73.3
101 88.9 91.1 73.5 58.6 75.1 84.0 50.7 88.0 76.3 91.0 92.0 96.4 98.4 65.2 97.8 95.9 89.3 82.4 73.6 26.6 82.8 84.0 60.3 50.3 68.2 73.3 75.7
50x4 91.3 90.5 73.0 65.7 77.0 85.9 57.3 88.4 79.5 91.9 92.5 97.8 98.5 68.1 97.8 96.4 89.7 85.5 59.4 30.3 83.0 85.7 62.6 52.5 68.0 76.6 78.2
50x16 93.3 92.2 74.9 72.8 79.2 88.7 62.7 89.0 79.1 93.5 93.7 98.3 98.9 68.7 98.6 97.0 91.4 89.0 69.2 34.8 83.5 88.0 66.3 53.8 71.1 80.0 81.5
50x64 94.8 94.1 78.6 77.2 81.1 90.5 67.7 88.9 82.0 94.5 95.4 98.9 98.9 71.3 99.1 97.1 92.8 90.2 69.2 40.7 83.7 89.5 69.1 55.0 75.0 81.2 83.6
CLIP-ViT B/32 88.8 95.1 80.5 58.5 76.6 81.8 52.0 87.7 76.5 90.0 93.0 96.9 99.0 69.2 98.3 97.0 90.5 85.3 66.2 27.8 83.9 85.5 61.7 52.1 66.7 70.8 76.1
B/16 92.8 96.2 83.1 67.8 78.4 86.7 59.5 89.2 79.2 93.1 94.7 98.1 99.0 69.5 99.0 97.1 92.7 86.6 67.8 33.3 83.5 88.4 66.1 57.1 70.3 75.5 80.2
L/14 95.2 98.0 87.5 77.0 81.8 90.9 69.4 89.6 82.1 95.1 96.5 99.2 99.2 72.2 99.7 98.2 94.1 92.5 64.7 42.9 85.8 91.5 72.0 57.8 76.2 80.8 83.9
L/14-336px 95.9 97.9 87.4 79.9 82.2 91.5 71.6 89.9 83.0 95.1 96.0 99.2 99.2 72.9 99.7 98.1 94.9 92.4 69.2 46.4 85.6 92.0 73.0 60.3 77.3 80.5 85.4
EfficientNet B0 74.3 92.5 76.5 59.7 62.0 62.5 55.7 84.4 71.2 93.0 93.3 91.7 98.2 57.2 97.1 97.3 85.5 80.0 73.8 12.4 83.1 74.4 47.6 47.9 55.7 53.4 76.9
B1 74.2 93.2 77.2 61.3 62.6 62.5 56.1 84.7 74.2 93.4 93.6 92.4 98.3 57.0 97.5 96.8 84.5 75.9 75.5 12.5 82.7 74.7 48.5 44.3 54.5 54.4 78.6
B2 75.8 93.6 77.9 64.4 64.0 63.2 57.0 85.3 73.5 93.9 93.5 92.9 98.5 56.6 97.7 96.9 84.4 76.4 73.1 12.6 84.3 75.1 49.4 42.6 55.4 55.2 79.7
B3 77.4 94.0 78.0 66.5 64.4 66.0 59.3 85.8 73.1 94.1 93.7 93.3 98.5 57.1 98.2 97.3 85.0 75.8 76.1 13.4 83.3 78.1 50.9 45.1 53.8 54.8 81.0
B4 79.7 94.1 78.7 70.1 65.4 66.4 60.4 86.5 73.4 94.7 93.5 93.2 98.8 57.9 98.6 96.8 85.0 78.3 72.3 13.9 83.1 79.1 52.5 46.5 54.4 55.4 82.9
B5 81.5 93.6 77.9 72.4 67.1 72.7 68.9 86.7 73.9 95.0 94.7 94.5 98.4 58.5 98.7 96.8 86.0 78.5 69.6 14.9 84.7 80.9 54.5 46.6 53.3 56.3 83.7
B6 82.4 94.0 78.0 73.5 65.8 71.1 68.2 87.6 73.9 95.0 94.1 93.7 98.4 60.2 98.7 96.8 85.4 78.1 72.7 15.3 84.2 80.0 54.1 51.1 53.3 57.0 84.0
B7 84.5 94.9 80.1 74.7 69.0 77.1 72.3 87.2 76.8 95.2 94.7 95.9 98.6 61.3 99.1 96.3 86.8 80.8 75.8 16.4 85.2 81.9 56.8 51.9 54.4 57.8 84.8
B8 84.5 95.0 80.7 75.2 69.6 76.8 71.5 87.4 77.1 94.9 95.2 96.3 98.6 61.4 99.2 97.0 87.4 80.4 70.9 17.4 85.2 82.4 57.7 51.4 51.7 55.8 85.3
EfficientNet Noisy Student B0 78.1 94.0 78.6 63.5 65.5 57.2 53.7 85.6 75.6 93.8 93.1 94.5 98.1 55.6 98.2 97.0 84.3 74.0 71.6 14.0 83.1 76.7 51.7 47.3 55.7 55.0 78.5
B1 80.4 95.1 80.2 66.6 67.6 59.6 53.7 86.2 77.0 94.6 94.4 95.1 98.0 56.1 98.6 96.9 84.3 73.1 67.1 14.5 83.9 79.9 54.5 46.1 54.3 54.9 81.1
B2 80.9 95.3 81.3 67.6 67.9 60.9 55.2 86.3 77.7 95.0 94.7 94.4 98.0 55.5 98.8 97.3 84.6 71.7 70.0 14.6 82.9 80.1 55.1 46.1 54.1 55.3 82.2
B3 82.6 95.9 82.1 68.6 68.8 60.6 55.4 86.5 77.2 95.0 94.8 95.2 98.1 56.0 99.1 96.5 85.0 70.5 69.5 15.1 83.1 81.8 56.8 45.1 55.7 52.0 83.8
B4 85.2 95.6 81.0 72.5 69.7 56.1 52.6 87.0 78.7 94.8 95.2 95.3 98.2 56.0 99.3 95.3 84.8 61.9 64.8 16.0 82.8 83.4 59.8 43.2 55.3 53.0 85.4
B5 87.6 96.3 82.4 75.3 71.6 64.7 64.8 87.8 79.6 95.5 95.6 96.6 98.8 60.9 99.4 96.1 87.0 68.5 73.7 16.4 83.5 86.4 61.6 46.3 53.4 55.8 85.8
B6 87.3 97.0 83.9 75.8 71.4 67.6 65.6 87.3 78.5 95.2 96.4 97.2 98.6 61.9 99.5 96.6 86.1 70.7 72.4 17.6 84.2 85.5 61.0 49.6 54.6 55.7 86.4
B7 88.4 96.0 82.0 76.9 72.6 72.2 71.2 88.1 80.5 95.5 95.5 96.6 98.5 62.7 99.4 96.2 88.5 73.4 73.0 18.5 83.8 86.6 63.2 50.5 57.2 56.7 87.0
L2-475 91.6 99.0 91.0 74.8 76.4 75.1 66.8 89.5 81.9 95.6 96.5 97.7 98.9 67.5 99.6 97.0 89.5 73.4 68.9 22.2 86.3 89.4 68.2 58.3 58.6 55.2 88.3
L2-800 92.0 98.7 89.0 78.5 75.7 75.5 68.4 89.4 82.5 95.6 94.7 97.9 98.5 68.4 99.7 97.2 89.9 77.7 66.9 23.7 86.8 88.9 66.7 62.7 58.4 56.9 88.4
Instagram 32x8d 84.8 95.9 80.9 63.8 69.0 74.2 56.0 88.0 75.4 95.4 93.9 91.7 97.4 60.7 99.1 95.7 82.1 72.3 69.2 16.7 82.3 80.1 56.8 42.2 53.3 55.2 83.3
32x16d 85.7 96.5 80.9 64.8 70.5 77.5 56.7 87.9 76.2 95.6 94.9 92.5 97.4 61.6 99.3 95.5 82.8 73.8 66.1 17.5 83.4 81.1 58.2 41.3 54.2 56.1 84.4
32x32d 86.7 96.8 82.7 67.1 71.5 77.5 55.4 88.3 78.5 95.8 95.3 94.4 97.9 62.4 99.3 95.7 85.4 71.2 66.8 18.0 83.7 82.1 58.8 39.7 55.3 56.7 85.0
32x48d 86.9 96.8 83.4 65.9 72.2 76.6 53.2 88.0 77.2 95.5 95.8 93.6 98.1 63.7 99.4 95.3 85.4 73.0 67.2 18.5 82.7 82.8 59.2 41.3 55.5 56.7 85.2
FixRes-v1 88.5 95.7 81.1 67.4 72.9 80.5 57.6 88.0 77.9 95.8 96.1 94.5 97.9 62.2 99.4 96.2 86.6 76.5 64.8 19.3 82.5 83.4 59.8 43.5 56.6 59.0 86.0
FixRes-v2 88.5 95.7 81.1 67.3 72.9 80.7 57.5 88.0 77.9 95.0 96.0 94.5 98.0 62.1 99.4 96.5 86.6 76.3 64.8 19.5 82.3 83.5 59.8 44.2 56.6 59.0 86.0
BiT-S R50x1 72.5 91.7 74.8 57.7 61.1 53.5 52.5 83.7 72.4 92.3 91.2 92.0 98.4 56.1 96.4 97.4 85.0 70.0 66.0 12.5 83.0 72.3 47.5 48.3 54.1 55.3 75.2
R50x3 75.1 93.7 79.0 61.1 63.7 55.2 54.1 84.8 74.6 92.5 91.6 92.8 98.8 58.7 97.0 97.8 86.4 73.1 73.8 14.0 84.2 76.4 50.0 49.2 54.7 54.2 77.2
R101x1 73.5 92.8 77.4 58.4 61.3 54.0 52.4 84.4 73.5 92.5 91.8 90.6 98.3 56.5 96.8 97.3 84.6 69.4 68.9 12.6 82.0 73.5 48.6 45.4 52.6 55.5 76.0
R101x3 74.7 93.9 79.8 57.8 62.9 54.7 53.3 84.7 75.5 92.3 91.2 92.6 98.8 59.7 97.3 98.0 85.5 71.8 60.2 14.1 83.1 75.9 50.4 49.7 54.1 54.6 77.4
R152x2 74.9 94.3 79.7 58.7 62.7 55.9 53.6 85.3 74.9 93.0 92.0 91.7 98.6 58.3 97.1 97.8 86.2 71.8 71.6 13.9 84.1 76.2 49.9 48.2 53.8 55.9 77.1
R152x4 74.7 94.2 79.2 57.8 62.9 51.2 50.8 85.4 75.4 93.1 91.2 91.4 98.9 61.4 97.2 98.0 85.5 72.8 67.9 14.9 83.1 76.0 50.3 42.9 53.6 56.0 78.5
BiT-M R50x1 83.3 94.9 82.2 70.9 69.9 59.0 55.6 86.8 77.3 91.5 93.9 99.4 98.0 60.6 98.4 97.5 87.4 68.6 68.2 16.6 82.5 79.4 53.2 49.4 54.5 53.4 76.7
R50x3 86.9 96.7 86.2 75.7 74.6 60.6 54.2 87.7 78.5 93.2 95.3 99.4 98.6 64.6 99.3 98.0 88.1 69.9 59.6 19.6 83.4 83.5 57.8 51.3 55.8 55.6 80.7
R101x1 85.5 95.7 84.4 73.0 72.5 59.8 55.0 87.3 78.1 92.2 95.0 99.5 98.1 62.5 99.0 97.6 87.8 68.7 67.7 18.0 84.0 82.3 55.9 53.4 54.8 53.1 79.4
R101x3 87.2 97.4 87.5 72.4 75.0 57.4 47.4 87.5 79.6 93.2 95.4 99.6 98.6 64.3 99.4 98.2 87.7 68.8 64.1 20.7 80.4 84.0 58.7 52.6 54.9 54.3 81.2
R152x2 88.0 97.5 87.8 75.8 75.9 61.5 55.3 88.1 79.8 93.6 95.9 99.5 98.5 64.3 99.5 97.9 89.0 70.0 70.3 20.7 82.6 85.5 59.6 50.8 54.9 55.1 81.9
R152x4 87.2 97.6 88.2 72.4 75.0 49.1 43.4 87.1 79.9 92.4 95.4 99.3 98.5 65.7 99.5 97.8 87.7 68.2 57.1 20.6 80.4 84.6 59.0 49.7 57.2 55.1 81.5
ViT B/32 81.8 96.7 86.3 65.2 70.7 49.1 42.7 85.3 73.1 90.4 94.5 98.7 97.8 59.0 99.0 96.3 83.0 68.1 65.1 15.7 82.6 79.1 51.7 38.9 57.1 54.6 76.6
B/16 86.7 96.9 86.4 74.0 74.2 54.7 46.0 86.7 74.3 92.7 94.1 99.2 97.4 61.3 99.5 96.4 84.5 63.1 61.5 17.5 85.4 82.7 56.6 40.0 57.0 56.1 80.9
L/16 87.4 97.9 89.0 76.5 74.9 62.5 52.2 86.1 75.0 92.9 94.7 99.3 98.0 64.0 99.6 96.5 85.7 70.4 58.8 17.7 85.7 84.1 58.0 38.4 58.4 52.8 81.9
H/14 83.4 95.8 84.5 70.2 69.2 62.3 54.8 84.7 75.4 91.7 93.7 98.9 98.5 62.4 98.4 97.3 87.0 73.9 63.4 15.4 87.0 79.4 52.1 41.1 55.9 54.1 75.9
SimCLRv2 R50x1 76.4 93.2 77.9 48.6 64.1 56.3 51.7 84.4 77.0 88.3 91.8 92.9 97.6 59.7 96.7 97.5 85.8 71.1 69.1 15.8 84.8 78.4 51.0 56.2 53.9 53.8 73.8
R50x3 81.0 95.6 82.4 56.5 67.0 65.6 61.1 85.9 78.8 90.9 94.1 95.4 98.7 62.6 98.2 97.9 88.2 78.2 74.7 17.6 85.4 82.6 54.6 55.4 54.2 55.2 77.3
R101x1 77.9 94.8 79.9 51.9 65.2 57.1 52.0 85.4 77.2 90.0 91.6 92.7 97.2 59.4 97.6 96.8 84.6 65.7 70.6 16.1 84.3 78.8 52.4 53.6 55.1 55.7 76.1
R101x3 82.2 96.4 83.4 57.5 68.2 64.6 60.0 86.2 78.9 91.8 95.0 95.4 98.4 63.0 98.5 97.9 88.0 77.5 69.1 18.3 85.5 82.9 55.9 52.2 54.5 56.3 78.8
R152x1 78.6 95.0 79.9 50.3 65.6 55.6 52.2 85.8 77.3 90.1 92.5 91.8 97.6 59.8 98.1 96.6 84.3 64.8 70.3 16.6 83.9 79.4 53.1 57.2 55.8 54.8 76.9
R152x2 82.3 96.7 83.9 58.1 68.5 64.9 58.7 86.6 79.1 92.2 94.1 96.0 98.2 64.1 98.5 98.0 88.1 77.0 69.8 18.4 85.3 82.7 56.2 53.6 56.0 56.5 79.2
R152x3 83.6 96.8 84.5 60.3 69.1 68.5 63.1 86.7 80.5 92.6 94.9 96.3 98.7 65.4 98.8 98.1 89.5 78.4 68.5 19.4 85.2 83.5 57.0 54.4 54.6 54.2 80.0
BYOL 50x1 74.0 93.6 79.1 47.6 63.7 61.6 62.3 82.6 77.0 88.3 93.7 94.3 98.7 58.8 96.4 97.6 88.2 80.1 71.4 14.1 84.8 77.3 49.3 56.1 53.8 54.4 73.3
200x2 78.5 96.2 83.3 53.4 68.5 61.7 55.4 86.6 77.4 91.9 95.5 93.9 98.7 62.6 98.6 97.7 87.4 77.1 76.4 16.4 84.0 82.6 55.1 54.1 52.5 52.4 79.2
MoCo v1 65.9 85.0 63.1 27.5 52.6 35.9 43.5 75.7 70.0 70.4 78.1 85.4 97.6 54.3 85.6 97.1 82.9 62.6 60.2 12.6 85.7 64.2 40.7 54.7 55.6 53.5 57.2
v2 72.2 93.4 76.3 39.6 60.2 48.3 51.1 82.6 75.1 84.4 89.9 90.7 98.4 58.3 95.7 97.2 85.4 75.7 75.4 13.2 85.6 72.7 47.8 56.9 53.9 53.8 69.1
VirTex 57.9 83.9 57.5 17.0 49.8 22.4 34.5 83.8 58.2 53.6 70.6 74.7 98.1 56.5 86.7 94.8 74.1 69.5 71.3 8.7 83.1 61.5 39.9 45.5 53.5 55.8 50.7
ResNet 50 71.3 91.8 74.5 52.7 60.5 49.9 48.5 83.8 72.3 92.4 90.8 90.8 98.3 54.9 96.4 96.7 83.6 70.6 67.1 11.7 82.5 71.2 46.8 43.0 56.5 55.5 74.3
101 72.7 93.0 77.2 53.7 60.8 50.1 47.0 84.4 71.6 92.3 91.9 90.4 98.5 56.6 97.0 97.1 83.4 72.5 63.6 11.9 83.3 72.7 48.3 43.2 53.0 54.7 75.8
152 73.7 93.5 78.0 55.1 61.6 52.8 48.4 84.5 71.9 93.0 92.1 89.6 98.2 57.0 97.6 97.0 83.1 70.1 70.2 12.3 82.9 75.3 49.2 42.4 53.2 53.9 77.1
Table 10: Linear probe performance of various pre-trained models over 27 datasets. Scores within the 99.5% Clopper-Pearson confidence interval of each dataset’s top score are shown in bold.
We updated the STL10 scores from the previous version of this paper after fixing a CUDA-related bug.

Refer to caption

Figure 20: Linear probe performance plotted for each of the 27 datasets, using the data from Table 10.

Refer to caption

Figure 21: Visualization of predictions from 36 CLIP zero-shot classifiers. All examples are random with the exception of reselecting Hateful Memes to avoid offensive content. The predicted probability of the top 5 classes is shown along with the text used to represent the class. When more than one template is used, the first template is shown. The ground truth label is colored green while an incorrect prediction is colored orange.

Food101

CIFAR10

CIFAR100

Birdsnap

SUN397

Stanford Cars

FGVC Aircraft

VOC2007

DTD

Oxford Pets

Caltech101

Flowers102

MNIST

FER2013

STL10

EuroSAT

RESISC45

GTSRB

KITTI

Country211

PCam

UCF101

Kinetics700

CLEVR

HatefulMemes

Rendered SST2

ImageNet

CLIP-ResNet RN50 81.1 75.6 41.6 32.6 59.6 55.8 19.3 82.1 41.7 85.4 82.1 65.9 66.6 42.2 94.3 41.1 54.2 35.2 42.2 16.1 57.6 63.6 43.5 20.3 59.7 56.9 59.6
RN101 83.9 81.0 49.0 37.2 59.9 62.3 19.5 82.4 43.9 86.2 85.1 65.7 59.3 45.6 96.7 33.1 58.5 38.3 33.3 16.9 55.2 62.2 46.7 28.1 61.1 64.2 62.2
RN50x4 86.8 79.2 48.9 41.6 62.7 67.9 24.6 83.0 49.3 88.1 86.0 68.0 75.2 51.1 96.4 35.0 59.2 35.7 26.0 20.2 57.5 65.5 49.0 17.0 58.3 66.6 65.8
RN50x16 90.5 82.2 54.2 45.9 65.0 72.3 30.3 82.9 52.8 89.7 87.6 71.9 80.0 56.0 97.8 40.3 64.4 39.6 33.9 24.0 62.5 68.7 53.4 17.6 58.9 67.6 70.5
RN50x64 91.8 86.8 61.3 48.9 66.9 76.0 35.6 83.8 53.4 93.4 90.6 77.3 90.8 61.0 98.3 59.4 69.7 47.9 33.2 29.6 65.0 74.1 56.8 27.5 62.1 70.7 73.6
CLIP-ViT B/32 84.4 91.3 65.1 37.8 63.2 59.4 21.2 83.1 44.5 87.0 87.9 66.7 51.9 47.3 97.2 49.4 60.3 32.2 39.4 17.8 58.4 64.5 47.8 24.8 57.6 59.6 63.2
B/16 89.2 91.6 68.7 39.1 65.2 65.6 27.1 83.9 46.0 88.9 89.3 70.4 56.0 52.7 98.2 54.1 65.5 43.3 44.0 23.3 48.1 69.8 52.4 23.4 61.7 59.8 68.6
L/14 92.9 96.2 77.9 48.3 67.7 77.3 36.1 84.1 55.3 93.5 92.6 78.7 87.2 57.5 99.3 59.9 71.6 50.3 23.1 32.7 58.8 76.2 60.3 24.3 63.3 64.0 75.3
L/14-336px 93.8 95.7 77.5 49.5 68.4 78.8 37.2 84.3 55.7 93.5 92.8 78.3 88.3 57.7 99.4 59.6 71.7 52.3 21.9 34.9 63.0 76.9 61.3 24.8 63.3 67.9 76.2
Table 11: Zero-shot performance of CLIP models over 27 datasets.
[Uncaptioned image]
Figure 22: CLIP’s zero-shot performance compared to linear-probe ResNet performance

Appendix B Zero-Shot Prediction

To provide a qualitative summary / overview of CLIP’s zero-shot performance we visualize a randomly selected prediction for 36 different zero-shot CLIP classifiers in Figure 21. In addition, Table 22 and Figure 22 show the individual zero-shot performance scores for each dataset.

Appendix C Duplicate Detector

Our early attempts at duplicate detection and analysis used nearest neighbors in the model’s learned embedding space. While it is intuitive to use a model’s own notion of similarity, we encountered issues. We found the model’s feature space is weighted very heavily towards semantic similarity. Many false positives occurred due to distinct objects that would be described similarly (soccer balls, flowers of the same species, etc…) having almost perfect similarity. We also observed the model was quite poor at assigning certain kinds of near-duplicates high similarity scores. We noticed repeatedly that images with high-frequency textures (such as fur or stripe patterns) pre-processed by different resizing algorithms (nearest neighbor vs bi-linear) could have surprisingly low similarity. This resulted in many false negatives.

We built our own near-duplicate detector to fix this issue. We created a synthetic data augmentation pipeline that combined a variety of common image manipulations. The augmentation pipeline combines random cropping and zooming, aspect ratio distortion, downsizing and upscaling to different resolutions, minor rotations, jpeg compression, and HSV color jitter. The pipeline also randomly selects from different interpolation algorithms for all relevant steps. We then trained a model to maximize the similarity of an image and its transformed variant while minimizing similarity to all other images in a training batch. We used the same n-pair / InfoNCE loss as CLIP but with a fixed temperature of 0.07.

We selected a ResNet-50 as the model architecture. We modified the base ResNet-50 with the anti-alias improvements from (Zhang, 2019) and used weight norm (Salimans & Kingma, 2016) instead of batch norm (Ioffe & Szegedy, 2015) to avoid leaking information about duplicates via batch statistics - a problem previously noted in (Henaff, 2020). We also found the GELU activation function (Hendrycks & Gimpel, 2016) to perform better for this task. We trained the model with a total batch size of 1,712 for approximately 30 million images sampled from our pre-training dataset. At the end of training it achieves nearly 100% accuracy on its proxy training task.

Appendix D Dataset Ablation on YFCC100M


Linear Classifier Zero Shot
Dataset YFCC WIT Δ\Delta YFCC WIT Δ\Delta
Birdsnap 47.4 35.3 ++12.1 19.9 4.5 ++15.4
Country211 23.1 17.3 ++5.8 5.2 5.3 ++0.1
Flowers102 94.4 89.8 ++4.6 48.6 21.7 ++26.9
GTSRB 66.8 72.5 -5.7 6.9 7.0 -0.1
UCF101 69.2 74.9 -5.7 22.9 32.0 -9.1
Stanford Cars 31.4 50.3 -18.9 3.8 10.9 -7.1
ImageNet 62.0 60.8 +1.2+1.2 31.3 27.6 ++3.7
Dataset Average 65.5 66.6 -1.1 29.6 30.0 -0.4
Dataset “Wins” 10 15 -5 19 18 ++1
Table 12: CLIP performs similarly when trained on only YFCC100M. Comparing a ResNet-50 trained on only YFCC100M with a same sized subset of WIT shows similar average performance and number of wins on zero shot and linear classifier evals. However, large differences in dataset specific performance occur. We include performance on the 3 datasets where YFCC does best and worst compared to WIT according to a linear probe in order to highlight this as well as aggregate performance across all linear and zero-shot evals and the canonical ImageNet dataset.

To study whether our custom dataset is critical to the performance of CLIP, we trained a model on a filtered subset of the YFCC100M dataset (details described in Section 2.2) and compared its performance to the same model trained on an equally sized subset of WIT. We train each model for 32 epochs at which point transfer performance begins to plateau due to overfitting. Results are shown in Table 12. Across our whole eval suite, YFCC and WIT perform similarly on average for both zero-shot and linear probe settings. However, performance on specific fine-grained classification datasets can vary widely - sometimes by over 10%. Our speculation is that these differences in performance reflect the relative density of relevant data in each pre-training dataset. For instance, pre-training on YFCC100M, which might contain many photos of birds and flowers (common subjects for photographers), results in better performance on Birdsnap and Flowers102, while pre-training on WIT results in better car and pet classifiers (which appear common in our dataset).

Overall, these results are encouraging as they suggest our approach can use any reasonably filtered collection of paired (text, image) data. This mirrors recent work which reported positive results using the same contrastive pre-training objective on the relatively different domain of medical imaging (Zhang et al., 2020). It also is similar to the findings of noisy student self-training which reported only slight improvements when using their JFT300M dataset over YFCC100M (Xie et al., 2020). We suspect the major advantage of our dataset over the already existing YFCC100M is its much larger size.

Finally, we caution that WIT includes this filtered subset of YFCC100M. This could result in our ablation underestimating the size of performance differences between YFCC100M and the rest of WIT. We do not think this is likely as YFCC100M is only 3.7% of the overall WIT data blend and it did not noticeably change the performance of models when it was added to the existing data blend during the creation of WIT.


Text Retrieval Image Retrieval
Flickr30k MSCOCO Flickr30k MSCOCO
R@1 R@5 R@10 R@1 R@5 R@10 R@1 R@5 R@10 R@1 R@5 R@10
Finetune Unicoder-VLa 86.2 96.3 99.0 62.3 87.1 92.8 71.5 90.9 94.9 46.7 76.0 85.3
Uniterb 87.3 98.0 99.2 65.7 88.6 93.8 75.6 94.1 96.8 52.9 79.9 88.0
VILLAc 87.9 97.5 98.8 - - - 76.3 94.2 96.8 - - -
Oscard - - - 73.5 92.2 96.0 - - - 57.5 82.8 89.8
ERNIE-ViLe 88.7 98.0 99.2 - - - 76.7 93.6 96.4 - - -
Zero-Shot Visual N-Gramsf 15.4 35.7 45.1 8.7 23.1 33.3 8.8 21.2 29.9 5.0 14.5 21.9
ImageBERTg - - - 44.0 71.2 80.4 - - - 32.3 59.0 70.2
Unicoder-VLa 64.3 86.8 92.3 - - - 48.4 76.0 85.2 - - -
Uniterb 83.6 95.7 97.7 - - - 68.7 89.2 93.9 - - -
CLIP 88.0 98.7 99.4 58.4 81.5 88.1 68.7 90.6 95.2 37.8 62.4 72.2
Table 13: CLIP improves zero-shot retrieval and is competitive with the best fine-tuned result on Flickr30k text retrieval. Bold indicates best overall performance while an underline indicates best in category performance (zero-shot or fine-tuned). For all other models, best results from the paper are reported regardless of model size / variant. MSCOCO performance is reported on the 5k test set. a(Li et al., 2020a) b(Chen et al., 2019) c(Gan et al., 2020) d(Li et al., 2020b) e(Yu et al., 2020) f(Li et al., 2017) g(Qi et al., 2020)

Appendix E Selected Task and Dataset Results

Due to the large variety of datasets and experiments considered in this work, the main body focuses on summarizing and analyzing overall results. In the following subsections we report details of performance for specific groups of tasks, datasets, and evaluation settings.

E.1 Image and Text Retrieval

CLIP pre-trains for the task of image-text retrieval on our noisy web-scale dataset. Although the focus of this paper is on representation learning and task learning for the purpose of transfer to a wide variety of downstream datasets, validating that CLIP is able to achieve high transfer performance transfer on exactly what it is pre-trained for is an important sanity check / proof of concept. In Table 13 we check the zero-shot transfer performance of CLIP for both text and image retrieval on the Flickr30k and MSCOCO datsets. Zero-shot CLIP matches or outperforms all prior zero-shot results on these two datasets. Zero-shot CLIP is also competitive with the current overall SOTA for the task of text retrieval on Flickr30k. On image retrieval, CLIP’s performance relative to the overall state of the art is noticeably lower. However, zero-shot CLIP is still competitive with a fine-tuned Unicoder-VL. On the larger MS-COCO dataset fine-tuning improves performance significantly and zero-shot CLIP is not competitive with the most recent work. For both these datasets we prepend the prompt “a photo of” to the description of each image which we found boosts CLIP’s zero-shot R@1 performance between 1 and 2 points.


IIIT5K Hateful
MNIST SVHN 1k Memes SST-2
Finetune SOTA 99.8a 96.4b 98.9c 78.0d 97.5e
JOINTf - - 89.6 - -
CBoWg - - - - 80.0
Linear Raw Pixels 92.5 - - - -
ES Best 98.9h - - 58.6h 59.0i
CLIP 99.2 - - 77.3 80.5

ZS

CLIP 88.4 51.0 90.0 63.3 67.9
Table 14: OCR performance on 5 datasets. All metrics are accuracy on the test set except for Hateful Memes which reports ROC AUC on the dev set. Single model SOTA reported to best of knowledge. ES Best reports the best performance across the 56 non-CLIP models in our evaluation suite. a(Assiri, 2020) b(Jaderberg et al., 2015) c(Wang et al., 2020) d(Lippe et al., 2020) f(Jaderberg et al., 2014) g(Wang et al., 2018) h(Xie et al., 2020) i(Mahajan et al., 2018)

E.2 Optical Character Recognition

Although visualizations have shown that ImageNet models contain features that respond to the presence of text in an image (Zeiler & Fergus, 2014), these representations are not sufficiently fine-grained to use for the task of optical character recognition (OCR). To compensate, models are augmented with the outputs of custom OCR engines and features to boost performance on tasks where this capability is required (Singh et al., 2019; Yang et al., 2020). Early during the development of CLIP, we noticed that CLIP began to learn primitive OCR capabilities which appeared to steadily improve over the course of the project. To evaluate this qualitatively noticed behavior, we measured performance on 5 datasets requiring the direct and indirect use of OCR. Three of these datasets MNIST (LeCun, ), SVHN (Netzer et al., 2011), and IIIT5K (Mishra et al., 2012) directly check the ability of a model to perform low-level character and word recognition, while Hateful Memes (Kiela et al., 2020) and SST-2 (Socher et al., 2013) check the ability of a model to use OCR to perform a semantic task. Results are reported in Table 14.

CLIP’s performance is still highly variable and appears to be sensitive to some combination of the domain (rendered or natural images) and the type of text to be recognized (numbers or words). CLIP’s OCR performance is strongest Hateful Memes and SST-2 - datasets where the text is digitally rendered and consists mostly of words. On IIIT5K, which is natural images of individually cropped words, zero-shot CLIP performs a bit more respectively and its performance is similar to Jaderberg et al. (2014) early work combining deep learning and structured prediction to perform open-vocabulary OCR. However, performance is noticeably lower on two datasets involving recognition of hand written and street view numbers. CLIP’s 51% accuracy on full number SVHN is well below any published results. Inspection suggests CLIP struggles with repeated characters as well as the low resolution and blurry images of SVHN. CLIP’s zero-shot MNIST performance is also poor and is outperformed by supervised logistic regression on raw pixels, one of the simplest possible machine learning baselines.

SST-2 is a sentence level NLP dataset which we render into images. We include SST-2 in order to check whether CLIP is able to convert low level OCR capability into a higher level representation. Fitting a linear classifier on CLIP’s representation of rendered sentences achives 80.5% accuracy. This is on par with the 80% accuracy of a continuous bag of words baseline using GloVe word vectors pre-trained on 840 billion tokens (Pennington et al., 2014). While this is a simple NLP baseline by today’s standard, and well below the 97.5% of the current SOTA, it is encouraging to see that CLIP is able to turn an image of rendered text into a non-trivial sentence level representation. Fully supervised CLIP is also surprisingly strong on Hateful Meme detection, where CLIP is only 0.7 points behind the current single model SOTA and several points above the best baseline from the original paper. Similar to SST-2, these other results on Hateful Memes use the ground truth text which CLIP does not have access to. Finally, we note that zero-shot CLIP outperforms the best results using fully supervised linear probes across all other 56 models included in our evaluation suite. This suggests CLIP’s OCR capability is at least somewhat unique compared to existing work on self-supervised and supervised representation learning.


UCF101 K700 RareAct
Top-1 AVG mWAP mWSAP
Finetune R(2+1)D-BERTa 98.7 - - -
NS ENet-L2b - 84.8 - -
HT100M S3Dd 91.3 - - -
Baseline I3De - 70.2 - -
Linear MMV FACf 91.8 - - -
NS ENet-L2c 89.4c 68.2c - -
CLIP 92.0 73.0 - -
ZS HT100M S3Dd - - 30.5 34.8
CLIP 80.3 69.6 40.7 44.8
Table 15: Action recognition performance on 3 video datasets. Single model SOTA reported to best of knowledge. Note that linear CLIP and linear NS ENet-L2 are trained and evaluated on a single frame subsampled version of each dataset and not directly comparable to prior work. On Kinetics-700, we report the ActivityNet competition metric which is the average of top-1 and top-5 performance. a(Kalfaoglu et al., 2020) b(Lu et al., 2020) c(Xie et al., 2020) d(Miech et al., 2020b) e(Carreira et al., 2019) f(Alayrac et al., 2020)

E.3 Action Recognition in Videos

For the purpose of learning, a potentially important aspect of natural language is its ability to express, and therefore supervise, an extremely wide set of concepts. A CLIP model, since it is trained to pair semi-arbitrary text with images, is likely to receive supervision for a wide range of visual concepts involving both common and proper nouns, verbs, and adjectives. ImageNet-1K, by contrast, only labels common nouns. Does the lack of broader supervision in ImageNet result in weaker transfer of ImageNet models to tasks involving the recognition of visual concepts that are not nouns?

To investigate this, we measure and compare the performance of CLIP and ImageNet models on several video action classification datasets which measure the ability of a model to recognize verbs. In Table 15 we report results on UCF-101 (Soomro et al., 2012) and Kinetics-700 (Carreira et al., 2019), two common datasets for the task. Unfortunately, our CPU based linear classifier takes a prohibitively long time to evaluate on a video dataset due to the very large number of training frames. To deal with this, we aggressively sub-sample each video to only a single center frame, effectively turning it into an image classification dataset. As a result, our reported performance in a linear evaluation setting likely under estimates performance by a moderate amount.


IN IN-V2 IN-A IN-R ObjectNet IN-Sketch IN-Vid YTBB
Top-1 Top-1 Top-1 Top-1 Top-1 Top-1 PM0 PM10 PM0 PM10
NS EfficientNet-L2a 88.3 80.2 84.9 74.7 68.5 47.6 88.0 82.1 67.7 63.5
FixResNeXt101-32x48d V2b 86.4 78.0 68.4 80.0 57.8 59.1 85.8 72.2 68.9 57.7
Linear Probe CLIP 85.4 75.9 75.3 84.2 66.2 57.4 89.1 77.2 68.7 63.1
Zero-Shot CLIP 76.2 70.1 77.2 88.9 72.3 60.2 95.3 89.2 95.2 88.5
Table 16: Detailed ImageNet robustness performance. IN is used to abbreviate for ImageNet. a(Xie et al., 2020) b(Touvron et al., 2019)

Despite this handicap, CLIP features transfer surprisingly well to this task. CLIP matches the best prior result on UCF-101 in a linear probe evaluation setting and also outperforms all other models in our evaluation suite. On Kinetics-700, CLIP also outperforms the fine-tuned I3D baseline from the original paper. Since it does not require a training stage, we report CLIP’s zero-shot performance when averaging predictions across all frames. CLIP also performs well in this setting and on Kinetics-700 its performance is within 1% of the fully supervised I3D baseline which is trained on 545000 labeled videos. Encouraged by these results, we also measure CLIP’s performance on the recently introduced RareAct dataset (Miech et al., 2020a) which was designed to measure zero-shot recognition of unusual actions like “hammering a phone” and “drilling an egg”. CLIP improves over the prior state of the art, a S3D model trained on automatically extracted captions from 100 million instructional videos, by 10 points.

While CLIP has encouragingly strong performance on the task of action recognition, we note that there are many differences between the models being compared beyond just their form of supervision such as model architecture, training data distribution, dataset size, and compute used. Further work is needed to more precisely determine what specific design decisions contribute to achieving high performance on this task.


1km 25km 200km 750km 2500km
ISNsa 16.9 43.0 51.9 66.7 80.2
CPlaNetb 16.5 37.1 46.4 62.0 78.5
CLIP 13.9 32.9 43.0 62.0 79.3
Deep-Ret+c 14.4 33.3 47.7 61.6 73.4
PlaNetd 8.4 24.5 37.6 53.6 71.3
Table 17: Geolocalization performance on the IM2GPS test set. Metric is percent of images localized within a given radius. Models are ordered by average performance. a(Muller-Budack et al., 2018) b(Hongsuck Seo et al., 2018) c(Vo et al., 2017) c(Weyand et al., 2016)

E.4 Geolocalization

Another behavior we noticed during the development of CLIP was its ability to recognize many places and locations. To quantify this we created the Country211 dataset as described in Appendix A and report results on it throughout the paper. However it is a new benchmark so to compare with prior work on geolocalization we also report results on the IM2GPS test set from Hays & Efros (2008) in Table 17. Since IM2GPS is a regression benchmark, we guess the GPS coordinates of the nearest image in a set of reference images using CLIP’s embedding space. This is not a zero-shot result since it uses nearest-neighbor regression. Despite querying only 1 million images, which is much less than prior work, CLIP performs similarly to several task specific models. It is not, however, competitive with the current state of the art.

E.5 Robustness to Distribution Shift

Section 3.3 provides a high level summary and analysis of ImageNet-related robustness results. We briefly provide some additional numerical details in this appendix. Performance results per dataset are provided in Table 16 and compared with the current state of the art results reported in Taori et al. (2020)’s evaluation suite. Zero-shot CLIP improves the state of the art on 5 of the 7 datasets, ImageNet-R, ObjectNet, ImageNet-Sketch, ImageNet-Vid, and Youtube-BB. CLIP’s improvements are largest on ImageNet-Vid and Youtube-BB due to its flexible zero-shot capability and on ImageNet-R, which likely reflects CLIP’s pre-training distribution including significant amounts of creative content. A similar behavior has been documented for the Instagram pre-trained ResNeXt models as discussed in Taori et al. (2020).

Appendix F Model Hyperparameters

Hyperparameter Value
Batch size 32768
Vocabulary size 49408
Training epochs 32
Maximum temperature 100.0
Weight decay 0.2
Warm-up iterations 2000
Adam β1\beta_{1} 0.9
Adam β2\beta_{2} 0.999 (ResNet), 0.98 (ViT)
Adam ϵ\epsilon 10810^{-8} (ResNet), 10610^{-6} (ViT)
Table 18: Common CLIP hyperparameters
Learning Embedding Input ResNet Text Transformer
Model rate dimension resolution blocks width layers width heads
RN50 5×1045\times 10^{-4} 1024 224 (3, 4, 6, 3) 2048 12 512 8
RN101 5×1045\times 10^{-4} 512 224 (3, 4, 23, 3) 2048 12 512 8
RN50x4 5×1045\times 10^{-4} 640 288 (4, 6, 10, 6) 2560 12 640 10
RN50x16 4×1044\times 10^{-4} 768 384 (6, 8, 18, 8) 3072 12 768 12
RN50x64 3.6×1043.6\times 10^{-4} 1024 448 (3, 15, 36, 10) 4096 12 1024 16
Table 19: CLIP-ResNet hyperparameters
Learning Embedding Input Vision Transformer Text Transformer
Model rate dimension resolution layers width heads layers width heads
ViT-B/32 5×1045\times 10^{-4} 512 224 12 768 12 12 512 8
ViT-B/16 5×1045\times 10^{-4} 512 224 12 768 12 12 512 8
ViT-L/14 4×1044\times 10^{-4} 768 224 24 1024 16 12 768 12
ViT-L/14-336px 2×1052\times 10^{-5} 768 336 24 1024 16 12 768 12
Table 20: CLIP-ViT hyperparameters