New Tool Radar

Local AI

Benchmark a Local Model with llama-bench and Read Tokens per Second

Run llama-bench on a GGUF model, read prompt processing and generation speeds, and compare against community numbers.

Schematic with three steps: Run the basic benchmark; Test prompt processing separately; Compare and record.

llama-bench ships with llama.cpp and measures raw inference throughput: prompt processing speed and token generation speed, in tokens per second. Running it tells you whether your GPU setup performs as expected, or whether layers are stuck on the CPU.

What you need

  • llama.cpp built, with llama-bench in build/bin/
  • A GGUF model file on disk
  • A GPU with a working backend, for a GPU benchmark

Step 1: Run the basic benchmark

Run ./llama-bench -m model.gguf -ngl 999. The -ngl 999 flag offloads all layers to the GPU. The output reports model size, backend, layers offloaded, prompt processing speed, and text generation speed.

Step 2: Test prompt processing separately

Run ./llama-bench -m model.gguf -ngl 999 -p 512 -n 128 -r 3. The -p 512 flag sets the prompt size, -n 128 the tokens generated, and -r 3 repeats the test three times for an average. The output shows pp512 and tg128 figures.

Step 3: Compare and record

Compare the tg128 tokens-per-second figure with community numbers for the same GPU and model. If the result is far below the community average, check GPU clocks, driver version, and whether all layers really offloaded. Record the GGUF SHA-256 with the result so the comparison is reproducible.

Worked example: a 14B model on a 12 GB card

The table below is a synthetic example. The command shape and the sample speeds come from the cited benchmark guides; the model is illustrative.

Metric Example value Meaning
Prompt processing pp512 380.21 t/s Prefill speed
Generation tg128 18.44 t/s Decode speed
Comfortable reading 10 t/s minimum About reading pace

Expected result (UNTESTED). llama-bench prints pp and tg speeds in tokens per second, and the generation figure sits near the community average for the same GPU and model. This check was not run live; the commands and sample speeds come from the cited benchmark guides.

Limits

  • Benchmarks measure the engine, not chat quality; a fast model can still answer badly.
  • Thermal throttling under sustained load lowers the numbers; check GPU temperature.
  • Run the test twice and keep the second result, since the first run includes warm-up.
  • CPU thread count and batch size also change prompt processing speed.

Sources

See all