Skip to content
Logo
←Applied AI Engineering
Chapter 2 of 23 · Level 1 · Foundations: How LLMs Work

How Models Generate Text

Logits to probabilities, temperature and sampling, the prefill/decode phases, and why models hallucinate.

  1. 2.1

    A Language Model Is a Probability Machine

    How a language model works comes down to one fact: it predicts the next token. Tokens, embeddings, attention, context, and every sampling knob you touch all live inside that single trick.

    8 min read
    →
← Previous chapterInside a Language ModelNext chapter →What Models Take In
© 2026 Said Mustafa Said
LinkedInGitHubEmail
Logo