Train merges, encode new text, and compare tokenizers fairly.
Preparation: Counting, pairs and fractions.
Plan 20–35 minutes with the activities; this is a study estimate, not a timed requirement. Both paths have complete narration. Your notes and progress are kept separately for each level.
FULL LOCAL NARRATION
Follow the complete explanation.
Narration includes worked solutions. Pause at each practice prompt before continuing. Formula notation has a spoken explanation; all teaching text remains readable.
College path. Train merges, encode new text, and compare tokenizers fairly.
Preparation: Counting, pairs and fractions. Work through one section at a time. Predict the experiment result before changing its controls, then explain what the example leaves out.
Tokenization maps text to vocabulary IDs. Its training collection, normalization, special tokens and decoding rules are part of the representation. Sequence length depends on the whole configuration, not just vocabulary size. IDs are categorical labels: ID twenty is not twice the meaning of ID ten. An embedding lookup subsequently assigns vectors. A pretrained model and its tokenizer must agree about the vocabulary; swapping tokenizers is not a free optimization.
Worked step 1. Write b, a, n, a, n, a as six pieces.
Worked step 2. Give repeated pieces the same vocabulary ID.
Worked step 3. Join the decoded pieces and recover banana.
Try it yourself. Must the ID of ana be three times the ID of a?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. No. IDs are labels. Their magnitude has no relationship to the number of letters or the meaning of a piece.
Section 02 / 07
Count adjacent pairs
Each BPE training iteration counts adjacent pairs over the current symbol sequences, selects a pair and replaces non-overlapping occurrences. Recount after merging. Boundary treatment, word-frequency weighting, initial byte or character alphabet, and tie-breaking vary between implementations. Our single-word character fixture isolates this algorithm; it does not reproduce a production tokenizer's vocabulary. It also makes the distinction between counting overlapping candidate pairs and performing non-overlapping replacements visible.
Worked step 1. Pairs are ba, an, na, an, na.
Worked step 2. Choose an and replace its two non-overlapping occurrences.
Worked step 3. The new sequence is b, an, an, a: four pieces.
6 pieces → 4 pieces
Two non-overlapping merges reduce six pieces to four.
Try it yourself. Can the original pair counts be reused for the next merge?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. No. The current pairs are b with an, an with an, and an with a. Counts describe the current symbol sequence.
Section 03 / 07
Freeze the rules before encoding
At inference, merge ranking is fixed. Encoding applies eligible learned merges according to that ranking rather than estimating new frequencies from the input. Train the tokenizer on a training split, freeze its vocabulary and normalization, then evaluate held-out text. A merge can be rare in the current document and still belong to the encoder. Model compatibility includes special-token IDs and the meaning of every vocabulary entry, not just the vocabulary's length.
Worked step 1. Freeze a+n→an, followed by an+a→ana.
Worked step 2. Banana encodes as b, an, ana.
Worked step 3. Band encodes as b, an, d; no band tile is invented.
Try it yourself. Why not learn fresh merges for every incoming message?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. A fixed model has no trained embedding for arbitrary new pieces. Stable encoding is required to interpret the saved vocabulary.
Section 04 / 07
Bytes and visible characters differ
Unicode code points, grapheme clusters and UTF-8 bytes are distinct. A byte-level token can contain an incomplete character fragment while the reconstructed byte sequence remains valid. Normalization may intentionally collapse distinctions before tokenization. SentencePiece supports multiple model families, including BPE and unigram; the framework name does not identify the algorithm. Normalization and byte-fallback configuration must be recorded when measuring unknown characters or round-trip fidelity.
Worked step 1. ASCII a occupies one UTF-8 byte.
Worked step 2. A single-code-point é occupies two UTF-8 bytes.
Worked step 3. An e plus combining accent has a different code-point sequence, even if it looks similar.
Try it yourself. Does more UTF-8 storage always mean more final tokens?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. No. Learned merges can combine bytes. Measure the chosen tokenizer, and record normalization and fallback settings.
Section 05 / 07
Predict, merge, measure
Compare local compression with generalization. The training fixture must reconstruct the input after every merge, while held-out compression requires a separate corpus. Tokens per byte, tokens per character and tokens per word have different denominators and different limitations. Larger vocabularies also increase embedding and output-table costs. Report the trade-off rather than treating minimum token count as a complete downstream-quality metric.
Worked step 1. At zero merges banana has six pieces.
Worked step 2. At one merge it has four pieces.
Worked step 3. At two merges, inspect the displayed sequence and join the pieces again.
Try it yourself. What must remain invariant when the piece count changes?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. The decoded character sequence remains banana. This fixture does not discard or reorder characters.
Section 06 / 07
Build a fair comparison
A reproducible comparison records tokenizer revision, training split, evaluation domain and language, normalization, fallback policy, byte count and token count. Evaluate model-task quality separately. A tokenizer that compresses one corpus well can perform poorly on another. Replacing a pretrained tokenizer usually requires additional model adaptation, so deployment comparisons must include that cost. The goal is to identify a suitable representation under stated constraints, not a universal best tokenizer.
Worked step 1. Keep evaluation texts unchanged.
Worked step 2. Encode them using two frozen configurations.
Worked step 3. Decode and record any normalization changes alongside counts.
Try it yourself. One tokenizer is better on English but worse on your main teaching language. Which result matters?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. Use the actual audience and workload. Report both outcomes and their trade-offs rather than hiding one behind a global average.
Section 07 / 07
Mastery and transfer
Bring the pieces together. First answer the checkpoint without the worked solutions. Then explain the mechanism in your own words, using one numerical example from this lesson.
Which procedure avoids tokenizer-training leakage? Option 1: Train on the test set first. Option 2: Freeze before held-out evaluation. Option 3: Tune every merge on test answers.
Pause here and choose an answer before continuing. The checkpoint explanation follows.
Reveal worked solution
The correct choice is option 2: Freeze before held-out evaluation. Keep training and evaluation data separate.
Transfer task. Change one assumption in the worked example. State your prediction, calculate or test it in Workbench, then explain whether the result supports your prediction.
Reveal worked solution
Self-check rubric. Name the changed assumption, keep the other inputs fixed, show at least one intermediate calculation, and distinguish what the toy example guarantees from what would require a trained model or a real measurement.
WORKBENCH / PREDICT → TEST → EXPLAIN
Inspect exact numerical data
These are computed teaching fixtures. No remote AI model or GPU is called by the experiment.
CHECK YOUR UNDERSTANDING
Commit to an explanation.
Keep your learning record.
Sources and scope
Original worked examples and teaching text, grounded in these primary references. Numerical fixtures explain mechanisms; model quality and hardware performance require separate measurements. Both levels share key examples, with different explanations and checkpoints.
What a model learns: from numbers to a useful answer
Follow a sentence through learned weights, temporary activations, and the next-token decision.
Additional reading · original lesson audio remains unchanged.
Read the full explanation · 586 words + college extension
What changes when you ask a question?
23input x
×
0.6−0.2learned weights
+
0.1bias
=
0.7output y
The weights stay fixed during ordinary inference. Activations change with your input.
Text → tokens
Tokens → vectors
Learned transformations
Next-token scores
Text → tokens
A model is a computation with learned settings
A language model does not contain a little librarian choosing a finished answer from a shelf. It contains a structured computation whose numerical settings were learned during training. Those settings are called parameters. Many are weights arranged in matrices; other parameters can include offsets or normalization scales. The architecture determines which operations happen and how information travels. The weights determine the particular transformations performed by those operations. Two models can share an architecture and behave differently because they learned different parameter values.
Consider a tiny operation: y = 0.6x₁ − 0.2x₂ + 0.1. With inputs x₁ = 2 and x₂ = 3, the output is 0.7. Changing the first weight from 0.6 to 0.5 changes the output to 0.5. This is a teaching example, not a miniature intelligent system. Its purpose is to make one idea visible: numerical settings influence the result. In a language model, many such transformations act together across large vectors, nonlinear functions, and layers.
Follow the sentence
First, a tokenizer turns text into a sequence of token identifiers. A token may represent a word, part of a word, punctuation, or another unit. An embedding table supplies a learned vector for each identifier. These vectors are starting representations, not complete dictionary definitions. As they pass through the network, surrounding tokens influence how the current sequence is represented.
In attention, learned projections produce queries, keys, and values. The model compares queries with keys to calculate input-dependent attention scores, then combines value representations. This distinction matters: the projection weights normally remain fixed during a conversation, while the attention scores change with the input. Feed-forward transformations further process the representations, and residual connections carry information around sublayers. Finally, an output transformation supplies scores for possible next tokens. A selection procedure chooses a continuation, which becomes part of the next input step.
Training changes the settings; a conversation changes the state
During training, a loss measures how the predictions compare with the training objective. Gradients estimate how parameter changes would affect that loss. An optimizer uses those gradients to update trainable parameters. A single example does not usually teach an isolated fact to one identifiable weight. Useful patterns emerge through many updates, and knowledge and behavior are distributed across the computation.
During ordinary inference, the parameters stay fixed. Your prompt changes the activations: the temporary numbers produced while the model runs. A cache can retain intermediate information so the system need not repeat earlier work. That cache is not a new permanent education for the model. A product may separately save conversation history or conduct later training, but those are additional mechanisms. Saying that a chatbot remembers your previous sentence does not establish that its weights changed.
Why more parameters is not a complete explanation
A parameter count describes scale, not a guarantee of reliability. Data quality, architecture, training, numerical precision, and the way a model is evaluated all matter. A large model can produce a convincing error; a smaller specialized model can perform a narrow task well. To compare systems, ask what task was tested and under what conditions, rather than treating one number as a universal intelligence score.
Return to the animation and identify three different objects: a stored weight, an activation that changes with the sentence, and an output score. If the diagram uses moving dots, those dots represent information flow; they are not literal particles inside a model. Using the small equation above on paper, change an input while keeping a weight fixed, then change the weight while keeping the input fixed. Explain why these are different experiments. That distinction will help you understand fine-tuning, quantization, caches, and model releases throughout the course.
College extension · make the assumptions explicit
For a linear layer, write y = Wx + b. If W has shape m × n, x has n entries and y has m entries. During backpropagation, the chain rule relates a loss gradient at y to gradients at W and x. During inference, the same forward transformation can execute without constructing those training gradients. In attention, WQ, WK and WV are parameters; QKᵀ and its normalized scores are functions of the current activations. Keeping these categories separate prevents a common mistake: interpreting an attention heat map as a direct picture of stored model weights.
Sources and further investigation
Source review: October 28, 2026. Model-release claims are attributed to their publishers.