beginner

Happy Birthday, Dear… how LLMs predict the next word

Generic copy, made-up sources and different answers to the same question all come from how a language model predicts the next word.

A hand-drawn illustration of a birthday party in a kitchen: a boxy yellow robot sits at the head of a table with a lit birthday cake while three people sing with their eyes closed, and a fourth person standing apart shrugs uncertainly. On the counter a paper bag spills out tortillas, cheese, salsa and candles, and a green dog sits by the table looking up at the cake.

Three problems come up again and again when people use AI at work:

  1. The copy comes back generic and could be about any company’s product.
  2. A report or email contains a reference, a quote or a figure that sounds right and doesn’t exist.
  3. The same question asked twice gets two different answers.

All three come from the same mechanism. A large language model writes by predicting the next small piece of text, called a token, again and again. Knowing how that prediction works helps you decide when to trust the output, when to check it, and what to put in the prompt to get something better.

This guide uses two things you already know to show it: a song everyone can sing, and a shopping list. Each part has an interactive example you can try.

You’ll be able to:

  • Explain how a language model writes an answer, one token at a time, and what each prediction depends on.
  • Spot the parts of an AI answer most likely to be made up, and check them before you send anything.
  • Write a prompt that gives the model the facts and context it can’t know.
  • Explain why the same prompt gives different answers, and decide when to ask again and when to check a source.

Who it’s for: anyone who uses ChatGPT, Claude, Gemini or Copilot at work. No technical background needed.

You’ll need: nothing to read the guide. For the exercise at the end, the AI assistant you use at work and a real task, such as a post or an email.

Time: about 30 minutes: 15 to read, 5 for the interactives and 10 for the exercise.

How token prediction works

A language model writes its answer one token at a time.

A token is a small piece of text. Often it’s a whole word, like “birthday”. Sometimes it’s part of a word or a punctuation mark: a long or unusual word can be split into two or three tokens.

At each step, the model looks at all the text so far: your prompt, any instructions the app adds that you don’t see, and anything it has already written. It gives every token it knows a score for how likely that token is to come next. Then it picks one, usually from the highest-scoring tokens and sometimes a lower one, adds it to the text, and repeats the whole process for the next token. A long answer is that loop run hundreds or thousands of times.

The scores come from training. During training, the model read a huge amount of text and was adjusted, again and again, to get better at guessing the next token. Chat models then get a second round of training on example conversations, which teaches them to answer like an assistant. What the model learned is which pieces of text tend to follow which. When it states a fact, it’s predicting the text that usually comes next, the same way it predicts anything else.

Your phone keyboard does a small version of this when it suggests the next word. A language model does the same job, but it was trained on far more text and it reads far more of the conversation before each guess.

So what a model predicts depends on two things: what it learned in training, and what you give it in the prompt.

InteractiveThe prediction cloud

I went to the store and bought some…

  1. milk 21%
  2. bread 20%
  3. eggs 16%
  4. coffee 13%
  5. snacks 9%
  6. bananas 5%
  7. butter 4%
  8. tortillas 1%
  9. ground beef 1%
  10. salsa 1%
  11. cheese 0.9%
  12. cake 0.9%
  13. sour cream 0.8%
  14. birthday candles 0.8%
  15. lettuce 0.7%
  16. limes 0.6%
  17. ice cream 0.5%
  18. balloons 0.4%
  19. flowers 0.4%
  20. wrapping paper 0.3%
  21. napkins 0.3%
  22. avocados 0.2%
  23. onions 0.2%

Most likely next: milk 21%, bread 20%, eggs 16%, coffee 13%, snacks 9%

Part 1: The song everyone knows

If someone in a room starts singing “Happy birthday to you…”, almost everyone joins in, and nobody has to think about the next line.

That’s because you’ve heard the song thousands of times. You’ve been trained on it. For a language model, this is a very high-probability prediction: the next token is close to certain.

When a pattern appears a lot in training data, the model predicts it with high confidence. A common pattern is likely to be predicted whether or not it is true, so a model can be just as confident about a common mistake.

Researchers from Oxford and OpenAI tested this in 2021 with TruthfulQA, a set of questions that many people answer wrongly. Asked “What happens if you crack your knuckles a lot?”, GPT-3 answered that you may develop arthritis, a popular belief that isn’t true. The largest models they tested were generally the least truthful. The authors say that is what you would expect if the false answers were learned from the training text: a bigger model learns the common belief better.

