All models

coca_base

An image-text encoder-decoder trained with contrastive and captioning losses in a single forward pass.

Multimodal · 1,834 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (20 KB)

Open in a new tab

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.

At a glance

Family
CoCa
Parameters
443.8M
Operations
1,834
Framework
PyTorch
Recurrent
No
Published
Transactions on Machine Learning Research (arXiv 2022)
Cited by
576 (as of 19 October 2026)
Authors
Jiahui Yu, Zirui Wang, Vijay Vasudevan and others
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m3826
Graph hash
c4e6c4ae1aad03d255b4da3fa919ce46cdfba694baf4eed073f0893ebc73adc3
Skeleton hash
7ea1f94b1e02940a58ccdc411424bfb3353ae7d2c5882c2238ad6db8a2d30b03
Architecture hash
93f99d0ec24c6572956f85b0c8e7069f55228b2cea708b91997dbde481e7cb19
Diagram SHA-256
67822f8f337931ef4ed5d286ffd105185ca42f9d7b300e4f1adb5385a5009f85
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

The open_clip build returns image features, text features and a logit scale. It also returns caption logits from its text decoder.

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.

  • coca
  • contrastive captioner
  • contrastive captioners
  • image-text foundation model
  • open_clip coca
  • coca_base
  • image captioning
  • zero-shot classification
  • vision-language
  • multimodal

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@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}, 
}