Main Point
A model processes units defined by its tokenizer and input format. Measure that representation rather than substituting word, character or file-byte counts.
Key Points
- A token may represent a word, fragment, punctuation, whitespace pattern, byte-related unit or special symbol.
- Token IDs select vocabulary entries; their arithmetic order has no inherent semantic meaning.
- Chat roles and boundaries can contribute to the final input representation.
- Tokenizer, model and expected message template are a matched configuration.
- Equal character limits or translated meaning do not establish equal token use, cost or task performance.
1. Reproduce a supplied example
These are invented classroom tokenizers. They are not observed outputs of a commercial model.
| Representation | Supplied units | Count |
|---|---|---|
| A content | unbelievable, ! | 2 |
| B content | un, believ, able, ! | 4 |
| A with 1 user and 1 end marker | user marker, unbelievable, !, end marker | 4 |
| B with 1 user and 1 end marker | user marker, un, believ, able, !, end marker | 6 |
The displayed comment stays `unbelievable!`. The rules determine a different sequence length. Real tokenizers may segment it differently. A fragment need not be a dictionary word. Vocabulary, segmentation, whitespace and fallback behavior are all relevant.
In the B teaching vocabulary, IDs 12, 903 and 35 select `un`, `believ` and `able`. The value 903 carries no greater importance, and distance between IDs is not semantic distance. Lesson 3 will distinguish the identifier from the learned vector it selects.
2. Why smaller units matter
Sennrich, Haddow and Birch’s August 2016 translation work addressed rare and unseen words with reusable subword representations. Its English–German and English–Russian experiments illustrate a concrete reason to move below whole words. The historical findings do not specify a later model’s vocabulary, segmentation or task quality.
3. Preserve the message structure
A chat template converts role-labelled messages into the sequence expected by a model. Transformers v4.57.1 documents different control formats for Mistral-7B-Instruct-v0.1 and Zephyr-7B, despite their shared base family. Use this as a versioned implementation example. A later service can use different fields, formats and limits. No tokenizer or model was executed for this lesson.
For a controlled count, record the exact text, model/tokenizer identity and revision, template/formatting procedure, included special units, and the service’s input/output accounting. Keep unchanged inputs where you want to isolate a model comparison, and record unavoidable differences.
4. Documents and other inputs
Bytes describe file storage. A PDF may store selectable text, compressed resources or page images. Extraction and supported vision processing can produce different model inputs. Images and audio can use other representations and billing conventions. Count the final supported representation under the actual model/service rules.
5. Closing
You can now ask what was counted and under which configuration. The next step is to understand what numerical representation a token ID selects.
6. Learning Checks
Attempt each question before opening its explanation. The blank worksheet and separate key remain available for a longer response.
M14-L02-Q01
Under the supplied classroom rules, B emits `un`, `believ`, `able`, `!`, then 1 user marker and 1 end marker are added. How many units are in the formatted input? Does the largest token ID identify the most important fragment?
Your attempt: ____________________
Show explanation after your attempt
6 units: 4 supplied content units plus 2 supplied markers. ID 903 is a vocabulary lookup identity, with no inherent importance ranking. Counts without the stated convention are incomplete.
M14-L02-P01
A team translates a notice and uses the same character limit for both versions. It claims that context use and cost are equal. What should be measured, and what other performance question remains?
Your attempt: ____________________
Show explanation after your attempt
Measure each exact input with its matched tokenizer and chat format, record revisions and included special units, and apply the actual service’s input/output limits and charging convention. Character equality does not establish token equality. Evaluate language/task capability separately. No observations or prices are supplied by this key.
Sources
- Sennrich, Rico; Haddow, Barry; Birch, Alexandra. *Neural Machine Translation of Rare Words with Subword Units*. ACL, August 2016, pp. 1715–1725. Primary paper, introduction and section 3. Retrieved 29 October 2026. Historical translation study; its methods and findings concern the reported tasks.
- Hugging Face. *Chat templates*, Transformers v4.57.1. Versioned documentation. Retrieved 29 October 2026. Documentation publication date is not reported here. This pinned older example does not assert the latest library or hosted-service behavior.