liveBook · Manning

Perplexity

As explained in Domain-Specific Small Language Models

A measure of how well a language model predicts tokens in sequence, with lower values generally indicating better predictive fit.

Perplexity measures how well a language model predicts a sequence. Lower values indicate less predictive uncertainty and generally better fit for the evaluated data. section 4.1.4 section 8.5

Evaluation workflows use related metrics for different prediction units:

  • Word perplexity measures prediction over words. section 4.1.4
  • Byte perplexity measures prediction of the next byte from preceding bytes. section 4.1.4
  • Bits per byte reports the average number of bits needed to predict the next symbol. section 4.1.4
  • For generated proteins, lower perplexity supports higher-quality output, but biological validation still requires domain-specific tools. section 8.5

Language-model evaluation

An LM-Eval wikitext run for GPT-Neo 2.7B reports word perplexity 13.9382, byte perplexity 1.6367, and bits per byte 0.7108. section 4.1.4

hf-causal (pretrained=EleutherAI/gpt-neo-2.7B,dtype=float16), limit: None, provide_description: False, num_fewshot: 0, batch_size: None
|  Task  |Version|    Metric     | Value |   |Stderr|
|--------|------:|---------------|------:|---|------|
|wikitext|      1|word_perplexity|13.9382|   |      |
|        |       |byte_perplexity| 1.6367|   |      |
|        |       |bits_per_byte  | 0.7108|   |      |

Inspect a tabular LM-Eval result showing perplexity alongside related prediction metrics. section 4.1.4

How Domain-Specific Small Language Models covers it

How deep it goes
Defines word, byte, and bits-per-byte measures with one concrete benchmark, but does not derive the metric mathematically.
Examples
Uses wikitext evaluation for GPT-Neo 2.7B and protein-sequence scoring for ProtGPT2 and antibody-generation models.
What you can do after
Evaluate language-model predictions and inspect whether quantization preserves comparable performance.
How it connects
Connects language models with token prediction, byte perplexity, bits per byte, quantization, and domain-specific validation.

Also explained in

Compare how 5 books explain perplexity →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Domain-Specific Small Language Models. The section links point to the parts of the book it draws on.