Papers › CoCa: Contrastive Captioners are Image-Text Foundation Models

CoCa: Contrastive Captioners are Image-Text Foundation Models

4 May 2022arXiv:2205.01917archive 2025-07-28

Jiahui Yu, ZiRui Wang, Vijay Vasudevan, Legg Yeung, Mojtaba Seyedhosseini, Yonghui Wu

Exploring large-scale pretrained foundation models is of significant interest in computer vision because these models can be quickly transferred to many downstream tasks. This paper presents Contrastive Captioner (CoCa), a minimalist design to pretrain an image-text encoder-decoder foundation model jointly with contrastive loss and captioning loss, thereby subsuming model capabilities from contrastive approaches like CLIP and generative methods like SimVLM. In contrast to standard encoder-decoder transformers where all decoder layers attend to encoder outputs, CoCa omits cross-attention in the first half of decoder layers to encode unimodal text representations, and cascades the remaining decoder layers which cross-attend to the image encoder for multimodal image-text representations. We apply a contrastive loss between unimodal image and text embeddings, in addition to a captioning loss on the multimodal decoder outputs which predicts text tokens autoregressively. By sharing the same computational graph, the two training objectives are computed efficiently with minimal overhead. CoCa is pretrained end-to-end and from scratch on both web-scale alt-text data and annotated images by treating all labels simply as text, seamlessly unifying natural language supervision for representation learning. Empirically, CoCa achieves state-of-the-art performance with zero-shot transfer or minimal task-specific adaptation on a broad range of downstream tasks, spanning visual recognition (ImageNet, Kinetics-400/600/700, Moments-in-Time), crossmodal retrieval (MSCOCO, Flickr30K, MSR-VTT), multimodal understanding (VQA, SNLI-VE, NLVR2), and image captioning (MSCOCO, NoCaps). Notably on ImageNet classification, CoCa obtains 86.3% zero-shot top-1 accuracy, 90.6% with a frozen encoder and learned classification head, and new state-of-the-art 91.0% top-1 accuracy on ImageNet with a finetuned encoder.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2205.01917")

Code

Syntology Ran 9 of 17 code samples harvested from 2 repositories linked to this paper; 8 have no recorded run. Of those that ran: 2 ran · honoured contract; 7 ran with no contract checked.

By repository: community (archive-listed): 17 samples from 2 repositories, 9 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Chaolei98/FreeZAD mentioned on GitHubpytorchMIT report
amitakamath/hard_positives mentioned on GitHubpytorch report
amitakamath/whatsup_vlms mentioned on GitHubpytorchMIT report
facebookresearch/multimodal mentioned on GitHubpytorch report
lucidrains/CoCa-pytorch mentioned on GitHubpytorch report
mlfoundations/open_clip mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

17 samples harvested; 9 ran; 2 honoured the contract we drafted; 8 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

2ran · honoured contract
7ran
8unverified

Licence: 0 of the 17 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

