Comparative Evaluation and Preference Models
Language modeling metrics count tokens, and a token can be a character, a word, or part of a word, so tokenization must be fixed before numbers are compared.
Why Language Model Numbers Are Hard to Compare
As AI models grow stronger, the damage a single failure can cause grows with them, so evaluating these models matters more over time. Evaluating open-ended, powerful models is hard, and many teams fall back on human judgment. Humans in the loop are useful for sanity checks, and in many cases human evaluation is essential. Automatic evaluation is where this material focuses, and language modeling metrics are one of its foundations, because many foundation models contain a language model component.
Two of the language modeling metrics, perplexity and cross entropy, have a reputation for being confusing. Many people find them hard to interpret. This article takes a different route from a typical explanation: it starts with the units of text that the metrics count, then builds up to entropy, cross entropy, and finally perplexity. The order matters, because a number produced by a metric only means something once you know what was being counted.
What do you think happens?
If the word cats is split into single characters, or kept as one whole word, which version produces more units for the metric to count?
Reveal answer
The character version produces more units. Splitting into characters gives four units for cats, while keeping the whole word gives one.
Most people first meet text as words, so it is natural to assume a language model also reads words. Every language modeling metric is counted in tokens, and a token is not always a word. The same text can be cut in several ways, and the cut determines how many units get counted.
Tokens: Characters, Words, or Parts of Words
A token is the unit that a language model reads and predicts. The source gives the rule directly: a token can be a character, a word, or part of a word.
These are three different ways to cut up the same text, and the choice is not cosmetic. The source notes that tokenization affects language modeling performance. It points out that you might want to decide whether cats and cat should count as two separate tokens, or whether will not and won't should count as two separate tokens. Each decision changes what the model is asked to predict and what the metric measures.
Read the diagram column by column. In the character column, the word is four tokens long. In the word column, it is a single token. In the part-of-word column, it becomes two tokens: a stem and a suffix. The text is identical in all three cases, yet the count of tokens differs, and any metric averaged over tokens will reflect that difference. This is the practical reason tokenization has to be understood before comparing numbers from two different systems.
Tracing One Passage Through Two Tokenizers
Suppose two evaluation teams both report a per-token score for the same passage. Team A tokenized the passage into characters. Team B tokenized it into whole words. Team B's passage has far fewer tokens, because each word is one unit where Team A has several. Nothing about the passage changed, only the unit being counted.
Counting Units Before Comparing Scores
Two systems each report an average loss per token on the word cats. System X uses character tokens and System Y uses whole-word tokens. Which step must be done before the two numbers can be compared?
- 1Identify the unit in each system
System X counts characters, so cats is 4 tokens. System Y counts whole words, so cats is 1 token.
- 2Recognize what the average is over
A per-token average divides a total by the number of tokens. The same total spread over 4 units and over 1 unit gives different per-token values, even though the text is the same.
- 3Fix the tokenization first
Because the denominator depends on the tokenizer, the two numbers only become comparable once both systems use the same tokenization of the same text.
The per-token numbers cannot be compared directly. Tokenization must be fixed before comparing numbers from two systems.
Entropy as Average Information per Letter
Cross entropy builds on entropy, so start there. When Claude Shannon introduced entropy in 1951, the tokens he worked with were characters. Entropy, in his framing, is a statistical parameter that measures how much information is produced on average for each letter of a text in a language. If the language is translated into binary digits in the most efficient way, entropy is the average number of binary digits needed per letter of the original language.
The unit in Shannon's definition is a letter, which is a character-level token. That is why it is a natural starting point for language modeling metrics that count tokens. Entropy is about the average information per unit, not the total length of the text. A long text and a short text can therefore have the same entropy if they carry information at the same average rate.
A useful way to hold entropy is as a rate: information per unit of text. It answers how much new information each letter carries on average, not how much information the whole text contains. Two passages of very different lengths can share the same rate.
From Entropy to Cross Entropy
The source describes cross entropy as a measure of information production per letter, and it lists the entropy introduced by Claude Shannon in 1951 as its prerequisite. Cross entropy is therefore the same kind of average-per-unit quantity, used in the context of language modeling. There, a model predicts the next token, and those predictions are judged against the text that actually appears.
The source pack does not spell out the arithmetic that links cross entropy to the model's probabilities, so this article does not derive it. What it does establish is the framing: cross entropy is an average per unit of text, and the unit depends on how the text was tokenized. A cross entropy value from one tokenizer is therefore not automatically the same kind of number as a cross entropy value from another.
Choosing a Logarithm Base
Entropy is often expressed in binary digits, which uses base 2 logarithms. The source notes that many people prefer the natural logarithm instead, because it has properties that make the math easier. One concrete property it cites is the derivative of the natural log, which keeps the calculus simple. This is why the same information measure can appear with different logarithm bases in different sources.
Perplexity and Its Limits
Perplexity is a language modeling metric, and the source lists it alongside cross entropy as one of the metrics many people find confusing. The source says the chapter includes a section on interpreting these metrics so they can be used in evaluation and data processing. Hold that frame: perplexity is a tool for judging a language model, and it should be read in the context of how the text was tokenized and what the model was asked to predict.
Perplexity measures how well a model predicts the next token. It does not directly measure whether the model will succeed at a task built on top of it. The source makes this distinction explicit: there is a strong correlation between language modeling performance and downstream performance, but language modeling performance does not fully explain downstream performance.
Mistakes When Comparing Language Model Numbers
Common mistake Comparing per-token scores from systems that tokenize differently
What it looks likeTeam A reports a score per character and Team B reports a score per whole word for the same passage.
Why it failsThe denominator is the number of tokens, and the number of tokens depends on the tokenizer. The same text yields different counts.
Do this insteadFix the tokenization for both systems before comparing numbers.
Common mistake Assuming a language model reads words because people do
What it looks likeReading the word cats as one thing and assuming the model's metric also counts one unit.
Why it failsEvery language modeling metric is counted in tokens, and a token can be a character, a word, or part of a word.
Do this insteadAsk which unit the metric counts before interpreting the value.
Common mistake Ignoring the logarithm base
What it looks likeOne report uses binary digits and another uses natural log units, and the two values are read as if they were on the same scale.
Why it failsThe base changes the unit of the number, so the raw values are not directly comparable.
Do this insteadConfirm the base before concluding that one model is better.
Common mistake Treating lower perplexity as proof of better application performance
What it looks likeA model with lower perplexity is assumed to do better on a specific downstream task.
Why it failsLanguage modeling performance correlates with downstream performance but does not fully explain it.
Do this insteadTreat perplexity as one signal and evaluate the downstream task directly.
Practice: Check Before You Compare
Two reports give a per-token score for the same English sentence. One report tokenized the sentence into characters, and the other into whole words. Before deciding which model is better, list the three checks you would make, in order.
Hints
- Start with the unit each report counted.
- Ask whether the denominator, the number of tokens, is the same in both reports.
- Ask which base or metric version was used, and whether the task being evaluated matches the one you care about.
Key Takeaways
- Language modeling metrics count tokens, and a token can be a character, a word, or part of a word, so tokenization must be fixed before numbers are compared.
- Entropy, introduced by Claude Shannon in 1951, measures the average information produced per letter, and cross entropy builds on it as a measure of information production per unit of text.
- The choice of logarithm base changes the unit of a reported value, so check the base before comparing two numbers.
- Perplexity is a language modeling metric that correlates with downstream performance but does not fully explain it, so it is a signal rather than a guarantee.