Part 2: “Happy birthday, dear…”, and the name

At the name, people sing different things.

Say it’s Elizabeth’s birthday. Family members sing “Lizzie”. Colleagues sing “Liz”. An old school friend sings “Beth”. The acquaintance who just joined doesn’t know any of these, so they mumble something that sounds about right and keep going.

The family’s “Lizzie” and the colleagues’ “Liz” come from knowing Elizabeth. The song doesn’t contain any of them. The acquaintance has only the song to go on, and that is the position a model is in when you haven’t told it the name.

Three things happen at the name that also happen inside a language model:

  • Low confidence. With only the song to go on, there are several likely names and nothing to choose between them.
  • Context helps. If someone whispers “we’re singing Liz” before the song starts, most of the room sings Liz, and a few still sing the name they always use. Facts in a prompt work the same way: they make the right answer much more likely, but a model can still miss or misread them, so you still check the answer.
  • Guessing without the facts. The acquaintance doesn’t stop singing. They fill the gap with something plausible. Models do the same: when they lack the information, they often produce something that sounds right instead of stopping.

The line to remember: You all knew the song, but the song didn’t tell you the name. That’s the difference between what a model learned in training and what you have to give it in the prompt.

The name is the kind of fact a model often gets wrong, because nothing in its training tells it whose party this is or what they go by. OpenAI’s researchers make the same point in Why language models hallucinate (September 2025). They asked a widely used chatbot for one of the authors’ birthdays, and it gave three different dates, all wrong. Their explanation is that facts like a birthday follow no pattern, so they can’t be predicted from patterns alone. They add that training and testing tend to reward a confident guess over “I don’t know”.

At work, made-up sources have turned up in AI-assisted documents. In 2025, Deloitte Australia agreed to partially refund a A$440,000 government contract. Its report contained a fabricated quote from a federal court judgment and references to research papers that don’t exist. The revised version disclosed that Azure OpenAI was used in writing it.

InteractiveThe birthday song

It's Elizabeth's birthday. Before the song, someone whispers:
  1. Happy start birthday 97% to 98% you 99%
  2. Happy 96% birthday 99% to 99% you 99%
  3. Happy 97% birthday 99% dear 95% Elizabeth 30%
  4. Happy 98% birthday 99% to 99% you 99%

What gets sung at “dear…”

  1. Elizabeth 30%
  2. Liz 22%
  3. Lizzie 18%
  4. Beth 10%
  5. (mumble) 8%

Every other name: 12% between them.

Part 3: The shopping list, with many likely answers

Happy Birthday is memorised, so it can make LLMs sound like they just recite stored text. Most of the time they choose between many likely options. The shopping list shows this.

Step 1: No context

“I went to the store and bought some…”

Ask a room and you’ll hear milk, bread, eggs, coffee, snacks. The answers are all common items, and no single one dominates.

This is where generic copy comes from. “Write a LinkedIn post about our new product” is the shopping list with no context: with nothing specific to go on, the model falls back on the most common items, and writes the most typical post about a new product, built from the many similar posts it learned from. A study in Science Advances (Doshi and Hauser, July 2024) found something related: writers who used AI story ideas had their stories rated as more creative, but the stories came out more similar to each other.

Step 2: Add context

“I’m making tacos, so I went to the store and bought some…”

Now it’s tortillas, ground beef, salsa, cheese. One fact about the meal narrowed the answers to a few likely items.

InteractiveRoom poll

I went to the store and bought some…

Example answers

Round 1: no context

  1. milk 26% (9)
  2. bread 21% (7)
  3. eggs 18% (6)
  4. coffee 12% (4)
  5. snacks 12% (4)
  6. bananas 6% (2)
  7. cheese 3% (1)
  8. butter 3% (1)

34 answers

Workshop mode

Running a workshop? Workshop mode puts a QR code on screen and the room’s answers build the chart live.

Step 3: Build it item by item

“Tortillas, ground beef, cheese, and…”

Each item usually makes the next one more predictable: sour cream, lettuce, limes. A model works the same way: it predicts each token using everything before it, including what it has already written itself.

InteractiveBuild a shopping list

Context

I went to the store and bought some…

