esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

What Is a Large Language Model?

What an LLM is, how it writes one token at a time, how it is trained, and where it goes wrong, explained simply for your AI interview.

In short

A large language model (LLM) is an AI model with a very large number of parameters, trained on huge amounts of text to predict the next token. It writes one small piece at a time, so it can sound fluent while being wrong.

11 min readBeginnerVery common · estimateFacts checked 26 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

A large language model is an AI model with a very large number of parameters, which are the numbers it learns during training. It is trained on huge amounts of text to predict the next token, a small piece of text such as a word or part of a word. It writes a reply one token at a time, so it can sound fluent and still be wrong. It predicts text and does not check facts on its own. So in a real product I give it the facts it needs, check its output, and keep the important decisions in code.

What is a large language model, in plain words?

Picture a claims handler at an insurance company who has read thousands of policy wordings. Asked to finish a sentence in a customer letter, they write from the pattern of policy language they have absorbed. Most of the time it is right. Sometimes it sounds right and is wrong, because they remembered the pattern instead of checking the policy on file.

A large language model, or LLM, does the same thing with text. It has absorbed patterns from a very large amount of writing, and it predicts what comes next. Chat assistants such as Claude are built on this kind of model.

  • “At a minimum, a language model having a very high number of parameters.”

    Google, machine learning glossary

  • “Large language models (LLMs) are AI language models with many parameters that are capable of performing a variety of surprisingly useful tasks.”

    Anthropic, glossary

Key words

Parameter
A number inside the model that training adjusts. A large model has a very great many of them.
Token
A small piece of text the model reads or writes: a word, part of a word, or a single character.
Pretraining
The first, general training pass on a huge pile of text.
Context window
How many tokens the model can read at once. Its working memory for one conversation.

How does an LLM write a reply, one token at a time?

An LLM does not write whole sentences in one go. It writes tokens. Google's crash course puts it simply: LLMs predict a token or sequence of tokens. A token can be a word, part of a word or a single character.

  1. 1

    Read the text so far

    Your prompt and the reply so far, cut into tokens.

  2. 2

    Score every next token

    The model gives each possible next token a chance of coming next.

  3. 3

    Pick one

    Pick one token from those chances. Temperature, a setting, controls how much the choice varies.

  4. 4

    Add it and repeat

    The new token joins the text, and the loop runs until the reply ends.

How one reply is built

Text so far

your prompt and the reply so far

Language model

scores every possible next token

Chances for each token

the chances add up to 100%

Pick one token

chosen by its chance

Add it and repeat

stops when the reply ends

  1. 1Your prompt and the reply so far are cut into tokens.
  2. 2The model gives every possible next token a chance.
  3. 3The chances across all the options add up to 100%.
  4. 4The model takes one token, based on those chances.
  5. 5The token joins the text, and the loop repeats until the reply ends.
How one reply is built. The model scores every possible next token, one is picked and added to the text, and the loop repeats until the reply stops.

Google's glossary adds that, more informally, the term covers any Transformer-based language model. The Transformer is a design "based solely on attention mechanisms": as it reads, each token weighs how much the other tokens in the text matter to it.

Tip

Say the loop out loud: read, score, pick, add, repeat. It shows you know the mechanics, not just the buzzwords.

How is an LLM trained?

Training has two big passes. The first is pretraining, the general step on a huge pile of text. The second is fine-tuning, which teaches a specific job or behaviour.

  • Pretraining

    General language

    The model predicts the next token across a huge pile of text. This builds broad language skill.

  • Fine-tuning

    One job, one style

    A second training run on examples of one task, such as answering questions in a chat format.

Two training passes

Huge pile of text

raw text, with no labels

1. Pretraining

Predict the next token

learns general language patterns

2. Fine-tuning

Examples of one job

answers in the style you want

Assistant model

follows instructions in a chat

  1. 1Pretraining reads a huge pile of text and predicts the next token.
  2. 2Fine-tuning is a second pass on examples of one job.
  3. 3The tuned model follows instructions in a chat, which pretraining alone does not teach well.
Two training passes. Pretraining teaches general language from a huge pile of text. Fine-tuning then teaches a job from examples. Chat assistants add further tuning, such as RLHF, on top.

