SmallCap
Image captioner that links a CLIP encoder to a GPT-2 decoder and conditions on retrieved captions.
Multimodal · 1,160 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.
At a glance
- Task
- Multimodal
- Parameters
- 257.6M
- Operations
- 1,160
- Framework
- PyTorch
- Recurrent
- No
- Published
- CVPR 2023
- Cited by
- 133 (as of 27 October 2026)
- Authors
- Rita Ramos, Bruno Martins, Desmond Elliott, Yova Kementchedjhieva
- Source
- GitHub: RitaRamo/smallcap
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
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.
Details
- Stable ID
- m20469
- Graph hash
- 1a6268829c8c62ac09a62c2bed3ffb2a658058adbd650ebc25df92e948c8a91b
- Skeleton hash
- a84dd6b7e5519ddc212e03ac6669c7ee5dd928ed890bffd6365039ee1a7baadc
- Architecture hash
- fe04e38d6f54bcf558ebd686fecedb7001d78d9da95fe487bc2a8a3909162155
- Diagram SHA-256
- 8e3eaf6998bf48a5964e6a23d6b4315c4291216c2445e91d166c6e160a9d71f6
- 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
SmallCap is an image captioning model that generates a caption conditioned on an input image and on related captions retrieved from a datastore. The paper presents it as an alternative to large models, noting that work on scaling data and model size had substantially increased the cost of pre-training and finetuning.
The model joins a pre-trained CLIP encoder to a GPT-2 decoder, and the only learned parameters are in newly introduced cross-attention layers between the two. Because the contents of the datastore can be replaced, SmallCap can transfer to new domains without additional finetuning and can use large-scale data without training. The paper reports that SmallCap, trained only on COCO, has competitive performance on that benchmark and transfers to other domains without retraining, solely through retrieval from target-domain data.
The authors' pretrained model is available on HuggingFace at Yova/SmallCap7M. Using it also requires the retrieval datastore, a COCO index with its associated captions. The training code names models by retrieval setting and size, for example rag_7M for a model trained with retrieval augmentation and 7M trainable parameters.
Key idea. SmallCap captions images by conditioning a pre-trained GPT-2 decoder on retrieved captions and training only new cross-attention layers that connect it to a pre-trained CLIP encoder.
- SmallCap
- SmallCap7M
- image captioning
- retrieval-augmented captioning
- retrieval augmentation
- lightweight image captioning
- image-to-text
- caption generation
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{ramos2023smallcaplightweightimagecaptioning,
title={SmallCap: Lightweight Image Captioning Prompted with Retrieval Augmentation},
author={Rita Ramos and Bruno Martins and Desmond Elliott and Yova Kementchedjhieva},
year={2023},
eprint={2209.15323},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2209.15323},
}