In the third installment of the ISTQB Generative AI tutorial series, we explore two fundamental concepts powering modern AI: tokenization and context windows. Understanding these mechanisms is critical for software testers and developers working with large language models.
Tokenization is the process of breaking text into smaller units called tokens. Tokens can be words, subwords, or characters. For example, the sentence "I love AI" might be split into three tokens: "I", "love", and "AI". However, tokens aren't always one-to-one with words. In English, an average token represents about four characters. So, a 1,000-word article might equate to roughly 1,300 tokens. Tokenization enables models to process text efficiently, converting it into numerical vectors.
The context window defines the number of tokens the model can "see" at once when generating a response. It acts as the model's short-term memory. For instance, a context window of 2,048 tokens means the model can only consider the last ~1,500 words. If you ask a question that requires information beyond that window, the model won't have access to it. Larger context windows (e.g., 32,000 tokens in newer models) allow for more comprehensive analysis of long documents or extended conversations.
These concepts are directly applicable to software testing. When testing AI applications, testers must consider how a model handles prompts near its context limit, how tokenization affects multi-language support, and whether truncation leads to loss of meaning.
"Tokenization is the first step in making language models understand human text. Without it, there is no input for the model to process."
This tutorial provides practical examples to illustrate both concepts, using the ISTQB GenAI certification framework as a guide.