Pretrained models are not built to chat. Anthropic's glossary says they are not inherently good at answering questions or following instructions, which is why the second pass matters.

Chat assistants add further tuning. Anthropic's glossary says fine-tuning and RLHF are used to refine these pretrained models, making them more useful for a wide range of tasks.

Why can a fluent answer still be wrong?

Because the model predicts plausible text, it can produce an answer that sounds sure and is false. The field has a name for this: hallucination.

  • “The production of plausible-seeming but factually incorrect output by a generative AI model that purports to be making an assertion about the real world.”

    Google, machine learning glossary

  • Known from training

    Learned patterns

    Its knowledge sits in its parameters. It cannot check a fact against a source unless you give it one.

  • Given in the prompt

    Working memory

    Anything you paste in sits in the context window. The model reads it as it writes.

Anthropic's glossary calls the context window the model's "working memory", separate from the data it was trained on. Answers can also change between runs: temperature is a setting that controls how random the model's picks are, and Anthropic notes that even at temperature 0 the results will not be fully deterministic.

Worked example. Here is a made-up claims letter at a home insurer. The model drafts a line about a burst pipe. The chances are invented for this example, and they favour a figure that is not in the policy on file. The model cannot tell the difference, so code checks the figure before the letter goes out.

Python
# A simplified claims-letter step. The chances are invented for this example, not from a real model.
POLICY = "Water damage from a sudden pipe burst is covered up to 18,000 dollars, after a 750 dollar excess."
NEXT_OPTIONS = [("25,000", 0.46), ("18,000", 0.31), ("10,000", 0.15), ("unlimited", 0.08)]

def pick_most_likely(options):
    # Greedy choice: always take the option with the highest chance.
    return max(options, key=lambda option: option[1])

amount, chance = pick_most_likely(NEXT_OPTIONS)
draft = "Your policy covers water damage from a burst pipe up to $" + amount + "."
print("Draft:", draft)
print("Chance of that pick:", chance)

def check_against_policy(figure):
    # Code, not the model, decides whether a figure is on file.
    if " " + figure + " " in " " + POLICY + " ":
        return "OK: " + figure + " is in the policy"
    return "HOLD: " + figure + " is not in the policy, send to a claims handler"

print(check_against_policy(amount))

Output

Draft: Your policy covers water damage from a burst pipe up to $25,000.
Chance of that pick: 0.46
HOLD: 25,000 is not in the policy, send to a claims handler

Tip

In an interview, lead with the fix: the figure comes from the policy document that code retrieves, and a check in code blocks any figure that is not on file. It cannot tell whether a figure on file is used correctly, so the drafting step should also name the field it fills.

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: a very large model that predicts the next token.
  • Parameters and training: learned from huge text by predicting tokens.
  • How a reply forms: one token at a time, from the text so far.
  • Pretraining vs fine-tuning, and what each one adds.
  • Hallucination and the context window as the two limits to plan for.
  • Honest about variation: the same prompt can give different wording.

Common traps

  • Trap"An LLM looks the answer up in a database."

    BetterIt predicts text from patterns in its parameters. It only reads what is in the context window or what a tool returns.

  • Trap"It understands things the way a person does."

    BetterDescribe what it does: it predicts tokens well, and that can look like understanding. Do not overclaim.

  • Trap"A bigger model is always the better choice for my product."

    BetterSize is one choice. Cost, speed and the task decide it, so test candidates on your own examples.

Can you spot the problem?

Spot the problem

A claims assistant drafts a customer letter. Which line is the risk?

Quick check

What does a large language model do when it writes a reply?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q002What does "predict the next token" mean?10 min
  2. Q003What is a token, and why not whole words?11 min
  3. Q008What is a context window?11 min
  4. Q016Pretraining vs fine-tuning vs instruction tuning?10 min
  5. Q023What is a hallucination, and why does it happen?11 min
  6. Q043What is self-attention?11 min

Learn it in depth

Last updated on 26 November 2026

Building a product on an LLM for your team?

I design and build AI products and agents: the interface and the system behind it, with checks on the model's output. Book a short call and tell me what you need.