Braj Kishore
JourneyVaultML FoundationsAI PM GuideAgenticNewsWork With MeMentorshipPulseNow
Say hi

Hiring · Building · Investing

Have a system — or a team —that needs to scale?

info@avyxon.ai

Usually replies within a day · track record here

JourneyVaultML FoundationsAI PM GuideAgenticNewsWork With MeMentorshipPulseNow
LinkedInXYouTubeSubstackInstagramThreadsFacebookDiscordGitHubTopmate
© 2026 Braj Kishore · Bengaluru, INThink Big · Start Small · Scale Fast
ML Foundations
14Track 4 · The bridge to GenAI

Multimodal: one space for pixels and words

How CLIP put images and captions in the same vector space and got zero-shot classification for free — and how diffusion learned to generate by reversing noise.

40 min1 interactive5 sources

Before CLIP, classifying an image as 'a photo of a chest x-ray showing pneumonia' required a labelled dataset of exactly that. After CLIP, you type the sentence and it works — because the image and the sentence land near each other in the same space, and nobody trained on that specific label.

The intuition

Two languages, one shared meaning-space. Train an image encoder and a text encoder together so that a picture of a dog and the words 'a photo of a dog' end up as neighbours. Once they share coordinates, comparing across modalities is just a dot product.

Unlearn this

That multimodal models 'understand' images the way they parse text. What they mostly have is an alignment — a mapping from pixels into a representation the language side can consume. That's enormously useful and also why they fail on tasks needing precise spatial reasoning, counting, or reading small text in an image.

01CLIP: contrastive training on captions the internet already wrote

CLIP trains two encoders — one for images, one for text — on roughly 400 million image-caption pairs scraped from the web. The captions are the free labels: nobody annotated anything, the internet had already described its own pictures.

The objective is contrastive. Take a batch of N pairs, embed all images and all texts, and compute the N×N similarity matrix. Maximise the similarity of the N correct pairs on the diagonal and minimise all N²−N incorrect ones. It's a classification problem over the batch, in both directions, and it is the same cross-entropy loss from Lesson 4 applied to a similarity matrix.

Zero-shot classification then falls out with no extra training. To classify an image into a set of categories, write each category as a sentence — 'a photo of a {label}' — embed them all, embed the image, and take the nearest. The set of classes is defined at inference time by what you type, which is a genuinely different capability from a fixed softmax head over 1,000 ImageNet classes.

Learning Transferable Visual Models From Natural Language Supervision (CLIP)Radford et al., ICML · 2021

Try it

Pull the pairs together, push the rest apart

Train the contrastive objective and watch zero-shot classification appear without being asked for.

02Diffusion: learn to destroy, then run it backwards

The forward process is trivially defined: repeatedly add a small amount of Gaussian noise to an image until, after enough steps, nothing is left but noise. No learning is involved — it's a fixed schedule.

The model learns the reverse. Given a noisy image and a timestep, predict the noise that was added. Train that on millions of images and you have a denoiser, and generation becomes: start from pure noise and denoise repeatedly, steering each step with a text embedding, until an image appears.

Two practical points worth knowing. Latent diffusion runs the whole process in a compressed latent space rather than at pixel resolution, which is what made high-resolution generation affordable and is the architecture behind most open image models. And classifier-free guidance scales the difference between the conditioned and unconditioned predictions to trade diversity for prompt adherence — it's the 'guidance scale' slider in every image tool.

Note the shape of it: another self-supervised objective with free labels (you know exactly what noise you added), trained with the same loop from Track 2. The pattern repeats everywhere once you can see it.

Denoising Diffusion Probabilistic ModelsHo, Jain & Abbeel, NeurIPS · 2020High-Resolution Image Synthesis with Latent Diffusion ModelsRombach et al., CVPR · 2022Diffusion ExplainerPolo Club, Georgia Tech

03Why a shared space is the enabling idea

Once modalities share a representation, capabilities compose without new training. Text-to-image search over a photo library. Image-to-text retrieval. Guiding a generator with a text prompt. Feeding image patches into a language model as if they were tokens — which is broadly how modern vision-language models work: a vision encoder produces embeddings that are projected into the LLM's token space and attended over like any other tokens.

That last point is the connection back to Lesson 12. Once anything can be projected into the sequence of vectors a transformer consumes, attention doesn't care whether it started as a word, a patch, an audio frame or a video clip. Multimodality is less a new architecture than a new set of adapters into one that already existed.

