AI Primer Advanced
How LLMs Work
Next-token prediction, sampling, and reliable prompting
Module progress
Not started
Concept stack
Learner outcome
Understand why next-token prediction can produce useful behavior, why context is not memory, and how sampling settings shape output reliability.
Mechanism
An LLM repeatedly scores likely next tokens from the prompt context. Temperature changes how sharply or loosely the model samples from that probability distribution.
Architecture notes
What this changes in a real system.
Next-token prediction can compose planning-like behavior because each token conditions on the growing answer.
A larger context window increases working room, not permanent memory.
Hallucinations happen when plausible tokens outrun available evidence.
Reliable prompts narrow the task, inputs, constraints, and verification criteria.
A chat model expects one training format for system, user, and assistant turns. Get the format wrong and the same weights look broken.
Model type sets what a checkpoint is trained to do. Base models continue text. Instruct, chat, reasoning, and tool-tuned checkpoints are built to follow a request.
Interactive demos
Run the mechanism, then claim demo XP.
Next-token prediction simulator
Score the next token after a short context.
Knowledge check