READ IN CLOUD READER →
CHAPTER 3 OF 6

How Words Guide the Picture

From the monograph How AI Creates Images by Leo Odåsnac · ~11 min read (2,023 words)
auto_stories Open this chapter in the interactive reading room
CLOUD READER →

Turning a Prompt into a Guide

The random noise can become a bicycle scene, but noise alone does not specify which scene. To make the result answer a prompt, the model needs a way to bring the words into the image-making process. It does not pass the sentence directly into the denoising machinery as English. First, the sentence is converted into numbers the model can work with.

Take: “a photograph of a red bicycle outside a blue café on a rainy Parisian street.” A tokenizer breaks the prompt into pieces called tokens, which a text encoder—a neural network trained to represent language—then processes. A token might be a whole short word, part of a longer word, or punctuation. Each token is mapped to a list of numbers, a numerical representation called an embedding. The encoder also processes how those tokens relate in context, helping represent the connection between red and bicycle, rather than treating each as an isolated dictionary entry.

An embedding is not a tiny picture hiding inside the word. Nor is it a direct instruction such as “paint these 37 pixels red.” It is better thought of as a position in a learned landscape of meanings and associations. During training, the system encounters many examples linking language with images. Across those examples, its representations can come to connect bicycle with familiar visual features—wheels, frame, handlebars—and rainy street with wet pavement, reflections, and overcast light. “Parisian” may be associated with visual patterns present in images and captions from Paris, though it cannot guarantee a landmark or a geographically faithful street.

The text representation acts as conditioning: information that guides the image-generation process. At each denoising stage, the image-making network uses that guidance while estimating how to move from its current noisy state toward a more image-like one. Without the prompt, the same general model might produce any of many scenes its training has made plausible. With it, the process is pushed toward a photograph-like scene containing a red bicycle, a blue café, and rain. The prompt guides the process; it does not blueprint every pixel.

This guidance is not a literal checklist. The model does not necessarily reserve one compartment for “red bicycle,” another for “blue café,” and then tick both boxes. The prompt’s numerical representation carries patterns of relationship learned from data. Those relationships help the model connect words to visual features, but they are not perfectly precise commands. The system may make the café blue while giving the bicycle a reddish reflection, put the bicycle inside the café, or attend more strongly to “Parisian street” than to “red.” The words constrain the possibilities; they do not pin every detail to a coordinate.

This is one useful connection to language models. In both cases, words become numerical representations that a neural network can process, and context matters: blue café means something different from blue bicycle. But here the text is not simply the next sequence to be continued. It guides a separate visual transformation, helping shape an image that is being built through denoising.

The prompt, then, is less like a blueprint and more like a set of bearings. It points the generation toward a region of possible pictures—one with the right objects, qualities, and relationships—while leaving many choices open. How the model weighs those relationships, and how language features connect to visual ones, becomes clearer when we look at the attention mechanisms that help link them.

Attention and the Link between Words and Visual Features

A prompt’s relationships matter: in “a red bicycle outside a blue café,” the model needs to associate each color with the intended object. Attention is one architectural mechanism that helps neural networks use information from relevant parts of a representation. Within the text, it can help represent red in relation to bicycle and blue in relation to café, rather than treating the words as an unordered list.

In many text-to-image systems, attention also helps connect text representations to the features involved in constructing an image. At a particular stage of generation, the model has a partly formed internal representation—not necessarily a little picture you could inspect—and can use the prompt to guide what kinds of visual details should take shape. A region or feature associated with the bicycle may draw more strongly on bicycle and red; another, associated with the café, may draw on café and blue. The rainy Parisian street provides further context for the scene: wet surfaces, street architecture, perhaps reflections and a particular atmosphere.

This is a useful mental picture, not a literal map of words pointing to neat, labeled boxes. The model’s internal features are distributed and can mix information. Attention weights describe patterns of information being exchanged inside the network; they are not little spotlights that prove the model has identified an object as a person would. Nor does attention guarantee that attributes will bind to the intended objects. Colors can attach to the wrong things, details can compete, and relationships may be represented imperfectly. Other parts of the model and the way it was trained matter too.

The precise machinery varies. Some systems use cross-attention, where image-generating features can draw information from text features; others use different arrangements or combine several approaches. Latent diffusion research provides a concrete example of cross-attention conditioning; later work investigates how prompt tokens influence spatial features during denoising. [3] [4] The shared idea is that these mechanisms let information from the prompt influence visual features during generation. They are part of how a model processes relationships, not a transparent readout of its understanding.

For our scene, attention can contribute to the model’s use of the relationships among red, bicycle, blue, and café, but it does not guarantee the colors will land correctly. The resulting representation also depends on how the system represents the image. In many systems, that representation is compressed, allowing much of the construction to happen before the final pixels are produced.

Latent Space: Building Before Rendering

Those clues from the prompt do not have to be worked out directly on a giant canvas of colored dots. In many image systems, much of the work happens first in a latent space: a compact numerical representation of an image, designed to retain the visual information the model needs while leaving out some pixel-level detail.

A photograph may contain millions of pixels. Yet neighboring pixels often repeat or vary gradually: a patch of blue sky is not a million unrelated facts. A compression system can represent broad patterns with fewer numbers, then use a decoder to reconstruct an image from that compact description. Image-generation systems can use a related strategy. In encoder-decoder systems, an encoder compresses training images into latent representations; the generative model learns to create or refine representations in that space; and a decoder turns the result back into pixels.