Embedding ProjectorTensorFlow
The vocabulary, defined once
Contrastive learning
Pull matching pairs together and push mismatched pairs apart in embedding space. Free labels from co-occurrence.
Shared embedding space
One vector space holding several modalities, so cross-modal comparison is a dot product.
Zero-shot classification
Defining the classes at inference by writing them as text. Falls out of CLIP-style alignment for free.
Diffusion
Learn to predict added noise, then generate by iteratively denoising from pure noise.
Latent diffusion
Diffusion run in a compressed latent space instead of pixel space. What made high-resolution generation affordable.
Classifier-free guidance
Amplify the gap between conditioned and unconditioned predictions. The prompt-adherence vs diversity dial.

The lab

Everything above, with the dials exposed. Break it deliberately — the failure modes are where the understanding is.

Try it

Pull the pairs together, push the rest apart

Train the contrastive objective and watch zero-shot classification appear without being asked for.

What they actually ask

Multimodal: one space for pixels and words — the interview questions

QHow would you build image search over a product catalogue?Answer it out loud first, then open this

Embed every product image with a CLIP-style encoder once, offline, into a vector index. At query time embed the user's text — or their uploaded photo — into the same space and take nearest neighbours. It's zero-shot, so it handles queries nobody enumerated, and the same index serves both text-to-image and image-to-image search. I'd measure recall@k against a labelled query set, and keep keyword search alongside it, because embeddings are weak on exact identifiers like SKUs.

What they're listening for
Adding 'keep keyword search alongside' shows you know where dense retrieval actually fails.

QWhy do vision-language models struggle with counting objects?Answer it out loud first, then open this

The training objective never required it. Contrastive caption matching rewards getting the gist right — a caption saying 'some sheep' matches a photo of any number of sheep — so precise counting is not something the loss ever pushed on. It's a good illustration of the general rule: models are good at what the loss measured, not at what you assumed it implied.

Before you move on

Recall beats re-reading, every time. Answer before you flip.

Multimodal: one space for pixels and words · self-test1 / 3

How does CLIP do zero-shot classification?

Go to the primary sources

Where each claim above comes from. Open them alongside the lesson rather than after it — the papers are shorter than you think, and the figures usually carry the whole argument.

Paper
  • Learning Transferable Visual Models From Natural Language Supervision (CLIP)(2021)Radford et al., ICMLFigure 1 shows the contrastive batch matrix and the zero-shot classification recipe in a single diagram. Read that page if nothing else.
  • Denoising Diffusion Probabilistic Models(2020)Ho, Jain & Abbeel, NeurIPSThe paper that made diffusion work. The key simplification — train the network to predict the noise — is in section 3.2.
  • High-Resolution Image Synthesis with Latent Diffusion Models(2022)Rombach et al., CVPRMoving diffusion into a compressed latent space — the change that made high-resolution generation affordable, and the basis of Stable Diffusion.
Play with it
  • Diffusion ExplainerPolo Club, Georgia TechRun Stable Diffusion interactively and watch the denoising steps and the effect of guidance scale, prompt by prompt.
  • Embedding ProjectorTensorFlowRotate a real embedding space in 3D and watch semantic neighbours cluster. The fastest way to make 'shared space' concrete.

External links open in a new tab. Every URL was reachable when this page was written; links rot, so treat the list as a map rather than a guarantee.

Got it? Tick it off — progress saves on this device.

← PreviousHow a transformer becomes an LLMNext →From model to agent
Pull the pairs together, push the rest apartstep 0 · loss 2.200

The shared embedding space

🐕dog🐈cat🚲bicycle🍕pizza🏔️mountain🎸guitardashed line = a matched pair

Similarity matrix — the diagonal is the objective

