Skip to content
mentoor

Measuring and tuning local inference speed

For engineers

Measuring prompt processing and generation speed, tuning GPU offload, context and KV cache settings, speculative decoding and diagnosing slow runs

See where you stand

110 questions across four stages: Understand, Apply, Solve and Judge.

Try 5 questions

Practice items, not counted towards your mastery. No account needed.

Check yourself · 1 of 5

A benchmark prints rows named pp512 and tg128. What does tg128 measure?

Choose one answer

Check yourself · 2 of 5

What does the -ngl flag in llama.cpp set?

Choose one answer

Check yourself · 3 of 5

In speculative decoding, what does the large target model do with the draft model's tokens?

Choose one answer

Check yourself · 4 of 5

A local model suddenly runs at a fraction of its usual speed, with no error. The log says 0 layers were offloaded. What is the most likely cause?

Choose one answer

Check yourself · 5 of 5

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

Choose one answer

Topics

  1. Measuring tokens per second and time to first token4 min read · Prompt processing versus generation speed, warm-up runs and llama-bench for repeatable numbers
  2. Tuning GPU offload and context length4 min read · How many layers go on the GPU, the speed cliff of partial offload, and how context length and KV cache quantization use memory
  3. Speeding generation with speculative decoding4 min read · A small draft model or extra prediction heads propose tokens the large model verifies, and when the speed-up appears
  4. Diagnosing slow local inference4 min read · Silent CPU fallback, memory swapping, thermal throttling, a wrong backend build and an oversized context
  5. Benchmarking runtimes on the same hardware fairly4 min read · Same model file, quant, prompt length and output length, warm caches and several runs before comparing runners or settings

Start here

110 questions · last verified 2026-12