Perplexity
In information theory, perplexity is a measurement of how well a probability distribution or probability model predicts a sample. It may be used to compare probability models. A low perplexity indicates the probability distribution is good at predicting the sample.
In information theory, perplexity is a measurement of how well a probability distribution or probability model predicts a sample. It may be used to compare probability models. A low perplexity indicates the probability distribution is good at predicting the sample. \mathit{PP}(p) := 2^{H(p)}=2^{-\sum_x p(x)\log_2 p(x)}=\prod_x p(x)^{-p(x)} where H(p) is the entropy (in bits) of the distribution, and x ranges over the events. The base of the logarithm need not be 2: The perplexity is independent of the base, provided that the entropy and the exponentiation use the same base. In some contexts, this measure is also referred to as the (order-1 true) diversity. Perplexity of a random variable X may be defined as the perplexity of the distribution over its possible values x. It can be thought of as a measure of uncertainty or "surprise" related to the outcomes. In the special case where p models a fair k-sided die (a uniform distribution over k discrete events), its perplexity is k. A random variable with perplexity k has the same uncertainty as a fair k-sided die. One is said to be "k-ways perplexed" about the value of the random variable. Unless it is a fair k-sided die, more than k values may be possible, but the overall uncertainty is not greater because some values may have a probability greater than 1/k. Perplexity is sometimes used as a measure of the difficulty of a prediction problem. However, it's not always an accurate representation. For example, if you have two choices, one with probability 0.9, your chances of a correct guess using the optimal strategy are 90 percent. Yet, the perplexity is 2 −0.9 log 2 0.9 - 0.1 log 2 0.1 = 1.38. The inverse of the perplexity, 1/1.38 = 0.72, does not correspond to the 0.9 probability. The perplexity is the exponentiation of the entropy, a more straightforward quantity. Entropy measures the expected or "average" number of bits required to encode the outcome of the random variable using an optimal variable-length code. It can also be regarded as the expected information gain from learning the outcome of the random variable, providing insight into the uncertainty and complexity of the underlying probability distribution. b^{- \frac{1}{N} \sum_{i=1}^N \log_b q(x_i)} = \left(\prod_i q(x_i) \right)^{-1/N} where b is customarily 2. Better models q of the unknown distribution p will tend to assign higher probabilities q(x i ) to the test events. Thus, they have lower perplexity: they are less surprised by the test sample. The exponent above may be regarded as the average number of bits needed to represent a test event x i if one uses an optimal code based on q. Low-perplexity models do a better job of compressing the test sample, requiring few bits per test element on average because q(x i ) tends to be high. The exponent - \frac{1}{N} \sum_{i=1}^N \log_b q(x_i) may also be interpreted as a cross-entropy: H(\tilde{p},q) = -\sum_x \tilde{p}(x) \log_b q(x) where \tilde{p} denotes the empirical distribution of the test sample (i.e., \tilde{p}(x) = n/N if x appeared n times in the test sample of size N). By the definition of KL divergence, it is also equal to H(\tilde p) + D_{KL}(\tilde p \| q) which is \geq H(\tilde p) . Consequently, the perplexity is minimized when q = \tilde p . \left(\prod_{i=1}^n q(s_i) \right)^{-1/N} where s_1, ..., s_n are the n sentences in the corpus, but N is the number of words in the corpus. This normalizes the perplexity by the length of the text, allowing for more meaningful comparisons between different texts or models. Suppose the average sentence x i in the corpus has a probability of 2^{-190} according to the language model. This would give a model perplexity of 2 190 per sentence. However, it is more common to normalize for sentence length. Thus, if the test sample's sentences comprised a total of 1,000 words, and could be coded using 7.95 bits per word, one could report a model perplexity of 2 7.95 = 247 per word. In other words, the model is as confused on test data as if it had to choose uniformly and independently among 247 possibilities for each word. The lowest perplexity that has been published on the Brown Corpus (1 million words of American English of varying topics and genres) as of 1992 is indeed about 247 per word, corresponding to a cross-entropy of log 2 247 = 7.95 bits per word or 1.75 bits per letter using a trigram model. It is often possible to achieve lower perplexity on more specialized corpora, as they are more predictable. Simply guessing that the next word in the Brown corpus is the word "the" will have an accuracy of 7 percent, not 1/247 = 0.4 percent, as a naive use of perplexity as a measure of predictiveness might lead one to believe. This guess is based on the unigram statistics of the Brown corpus, not on the trigram statistics, which yielded the word perplexity 247. Using trigram statistics would further improve the chances of a correct guess. ==See also== Statistical model validation ==References==
References
No reference rows published for this article.
Cite this article
MLA
"Perplexity." encyclopegia.org, 2026, https://encyclopegia.org/wiki/perplexity. Accessed 24 November 2026.
Chicago
"Perplexity." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/perplexity.
APA
encyclopegia.org. (2026). Perplexity. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/perplexity
Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON
Claims
| Predicate | Value | Source |
|---|---|---|
| publication date | 1992 | Wikipedia |