Back to Glossary
Natural Language Processing

Perplexity

A measurement of how well a probability distribution or probability model predicts a sample, commonly used to evaluate the performance of language models.

Explanation

In natural language processing, perplexity is a metric used to judge how well a language model predicts a text sample. Mathematically, it is defined as the exponentiated average negative log-likelihood of a sequence. A lower perplexity indicates that the model is less surprised by the test data and can predict the next token with higher confidence. It serves as a proxy for the model's understanding of linguistic patterns, although it may not always align with human judgment of text quality. It is frequently used during the training and benchmarking phases of Large Language Models (LLMs) to compare the efficiency of different architectures or training datasets.

Related Terms