Topic 3 of 5 · 5 min read
Captioning images versus embedding them directly
Goal: Plan an indexing pipeline for a mixed image and text library and state when captions, direct embeddings or both are worth the cost.
You can make images searchable by writing a text description of each one, by embedding the pixels directly, or by doing both, and each choice trades cost, accuracy and upkeep. A caption pipeline turns the problem into ordinary text search. A direct embedding pipeline skips the text and compares meaning in vector space.
Check yourself · 1 of 3
Which query is best served by captions plus keyword search?
Why it matters
A mixed library holds photos, screenshots, diagrams and text documents. Teams often pick one method by habit and then wonder why exact lookups or "looks like this" queries fail. The decision also sets your bill: captioning calls a vision-language model once per image, and embedding calls an embedding model once per image.
The three options
Captions. A model such as Claude, GPT or Gemini writes a description and any visible text. You store it, index it with keyword search (BM25) or text embeddings, and filter on it. Strengths: searchable by exact words and identifiers, readable by a human, easy to debug and to edit. Weakness: the caption holds only what the model chose to mention. If it never wrote "left-handed scissors", you cannot find them.
Direct embeddings. The image vector captures visual meaning, including things nobody described. Strengths: "find images like this one", style and look. Weakness: opaque, poor at small text and counts, and you cannot read why a result matched.
Both. Run keyword search on captions and vector search on embeddings, then merge the ranked lists. This is hybrid search. It costs the most and covers the most query types.
How to plan it
- Group queries: identifiers and exact words, descriptions, visual similarity.
- Map each group to a method. Identifiers need captions or OCR. Similarity needs embeddings.
- Write the caption prompt to ask for visible text, objects and the setting, in a fixed format.
- Record the model name and prompt version next to each caption and vector.
- Plan re-indexing: when the caption prompt or the embedding model changes, stored values are stale.
Before and after
Before: a team captions 50,000 product photos once with a short prompt. Months later, support asks for searches by the printed model code, which the captions never mention.
After: the prompt is revised to transcribe visible text, versioned, and only images that lack the new field are re-captioned. Embeddings are added for visual similarity.
What goes wrong
- Captions fixed at index time quietly go stale when needs change.
- Captioning every image at full size when a cheaper model would do for simple photos.
- Captions that contain a model's guess presented as fact, such as a brand it could not read.
Examples
Indexing plan for a screenshot library
- OCR every screenshot and store the text.
- Caption each image: app name, screen, any visible error text, in a fixed template.
- Embed each image with a multimodal model for "looks like this" queries.
- Search captions and OCR with keywords, search embeddings with vectors, merge by rank.
- Store
caption_prompt_v2and the model name on each record. Re-run only records with an older version.
Key points
- Captions make images searchable by exact words and identifiers, but they only contain what the caption model chose to mention.
- Direct embeddings capture unstated visual meaning and similarity, but are opaque and weak at small text.
- Hybrid search merges keyword results over captions with vector results over embeddings to cover both query types.
- Store the model and prompt version with each caption and vector so you know what is stale.
- Plan the cost up front: one model call per image per method, repeated whenever you re-index.
Common mistakes
- Using a one-line caption prompt and expecting it to answer later, different questions.
- Skipping version fields, then being unable to tell which records need re-indexing.
- Letting a vision model state brand names or numbers it could not actually read.
- Paying for both methods on a library where one query type accounts for nearly all searches.
Check yourself · 2 of 3
What is a real weakness of a caption-only index?
Check yourself · 3 of 3
You change the caption prompt to include visible text. What should you do with existing records?
Practice items, not counted towards your mastery.
Start here
- ColPali: Efficient Document Retrieval with Vision Language Models (opens in a new tab)PaperFree
Introduces retrieval over page screenshots and the ViDoRe benchmark, with the case against parse-then-chunk pipelines.
- Learning Transferable Visual Models From Natural Language Supervision (CLIP paper) (opens in a new tab)PaperFree
The paper behind shared image and text vector spaces, including its stated weak spots such as counting and fine detail.
- ColBERT: Efficient and Effective Passage Search via Contextualized Late Interaction over BERT (opens in a new tab)PaperFree
Defines late interaction: one vector per token and a max-similarity score, the idea ColPali applies to image patches.
More for this topic
- Image similarity with Hugging Face Datasets and Transformers (opens in a new tab)ArticleFree
A short runnable walk-through of embedding images and finding nearest neighbours.
- Embeddings (Cohere docs) (opens in a new tab)DocsFree
Covers embedding images and text with a hosted model and the input types for documents and queries.