Glossary
What is a seed in AI image generation
In short
A seed in AI image generation is the number from which a neural network gets its starting random noise. With the same seed, prompt and settings, the model repeats the same picture.
Images, video, audio · seed
MMOOZZGG.com editorsChecked: 1 min read
For a child
Imagine a game where you throw dice to find out which little house to build. Every throw gives a new house. Now imagine magic dice with a number: throw the dice number seven, and you always get the same result. A neural network that draws also throws dice like these. If you remember the number, you can get the picture you liked again.
In plain words
An image model does not start from a blank page. It starts from colored noise, like the static on an old TV. A random number generator makes this noise, and it starts from one number. If the number is new each time, you get new variants from the same description. If you fix it, the noise stays the same, and with the same settings you get the same picture. This is handy: you find a good variant, write down its number and change one word in the description, say the color of a dress, while the rest stays.
For business
A fixed seed turns image generation from a lottery into a process you control. A designer can return to an approved variant a month later. A lawyer can see how an ad layout was made. A team can compare settings fairly by changing one parameter from the same start. For a series of product cards, it keeps one look. It costs almost nothing, but it needs discipline: store the number, the description, the model and its version with each picture. Know one limit in advance: after an update of the model, the library or the graphics card, the result can differ even with the same number. Cloud services do not always let you set this parameter; on your own server it is always available.
For a specialist
A seed initializes the pseudo-random number generator. A diffusion model takes from it the initial Gaussian noise (initial latent noise) and the noise of stochastic samplers at the middle steps. In DDPM (Ho, Jain and Abbeel, 2020) sampling goes from pure noise to an image. So the seed, which sets both the start tensor and the noise along the way, determines the whole result when everything else is equal. In the diffusers library the seed goes through a torch.Generator object. The documentation advises a generator on the CPU, because it is more stable between machines, while a generator on a GPU can give other values. The object keeps its state and changes it after a call, so you create it again to repeat a run. Full determinism also needs deterministic cuDNN and cuBLAS algorithms and TF32 switched off. Even then, the documentation warns, an exact match is not promised, even with the same seed. For reproducibility, record the seed with the model version, the sampler, the number of steps and the size.
Example
A marketer tried thirty banner variants and chose one. They record its seed. After that they change only the text on the shop sign in the frame, and the composition with the main character stays the same.
Related terms
Questions and answers
Sources
Not sure whether your company needs this?
AI solutions map