AI Systems · intro

Tokenization (LLM)

Byte-level, char-level, BPE, vocab design.

ai-systemslanguage-modeling

Mental model

LLM tokenizers (BPE, SentencePiece) split text into small reusable pieces — often subwords — so the model can handle any input even if it has not seen the exact word. The model and the tokenizer are a pair; swapping one breaks the other.

How to study Tokenization (LLM)

Begin by restating the mental model in your own words, then connect it to a concrete system you have built or operated. Name the mechanism, the constraint it addresses, and the trade-off it introduces. Use Stanford CS336 — Language Modeling from Scratch (course), CS336 Assignment 1 — Build a tokenizer from scratch, Let's build the GPT Tokenizer (Karpathy) to check details, but close the source before writing your explanation. Retrieval is the learning step; rereading is only preparation.

Next, compare Tokenization (LLM) with Tokenization, Language Modeling. Ask what changes in correctness, latency, resource use, operability, and failure recovery. Complete One BPE merge step and preserve the command, input, output, and one failed attempt as evidence. Finish by explaining the idea without jargon to someone who has not studied the track.

Proof of understanding

  • Explain the mechanism from first principles and identify the state it reads or changes.
  • Give one situation where the concept is the right choice and one where it is not.
  • Predict a realistic failure mode before running the drill, then compare the prediction with evidence.
  • Connect the result to a roadmap or build artifact instead of treating the concept as isolated trivia.

Learn from primary sources

Practice and explain it back

One BPE merge step

Corpus tokenized as [l,o,w,e,r,l,o,w,e,s,t]. Count adjacent pairs; merge the most frequent pair once. What is the new sequence?

Expected evidence: lo appears twice → merge lo → [lo,w,e,r,lo,w,e,s,t].

Open the interactive drill →

Review prompts

  • Why can you not swap a model's tokenizer for a better one without retraining?

Build evidence

Synthesize: AI Models & Training

Move from transformer foundations through pre-training, fine-tuning, post-training, compression, and evaluation. Produce one working system, benchmark, or evidence-backed design that integrates the path.

  • Implements or precisely models the core mechanisms from all three milestones
  • Includes at least one injected failure or adversarial case and demonstrates recovery
  • Reports quality, latency, resource, reliability, or usability measurements relevant to the domain
  • Ships a concise architecture note explaining decisions, trade-offs, and remaining risks

Prerequisites

None assigned yet.

Related concepts

Learning paths