PRIMER
Recommended path: finish Level 1 before Level 2. This module remains available because advanced learners may arrive directly.

AI Primer Advanced

How LLMs Work

Next-token prediction, sampling, and reliable prompting

Not started0 / 6 demos

Module progress

Not started

Lesson progressNot started
Demo completion0 / 6
Quiz completionNot started
Module completionOpen
Next recommended actionFinish Demo Lab

Complete the demos to prove the mechanism before the checkpoint.

Finish Demo Lab

Concept stack

LLMsContext WindowTemperatureHallucinationPrompt EngineeringChat TemplatesModel Types

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.

Top tokenpolicy

Next-token prediction simulator

Score the next token after a short context.

policy 42%, window 24%, request 14%The model predicts a distribution, not a single guaranteed word.
Explore the demo, then log the advanced practice XP.

Knowledge check

How LLMs Work checkpoint

0 / 6 correct0 / 6 answered
Why does next-token prediction produce useful behavior?
Why does a larger context window not equal perfect memory?
Why do hallucinations happen?
What makes a prompt more reliable?
Why can the same model weights suddenly look broken?
Why shouldn't you start with a base model for a chat product?