
coca_base
Multimodal1,834 ops443.8M params
An image-text encoder-decoder trained with contrastive and captioning losses in a single forward pass.
Multimodal · 990 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
The CoCa-pytorch build by lucidrains uses parallel SwiGLU feedforwards for both the unimodal and multimodal transformers as well as the cross attention blocks. Its configuration uses 20000 text tokens.
About this model's family
CoCa, the Contrastive Captioner, is an image-text encoder-decoder foundation model pretrained jointly with a contrastive loss and a captioning loss, so one network subsumes the abilities of contrastive models like CLIP and generative ones like SimVLM.
The text decoder is split in two: the first half of its layers omit cross-attention and encode text alone, while the remaining layers cross-attend to the image encoder for multimodal representations. A contrastive loss is applied between the image embedding and the unimodal text embedding, and a captioning loss on the multimodal decoder's autoregressive token predictions. Because the two objectives share one computational graph, both are computed with minimal overhead. Attentional poolers adapt the image features to each objective, with 256 queries for the generative loss and a single query for the contrastive loss. Following ALIGN, images are encoded at 288×288 resolution with 18×18 patches, giving 256 image tokens.
The paper's largest model follows a ViT-giant setup with 1B parameters in the image encoder and 2.1B altogether with the text decoder. On ImageNet classification the paper reports 86.3% zero-shot top-1 accuracy, 90.6% with a frozen encoder and learned classification head, and 91.0% with a finetuned encoder. The coca_base build here is one of the CoCa configs listed by the open_clip library, alongside coca_ViT-B-32 and coca_roberta-ViT-B-32.
Key idea. CoCa pretrains one image-text encoder-decoder jointly with contrastive and captioning losses, subsuming the capabilities of contrastive models like CLIP and generative models like SimVLM.
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
@misc{yu2022cocacontrastivecaptionersimagetext,
title={CoCa: Contrastive Captioners are Image-Text Foundation Models},
author={Jiahui Yu and Zirui Wang and Vijay Vasudevan and Legg Yeung and Mojtaba Seyedhosseini and Yonghui Wu},
year={2022},
eprint={2205.01917},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2205.01917},
}