From words to pixels
Text-to-image models learn from huge collections of images paired with captions, often scraped from the web, such as the LAION-5B dataset. A text encoder turns your prompt into tokens and then into vectors, lists of numbers that place words in a space of meaning. Models like Stable Diffusion used OpenAI's CLIP text encoder; others, like Google's Imagen, used large language models such as T5.
The image itself is usually made by diffusion: starting from noise and removing it step by step, guided by the text. At each step, cross-attention links parts of the prompt to parts of the image. Knowing this explains a lot of everyday behaviour: why some words dominate, why long prompts get cut, and why models still struggle with things that are easy in language, like 'three' or 'not'.
The pipeline
Pieces of words the model reads; rare words and non-Latin scripts often split into many tokens.
A vector that places a token or a prompt in a space where similar meanings are close.
The part that understands the prompt, like CLIP or a language model.
Generating an image by gradually removing noise, guided by the text.
The mechanism linking words to regions of the image.
How strongly the image follows the prompt versus looking natural.
What it learned from
Models learn from how people captioned images online, with all their habits and gaps.
Much of the training text was written for other purposes, often short and plain.
When a prompt is vague, the model fills gaps with the most common pattern it saw.
Some systems, like DALL·E 3, rewrite your prompt into a longer one with a language model before generating.
Typical blind spots
'Seven birds' often gives five or nine.
'No' and 'without' can bring the very thing into the image.
Left, right, behind and on top of are often confused.
Colours or materials move from one object to another.
Writing has improved but is still fragile, especially in Persian and other right-to-left scripts.
Older encoders read only a limited number of tokens (77 for CLIP); later words may be ignored.
Words to describe Text-to-Image Semantics
Precise words for the qualities above. Combine a few of them instead of naming the style or artist alone.
- tokens
- text embedding
- CLIP text encoder
- diffusion denoising
- cross-attention
- guidance scale
- image-caption training data
- default patterns
- attribute leakage
- token limit
Instead of 'a room with no windows and three lamps on the left of a blue chair', try: 'A windowless room with solid walls. A blue chair in the centre. Three brass lamps stand together to the left of the chair.'
How to describe Text-to-Image Semantics in words
- Put the essential subject early and in plain words.
- Describe what is present instead of what is absent.
- Keep each object and its attributes together, and simplify spatial relations.
Where we usually get it wrong
It is tempting to think the model 'understands' like a person. It matches patterns between words and images it has seen. That's why describing images in the way good captions do, concrete, visual and specific, works better than abstract instructions.
Write a prompt with three objects of different colours in a specific arrangement. Generate several images and note every error: swapped colours, wrong positions, missing objects. Rewrite the prompt to reduce each one.