Seeds in the Noise: How AI Engineers Turn Chance into Reproducible Results
Photo: Steins / Medium
AI

Seeds in the Noise: How AI Engineers Turn Chance into Reproducible Results

Every AI-generated image starts with a noise image, and that noise image is determined by exactly one number. In real-world testing: the 275 retained images consumed 421 GPU cycles, while the seed space was smooth in sections and then broke off.

Updated: September 2026.

In my image library, there are two images side by side. They’re the same model, with the exact same prompt down to the last comma, the same number of steps, the same sampling settings, and everything else listed in the parameter table. One is usable; the other is trash. The only difference is a single integer quietly tucked away in the metadata—what the AI community calls a “seed.”

To a novice, it looks like a meaningless technical detail—a “random” button to press just for fun. Experts, however, know that it determines more than most of the text in the prompt. And around that number, an entire way of working has emerged: how to make randomness repeatable, how to move from one stroke of luck to an even better one, and how to pay the price for the unlucky moments.

A seed is not “random.” It is an address.

Computers hardly ever generate true randomness. What they have is a pseudorandom number generator: a completely deterministic mathematical function that takes a number as input and outputs a long sequence that appears random. Feed it the same number, and it will produce exactly the same sequence—today as well as next year. The number you feed into it is called the seed.

In a diffusion model, that sequence of numbers is poured into a noise pad—a block of numbers the same size as the image to be generated (usually in a compressed latent space). The entire “image generation” process then consists of starting from that noise field, gradually reducing the noise with each step, until a clear image remains. The prompt doesn’t “draw” anything; it merely acts as a guide, steering each step toward elements that align with the text.

So the correct way to understand it is this: the model’s weights generate the terrain, the prompt tilts the terrain, and the seed drops you at a specific point on it—then you roll down into the nearest valley. Changing the seed isn’t “adding randomness”; it’s changing your starting position.

The implication of this understanding is rather unusual but very useful: the photograph isn’t created; it’s discovered. It was already there in the noise before you pressed the shutter button—you just didn’t know where you were standing.

Hạt giống không thêm sự ngẫu nhiên — nó chọn sẵn điểm xuất phát. Cùng prompt, cùng mô hình, đổi mỗi con số ấy là đổi cả bố cục.
Seeds don’t add randomness—they predetermine the starting point. With the same prompt and the same model, changing any one of those numbers changes the entire layout.

Why Can't Words Beat Numbers?

I once tried something that sounded very reasonable: I fed the model a reference image, let it generate a prompt on its own, had it generate an image, compared it to the original, adjusted the prompt, and had it generate again—repeating this cycle many times, hoping it would converge on the original. The similarity score plateaued at around 56 out of 100, and no number of iterations could break through that barrier.

The reason lies in the division of labor between the two. The prompt controls the content and style: who is in the frame, what they’re wearing, whether the lighting is warm or cool, and what the drawing style is like. The seed controls the composition: whether the person is positioned to the left or right, where their hands are placed, the ratio of the head to the frame, and which corner the light falls on. There’s no English phrase that can describe “the hand at this coordinate.” Yet composition is the first thing the human eye notices.

This leads to a practical rule: don’t promise to recreate an image using just a prompt. If you want to preserve an image, you have to preserve the seed, the model, the number of steps, and the sampling set—miss one of these, and it’s gone for good. This is also where the “art of prompt writing” hits its limit: past a certain point, you’re just arguing with the terrain using words.

The seeds are hidden in three layers—not just in the image

First layer — during training. The initial weights of the network are randomly selected, the order in which the data is shuffled is also random, and the layers from which neurons are removed are chosen randomly as well. Using the same formula, changing the seed produces a different model and different scores. Researchers call this phenomenon the “seed lottery”: an “improvement” reported from a single run is sometimes just a fluke. This is why n = 1 is never a conclusive result—you must run multiple trials and take the median.

The second layer—word generation. The language model doesn’t “know” the next word; it generates a probability distribution and then draws a word from it. The temperature and top-p parameters determine how risky the draw is, while the seed determines the specific sequence of draws. Many language model APIs now allow users to pass a seed parameter, precisely because users need to be able to reproduce the results. This is also part of the reason why models make things up: the same question, two different draws, and two equally confident answers.