dogcatbicyclepizzamountainguitar🐕🐈🚲🍕🏔️🎸🐕 ↔ "a photo of a dog": 0.69🐕 ↔ "a photo of a cat": -0.65🐕 ↔ "a photo of a bicycle": -0.83🐕 ↔ "a photo of a pizza": -0.95🐕 ↔ "a photo of a mountain": -0.83🐕 ↔ "a photo of a guitar": 0.86🐈 ↔ "a photo of a dog": 0.25🐈 ↔ "a photo of a cat": -0.20🐈 ↔ "a photo of a bicycle": -1.00🐈 ↔ "a photo of a pizza": -0.98🐈 ↔ "a photo of a mountain": -0.46🐈 ↔ "a photo of a guitar": 1.00🚲 ↔ "a photo of a dog": -0.33🚲 ↔ "a photo of a cat": 0.37🚲 ↔ "a photo of a bicycle": -0.88🚲 ↔ "a photo of a pizza": -0.72🚲 ↔ "a photo of a mountain": 0.11🚲 ↔ "a photo of a guitar": 0.85🍕 ↔ "a photo of a dog": 0.49🍕 ↔ "a photo of a cat": -0.53🍕 ↔ "a photo of a bicycle": 0.78🍕 ↔ "a photo of a pizza": 0.59🍕 ↔ "a photo of a mountain": -0.29🍕 ↔ "a photo of a guitar": -0.74🏔️ ↔ "a photo of a dog": -0.77🏔️ ↔ "a photo of a cat": 0.80🏔️ ↔ "a photo of a bicycle": -0.51🏔️ ↔ "a photo of a pizza": -0.27🏔️ ↔ "a photo of a mountain": 0.61🏔️ ↔ "a photo of a guitar": 0.45🎸 ↔ "a photo of a dog": 0.93🎸 ↔ "a photo of a cat": -0.91🎸 ↔ "a photo of a bicycle": -0.52🎸 ↔ "a photo of a pizza": -0.72🎸 ↔ "a photo of a mountain": -0.99🎸 ↔ "a photo of a guitar": 0.57bordered cells = the 6 correct pairs
batch accuracy 0%

Zero-shot classification — pick an image, rank the captions

  1. 1a photo of a guitar0.86
  2. 2a photo of a dog0.69
  3. 3a photo of a cat-0.65
Before training, an image sits near captions it has nothing to do with, and the similarity matrix is noise. Press Train and watch the diagonal light up while everything off it darkens. The loss is doing exactly one thing: raising the similarity of the 6 matched pairs and lowering the other 30.

Six images, six captions, one shared space. The objective only ever says 'this caption goes with this image, those five don't' — everything else, including zero-shot classification, falls out of that.

Pull the pairs together, push the rest apartstep 0 · loss 2.200

The shared embedding space

🐕dog🐈cat🚲bicycle🍕pizza🏔️mountain🎸guitardashed line = a matched pair

Similarity matrix — the diagonal is the objective

dogcatbicyclepizzamountainguitar🐕🐈🚲🍕🏔️🎸🐕 ↔ "a photo of a dog": 0.69🐕 ↔ "a photo of a cat": -0.65🐕 ↔ "a photo of a bicycle": -0.83🐕 ↔ "a photo of a pizza": -0.95🐕 ↔ "a photo of a mountain": -0.83🐕 ↔ "a photo of a guitar": 0.86🐈 ↔ "a photo of a dog": 0.25🐈 ↔ "a photo of a cat": -0.20🐈 ↔ "a photo of a bicycle": -1.00🐈 ↔ "a photo of a pizza": -0.98🐈 ↔ "a photo of a mountain": -0.46🐈 ↔ "a photo of a guitar": 1.00🚲 ↔ "a photo of a dog": -0.33🚲 ↔ "a photo of a cat": 0.37🚲 ↔ "a photo of a bicycle": -0.88🚲 ↔ "a photo of a pizza": -0.72🚲 ↔ "a photo of a mountain": 0.11🚲 ↔ "a photo of a guitar": 0.85🍕 ↔ "a photo of a dog": 0.49🍕 ↔ "a photo of a cat": -0.53🍕 ↔ "a photo of a bicycle": 0.78🍕 ↔ "a photo of a pizza": 0.59🍕 ↔ "a photo of a mountain": -0.29🍕 ↔ "a photo of a guitar": -0.74🏔️ ↔ "a photo of a dog": -0.77🏔️ ↔ "a photo of a cat": 0.80🏔️ ↔ "a photo of a bicycle": -0.51🏔️ ↔ "a photo of a pizza": -0.27🏔️ ↔ "a photo of a mountain": 0.61🏔️ ↔ "a photo of a guitar": 0.45🎸 ↔ "a photo of a dog": 0.93🎸 ↔ "a photo of a cat": -0.91🎸 ↔ "a photo of a bicycle": -0.52🎸 ↔ "a photo of a pizza": -0.72🎸 ↔ "a photo of a mountain": -0.99🎸 ↔ "a photo of a guitar": 0.57bordered cells = the 6 correct pairs
batch accuracy 0%

Zero-shot classification — pick an image, rank the captions

  1. 1a photo of a guitar0.86
  2. 2a photo of a dog0.69
  3. 3a photo of a cat-0.65
Before training, an image sits near captions it has nothing to do with, and the similarity matrix is noise. Press Train and watch the diagonal light up while everything off it darkens. The loss is doing exactly one thing: raising the similarity of the 6 matched pairs and lowering the other 30.

Six images, six captions, one shared space. The objective only ever says 'this caption goes with this image, those five don't' — everything else, including zero-shot classification, falls out of that.