Skip to content
mentoor

Topic 5 of 5 · 4 min read

Benchmarking runtimes on the same hardware fairly

Goal: Spot the unfair setup in a benchmark that compares two local runners.

A benchmark comparison is fair only when everything except the thing you are testing is identical. If two runners differ in model file, context, offload and batch size at the same time, the table cannot tell you which difference caused the result.

Check yourself · 1 of 3

You want to compare two local runners on speed. Which model setup is fair?

Choose one answer

Why it matters

People pick runtimes and settings from benchmark tables, forum posts and release notes. Many of those tables compare unlike things: one runner with the GPU fully used, the other with half the layers on the CPU, or one with a 512-token prompt and the other with a 4,000-token prompt. You will make a wrong choice from them, and you will publish a wrong one yourself.

What to hold fixed

  • The same model file: identical weights and the same quant, not "the same model" from two different conversions.
  • The same hardware and conditions: one machine, nothing else using the GPU, similar temperature, same power mode.
  • The same offload: how many layers are on the GPU, and the same context length and batch size.
  • The same prompt length and output length: and the same flash attention and KV cache settings.
  • Warm state: a warm-up run first, so no runner pays for loading while another does not.
  • Several runs: a mean and a spread. If two means differ by less than the spread, you have not shown a difference.

Check each runner's defaults, since defaults differ for context length, offload and batch size. A runner that silently defaults to a smaller context or to partial offload looks slower or faster for reasons unrelated to its engine. State what you did not control.

Before and after

Weak table: "Runner A 45 t/s, Runner B 31 t/s." Nothing says what ran.

Better table: both read the same Q4_K_M GGUF, -ngl 99, 8,192 context, pp512 and tg128, five runs after a warm-up, same laptop plugged in. Now the 45 versus 31 means something, and a reader can repeat it.

What goes wrong

  • Different quants. A Q8 file against a Q4 file is a memory test, not a runner test.
  • Cold versus warm. The runner tested first pays the disk cost.
  • Mismatched defaults. One runner quietly keeps layers on the CPU.
  • One run, no spread. Noise gets reported as a result.
  • Different outputs. Counting speed over answers of different length measures the answer, not the engine.

Examples

An unfair table

Runner Model file Layers on GPU Context Result
One 8B Q4_K_M all 8,192 45 t/s
Two 8B Q8_0 24 of 33 4,096 31 t/s

The quant, offload and context all differ. The 31 might be caused by any of them, so the table says nothing about the runners.

Making it fair

Use the same GGUF in both runners, set -ngl 99 and an 8,192 context in both, fix the prompt at 512 tokens and the output at 128, run each runner once as a warm-up and then five times, and report the mean and spread.

Key points

  • Change one variable at a time and hold the rest identical.
  • Use the same model file and quant, on one machine, with nothing else using the GPU.
  • Match offload, context, batch size, flash attention and cache type, and check each runner's defaults.
  • Match prompt and output length, and warm up each runner before timing.
  • Report a mean and spread over several runs, and say what you did not control.

Common mistakes

  • Comparing different quants or conversions and calling it a runner comparison.
  • Relying on each runner's default context and offload without checking them.
  • Timing the cold run of one runner against the warm run of another.
  • Reporting one run without a spread.

Check yourself · 2 of 3

Runner A is tested first, right after boot. Runner B is tested next on the same GGUF file. B looks much faster. What is the most likely flaw?

Choose one answer

Check yourself · 3 of 3

Two benchmark rows show 41 and 39 tokens per second for two settings, each from three runs with spreads of about 4. What can you conclude?

Choose one answer

Practice items, not counted towards your mastery.

Start here