New Tool Radar

Local AI

How to Measure a Local Model’s Speed with llama-bench

Measure your own model's prompt-processing and generation speed in tokens per second with llama-bench, instead of trusting a benchmark run on someone else's computer.

Schematic diagram with three boxes: a Qwen 1.5B Q4_K_M GGUF model file, the llama-bench command with -p 512 -n 128 -t 2 -r 3, and the two speeds pp512 for reading the prompt and tg128 for writing the answer.

Benchmarks on review sites answer the wrong question: they tell you how fast a model ran on someone else’s computer, with someone else’s cooling and someone else’s settings. The number that matters for your work is how fast your model runs on your machine, at the quantization and context length you actually use. llama.cpp ships a small tool for exactly that measurement: llama-bench. It reports two speeds, and knowing which is which tells you whether a model will feel fast in chat or slow on long documents.

Build it and run one measurement

llama-bench comes with llama.cpp. If you installed llama.cpp from a release, the binary is included; if you built from source, build the bench target as well, for example:

cmake --build build --config Release -j --target llama-bench

Then run it against a GGUF model file already on your computer. The command below follows the guides linked in Sources, measuring a 512-token prompt and 128 generated tokens, on 2 threads, averaged over 3 runs:

./build/bin/llama-bench -m qwen2.5-1.5b-instruct-q4_k_m.gguf -p 512 -n 128 -t 2 -r 3

The two rows in the output are the whole story. pp512 is prompt processing: how fast the model reads 512 input tokens before it starts to answer. tg128 is generation: how fast it writes 128 new tokens. Set the thread count (-t) to the number of CPU cores you have, and run the command twice, keeping the second run — the first run loads weights from disk and measures disk speed, not compute.

Try it: measure one model and read the two numbers

Run the command above on a small GGUF model on your computer, then read the two rows against this table. The numbers below are the published example from one of the guides, on a 2-vCPU machine with no GPU, for the same 1.5B Q4_K_M model — they show the shape of the output, not a result you should expect on your hardware:

Row What it measures Example value (guide’s machine) What it means for you
pp512 Prompt processing, tokens per second 55.89 How long the silence is before the first word on a long prompt
tg128 Generation, tokens per second 12.58 How fast the answer appears once it starts — about reading speed

If both rows print with a small spread between runs, you have your model’s speed on your machine. Expected result. We checked two independent guides to llama-bench. We did not run llama-bench.

Limits

One number never tells the whole story: prompt processing is compute-bound and generation is memory-bandwidth-bound, so a model can be fast at one and slow at the other, and a long context slows prompt processing further. The ± spread matters too — if it is large, the machine was busy or thermally throttling, and the average is unreliable. Only compare runs made with the same flags, the same model file, and the same machine; comparing your tg128 with a number from a different computer proves nothing. We did not run llama-bench, so no speed here is a measured result.

Sources

See all