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批量已足够。我们期望本研究能推动语言-图像预训练质量与效率的进一步探索。