Review — From text to tokens
Back to the lesson · Practice and experiments · Explore tokenization in depth · Learning path plan
What to remember
- The tokenizer encodes text as units from its vocabulary. A token can represent part of a word, a space, a symbol, or part of its byte representation.
- The vocabulary assigns an integer ID to each token. The number identifies that entry in the vocabulary.
- Both segmentation and IDs depend on the tokenizer. Two tokenizers may encode the same text into sequences of different lengths.
- IDs then select embeddings in the model. With fixed parameters, two occurrences of the same ID retrieve the same initial vector; their positions and contexts can later produce different states.
- Encoding a prompt applies an already fixed tokenizer. Preparing a corpus and fitting a tokenizer belong to model construction, not to each request.
- A longer sequence consumes more context budget and may increase computation. Token count alone measures neither linguistic quality nor downstream model quality.
Recall from memory
Two tokenizers return different ID lists for the same text. Does this imply a bug? What stays fixed, and what can change?
Show the answer
No. The input text stays fixed. Token boundaries, the number of tokens, and their IDs can change with the segmentation rules and vocabulary. Each ID list is interpreted with its own tokenizer.
A second question to check the mental model
Why is ID 31373 not “larger” or “closer in meaning” than ID 995?
Show the answer
An ID is a label that indexes a vocabulary entry. Its numeric value expresses neither a distance nor a semantic quantity. The corresponding row of the matrix supplies the initial vector.
Check the initial lookup
Why do two occurrences of the same ID retrieve the same initial vector even though their later representations may differ?
Show the answer
Lookup reads the same embedding-matrix row for a given ID. Position and context enter later model computations, so they can produce different contextualized states.
Distinguish encoding from tokenizer training
Does submitting a prompt train or fit the tokenizer?
Show the answer
No. The prompt is encoded with an already fixed tokenizer. Training or fitting it belongs to model construction from a corpus.
Interpret token count
Is a tokenizer that produces fewer tokens necessarily better?
Show the answer
No. A shorter sequence may save context budget or some compute, but quality also depends on the system and target-task results. It requires separate evaluation.