LLM Basics
Lesson 1 of 15

What Is a Language Model?

You've already used a language model, even before ChatGPT existed. Every time your phone's keyboard suggests the next word as you type, it's running a tiny language model.

At its core, a language model is just a system that predicts what word (or piece of a word) comes next, given the words that came before it.

Try finishing this sentence in your head:

"The cat sat on the ___"

You probably thought of mat, floor, or couch — not airplane or Tuesday. That's because your brain has learned, from a lifetime of reading and hearing language, which words are likely to follow others.

A large language model (LLM) does the same thing, but it learned this by reading enormous amounts of text and adjusting billions of internal numbers (called parameters) until its next-word predictions got very good.

Predict before you look

Try the default phrase before touching anything else: "the cat sat on the ___." What word do you think will get the highest bar?

Those percentages are real — computed by an actual pretrained model (Google's "tiny BERT"), not hand-picked. That's exactly the shape of what a language model outputs at every single step: not one "answer," but a full probability distribution over every possible word, with the most likely ones getting the most weight.

One honest detail: this particular model's real task is filling in a masked word using context from both directions, not just predicting what comes next left-to-right (that's the GPT-style task the rest of this course builds toward). Same core idea — a probability distribution over words — just not identical mechanics. More on that difference later.

The real computation behind those bars, reproduced here in Python against the exact same real model weights:

Python

The word "large" in LLM refers to two things:

  1. The amount of text it learned from — often a large fraction of the public internet, books, and code.
  2. The number of parameters — the internal numbers the model tunes during training. Modern LLMs have anywhere from millions to hundreds of billions of them.

Everything else in this course is really just answering one question: how does a model turn text into predictions, and how does it learn to do that well? Before we touch language at all, we need the machinery behind that second question — how a model adjusts its parameters. That starts with derivatives.

What is the fundamental task a language model is trained to do?