DEPLOYEDAI-era interview training
RankBootstrapping
XP 0 / 250
0
0%
Ready
Applied AI / Forward Deployed Engineer · LLM Foundations · Lesson 1 of 5

What an LLM actually does: next-token prediction

7 min

A large language model is, mechanically, a next-token predictor. Given a sequence of tokens, it outputs a probability distribution over the next token. That's it. Everything else — reasoning, coding, translation — is emergent behavior from doing this extremely well at scale over trillions of tokens.

Tokens, not words

Models don't see characters or words; they see tokens — sub-word chunks from a fixed vocabulary (~100k–256k for modern models). "tokenization" might be 2 tokens; a rare word or code symbol might be several. Rule of thumb: ~4 characters ≈ 1 token, and 100 tokens ≈ 75 words in English (so ~1.3 tokens per word — English text is a bit more than one token per word).

Why tokens matter in practiceCost and context limits are measured in tokens, not words. Tokenization explains classic failures: models struggle to count letters in a word ("how many r's in strawberry") because they never see letters — they see tokens.

The Transformer, in one breath

The architecture is the Transformer (Vaswani et al., 2017). Its key mechanism is self-attention: every token can look at every other token in the context and weigh how relevant each is. Stack many attention + feed-forward layers, train to predict the next token, and you get an LLM. You don't need to derive attention math for this role — but you must know what it does and why it's expensive (attention cost grows with the square of sequence length).

◆ Lock it in

  • LLMs predict the next token from a probability distribution; capability is emergent from scale.
  • Models operate on tokens (~4 chars each), not words or letters — this drives cost, limits, and quirks.
  • The engine is the Transformer; self-attention lets every token weigh every other; cost scales ~quadratically with length.
Feynman drill — say it out loudExplain why an LLM might fail to count the letters in a word, using the concept of tokens.
Step 1 rate your confidence · Step 2 pick your answer
Fundamentally, what is a language model computing at each step?
Step 1 — how sure are you?