AI image generators turn a short text description into a photo, an illustration or a 3D render in a few seconds. In this article, you'll learn how these models are trained, what happens inside a diffusion model after you enter a prompt, which types of image generation models exist and how AI edits existing images.
AI generates images with generative models that are trained on large datasets of images paired with text descriptions. During training, a model learns which visual features correspond to which words. To create an image, the model converts a text prompt into numbers and builds a picture that matches it. Most current image generators, including Stable Diffusion, Imagen and FLUX, are diffusion models: they start from random noise and remove it step by step until an image appears. Other models, such as the image generator in ChatGPT, are autoregressive and build an image piece by piece.
How AI image models are trained
An image generation model is trained on a dataset of images paired with text, such as captions or the alt text of images on web pages. Stable Diffusion was trained on the English-language part of LAION-5B, a public dataset of 5.85 billion image–text pairs extracted from Common Crawl, an archive of web pages. Adobe trained its Firefly models on licensed content, such as Adobe Stock, and on public domain content.
During training, the model processes these pairs many times and adjusts its internal parameters to associate words with visual features such as shapes, colors, textures and styles. After training, these associations are stored in the model's parameters, which are numerical values. The training images themselves are not stored in the model.
How AI turns a text prompt into an image
In a diffusion model, generating an image from a text prompt has four stages.
Step 1: Convert the prompt into numbers
A text encoder converts the prompt into a set of numbers that represents its meaning. Stable Diffusion uses CLIP, a model that OpenAI trained on 400 million image–text pairs. Google's Imagen uses T5, a language model trained on text only.
Step 2: Create random noise
Generation starts from an image that consists of random noise. During training, the model was shown real images with increasing amounts of noise added to them and learned to predict that noise. Because the starting noise is random, the same prompt produces a different image each time.
Step 3: Remove the noise step by step
The model removes the noise over a series of steps. At each step, it predicts which part of the current image is noise and subtracts part of it, using the encoded prompt as guidance. The early steps define the overall composition and colors, and the later steps add detail. The number of steps depends on the model. FLUX.1 [schnell] from Black Forest Labs generates an image in 1 to 4 steps.
Step 4: Turn the result into a full image
Many diffusion models, called latent diffusion models, remove the noise from a compressed representation of the image, called the latent space, which requires less computation. After the last step, a decoder converts the result from the latent space into a full-resolution image.
Types of AI image generation models
There are three main types of image generation models: diffusion models, autoregressive models and generative adversarial networks (GANs).
Diffusion models
Diffusion models generate an image by gradually removing noise, as described above. Stable Diffusion and Google's Imagen are diffusion models. FLUX by Black Forest Labs and Seedream by ByteDance are diffusion models built on transformers, the neural network architecture that is also used in large language models.
Autoregressive models
Autoregressive models generate an image as a sequence of parts and predict each part from the parts generated before it, in the same way that a language model predicts the next word. The image generator in ChatGPT, which OpenAI introduced as GPT-4o image generation in March 2025, is an autoregressive model built into ChatGPT. Because the same model processes both text and images, it can also take uploaded images as input and modify them.
GANs
A generative adversarial network (GAN) consists of two neural networks: a generator that creates images and a discriminator that tries to distinguish them from real images. The two networks are trained together, and the generator improves as the discriminator gets better at detecting its images. GANs were introduced in 2014 and were the main image generation method before diffusion models. Current text-to-image generators mostly use diffusion or autoregressive models.
How AI edits an existing image
Editing an existing image with AI is called image-to-image generation. In a diffusion model, the input image is partially covered with noise, and the model then removes the noise, guided by the new prompt. Because the noise does not fully replace the original image, the result keeps its composition. The amount of added noise determines how much the result differs from the original.
In a test in Overchat AI, Nano Banana 2 received a summer photo of a city street and a prompt to change the scene to a snowy winter evening. The result kept the street, the buildings and their layout, and changed the season and the lighting.
These models are available in the developers' own products, such as ChatGPT, and on platforms that offer models from several developers. Overchat AI provides 15 image models, including Nano Banana 2, GPT Image 2.5, Seedream 5 and Flux 2 Max.
FAQ
Where does AI get its pictures from?
Image generation models are trained on large datasets of images with text descriptions. Most of these datasets are collected from the public web. LAION-5B, for example, was built from Common Crawl by pairing images with their alt text. Some developers use licensed data: Adobe trains Firefly on Adobe Stock and public domain content. When generating an image, the model uses what it learned during training and does not retrieve images from the dataset.
Does AI copy existing images?
In most cases, no. A model generates each image from the patterns it learned, so the output is a new image. However, models can memorize some of their training images. In a 2023 study, researchers extracted over a thousand training images from Stable Diffusion and Imagen, including photos of individual people and trademarked logos.
Do I own AI-generated images?
Ownership depends on local law and on the amount of human contribution. In the United States, the Copyright Office has concluded that prompts alone do not make a user the author of an image, and material generated entirely by AI is not protected by copyright. Human edits to the output and the creative selection and arrangement of AI-generated material can be protected. The terms of service of each AI product define how its output may be used.
How long does it take AI to generate an image?
Generation usually takes from a few seconds to about half a minute, depending on the model, the resolution and the quality settings. In Overchat AI, Nano Banana 2 generated a 1K image in about 20 seconds, and GPT Image 2.5 Sunburst generated a medium-quality image in 25 seconds. Seedream 4.0 can generate a 2K image in under two seconds.
Can I generate AI images for free?
Yes. ChatGPT and Gemini include image generation in their free plans with daily limits, and other free AI image generators also offer limited free use.