Why Does an AI Never Repeat Itself?
How a dead physicist's thermodynamics equation makes your LLM come alive
I remember the first time I sat down with ChatGPT, and I suspect you remember yours.
It was everywhere at once. In the news, in the feeds of people who had never thought about software in their lives, in screenshots passed around with the buzzing energy of contraband. And when access finally arrived, I did what I imagine nearly everyone did, which is to say nothing even remotely useful. I asked it for a science fiction story. Then I asked it to tell the same story as Edgar Allan Poe might have. The prompt after that is lost to me, though I would wager a modest sum that it involved a character from Sesame Street.
None of it was work. I was prodding the thing to watch it move. It felt like meeting an alien, if the alien had read every book in the local library and was sitting, perfectly at ease, at your kitchen table. The future had arrived a few years early, and it wanted to chat.
We’d seen a real attempt at this before. Its name was Siri.
Siri came dressed in the language of intelligence: a voice in your pocket that was finally going to understand you. And then you used it. For most of what you asked, you got the same flat reply, the same courteous dead end, or the same useless handful of search results, delivered with all the interior life of an answering machine. Nothing back there was thinking, and we knew it within an hour. While Siri may actually get good in Apple’s next release, I suspect most of us right now put it to the same use I do: setting a timer for boiling eggs.
Today’s systems are extraordinarily better than Siri, but most of us know by now that there’s still nobody home. No sentient presence sits on the far side of the screen, waiting for your message and feeling something about it. There’s just a whole load of training data and a very large pile of numbers, multiplied together very quickly. That’s the whole cast of characters. The lights are on, brilliantly on, but the house is still empty. And yet they seem so present, so nearly alive, that we spend real effort being polite to them; thanking them, asking what they make of our work, our plans, even our love lives. We don’t bark commands in an annoyed voice the way we do to Siri.
So the question isn’t whether the machine is conscious. It’s not. The interesting question is why it feels so different from the last thing that wasn’t.
Ask a friend the same question twice and you’ll likely get two different answers, because they’re a living thing reconstructing a thought rather than retrieving a document. Ask a calculator the same question a billion times and you will get the identical response a billion times, because that is what a machine is. Those are the two categories we walk around with. Living things improvise. Machines repeat.
The first time I typed a prompt into that blank ChatGPT window, some part of me expected the friend, not the calculator. I expected that asking twice, or three times, or ten, would get me a fresh answer each time. And I suspect you did too, because with all the fanfare surrounding the advent of AI, the opposite would be unthinkable. A machine that returned the same sentence, word for word, every single time you gave it the same prompt would feel like exactly what it is: a deterministic process, a vending machine dispensing the identical packet of words forever. The illusion wouldn’t survive the first coffee break and the product would be dead. To pass as a conversation, the thing had to behave like one.
It had to surprise us.
Which brings us to the question this whole piece is really about. We wanted surprise, and we got it. So where does the surprise come from? Is it the unavoidable byproduct, the natural churn of billions of parameters too complex to ever produce the same thing twice? Or is it a choice, placed there on purpose by the people who built the system?
The moment it picks a word
To find the answer, we have to follow the machine down to the smallest thing it does, which is choose the next word.
A language model doesn’t write sentences. It writes one word, then looks at everything so far and writes the next one, then does it again, thousands of times. When you give it a prompt, it processes the text and produces, for that single next position, a giant list. On that list is essentially every word it knows, tens of thousands, sometimes past a hundred thousand, and next to each one a number: how likely this word is to come next, given everything that came before.
After “The cat sat on the,” the word mat might carry a high number, roof a smaller one, idea a tiny one, and democracy close to zero. The model’s one genuine talent is producing this ranked list of probabilities, astonishingly well, for any context you hand it.
And here’s what surprises a lot of people: the process is entirely deterministic (in principle, hold that thought, we’ll return to it later). Given the same input, the LLM will run the exact same arithmetic with the exact same fixed weights, producing the exact same response. And yet it doesn’t, by design. And that design decision alone carries a huge amount of what makes large language models seem more alive than they are.
When the machine produces its list, each word carries a score: the model’s read on how well that word fits. The obvious thing to do is to pick the highest number, always. After all, it’s the closest match, the most likely candidate to be correct. But do that, and you’ve reproduced the vending machine: the same sentences perfectly and lifelessly reproduced forever. So what do we do? As you may have guessed already, we introduce a bit of randomness.
The fact that one word fits, doesn’t mean that no other word will. The most “correct” word has a long list of neighbours that are almost as correct as the first one. So the machine samples from the list, letting each word’s score decide its chance of winning the lottery. If there’s just one heavy favourite, it will pick it, but if there are several plausible candidates, each word gets its occasional turn. And then, the machine moves on to the next word. It reads the full response so far, gives each word a score, calculates the probabilities and throws the dice another time.
It may not seem like much at first, but the randomness compounds, choice after choice, and by the end of a paragraph, the number of paths the sentence could have taken is effectively uncountable. The way one word choice can disrupt the direction of a sentence can be hard to grasp at first, but think about it this way: imagine having a conversation with a friend. For every noun (which carries most of a sentence’s meaning), they shut their eyes, jab a finger into a dictionary, and say whatever first noun it lands on. You ask how their weekend was. “I spent Saturday at the,” and here comes the jab, “aquarium.” Fine. Plausible, even. You settle in. “I got there early and ran into my old,” jab, “thermostat.” You blink. “We hadn’t spoken since the,” jab, “avalanche.”
“I spent my Saturday at the aquarium. I got there early and ran into my old thermostat. We hadn’t spoken since the avalanche.”
The conversation is far gone. Each random word doesn’t just sound odd on its own, it drags everything after it into new territory. Once your friend has committed to “thermostat,” the next real word has to make sense of a sentence that already contains a thermostat, and the one after that inherits the wreckage of both. Three careless picks and you’re no longer in a conversation about a weekend, you are in a psychedelic fever dream about appliances and natural disasters.
Clearly, complete randomness generates gibberish, so let’s change the rules. Same friend, same one-word-at-a-time habit, same little jab of randomness. But this time they don’t stab blindly into the whole dictionary. They only allow themselves words that actually fit, with just a tiny bit of room for surprise.
You ask how their weekend was. “I spent my Saturday at the,” and this time the pick lands on “market.” “Got there early, picked up way too much,” pick, “coffee.” “Ended up spending the afternoon,” pick, “cooking.” A perfectly ordinary story.
“I spent my Saturday at the market. Got there early, picked up way too much coffee. Ended up spending the afternoon cooking.”
It may not be Shakespeare, but it’s coherent and plausible. What the example shows is the compounding effect of changing just one word at a time.The conversation about the weekend is now about “the market”, “coffee” and “cooking”, but it could have been something else entirely.
This is the whole idea. Run a deterministic calculation, pick a random word from the top candidates, and the model suddenly seems alive, as if reconstructing a thought instead of stubbornly constructing the same answer every time.
Now for the deeper part: how it does it.
Temperature is the dial
The randomness we just described is set with a dial called temperature. If you’ve dabbled with AI settings, you may have heard of it.
Temperature controls how fair or how rigged the dice are. Turn it down to zero and the system stops gambling entirely. It takes the top word every time, and you get the dead, repetitive vending machine, technically correct and totally lifeless. Turn it up and you flatten the odds, giving the machine a bigger basket of ideas. The unlikely words start showing up, the phrasing turns unexpected, and the machine begins to feel inventive, sometimes brilliant, eventually unhinged if you push it too far.
So why temperature? This is one of those things that are easy to just rush by without giving it much thought, but the name isn’t arbitrary, and it follows an idea that’s prevalent in the AI space: engineers keep borrowing concepts from the real, physical world to solve problems.
Think about what temperature is. Hot and cold are just what we feel, but heat is movement. When you warm something up, you’re making tiny particles jostle around faster and more wildly. For example, heat a gas, and its molecules start moving unpredictably. They don’t all move at the same speed – some are fast, and others are slow. Cool that gas down toward the coldest temperature there is, the point physicists call absolute zero, and the molecules go quiet and settle into the calmest, lowest-energy state available to them.
And here’s the key thing: temperature isn’t something each particle carries. A single particle doesn’t have a temperature, it has a speed. The particles are flying around at wildly different speeds, colliding, trading energy, changing their own state from moment to moment. Some move slow, some fast, and the temperature is the average of all of it.
And here’s a question physicists asked in the 1800s: if I reach into the jar and pull out one particle at random, what are the odds it’s carrying a specific amount of energy? Not the average. An exact value. Physicists managed to find out, because that’s what they do, and they started writing this relationship down as a formula. It described, for any given temperature, how widely a system’s energy would be spread out: very wide when hot, very narrow when cold.
The formula they came up with is used everywhere: it determines how fast food decays at a given temperature, the density of air molecules on Mt. Everest, and it makes an MRI work. Once finished, it was named after one of the physicists who worked it out, Ludwig Boltzmann, and it looks about how you would expect from a physicist:
Yeah. Me too. So let’s simplify it.
Imagine a big staircase with a crowd of people on it. They wander up and down the steps, and they all feel a few things:
Going up takes effort
Going down is easy
Staying high takes effort
Staying low is easy
How would the crowd be spread across those steps at a given moment? It’s not a trick question, your hunch is right. People would mostly be bunched at the bottom, thinning out with each step up. A few energetic souls at the top, a big crowd down low.
Now turn up the temperature of the crowd. A cold crowd is sluggish and has no energy to spare, so almost nobody bothers climbing, and everyone piles onto the bottom steps. A hot crowd is bouncy and full of pep, so plenty of people go bounding up high, and the crowd spreads out over many steps. Temperature in our staircase is how willing the crowd is to spend effort climbing. Notice something important: a high temperature doesn’t move all the people to the top: it simply distributes the people more over all steps.
Now let’s return to particles. A low temperature, as we saw earlier, doesn’t mean that particle movement stops uniformly, altogether. It means that some particles drop into a low-movement state (slow, low-energy), while a few others still move around (fast, high-energy).
And the formula above answers one question: at a given temperature, how many particles will I find in a given state? Now let’s look at the variables (the letters) from Boltzmann’s formula:
e is a fixed constant, 2.71828… (and a lot more decimals). It’s one of those numbers, like Pi, that shows up everywhere in mathematics, such as compound interest and radioactive decay. It never changes. Exactly why is a bit too much to explain in this article, so we’ll just accept it.
E is the energy of a state (how high up on the staircase the step is).
T is the overall temperature (the crowd’s or particle’s average energy level)
k is Boltzmann’s constant. It answers one question: if I raise the temperature by one kelvin, how much energy does that correspond to, per particle? The answer is a fixed, very small number: 1.380649 × 10⁻²³ joules per kelvin.
Z is the bookkeeper. It sums up every possible state and divides through, so all the probabilities land between zero and one and add up to one. Physicists call it the partition function.
Ok, so I’m not going to pretend this is grade school arithmetic, but we’re starting to see the logic of how it works. What we’re doing in essence, is to take a score (the particle’s energy level), and convert it into a probability (the odds of a particular particle having that energy level.
And converting a score to a probability is exactly what we need for the LLM to pick a word at random, while still picking plausible and relevant words.
We explored that the LLM looks at every word it could possibly say and gives each one a score. That score is the model’s enthusiasm for that word, how well it fits. The king sat on the ___. “Throne” gets an 8, say, and “chair” gets a 5. But 8 out of what?
Not out of 10, not out of 100. The score isn’t a slice of any fixed pie. Each word gets its own number, in its own little world, just like your cart at the supermarket gets totaled without anyone caring what’s in the cart behind you. The rules are the same, but no cart needs to wait for the next one.
Which raises a fair objection: surely there’s a minimum and a maximum on how well a word can match? If “throne” scores an 8, then it must be 8 of something for the machine to pick it? And this is where most people’s intuition breaks down: the score isn’t a relevance rating. It’s the output of a giant pile of arithmetic, billions of numbers multiplied and added together, and that arithmetic has no fixed bounds. The score for a word can come out as 12, 40 or -200, because there is no fixed range of relevance.
To understand that, we need to look at what exactly relevant means. Think about our friend constructing a story, and having to find relevant nouns:
“I spent my Saturday at the market. Got there early, picked up way too much coffee.”
Why does “market” work? Partly the boring reasons. It’s a noun, so the sentence doesn’t collapse into “I spent my Saturday at the the.” Also it’s an English word, making it relevant in an English sentence. But relevance is about a lot more than that. Up until this point in the sentence, many words could fit well: “Market”, “beach”, “office”, “lake”. The “moon” would be grammatically correct, but implausible. Almost nobody could truthfully finish that sentence with it. Moving on to “coffee”, we need to narrow down relevance even more, because we have more context. The “market” suggests you’re there to trade, and a perfectly fine noun like “… picked up way too much honesty” would feel out of place. “Too much” suggests a quantity of something, and is not the same as “a/an” (house/apple), or “too many” (apples), so we need something we could possibly buy too much of. Enter “Coffee.”
Relevance isn’t a property of the word, but a relationship between the word and everything said so far. The words and sentences that precede it make a promise, and if we break that promise, the sentence stops making sense. So where does the math and score come in?
Every word the model considers gets a score for how well it fits right here. And as we just saw, “fitting” isn’t one thing, it’s many at once. Is this a noun? Is it the kind of thing you buy? The kind of thing you buy in quantity? The kind of thing a market sells? Each of those is a separate question, and the model checks a word against thousands of them, then combines the answers into a single number.
To make that concrete, imagine we could read the questions and grade “coffee” against a few, in this sentence:
Fits the “too much ___” quantity slot: 8
The kind of thing sold at a market: 7
Behaves like a noun here: 6
Matches the sentence’s casual, everyday tone: 5
...and the list runs on into the thousands.
Two honest caveats about that list:. First, the questions are invented. I wrote them so a human can follow along. The model’s real questions mostly have no clean English names; they’re abstract patterns it found on its own, and we can’t fully read them. Second, nobody programmed those questions or their importances. Through training on an enormous amount of text, the model tuned billions of internal values, its weights, nudging each a hair at a time until the whole machine got good at predicting what comes next.
And now we’re starting to see why these numbers aren’t a portion of anything. Look at the sum of the scores above: 26. Twenty-six of what? Just like our shopping cart, it’s just a number coming out of an individual calculation. So for the number to have meaning, it needs to be relative to something. Haaland scoring 88 goals is a perfectly good number, but it’s worthless without a relative value. Eighty-eight per match? Per season? Out of the hundred the team scored in total? The number only comes alive once you give it a denominator. And we happen to have a 500-year old word for that exact thing: in Italian accounting books of the 1400s and 1500s, clerks wrote “per cento,” per hundred. History shortened it to %.
Odds follow that same rule: they have to add up to 100%. And if “throne” really is a better word than “chair”, then the odds of picking “throne” need to be higher. We need to calculate how a word sits relative to other words. And the way to do that, is to measure the gap between them. If one word gets 8, and another gets 6, the gap (2) is the same as two words that get 108 and 106 (also 2). It’s the distance that matters. The model isn’t announcing “throne is worth 8.” It’s saying “throne beats chair by this much, and beats planet by a mile.” The score alone is useless, but its distance to another word's score gives us something to work with.
Which brings us back to Boltzmann’s formula. To turn them into odds, the model runs them through that equation. (Developers reading along: yes, this is the softmax.)
Picture the staircase again, but relabel every step. Each step is now one word the model could choose. The model’s score for a word decides how low its step sits. A word it loves gets a low, comfortable step near the floor. A word it finds absurd gets stranded up near the ceiling.

Then the probability crowd settles across those steps exactly the way it did before: most of the weight piling onto the low steps, the model’s favourites, and the high steps left nearly empty, the long shots. After applying the formula, each step, or word, has an odds of winning. Then the model reaches in and draws one word, weighted by those odds.
Turn up the temperature and the crowd fans out.
Words the model had rated as much less relevant start getting chosen. Push it far enough and the model will say “The king sat on the planet” and feel fine about it.
There’s one last detail the engineers had to settle, which differentiates the real-world temperature formula from the AI one.
Removing the unnecessary parts
Go back to the physics formula and you’ll find Boltzmann’s constant, k, sitting in the denominator. That constant serves a purpose that’s not needed in the LLM.
K is used to convert temperature and energy, two quantities that are measured in different units, kelvin and joules. In a large language model, we only have one unit: the score. With nothing to convert, the k was dropped.
(There’s an interesting fact-nugget here: Boltzmann never wrote his own constant down. Max Planck introduced it in 1900, gave it its value, and named it after Boltzmann, in the same stretch of work that produced Planck’s constant. So the equation carrying Boltzmann’s name has a number in it that Boltzmann himself never used. Planck also carved the related entropy equation, S = k log W, and that formula ended up on Boltzmann’s tombstone in Vienna. Boltzmann had both the equation and the constant named after him, but someone else actually supplied both.)
There’s another tiny adjustment that also has a simple logical explanation. In the physics formula, there’s a minus sign in front of E. This is because to a physicist, energy is a cost. A state that demands more energy is something that nature tries to avoid, so the formula punishes it: the more energy, the less likely.
In an LLM, the logic is flipped. Its score isn’t a cost (energy) but an appeal. A word the model likes gets a high score, and so that score should make that word more likely, not less.
Put the two side by side and you’ll notice the bearing parts are still very similar.
Phycisists:
LLMs:
They didn’t lift the equation as decoration and call it temperature because it sounded awesome. They took it, understood it down to the bone, and shed the two pieces that didn’t apply to them. This is why we have mathematicians.
Now let’s have a look at what the equation spits out from some invented numbers returned by the LLM.
Calculating the odds
The king sat on the ___. The model has scored its candidates. Throne gets an 8, chair a 5, planet a 0. Three raw numbers, no meaning yet, just the model’s enthusiasm for each word.
The formula does three things, in order.
Raise e to the power of each score.
Add up the results.
Divide each result by that total.
Step 1
Raise e to each score.
We’ll set temperature to 1 for now, so each score rides through unchanged. Keep in mind that e is the constant 2.71828[…].
throne: e^8 ≈ 2981
chair: e^5 ≈ 148
planet: e^0 = 1
(That is the whole reason for the e. It takes a modest lead in the scores, throne beats chair by three, and stretches it into a runaway gap. A word the model likes a little more becomes a word it picks a lot more.)
Step 2
Add them up.
2981 + 148 + 1 = 3130. That total is Z.
Step 3
Calculate each word’s percentage:
throne: 2981 / 3130 = 95.2%
chair: 148 / 3130 = 4.7%
planet: 1 / 3130 = 0.03%
There are your odds. The model reaches in and draws one word weighted by them, and “throne” walks away with it better than nineteen times in twenty. But nineteen in twenty isn’t always. “Chair” wins about one time in twenty, and “planet” sits there at three in ten thousand, waiting for its chance that almost never comes. As we saw earlier, that randomness can throw the text into a wildly different direction.
Now let’s turn the dial and change the temperature. It sits under each score, dividing it, so lowering it magnifies every score and widens every gap, and raising it does the reverse.
Cool it to 0.5 and the odds harden:
throne: 99.75%
chair: 0.25%
planet: near zero
Heat it to 2 and they fan out:
throne: 80.6%
chair: 18.0%
planet: 1.5%
Watch “chair” make the climb. A quarter of a percent when the room is cold, five percent at normal heat, eighteen percent once it warms up.
And now we can see why a higher temperature makes an LLM seem unhinged. “Planet” is weird, but is picked 1,5% of the time. Turn it even higher, and its odds rise.
Natural variations
What comes out of all this is a simple shape: an LLM is a deterministic calculation with a controlled dose of mathematical randomness poured over the top, and that randomness cascades. Turn the temperature up and you add creativity. Turn it up too far and the model slips into a kind of feverish babble, informing you with great confidence that the king sat on the planet. Turn it to zero and the randomness switches off. The model takes its favourite word every time, and the same prompt returns the same answer, word for word, forever.
In principle.
That was the phrase I asked you to hold onto. Because if you ask a model the identical question twice at temperature zero, with every dice roll switched off, you will still, once in a while, get two different answers.
But it isn’t coming from the model. Not the parameters, not the training data, not the temperature dial we just set to zero. It’s not even intentional. The variation lives one floor down, in the machinery that runs the math. To find it, we have to look at the thing doing the work: the GPU.
Remember what I said earlier about the independent calculation of each word’s score: the shopping cart not caring about other shopping carts. This tells us an important thing: since they don’t depend on each other, they can be calculated at the same time.
Now think about what a GPU does. A GPU, or graphics processing unit, is a specific kind of chip, and it was built to draw video games. Picture a single frame of a game. Each little dot on your display is a pixel, and there are a couple of millions of them, and each one needs to be refreshed about sixty times per second. What a GPU does is to calculate what color each pixel should have in one single frame. And a pixel only cares about its own color, it doesn’t worry itself about its neighbouring pixels.
The math for each pixel is simple. There’s just an absurd amount of it. So the GPU was built for that exact shape of problem: enormous piles of small, identical calculations that can all run at once. A CPU, the main chip in your computer, is a brilliant generalist. It has a few very fast workers who take tasks one after another. A GPU is the opposite. Thousands of slower workers, all moving at the same time. Exactly the kind of calculation an LLM needs.
Underneath, the model does nothing but multiply and add vast grids of numbers, billions of tiny sums, none depending on the one beside it. That is a GPU’s native language. It’s the whole reason the AI boom had to wait on the graphics-card companies, and a good part of why NVIDIA, the company that makes the best of them became, for a stretch, the most valuable company on earth.
Returning to the unintentional randomness, it’s simply a quirk of how GPUs are created to work as efficiently as they can. A single prompt doesn’t spend all the capacity that a GPU has, so when you send it, it waits a few milliseconds, sweeps up the other prompts landing in the same instant, and bundles them into one batch. The whole batch rides through the GPU together. It’s a bus, not a taxi. The GPU fills the seats before it pulls out.
And here is where the ghost gets in.
Your next word gets chosen by adding up a long column of numbers, and the GPU doesn’t add that column the way you would. It doesn’t go top to bottom. It slices the column into chunks, hands them to its thousands of workers to add all at once, then combines the pieces at the end. That speed comes with a catch. A computer can’t hold numbers to infinite precision, so it rounds, constantly, far below anything you would notice. And once you’re rounding, grouping matters. Add a huge number to a tiny one and the tiny one can vanish in the rounding; add the tiny ones to each other first and they survive to move the total. Same numbers, different grouping, a total that lands a hair apart.
How the GPU slices the column depends on the size of the job. And the job is the whole busload, not your prompt alone. A near-empty bus gets sliced one way. A packed one gets sliced another, because the machine rebalances the work to keep every worker fed. Same numbers, same math, a different set of slices, and the rounding settles a fraction off. Push that fraction through a word sitting at 50.001 percent one time and 49.999 the next, and the sentence has a slight chance to lead down a different path.
Notice how invisible the culprit is. Hand the GPU the identical batch twice and it returns the identical answer, to the last decimal, every time. There are no dice down here either. The only thing that changed between your two questions is the size of the crowd you shared the bus with. Not who they were. How many.
So when a model hands you two different answers to the same question at temperature zero, no dice were rolled. What you’re seeing is an accident of traffic. You asked twice, and the answers came apart because a stranger three time zones away sent their prompt into the same millisecond as yours, the bus filled to a different level, and the machine sliced your arithmetic into different pieces on the way through.
(Thanks to Sulbha Jain in this Medium article for sharing her thoughts on LLM determinism. There you can also read about what we thought caused the non-determinism until we discovered the reason above).
The whole trick
And that’s the whole trick. A thermodynamics formula from the 1800s, written to describe the movement of heat, doing work its authors could never have pictured. A chip built to draw video games, crunching an absurd pile of numbers at once. And then, once in a while, a third ingredient nobody built in on purpose: a sliver of randomness, thrown off when a stranger three time zones away lands a prompt in the same millisecond as yours.
We started with a question that felt almost philosophical: why does this thing feel so alive when the last one, Siri, so plainly didn’t? There’s still no mind on the other side of the screen. But somehow, this is even more interesting. A conscious machine would be a miracle that we might never understand. This is the opposite: a magic trick where we can trace every step. Instead of an intelligence, we have a stack of human cleverness, assembled so well that it feels like one anyway.
If you liked this post, you may also be interested in my previous AI article: What is a vector database, anyway?




