Part XV — Multimodal Foundation Models: CLIP, Cross-Attention & VLMs · Chapter 11

Assemble a tiny multimodal assistant

Hook

Audio in, an image out — with nothing hand-built in between except two mechanisms this part already built separately. Retrieval finds the right words; generation turns those words into a picture. Chain them, and you have a tiny multimodal assistant.

Intuition
Image: dogImage: catImage: birdCaption: a dog runningCaption: a cat sleepingCaption: a bird flyingAudio: a dog barkingAudio: a cat meowingAudio: a bird chirping
retrieved: "Caption: a dog running" (distance 0.50)
generated value: 2.789 — steered by the retrieved caption's conditioning

Pick an audio clip. It retrieves its nearest caption in the shared embedding space — exactly Chapter 1's mechanism — and that caption's identity selects which noise-conditioning sequence steers the reverse-diffusion process — exactly Chapter 2's mechanism.

Formalize

Two stages, two chapters, one pipeline:

audionearest-neighbor in shared spacecaptionselectsϵ^(xt,t,c)reverse diffusiongenerated value\text{audio} \xrightarrow{\text{nearest-neighbor in shared space}} \text{caption} \xrightarrow{\text{selects}} \hat\epsilon(x_t, t, \mathbf{c}) \xrightarrow{\text{reverse diffusion}} \text{generated value}
  • c\mathbf{c} — the text embedding of whichever caption audio retrieval selected, threaded into the denoiser exactly as in the diffusion chapter.
  • ϵ^(xt,t,c)\hat\epsilon(x_t, t, \mathbf{c}) — the same conditioned noise predictor from the diffusion chapter, now driven by the retrieved caption's embedding.
  • xtx_t, tt — the noisy diffusion state and current timestep, unchanged from that chapter's process.
  1. No new mechanism — just reused pieces

    Nothing here is a new mechanism — it's the exact retrieval rule from audio embeddings, feeding the exact conditioning slot from text-conditioned diffusion.

  2. This is the general shape of multimodal systems

    A working multimodal system is very often just two or three single-modality mechanisms, connected so one's output becomes the next one's input.

Play

Three audio clips, the same shared starting noise, the same reverse-diffusion formula — and three completely different generated values, because retrieval routed each one to a different conditioning sequence before generation ever started.

Worked example

Three audio inputs, run through the full pipeline:

  1. Dog barking routes to the dog caption and dog conditioning

    Retrieval: "Audio: a dog barking" (1.9,3.2)(1.9,3.2) to "Caption: a dog running" (2.2,2.8)(2.2,2.8)(1.92.2)2+(3.22.8)2=0.09+0.16=0.25=0.5\sqrt{(1.9-2.2)^2+(3.2-2.8)^2}=\sqrt{0.09+0.16}=\sqrt{0.25}=0.5. Generation: the dog-conditioned noise sequence [0.7,0.3,0.9,0.6][0.7,-0.3,0.9,-0.6] reverses the shared x4=2.0x_4=2.0 (same mechanism as Chapter 2's first-step check, x32.010x_3\approx2.010) all the way to a final value 2.789\approx2.789.

  2. Cat meowing routes to the cat caption and cat conditioning

    Retrieval: "Audio: a cat meowing" (0.1,1.2)(0.1,1.2) to "Caption: a cat sleeping" (0.3,0.8)(0.3,0.8)(0.10.3)2+(1.20.8)2=0.04+0.16=0.20.45\sqrt{(0.1-0.3)^2+(1.2-0.8)^2}=\sqrt{0.04+0.16}=\sqrt{0.2}\approx0.45. Generation: the cat-conditioned noise sequence [1.2,0.8,0.5,1][-1.2,0.8,-0.5,1] reverses the same x4=2.0x_4=2.0 (first step x33.562x_3\approx3.562, per Chapter 2) to 4.330\approx4.330 — a different destination from the same starting point.

  3. Bird chirping completes the set

    Retrieval: "Audio: a bird chirping" (4.2,0.2)(4.2,0.2) to "Caption: a bird flying" (3.7,0.4)(3.7,0.4)(4.23.7)2+(0.20.4)2=0.25+0.04=0.290.54\sqrt{(4.2-3.7)^2+(0.2-0.4)^2}=\sqrt{0.25+0.04}=\sqrt{0.29}\approx0.54. Generation: the bird-conditioned noise sequence [0.2,0.4,0.9,0.5][-0.2,0.4,-0.9,0.5] (read t=3t{=}3 down to t=0t{=}0), first step x3=(2.00.4×(0.2))/0.62.746x_3=(2.0-\sqrt{0.4}\times(-0.2))/\sqrt{0.6}\approx2.746, reverses all the way to 3.866\approx3.866 — a third distinct value, confirming all three retrieval-then-generation chains work independently and correctly.

Checkpoint

Find the audio input whose full pipeline produces the largest generated value.

Pick an audio input to try it
Summary
audioretrievalcaptionconditioninggeneration\text{audio} \to \text{retrieval} \to \text{caption} \to \text{conditioning} \to \text{generation}

This is the actual shape of most real multimodal systems: not one enormous end-to-end model, but a handful of well-understood single-modality mechanisms — an embedding space here, a conditioned generator there — wired together so information flows from one to the next. Every piece in this pipeline was built, verified, and understood on its own first; the assembly is just plumbing. This closes Part XII — Multimodal, Continued. The next part turns to the modern LLM engineering toolkit: parameter-efficient fine-tuning, scaling laws, and the machinery behind deploying models at scale.