Lesson 4.7 · 7 of 10 · 4 min read · Reviewed 24 Nov 2026
Multimodal embeddings
By the end, you can
- Explain how one space can hold text and images.
- Know when multimodal retrieval is worth it.
One space, two kinds of input
A text model places sentences in a space where similar meanings sit close. A multimodalMultimodal model: A model that can take more than one kind of input, such as text and images, and reason across them. embedding modelEmbedding model: A model trained to turn text (or images) into embeddings for search and comparison, rather than to generate text. does the same for images and text together, so these all land near each other:
"a red bicycle leaning on a wall" (text)
[photo of a red bicycle] (image)
"bike, red, parked" (text)
Training does this by showing the model millions of image and caption pairs and pulling each pair together while pushing mismatched pairs apart. CLIP is the best-known early example.
Two ways to search images
| Route | How | Good at | Weak at |
|---|---|---|---|
| Direct image embedding | Multimodal model embeds each image | Visual similarity, style, objects | Small text inside images |
| Describe, then embed | A vision model (such as Claude with vision) writes a description; a text model embeds it | Explaining charts, reading labels, adding domain words | Costs a model call per image at index time |
Many systems do both and merge the results (hybrid retrievalHybrid search: Combining keyword search (such as BM25) with semantic vector search and merging the results., 22.4).
Documents with pictures
PDFs, slides and screenshots mix text, tables and diagrams. A practical recipe:
- Extract the text layer and embed it in chunksChunking: Splitting documents into smaller passages before embedding and indexing them..
- For each figure, store the image and a generated description.
- Embed the description (and optionally the image).
- At answer time, pass the matching page or image to Claude, which can read images directly.
Where it pays off
- Product search from a photo, or a photo from a description.
- Finding the right slide or diagram in a large deck library.
- Support teams matching screenshots of errors to known issues.
If your content is almost all text, a text model plus image descriptions is usually simpler and good enough.
Key points
- A multimodal embedding model maps images and text into the same space, so a text query can find a picture.
- Models like CLIP learn this by pulling matching image and caption pairs together during training.
- Two routes: embed images directly, or have a vision model describe each image and embed the description.
- Diagrams, scanned forms and screenshots often need text extraction too, because fine print is hard to embed.
Search photos with text using CLIP
Run an open multimodal embedding model locally and find images from a text description.
You will have: A short script and a results table: five text queries, the top two images for each, and whether they were right.
Steps
- Create a Python virtual environment and install the Hugging Face transformers library, a CPU build of PyTorch and Pillow.
- Put 20 of your own photos (or freely licensed ones) in a folder, covering four or five clear themes.
- Load an open CLIP checkpoint with CLIPModel and CLIPProcessor, embed every image once and normalise the vectors.
- Embed five text queries the same way and rank images by cosine similarity.
- Record the top two images per query in a table and mark each hit or miss.
- Try one query that needs reading small text in an image and note how it fails.
Done when
- All 20 images are embedded once and reused for every query.
- At least 4 of 5 queries have a correct top hit.
- Your table notes at least one failure and its likely cause.
Docs: CLIP (Hugging Face Transformers docs) · openai/CLIP on GitHub