CoCaTextEmbeddings facebookresearch/multimodal/torchmultimodal/models/coca/coca_model.py community (archive-listed) ran · metamorphic tier: deterministic BSD-3-Clause (permissive) · 38c836510c2b097d · report
Fp32LayerNorm facebookresearch/multimodal/torchmultimodal/models/coca/coca_model.py community (archive-listed) ran BSD-3-Clause (permissive) · 1851c02d87765a1f · report
MHAWithCacheOutput facebookresearch/multimodal/torchmultimodal/models/coca/coca_model.py community (archive-listed) ran · metamorphic tier: deterministic BSD-3-Clause (permissive) · c3bf9823eb334b94 · report
MLP facebookresearch/multimodal/torchmultimodal/models/coca/coca_model.py community (archive-listed) ran · metamorphic tier: deterministic BSD-3-Clause (permissive) · 69bbd7902f886836 · report
MultimodalOutput facebookresearch/multimodal/torchmultimodal/models/coca/coca_model.py community (archive-listed) ran · metamorphic tier: deterministic BSD-3-Clause (permissive) · c48e25a9b1ad8b20 · report
TransformerOutput facebookresearch/multimodal/torchmultimodal/models/coca/coca_model.py community (archive-listed) ran · metamorphic tier: deterministic BSD-3-Clause (permissive) · 16907aa066126740 · report
get_causal_attention_mask facebookresearch/multimodal/torchmultimodal/models/coca/coca_model.py community (archive-listed) ran · honoured contract BSD-3-Clause (permissive) · e35be5f71f1604be · report
interpolated_prec_rec Chaolei98/FreeZAD/evaluate.py community (archive-listed) ran fingerprinted MIT (permissive) · 1fc3d3455e5edcbb · report
segment_iou Chaolei98/FreeZAD/evaluate.py community (archive-listed) ran · honoured contract fingerprinted MIT (permissive) · d0744a2fe3151508 · report
CoCaModel facebookresearch/multimodal/torchmultimodal/models/coca/coca_model.py community (archive-listed) unverified BSD-3-Clause (permissive) · c3f20e8434033e06 · report
CoCaMultimodalDecoder facebookresearch/multimodal/torchmultimodal/models/coca/coca_model.py community (archive-listed) unverified BSD-3-Clause (permissive) · d39521c69dad724c · report
CoCaTextDecoder facebookresearch/multimodal/torchmultimodal/models/coca/coca_model.py community (archive-listed) unverified BSD-3-Clause (permissive) · 378d7fee25d36766 · report
MultiHeadAttentionWithCache facebookresearch/multimodal/torchmultimodal/models/coca/coca_model.py community (archive-listed) unverified BSD-3-Clause (permissive) · a73d62315a5ca5ca · report
TransformerDecoder facebookresearch/multimodal/torchmultimodal/models/coca/coca_model.py community (archive-listed) unverified BSD-3-Clause (permissive) · a241668983092d20 · report
TransformerDecoderLayer facebookresearch/multimodal/torchmultimodal/models/coca/coca_model.py community (archive-listed) unverified BSD-3-Clause (permissive) · 3624eeb428e322e8 · report
compute_average_precision_detection Chaolei98/FreeZAD/evaluate.py community (archive-listed) unverified MIT (permissive) · 320499e20591d89f · report
get_video_info Chaolei98/FreeZAD/extract_features.py community (archive-listed) unverified MIT (permissive) · f6224c8305205872 · report

Tasks

