Search

Search IconIcon to open search

Perplexity

Last updatedUpdated: by Jakub Žovák · 2 min read

Properties
created 30.10.2024, 10:59
modified 08.11.2025, 18:12
published Empty
topics Perplexity, Language Model Evaluation, LLM Evaluation
authors Empty
ai-assisted No

# Definition

Perplexity is defined as the exponentiated average negative log-likelihood of a sequence. If we have a tokenized sequence $X = (x_0, x_1, \ldots, x_t)$, then the perplexity of $X$ is,

$$
\text{PPL}(X) = \exp \left{ -\frac{1}{t} \sum_{i=1}^t \log p_\theta(x_i | x_{<i}) \right}
$$

where $\log p_\theta(x_i | x_{<i})$ is the log-likelihood of the $i$-th token conditioned on the preceding tokens $x_{<i}$ according to our model. Intuitively, it can be thought of as an evaluation of the model’s ability to predict uniformly among the set of specified tokens in a corpus. Importantly, this means that the tokenization procedure has a direct impact on a model’s perplexity, which should always be taken into consideration when comparing different models.

# Interpretation

Source: ChatGPT1

  • It represents the effective number of choices the model has when generating the next token.
  • Think of it as: “On average, how many equally probable options does the model consider at each step?”
  • Lower perplexity = better model performance (less uncertainty),
  • Higher perplexity = worse performance (more uncertainty).

# Possible Values and Interpretation

Perplexity ValueInterpretation
1The model is perfectly confident — it assigns probability 1 to every next token.
> 1The model is uncertain; the higher the value, the more it spreads probability.
≈ e (2.718)The model behaves like it is choosing randomly among 3 equally likely tokens.
10–100+Indicates substantial uncertainty; often signals that the model is poorly fit.

# Benefits And Limitations

# Limitations of Perplexity

  • Focus on Local Prediction: Perplexity measures next-word prediction, which may yield locally coherent but contextually disjoint content.
  • Limited in Handling Ambiguity and Creativity: It doesn’t capture a model’s ability to handle ambiguity or generate creative language.
  • Vocabulary Dependency: Perplexity is sensitive to vocabulary size; unfamiliar terms can raise scores, affecting model evaluation.
  • Overfitting Risk: Low perplexity on training data may not indicate strong generalization to diverse, real-world scenarios.

# Benefits of Perplexity:

  • Measures model fluency and coherence, indicating language understanding and task comprehension.
  • Offers insight into model generalization; lower perplexity on unseen data shows better generalization.
  • Provides a simple, cost-effective comparison metric for models, enabling quantitative evaluation.
  • Serves as a key metric for model optimization, with lower perplexity indicating improved model quality.
  • Assesses generated language quality, aiding in evaluating content applications using language models.

  1. Prompt: “Explain perplexity (natural log version), include its possible values and their interpretation. Provide mathematical definition, but also describe it in words.” ↩︎