Think of it as planning a painting with a small, rough map before laying down every brushstroke. The map might preserve where the bicycle sits, the café’s blue frontage, and the street’s broad reflections, without specifying the exact color of every raindrop. The analogy is useful because it captures the division between structure and rendered detail. It is not a literal map with labeled bicycle-shaped regions: a latent representation is a distributed set of numbers, and its meaning is learned rather than neatly assigned by hand.

When a system generates in a smaller latent representation, it can reduce the computation needed for some operations compared with processing a full-resolution image at every step. The amount saved depends on the architecture and task; not every system uses this approach. The decoder then expands that representation into the final image. In some systems, additional processing can refine details or increase resolution. The exact arrangement varies: some models operate directly on pixels, some generate in latent space, and some combine stages or use other representations.

Compression also has a trade-off. A compact representation is useful only insofar as it preserves what matters for reconstruction. Depending on the representation and decoder, fine texture, tiny lettering, or the exact shape of a bicycle spoke may be difficult to retain or recover. The decoder does not retrieve a hidden original photograph; it produces pixels consistent with the learned representation. Compression can therefore contribute to imperfect fine detail, alongside errors in generation itself. A malformed bicycle or misspelled sign cannot automatically be blamed on the decoder. [3]

For our rainy Parisian street, the prompt can guide a compact evolving representation toward a scene with a bicycle in the foreground, a blue café nearby, and wet reflections across the street. Only after that representation has been shaped does a decoder, in systems that use one, render it as a visible picture. The prompt guides the updates; the decoder produces the visible output from the internal representation. The next section follows that journey from prompt to pixels—and separates what the model learned earlier from what happens for this particular image.

Following One Image from Prompt to Pixels

The rainy Parisian street is ready to take shape. But before anything happens for this particular picture, the model has already gone through a much longer process: training.

During training, the system sees many examples of images, often paired with captions or other text. In a diffusion-based system, training includes deliberately corrupted examples, which teach the model how to reverse that corruption. Text helps connect visual patterns with descriptions, and the model’s adjustable parameters are gradually tuned. Training is not the creation of our bicycle image; it prepares the system to generate images later.

For this particular generation, we provide the prompt: “A photograph of a red bicycle outside a blue café on a rainy Parisian street.” A text encoder turns the words into numerical representations the image model can use. In a diffusion system, the model also starts from a random arrangement of values, often in a latent representation rather than full-resolution pixels. Noise is a starting representation, not a hidden picture. The random seed initializes the random-number generator that supplies the starting noise and, in some samplers, later randomness. Changing it can lead to a different composition even with the same prompt. Reproducing a result also requires the same model, settings, and sufficiently deterministic execution; a seed alone is not a portable image recipe.

For a typical latent diffusion system, the journey can be followed in five steps:

  1. Encode the request. Tokenize the sentence and compute text representations.
  2. Initialize the image representation. Sample random noise with the required latent dimensions.
  3. Predict. Give the network the current latent, its noise level, and the text conditioning. It predicts the quantity the sampler needs.
  4. Update and repeat. The sampler calculates the next latent state and advances the noise level. The same trained network is reused; it does not learn new weights for this picture.
  5. Decode. Convert the final latent into visible pixels.

Many systems strengthen prompt influence with classifier-free guidance: combine predictions made with and without the conditioning, emphasizing their difference. This adjusts the generation direction rather than checking a finished picture against a checklist. Stronger guidance trades off fidelity and variety; it is not a guarantee of correctness. [5]

The prompt and starting point do not specify a finished image in advance. They guide a process whose result can vary: the bicycle may turn, the camera angle may shift, or the café may sit farther back. In diffusion, the system applies a sequence of learned updates according to its model and sampling procedure; these updates are not a general-purpose image-quality judge. A decoder in latent-space systems converts the resulting representation into pixels. The output is a new candidate image, not a photograph of this exact imagined scene retrieved from a collection.

This is a useful map, not a universal blueprint. Many image generators use diffusion-like iterative processes, but implementations differ; some work directly with pixels, while others generate in a compressed latent space. Other systems use different generative approaches altogether. Diffusion is the main example, not the only route to an image. The key distinction is between the model’s earlier learning and the present act of generation: training tunes the system’s capabilities, while a prompt and a starting point shape one particular result. The prompt guides the process, but does not guarantee every instruction will be followed; a convincing image is not necessarily a correct one.

FOUNDATIONS & DOCUMENTATION

Sources Cited in This Chapter

  1. Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, Björn Ommer. High-Resolution Image Synthesis with Latent Diffusion Models. CVPR 2022. arXiv:2112.10752. ↩
  2. Maisha Maliha, Dean F. Hougen. Mechanistic Interpretability of Text-to-Image Diffusion Models via Cross-Attention Interventions. Findings of the Association for Computational Linguistics: ACL 2026, 2026. https://doi.org/10.18653/v1/2026.findings-acl.1265. ↩
  3. Jonathan Ho, Tim Salimans. Classifier-Free Diffusion Guidance. 2022; workshop version 2021. arXiv:2207.12598. ↩
READING ROOM ACCESS

Continue in the Knowelia Cloud Reader

Enjoy personalized typography, distraction-free reading, shelf syncing, and offline library access for How AI Creates Images.