Case & CodeA FIELD GUIDE TO AI
Start learning
Intermediate

Perplexity (metric)

Also: perplexity metric, perplexity score

In plain words

A score for how surprised a model is by a piece of text. Lower is better, but it does not measure accuracy on your task.

The fuller definition

Perplexity is a measure of how well a language model predicts a text sample. Lower values mean the text was less surprising to the model. It is used to compare models and quantization levels.

Same eight billion values, different storage precision
32 bits32 GB
16 bits16 GB
8 bits8 GB
4 bits4 GB

Idealized value storage only, in decimal GB. Metadata, caches, mixed precision, and runtime overhead add to actual requirements. This is not a GPU purchasing calculator.

A concrete example

A quantized model shows slightly higher perplexity on a test corpus than the full-precision version.

The distinction that matters

Not to be confused with Perplexity the search product. Lower perplexity does not mean more accurate answers on your task.

Related terms

Where it is taught

Run a local model and verify the actual setup

Source and further reading

Hugging Face · LLM course

The definition and example are written for this library. The link gives background, official documentation or legal authority as labelled. Legal scope depends on the jurisdiction and current text; product features depend on release and settings.

Lessons, terms, practical guides and sources ESC