Action ClassificationDecoderImage CaptioningImage ClassificationRepresentation LearningRetrievalVideo RetrievalVisual EntailmentVisual Question AnsweringVisual Question Answering (VQA)Visual ReasoningZero-Shot Cross-Modal RetrievalZero-Shot Transfer Image Classification

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Action Classification Kinetics-400 CoCa (finetuned) Acc@1 88.9 #20 of 207 Archive leaderboard report
Action Classification Kinetics-400 CoCa (frozen) Acc@1 88.0 #28 of 207 Archive leaderboard report
Action Classification Kinetics-600 CoCa (finetuned) Top-1 Accuracy 89.4 #16 of 65 Archive leaderboard report
Action Classification Kinetics-600 CoCa (frozen) Top-1 Accuracy 88.5 #19 of 65 Archive leaderboard report
Action Classification Kinetics-700 CoCa (finetuned) Top-1 Accuracy 82.7 #9 of 36 Archive leaderboard report
Action Classification Kinetics-700 CoCa (frozen) Top-1 Accuracy 81.1 #10 of 36 Archive leaderboard report
Action Classification Moments in Time CoCa (finetuned) Top 1 Accuracy 49.0 #3 of 4 Archive leaderboard report
Action Classification Moments in Time CoCa (frozen) Top 1 Accuracy 47.4 #4 of 4 Archive leaderboard report
Image Captioning COCO Captions CoCa BLEU-4 40.9 #16 of 41 Archive leaderboard report
Image Captioning COCO Captions CoCa CIDER 143.6 #16 of 41 Archive leaderboard report
Image Captioning COCO Captions CoCa METEOR 33.9 #16 of 41 Archive leaderboard report
Image Captioning COCO Captions CoCa SPICE 24.7 #16 of 41 Archive leaderboard report
Image Classification ImageNet CoCa (finetuned) Number of params 2100M #1 of 1060 Archive leaderboard report
Image Classification ImageNet CoCa (finetuned) Top 1 Accuracy 91.0% #1 of 1060 Archive leaderboard report
Image Classification ObjectNet CoCa Top-1 Accuracy 82.7 #1 of 106 Archive leaderboard report
Video Retrieval MSR-VTT CoCa (zero-shot) text-to-video R@1 30.0 #25 of 40 Archive leaderboard report
Video Retrieval MSR-VTT CoCa (zero-shot) text-to-video R@10 61.6 #25 of 40 Archive leaderboard report
Video Retrieval MSR-VTT CoCa (zero-shot) text-to-video R@5 52.4 #25 of 40 Archive leaderboard report
Video Retrieval MSR-VTT CoCa (zero-shot) video-to-text R@1 49.9 #25 of 40 Archive leaderboard report
Video Retrieval MSR-VTT CoCa (zero-shot) video-to-text R@10 81.4 #25 of 40 Archive leaderboard report
Video Retrieval MSR-VTT CoCa (zero-shot) video-to-text R@5 73.4 #25 of 40 Archive leaderboard report
Visual Entailment SNLI-VE test CoCa Accuracy 87.1 #3 of 8 Archive leaderboard report
Visual Entailment SNLI-VE val CoCa Accuracy 87.0 #3 of 9 Archive leaderboard report
Visual Question Answering VQA v2 test-dev CoCa Accuracy 82.3 #2 of 11 Archive leaderboard report
Visual Reasoning NLVR2 Dev CoCa Accuracy 86.1 #5 of 15 Archive leaderboard report
Visual Reasoning NLVR2 Test CoCa Accuracy 87.0 #4 of 14 Archive leaderboard report
Zero-Shot Cross-Modal Retrieval COCO 2014 CoCa Image-to-text R@1 66.3 #9 of 18 Archive leaderboard report
Zero-Shot Cross-Modal Retrieval COCO 2014 CoCa Image-to-text R@10 91.8 #9 of 18 Archive leaderboard report
Zero-Shot Cross-Modal Retrieval COCO 2014 CoCa Image-to-text R@5 86.2 #9 of 18 Archive leaderboard report
Zero-Shot Cross-Modal Retrieval COCO 2014 CoCa Text-to-image R@1 51.2 #9 of 18 Archive leaderboard report
Zero-Shot Cross-Modal Retrieval COCO 2014 CoCa Text-to-image R@10 82.0 #9 of 18 Archive leaderboard report
Zero-Shot Cross-Modal Retrieval COCO 2014 CoCa Text-to-image R@5 74.2 #9 of 18 Archive leaderboard report
Zero-Shot Cross-Modal Retrieval Flickr30k CoCa Image-to-text R@1 92.5 #5 of 22 Archive leaderboard report
Zero-Shot Cross-Modal Retrieval Flickr30k CoCa Image-to-text R@10 99.9 #5 of 22 Archive leaderboard report
Zero-Shot Cross-Modal Retrieval Flickr30k CoCa Image-to-text R@5 99.5 #5 of 22 Archive leaderboard report
Zero-Shot Cross-Modal Retrieval Flickr30k CoCa Text-to-image R@1 80.4 #5 of 22 Archive leaderboard report
Zero-Shot Cross-Modal Retrieval Flickr30k CoCa Text-to-image R@10 97.7 #5 of 22 Archive leaderboard report
Zero-Shot Cross-Modal Retrieval Flickr30k CoCa Text-to-image R@5 95.7 #5 of 22 Archive leaderboard report
Zero-Shot Transfer Image Classification ImageNet CoCa Accuracy (Private) 86.3 #3 of 23 Archive leaderboard report
Zero-Shot Transfer Image Classification ImageNet V2 CoCa Accuracy (Private) 80.7 #3 of 13 Archive leaderboard report
Zero-Shot Transfer Image Classification ImageNet-A CoCa Accuracy (Private) 90.2 #1 of 13 Archive leaderboard report
Zero-Shot Transfer Image Classification ImageNet-R CoCa Accuracy 96.5 #2 of 12 Archive leaderboard report
Zero-Shot Transfer Image Classification ImageNet-Sketch CoCa Accuracy (Private) 77.6 #1 of 7 Archive leaderboard report
Zero-Shot Transfer Image Classification ObjectNet CoCa Accuracy (Private) 82.7 #3 of 9 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

CLIPSimVLM

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections