We propose a simple pairwise sigmoid loss for image-text pre-training. Unlike standard contrastive learning with softmax normalization, the sigmoid loss operates solely on image-text pairs and does not require a global view of the pairwise similarities for normalization. The sigmoid loss simultaneously allows further scaling up the batch size, while also performing better at smaller batch sizes. With only four TPUv4 chips, we can train a Base CLIP model at 4k batch size and a Large LiT model at 20k batch size, the latter achieves 84.5% ImageNet zero-shot accuracy in two days. This disentanglement of the batch size from the loss further allows us to study the impact of examples vs pairs and negative to positive ratio. Finally, we push the batch size to the extreme, up to one million, and find that the benefits of growing batch size quickly diminish, with a more reasonable batch size of 32k being sufficient. We hope our research motivates further explorations in improving the quality and efficiency of language-image pre-training.
翻译:我们提出一种用于图文预训练的简单成对sigmoid损失函数。与采用softmax归一化的标准对比学习不同,该sigmoid损失仅作用于图像-文本对,无需全局视角下的成对相似度归一化。该损失函数既能支持更大批量的训练扩展,又能在小批量场景下表现更优。仅需四块TPUv4芯片,我们即可在4k批量训练Base CLIP模型,并在20k批量下训练Large LiT模型,后者在两天内达到84.5%的ImageNet零样本准确率。这种损失函数与批量的解耦特性使我们能够深入研究样本与配对数量、负对与正对比率的影响。最后,我们将批量推至极限(高达百万级),发现扩大批量的收益迅速递减,采用更合理的32k批量即可满足需求。我们希望本研究能激励学界进一步探索提升语言-图像预训练质量与效率的路径。