AI engineering

Stage 1 · Lesson 1 of 8

What a model does: predicting the next token

How LLMs work: tokens and context

A (LLM) is a program that reads a piece of text and guesses what comes next. The text is split into small called tokens. For every possible next token, the model gives a probability.

To write a reply, it picks one token, adds it to the end and runs again. It repeats this hundreds of times. Chat replies, and output all come from this same loop, just with different text going in.

The model has no memory between requests. A conversation only exists because your code sends the full history every time. Keep this picture in mind and the rest of the stage follows: cost grows with tokens, is the only thing the model sees, and a fluent answer is a likely answer, not a checked one.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

Keep handy

Also worth your time

Mark this stage as not done?