Layer Three — at the very bottom of the hardware, and this is the layer few people suspect. Floating-point numbers are not associative: (a + b) + c is not necessarily equal to a + (b + c), because each addition involves rounding. On a GPU, a massive cumulative addition is divided among thousands of threads, and how it’s divided depends on the batch size being processed. The batch size, in turn, depends on… how many people are making requests at the same time.

The result is highly counterintuitive: with the same seed, the same prompt, and the same model, a server with high traffic produces different text than one with low traffic. That’s why setting the temperature to 0 is still not enough to ensure reproducible results, and why, in 2025–2026, writing batch-size-invariant computational kernels became a highly sought-after technical topic. Anyone who needs audits, regression testing, or proof that “the model answered this question correctly last time” will need it. See also the seven common misconceptions about language models.

Building on a good start: a smooth stretch, then a sharp drop

Suppose you have a nice seed and want something “similar, but slightly different”—create a variation by generating a sequence of consecutive images. A common technique is to interpolate between two noisy images (sliding on a sphere, SLERP) and then gradually increase the deviation from 0.

The key question is: when you adjust it like that, do the images change smoothly or in jerky steps? I measured this across a series of six images, using the same pair of pixels, and only adjusted the offset.

Kéo dần từ hạt giống này sang hạt giống khác: ảnh đổi rất chậm trong một dải, rồi nhảy sang bố cục khác hẳn. Chỗ nhảy thuộc về prompt, không thuộc về hạt giống.
It gradually transitions from one seed to another: the images change very slowly within a range, then jump to a completely different composition. The jump is determined by the prompt, not the seed.

From 0.00 to 0.03, the six shots are almost like a very slow camera pan: same room, same people, same poses, same outfits. At 0.04, there’s a cut: a different camera angle, different outfits, hands positioned differently. The composition shifts abruptly from 7.8% to 32.4% in just one step.

But the interesting part lies in the next measurement. When we ran the experiment again on three different seed pairs with a different prompt, all three smoothly reached 0.05 without any jumps. This means that the breakpoint is not an attribute of the seed, nor is it due to the interpolation technique: it is the decisive boundary of the prompt itself—the point at which the model changes its mind about how this text should look.

Here’s another lesson on how to take measurements. The first time I scanned with a step size of 0.05, I almost concluded that “the interpolation curve was completely chaotic.” It wasn’t until I reduced the step size to 0.01 that I saw a long, smooth band. If you sample sparsely on a non-smooth function, you’ll get noise, and that noise looks exactly like a conclusion.

Selection: sow, grade, then sow again

This reveals an uncomfortable truth about the field: no one can optimize the seed. It is an integer, and the function mapping it to a “beautiful image” is piecewise and has no derivative. There is no gradient to gradient descent. There’s only one way left: generate a lot, score them, and keep the good ones—the same approach as “best-of-n” and sampling with replacement in language models.

What transforms this from superstition into a technical process is the automatic grading system. In my image-generation system, each completed drawing is measured against two simple metrics on the CPU—the percentage of blown-out pixels and the overall color deviation—and if either exceeds the threshold, the seed is changed and the drawing is redone, up to three times. The machine automatically filters out its own work before a human has to review it.

Cái giá của việc gieo lại: 275 ảnh giữ lại đã tiêu 421 lượt GPU. Thử nới ngưỡng cho đỡ tốn thì tỉ lệ ảnh cháy sáng tăng từ 23% lên 50%.
The cost of re-rendering: Rendering 275 retained images used 421 GPU cycles. When I tried raising the threshold to reduce resource usage, the rate of overexposed images increased from 23% to 50%.

The numbers speak for themselves: the 275 images that were kept consumed 421 GPU rendering passes—35% of the processing power went straight to the trash. Looking at those numbers, I thought I’d found a way to save resources, so I raised the threshold to reduce the number of times the system had to re-render. The subsequent results: the rate of overexposed images rose from 23% to 50%, and the owner of the image library noticed it immediately without anyone having to point it out.

