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 损失完全基于图像-文本成对样本,无需全局查看成对相似性以进行标准化。Sigmoid 损失同时允许进一步扩大批次大小,同时也在更小批次大小下表现更好。仅使用四个 TPUv4 芯片,我们可以训练一个 4k 批次大小的 Base CLIP 模型和一个 20k 批次大小的 Large LiT 模型,在两天内后者实现了 84.5% 的 ImageNet 零样本分类准确率。这种将批次大小与损失函数分离的方法还允许我们研究样本与成对以及负样本与正样本比例对性能的影响。最后,我们将批次大小推向极限,最高可达一百万,发现扩大批次大小的益处很快减少,32000 的较小批次大小已足够。我们希望我们的研究能够促进更进一步的改进语言-图像预训练的质量和效率。