Lesson 1 of 5 · 4 min read
Text-to-Image Pipelines
Every mechanism from the previous section — guidance, cross-attention conditioning — exists to answer one practical question: given a sentence of text, how do you actually get a picture out the other end? This note assembles them into one pipeline.
The question it answers
"How do a text prompt and a diffusion model actually combine into a finished image?" A text-to-image pipeline has three cooperating parts: a text encoder turns the prompt into embeddings; those embeddings condition every denoising step through cross-attention, letting the image-in-progress look at the prompt; and classifier-free guidance controls how strongly the final image is pulled toward matching that conditioning, versus simply being a plausible image in general. None of the three parts is new — this is where they're wired together.
Intuition
A diffusion model without any conditioning is like a sculptor chipping away at marble with no brief beyond "reveal something that looks like it belongs in this studio." Text conditioning hands the sculptor a written description to consult at every stage. Guidance is how insistently they follow it — ignore it entirely, follow it as one consideration among many, or let it override everything else about what "looks right" on its own.
Definition and notation
pipeline, per denoising step:
1. encode prompt → conditioning embeddings (text encoder, done once)
2. image-in-progress attends over those embeddings (cross-attention, every step)
3. combine conditional and unconditional scores (classifier-free guidance, every step)
4. take one denoising step using the combined score
→ repeat steps 2–4 until the image has fully denoised
A worked example
Three toy "concepts" sit at fixed positions: cat at (−2, 2), dog at (2, 2), bird at (0, −2.5). Starting every prompt from the same neutral point (0, 0) and running 6 CFG-guided denoising steps (guidance scale 3) toward whichever concept the prompt names:
prompt "cat": final position (-1.970, 2.012) target (-2, 2)
prompt "dog": final position ( 1.970, 2.012) target ( 2, 2)
prompt "bird": final position ( 0.000, -2.412) target ( 0, -2.5)
Each prompt's own conditioning pulled the same starting point toward a different target, landing within a few percent of the exact concept position after only 6 steps — the entire pipeline, from "which word was in the prompt" to "where the generated point ended up," runs through nothing but conditioning and guidance applied repeatedly.
Bench
Interactive bench: Text prompt → denoised image latent. Choose a prompt and step through a toy denoising process that pulls a point toward the matching concept.
Try this
- Choose each of the three prompts and step through their denoising paths.
- Compare how closely each path's final step lands on its target concept.
- Notice all three paths start from the exact same point — only the prompt changes where they end up.
What you should notice: the three concepts are generated by the exact same stepping procedure; the prompt only changes which direction the conditioning pulls, not how the pulling itself works.
Where it appears in AI
- Every major text-to-image system (Stable Diffusion, DALL·E, Imagen) follows exactly this three-part structure, differing mainly in which text encoder, which denoising architecture, and what guidance scale they default to.
- The text encoder is often a model trained on a completely different task (frequently a contrastive text-image model), reused here purely to produce conditioning embeddings.
- the image side of this pipeline usually isn't a single pass over raw pixels — most pipelines denoise a compressed latent representation, decoded to pixels only at the very end.
Common pitfalls
- Thinking the text encoder "draws" the image. It only produces the conditioning embeddings; all the actual image content comes from the denoising process reading and reacting to those embeddings over many steps.
- Assuming one pass through the pipeline is instant. Realistic pipelines run tens to hundreds of denoising steps, each one a full cross-attention-and-guidance pass — this worked example's 6 steps is a deliberately small illustration.
- Forgetting guidance and cross-attention are doing different jobs. Cross-attention is how the condition gets read at all; guidance is how strongly the result is pulled toward matching it. Removing either changes the result in a different way.
Quick check
1. What are the three cooperating parts of a text-to-image pipeline?
A text encoder (turns the prompt into conditioning embeddings), cross-attention (lets the image-in-progress read those embeddings at every step), and classifier-free guidance (controls how strongly the result is pulled toward the condition).2. In the worked example, what determined where each prompt's final position landed?
Only the target concept position named by the prompt — every prompt started from the exact same point and ran the same guided-denoising procedure.3. Does the text encoder generate any part of the image's content directly?
No — it only produces conditioning embeddings; the image content is produced by the denoising process, which repeatedly reads those embeddings through cross-attention.Key terms
- Text encoder: the component that turns a text prompt into conditioning embeddings for the rest of the pipeline.
- Text-to-image pipeline: a text encoder, cross-attention conditioning, and classifier-free guidance combined to turn a prompt into an image.
- Denoising step: one iteration of the diffusion process, informed by the conditioning at every step.
Related
Classifier-Free Guidance · Cross-Attention Conditioning for Generation · Super-Resolution and Upscaling