My reasoning was wrong in one specific way: I thought I could just let the image blow out slightly and then fix it in post-processing on the CPU. But post-processing can correct color casts, but not blown-out highlights—pixel values clipped at 255 lose all information, and no amount of math can recover them. I’ve reset the threshold to its original value. That 35% GPU usage isn’t a waste; it’s buying quality.

Economic Corner: Luck Bought with Electricity

Each re-run is a full GPU run. This means that the true cost of an image isn’t in the successful runs, but in the discarded ones—and the discard rate is determined by the threshold you set, not by the model. Three financial implications stem from this.

First: A scoring system is more expensive than a generation system. The generation model determines the average quality; the scoring system determines how many attempts it takes to pass a threshold. If the scoring system is cheap and accurate, it cuts costs immediately; if it’s inaccurate, it either discards the output or wastes GPU resources by redrawing images that have already passed.

Hai: Forgetting to record a seed means having to repurchase what you’ve already bought. If you have a beautiful image but don’t save the seed, the only way to find it again is to search blindly—and the seed space is so vast that a blind search is hopeless. Recording a number in the metadata is practically free; not doing so comes at the cost of all the GPU cycles you’ve already spent.

Three: Comparing models based on a single run is like gambling on noise. The difference between two models is sometimes smaller than the difference between two seeds of the same model. Making infrastructure purchasing decisions based on such a figure is like buying on a whim while thinking you’re basing your decision on data.

That same cost structure is repeated in the language model under the name “run-time computation”: generate many solutions, evaluate them, and keep the best one. The cost increases with the number of generations, even though the model doesn’t change a single parameter—so the cost per token is only half the story; the other half is how many times you have to generate before you get a usable result.

That’s why the most worthwhile optimization isn’t “redrawing faster,” but rather avoiding a full redraw altogether. In my system, making a local edit to a small area and pasting it over the old image takes about 32–34 seconds per frame, compared to about 50 seconds for a full redraw—and more importantly, the area outside the edited region doesn’t change a single pixel, so there’s no risk of ruining what was already good. Redrawing the entire image is the most expensive method of all.

True Craftsmanship: Turning Chance into a Process

All in all, the so-called “AI engineer who optimizes results” turns out not to be about controlling randomness. It’s about five very ordinary habits:

  • Record the seed directly in the product itself; do not record it in an external log. Metadata embedded in the file outlasts any spreadsheet.
  • Measure using multiple runs, report the median—don’t report the best result—the best result always exists, even with a poor method.
  • Embed the seed in your tests, so that when results change, you can be sure it’s because you just made a change—not because the machine is acting differently today.
  • Distinguish between “bad luck” and “wrong approach.” If ten seeds all fail in the same way, the error lies in the prompt, the image size, or the parameters—kept trying will just waste electricity.
  • Maintain a good library of seeds along with their corresponding conditions (which model, which image size, which sampler). Changing the model renders the entire library useless, because the landscape has changed.

The pleasant irony lies here: skilled professionals aren’t any luckier than anyone else. They simply mark the spots where they’ve succeeded and find their way back to them. In a sea of chaos where there’s nothing to hold onto, that’s their only advantage.

Prediction

  • Reproducible results become marketable. When the model enters the audit, healthcare, and legal sectors, providers will offer “deterministic mode” as a separate service tier—slower, more expensive, but guaranteed to produce the exact same output.
  • The seed becomes part of the product’s provenance. AI-generated images and text will carry the seed, model version, and computational instance as a “material invoice”—both for reproduction and for verification.
  • Automated scoring systems will attract more investment than generation systems. When users share a few base models, what makes the difference is how well you can filter results and how many runs you’re willing to pay for to achieve a satisfactory outcome.
  • Reporting multiple seeds will become a minimum requirement. Comparing models based on a single run will gradually be considered unusable data, just as the software industry has moved away from measuring performance with a single timestamp.
  • Local fixes will gradually replace reseeding. Patching the exact damaged area is cheaper and safer than redrawing the entire frame; any tool that can transform “this part isn’t quite right” into a specific area requiring correction will capture the majority of the editing demand.
  • But noise remains. As long as generation still starts from a random seed, there will still be a need for seeding and selection—tools merely make seeding cheaper and selection smarter.
Chia sẻ

Thảo luận