Text-to-image model

A text-to-image model is a generative AI model that takes a written description, called a prompt, and produces a new image that matches it.

A text-to-image model has two jobs. A text encoder turns the prompt into a list of numbers that captures its meaning. An image generator then produces a picture conditioned on those numbers. Since around 2020 the generator has usually been a diffusion model, which starts from random noise and removes it step by step until an image matching the prompt emerges.

Most current models are latent diffusion models. Robin Rombach and colleagues showed in December 2021 that running diffusion in the compressed representation of a pre-trained autoencoder, rather than on full-size pixels, cut the computing cost sharply while keeping detail, and that cross-attention layers could feed in text to guide the process. That work became the basis of Stable Diffusion.

The field moved fast. alignDRAW, from University of Toronto researchers in 2015, made blurry 32 by 32 pixel images. Reed and colleagues applied generative adversarial networks to the task in 2016. OpenAI announced DALL-E in January 2021 and DALL-E 2 in April 2022; Midjourney was released in July 2022, and Stable Diffusion was publicly released in August 2022. Google's Imagen used a large language model trained only on text, with its weights frozen, as the text encoder.

These models learn from pairs of images and captions, usually scraped from the web. LAION-5B, a widely used dataset, contains more than 5 billion such pairs, and the presence of controversial material in it has prompted debate about how such data is gathered. Output quality is judged by human ratings and by automatic measures such as Fréchet inception distance, which compares the statistics of generated images with real ones.

In practice the same prompt gives a different image each time, because generation starts from random noise; fixing the random seed makes a result repeatable. Users steer results with guidance settings, negative prompts and reference images. Questions about training on copyrighted images, and about who owns the output, are being settled by courts and copyright offices rather than by the technology.

Common questions

How do text-to-image models work?

A text encoder converts the prompt into numbers that represent its meaning, and an image generator, usually a diffusion model, turns random noise into an image step by step while being guided by those numbers. Most current models do this in a compressed latent space and decode the result into full-size pixels at the end.

What are examples of text-to-image models?

Well-known examples include OpenAI's DALL-E series, Midjourney, Stability AI's Stable Diffusion and Google's Imagen. Earlier research systems include alignDRAW from 2015. New versions appear frequently, so check the provider's current documentation for the latest model.

What data are text-to-image models trained on?

They are trained on very large collections of images paired with text descriptions, often gathered by scraping the web. The open LAION-5B dataset, for example, has more than 5 billion image and text pairs. The content and licensing of such datasets are the subject of ongoing ethical and legal disputes.

Why does the same prompt give different images?

Generation starts from random noise, so each run begins from a different starting point and ends at a different image. Many tools let you set a seed value; using the same seed, prompt and settings with the same model usually reproduces the same image.

Finding more

Search for "text-to-image diffusion", "latent diffusion model" or "LAION-5B" to understand how these models are built and trained. Good sources include the original papers on arXiv, documentation from open-source libraries such as Hugging Face's diffusers, and model cards published by developers. Comparisons published by model makers usually use prompts that suit their own model, so look for independent evaluations and try your own prompts.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.