Unit 1 · Foundations

Lesson 01 · Available to read

What Is a Large Language Model?

What an LLM actually is: a next-token predictor trained on vast text, and why that simple objective produces surprisingly general abilities.

Type a message on your phone and the keyboard suggests the next word. A large language model (LLM) does the same job — but trained on a meaningful fraction of the written internet, with billions of adjustable parameters, it does that job so well that it can write essays, explain code and work through problems step by step.

This lesson gives you the mental model that the rest of the course builds on.

The one job: predict the next token

An LLM reads a sequence of tokens (pieces of words — Lesson 2) and outputs a probability for every token in its vocabulary of what comes next. In probability notation it estimates:

P(next token | all the tokens so far)

Give it "The capital of France is" and it doesn't return "Paris" directly. It returns a whole distribution: maybe 82% " Paris", 4% " a", 3% " located", and tiny amounts on tens of thousands of other tokens.

An LLM turns the context into a probability distribution over the next token; ' Paris' gets 82%.
An LLM turns the context into a probability distribution over the next token; ' Paris' gets 82%.

That is genuinely all a pretrained LLM does. Everything else — chat, coding, translation — is built on top of this single ability.

Generation is a loop

To produce a full answer, the model runs in a loop called autoregressive generation:

  1. Read the tokens so far.
  2. Compute the probability distribution for the next token.
  3. Pick one token from that distribution (Lesson 13 covers how).
  4. Append it to the sequence and go back to step 1.

The model never plans a whole paragraph and then types it out. Each token is chosen one at a time, and each choice becomes part of the input for the next.

Autoregressive generation: the model predicts one token, appends it, and runs again on the longer sequence.
Autoregressive generation: the model predicts one token, appends it, and runs again on the longer sequence.

Why "large"?

Three things are large, and they grow together:

  • Parameters — the adjustable numbers (weights) inside the network. Modern models have billions to trillions of them. GPT-3 (2020) had 175 billion.
  • Data — training text measured in trillions of tokens: web pages, books, code, scientific papers.
  • Compute — training a frontier model takes thousands of specialised chips running for weeks or months.

Lesson 8 shows that scaling these three together makes the prediction error fall in a remarkably predictable way.

Why does predicting words produce intelligence-like behaviour?

Consider what it takes to predict the next token well in different documents:

  • In "2 + 2 × 3 =" you need to know operator precedence.
  • At the end of a mystery novel — "The murderer was…" — you need to track characters and clues across hundreds of pages.
  • In a Python file, you need to know what the function was supposed to do.

There is no shortcut that fits all of these: the cheapest way to get the loss down across trillions of tokens is to build internal representations of grammar, facts, and patterns of reasoning. Prediction is the training objective; knowledge and skill are what the model develops to meet it.

Careful: "learned patterns of reasoning" is not the same as "always reasons correctly". The model learns what plausible text looks like, which is usually but not always true text. That gap is where hallucinations come from (Lesson 18).

From raw predictor to helpful assistant

The model you chat with went through several stages. This course follows the same path:

The pipeline from web-scale text through pretraining, fine-tuning and alignment to a deployed assistant.
The pipeline from web-scale text through pretraining, fine-tuning and alignment to a deployed assistant.
  • Pretraining (Lessons 9–10) produces a base model: a brilliant document-completer that will happily continue your question with more questions.
  • Fine-tuning (Lesson 11) teaches it the format of a helpful conversation.
  • Alignment (Lesson 12) shapes it toward responses people actually prefer — helpful, honest and harmless.
  • Deployment (Lessons 13–20) wraps it with sampling settings, prompts, retrieval, tools, evaluations and safeguards.

What an LLM is not

  • Not a database. Facts are stored diffusely across billions of weights, not as retrievable rows. It can misremember.
  • Not a search engine. On its own, it knows nothing after its training data was collected (its knowledge cutoff) unless you give it tools or documents.
  • Not a persistent memory. Each request starts fresh; the model only "remembers" what is inside its context window (Lesson 7). Chat apps simulate memory by re-sending the conversation.
  • Not deterministic by default. Because tokens are sampled, the same prompt can produce different answers.

Key vocabulary

  • Token — the unit of text the model reads and writes.
  • Vocabulary — the fixed set of all tokens the model knows (often 50,000–200,000).
  • Parameters / weights — the learned numbers inside the model.
  • Context — the tokens the model can see when making a prediction.
  • Base model vs. assistant — before and after fine-tuning and alignment.

The takeaway

An LLM is a giant function trained to do one thing — predict the next token — and doing that one thing extremely well forces it to learn grammar, facts and patterns of reasoning.

Practice

0 of 7 attempted

  1. 1Recall

    In one sentence, define what a large language model does at each step of generation.

    Saved in this browser

  2. 2Multiple choice

    What does an LLM output at each step?

  3. 3Calculate

    A model gives P(" Paris" | "The capital of France is") = 0.8 and P("." | "The capital of France is Paris") = 0.9. What probability does it assign to the two-token continuation " Paris."?

    Saved in this browser

  4. 4Explain in your own words

    Explain in your own words why getting very good at next-token prediction forces a model to learn facts and reasoning patterns. Use an example that is not in the lesson.

    Saved in this browser

  5. 5Recall

    List the four stages that turn raw text into a deployed assistant, and say what each stage produces.

    Saved in this browser

  6. 6Apply

    A friend says: "I asked the chatbot about yesterday's football result and it confidently gave a wrong score. It must be broken." Using what you learned about what an LLM is not, write a short explanation for your friend.

    Saved in this browser

  7. 7Explain in your own words

    Why can the same prompt produce different answers on different tries?

    Saved in this browser

See what unlocked