You're referring to the relationship between character count and token count.
The answer is, it's not a joke, but it's also not a straightforward conversion. The number of tokens in a given text depends on the specific tokenization algorithm used.
What is tokenization?
Tokenization is the process of breaking down text into individual units, called tokens. These tokens can be words, subwords, or even characters, depending on the algorithm.
Why is the character-to-token ratio variable?
Different tokenization algorithms have varying ways of splitting text into tokens. Some common factors that influence the character-to-token ratio are:
- Tokenization algorithm: Different algorithms, such as word-level, subword-level (e.g., WordPiece, BPE), or character-level tokenization, will produce different token counts for the same text.
- Language and script: The complexity of the language and script used in the text can affect the tokenization. For example, languages with logographic scripts (e.g., Chinese) may have a different character-to-token ratio compared to alphabetic scripts (e.g., English).
- Special characters and markup: The presence of special characters, such as punctuation, HTML tags, or markup, can influence the tokenization.
The ~25k input token estimate
The estimate of ~25k input tokens for 100k characters is likely based on a specific tokenization algorithm, possibly a subword-level algorithm like WordPiece or BPE, which are commonly used in natural language processing (NLP) models.
To give you a rough idea, here are some approximate character-to-token ratios for different tokenization algorithms:
- Word-level tokenization: 1 token ≈ 5-7 characters (e.g., English text)
- Subword-level tokenization (e.g., WordPiece): 1 token ≈ 4-5 characters (e.g., English text)
Using these rough estimates, we can calculate the expected token count for 100k characters:
- Word-level tokenization: 100,000 characters / 6 characters/token ≈ 16,667 tokens
- Subword-level tokenization: 100,000 characters / 4.5 characters/token ≈ 22,222 tokens
So, the ~25k input token estimate for 100k characters is not entirely unreasonable, depending on the specific tokenization algorithm used.
Keep in mind that these are rough estimates, and the actual token count may vary depending on the specific use case and tokenization algorithm employed.