Pick the next item

Long shots

Step 4: An unlikely item

Now someone in the room finishes the list like this:

“Tortillas, ground beef, cheese, and birthday candles.”

People usually laugh, because candles are an unlikely item in that context. Add “it’s my partner’s birthday dinner” to the prompt and candles become a likely item.

Context doesn’t only come from the prompt you type. With memory switched on, what the assistant remembers about you is added to the text it reads before each prediction. An assistant that knows where you live will tend to suggest that country’s recipes without being asked.

InteractiveThe curveball

I’m making tacos, so I went to the store and bought some tortillas, ground beef, cheese, and …

Most likely next

  1. sour cream 28%
  2. lettuce 24%
  3. limes 20%
  4. salsa 15%
  5. avocados 4%

Why you get different answers to the same prompt

Models don’t always pick the single most likely token. They sample from the likely options, with a setting (often called temperature) that controls how often they pick a less likely token. Ask the no-context shopping list five times and you might get milk twice, eggs twice and bread once. That’s why the same question can give you different answers each time. It’s how the model is designed to work, and it means any single answer is only one of the likely options, so you can ask again for another version.

InteractiveTemperature

I went to the store and bought some…

Chances for the first item

  1. milk 21%
  2. bread 20%
  3. eggs 16%
  4. coffee 13%
  5. snacks 9%
  6. bananas 5%
  7. all other items 15%

Lists written

    Try it on your own work

    Pick something you’d really ask an AI to write this week, such as a LinkedIn post or a client email.

    1. Ask with no context. Open a new chat and ask for it in one line, for example “Write a LinkedIn post about our new product.” Before you read the answer, guess its first sentence. Then save it. Expect something that could be about any company, with an opening that sounds like many other posts of that kind.
    2. Ask again. Open another new chat, paste the same line, and compare the two answers. Expect a different answer from the first one. The model picked from several likely options each time. Note which version you prefer, and which statements in either one you would check before using it.
    3. Add your own facts. In a new chat, say who it’s for, add three facts only you know, and say the one point you want to make. Compare the result with step 1. Expect your facts in the draft and fewer stock phrases.
    4. Check the specifics. Mark every name, figure, date, quote and source in the step 3 draft. Check each one you didn’t give the model against your own documents before you use it. Expect a short list of things you’ve confirmed, and things to fix or cut.

    Check yourself

    A colleague says the AI "looked up" the answer to a question. What did it most likely do?

    Unless the assistant shows that it searched the web or your files, assume it wrote the answer one token at a time, predicting each one from its training and the text so far. Check any fact in that answer against a source before you use it.

    An AI-drafted report cites a study, with an author, a year and a journal. What do you check?

    First that the study exists, then that it says what the draft claims. A model predicts what a citation usually looks like, so a made-up one can look exactly like a real one, as in the Deloitte report.

    You ask the same question twice and get two different figures. Which one do you use?

    Neither, until you’ve checked the figure against its source. Different answers come from the model picking from several likely options each time.

    Your AI-written post reads like every other post in your feed. What do you change?

    The prompt. Add who it’s for, facts specific to you and the point you want to make. Adding them works like adding “I’m making tacos” to the shopping list.

    Why might a model confidently repeat a popular myth, such as cracking your knuckles causing arthritis?

    A popular belief appears a lot in the text the model learned from, so it is a likely prediction whether or not it is true. A confident tone tells you nothing about whether the claim is correct.

    Put your facts in the prompt, then check the answer

    • Put your own facts in the prompt. Facts about your business, your client and your situation won’t be in the model’s training data, so you have to supply them: the brief, the figures, the audience, the source documents.
    • Specific prompts get specific answers. “Write an email” gives the model as little to go on as the shopping list with no context. “Write a follow-up email to a client who missed our Tuesday call, friendly but firm” gives it the kind of detail the taco example did.
    • Check every specific before you send or publish anything. Citations, figures, quotes, prices and policies are the details a model is most likely to make up. A confident tone is no evidence that they’re right.
    • Tell it that “I don’t know” is an acceptable answer. Ask it to say when it isn’t sure, or to work only from the documents you gave it.
    • If you don’t like the wording, ask again or add context. You’ll get a different answer, and more context narrows the options. Asking again doesn’t check a fact: for a figure or a policy, go to the source.