10 November 2026

Randomness in LLMs

  • machine learning
  • physics

Physics has three very different kinds of randomness, and sorting a language model's randomness into the same three kinds is a useful way to see what can be removed and what can't. By randomness I mean something plain, which is that you do the same thing twice and get a different result.

Three kinds in physics

The first kind is classical noise, the sort that comes from friction and heat. Thermal noise in a resistor, for example, comes from the thermal motion of electrons, and since it grows with temperature you can reduce it by cooling the system down.

The second kind is chaos, where tiny differences at the start grow over time, so two runs that begin almost the same end up far apart.

The third kind is quantum randomness, and it is the one you can't engineer away. In 2018 NIST researchers used a Bell test to extract 1,024 random bits that, in their words, could not have been predicted by any physical theory that forbids faster-than-light signaling, although that only holds under those assumptions.

A language model has some of each, and the easiest way to see them is to send the same prompt to a model 1,000 times and count how many different answers come back.

Three layers in a language model

The first layer is the dial. A model scores every possible next word and then picks one, and temperature controls how it picks: at 0 it always takes the top score, while higher values allow more variety. The second layer is the seed. Above 0 the pick involves chance and a seed makes that chance repeatable, since one vLLM sampling guide puts it as "same seed + same prompt = same output", although a seed does not lock the hardware or the server underneath. With the temperature at 0 and a fixed seed you would expect all 1,000 answers to match, and in practice they don't, because of a third layer that I'll call drift.

Three layers of randomness in an LLM: the dial, the seed and drift, with what removes each

Drift

In a test by Thinking Machines, one prompt went to Qwen3-235B at temperature 0, 1,000 times, and the model gave 80 different answers. All 1,000 runs matched for the first 102 tokens, then at token 103 992 of them said "Queens, New York" and 8 said "New York City". 1,000 runs of one prompt agree for 102 tokens, then split 992 to 8

The cause is rounding. Computers add numbers with limited precision, so the order of the additions can change the last digits, and in Python (0.1 + 0.2) + 0.3 gives 0.6000000000000001 while 0.1 + (0.2 + 0.3) gives 0.6.

The same three numbers added in a different order give different results

A model does millions of additions per word, and most of the time the tiny differences wash out, but when the top two words are nearly tied, one tiny difference can flip the winner and every word after it then follows from that choice, which looks a lot like chaos. What changes the order is the server, which groups requests into batches, so the arithmetic for your request depends on the batch size and the same prompt gets different arithmetic depending on how busy the server is.

Can you remove it?

Yes, at some cost in speed. Thinking Machines wrote kernels that do the same arithmetic whatever the batch size, and all 1,000 runs matched. In one test on a smaller model the run took 42 seconds instead of 26, although Thinking Machines say part of that gap comes from unoptimized code, and a separate study says full 32-bit precision doubles memory and time.

Back to physics

Set next to physics, drift is like classical noise, because engineering can reduce it, and it also behaves like chaos, because a tiny difference grows into a different answer. The dial and the seed are settings you choose. I found nothing in the numerics of an LLM that can't be removed, whereas physics has one kind that can't.

Rounding drift in LLMs next to classical noise, chaos and quantum randomness in physics

Sources