New Tool Radar

Local AI

How to Measure a Model’s Perplexity with llama-perplexity

Score a GGUF model with llama-perplexity on your own text to compare two models fairly.

Schematic illustration with three step boxes: Pick a test text; Run the measurement; Compare two models.

Perplexity is a single number that says how surprised a model is by a piece of text: lower means the text looks more like what the model expects. llama-perplexity measures it for a GGUF model on a text file you supply, which lets you compare two models on the same text. This guide runs the measurement and compares two models.

Before you start

  • llama.cpp installed, with llama-perplexity on your PATH.
  • Two GGUF model files to compare, for example two sizes of the same family.
  • A plain-text file of a few hundred words, written in the style you care about.

Prepare the test text

Save a few hundred words of plain text as test.txt. Use text the models have not been trained on, such as your own notes, so the score reflects general ability rather than memorisation. Keep the same file for every model you test.

Run the measurement

Score the first model:

llama-perplexity -m qwen3-8b-q4_k_m.gguf -f test.txt

The tool prints a perplexity number when it finishes. Note it down with the model name and the file name.

Compare the second model

Run the same command with the second model and the same file. The lower perplexity is the better fit for this text, but a small difference may not matter in real chat; a large gap is the signal to trust.

Worked example

Worked example: score an 8B model and a 4B model on the same 400-word note about gardening. If the 8B model scores 12.4 and the 4B model scores 15.8, the 8B model predicts your text better, which is the expected direction; if the scores are close, the smaller model may be the better deal for the memory it saves.

Expected result

UNTESTED in this guide: no measurement was run while writing it. The expected result is that llama-perplexity prints a perplexity number for each model, and the larger model scores lower on the same text.

Limitations

Perplexity is not a chat-quality score: a model can have low perplexity and still give unhelpful answers. Use it to compare models on the same text, never to compare scores across different texts or different tools.

Sources

See all