Chapter 6

Count-Based Language Models

Unigrams, bigrams, trigrams, conditional probability, Markov assumptions, sparse counts, and zero probability.

What this chapter does

Counts make the language-modeling objective concrete before neural networks hide the table inside parameters.

Lessons

Read these in order.

Start with the chapter introduction, then move through the topic lessons. The order is chosen so each page can reuse ideas from the pages before it.

  1. 01
    Introduction

    Count-based language modeling as visible context counts and continuation probabilities.

  2. 02
    Unigram Models

    Estimating token probabilities from overall frequency, with no context.

  3. 03
    Bigram Models

    Using one previous token as context for next-token probabilities.

  4. 04
    Trigram Models

    Using two previous tokens as context and seeing sparsity appear.

  5. 05
    Conditional Probability

    The count formula behind n-gram next-token estimates.

  6. 06
    Markov Assumptions and Sparse Counts

    Why fixed context windows are clear but limited by sparse evidence.

Before moving on

  • Compute a bigram probability by hand.
  • Identify where a count model loses context.
  • Sample tiny text from counted probabilities.

Where this leads

  • Smoothing and Backoff
  • Evaluating Language Models

Chapter progress