What this thread does
Do first: Run llama-bench with an explicit local model via -m and choose prompt or generation token counts.
Short answer
The benchmark measures prompt processing (pp), token generation (tg), or combined processing/generation (pg). Compare the same model and settings; output gives mean tokens/second and standard deviation.
What to do
| Value | Action / meaning |
|---|---|
llama-bench -m models/7B/ggml-model-q4_0.gguf | Choose the local model explicitly; the README names this as the model default. |
-p / --n-prompt: 512 | Prompt-processing token count; set -p 0 for generation-only measurements. |
-n / --n-gen: 128 | Generated-token count; set -n 0 for prompt-only measurements. |
-pg <pp,tg> | Combined prompt processing followed by generation; unset by default. |
-r / --repetitions: 5 | Repeat each case, then report mean tokens/second and standard deviation. |
-o / --output: md; csv,json,jsonl,md,sql | Stdout format; JSON can include individual repetition results. |
-oe / --output-err: none; csv,json,jsonl,md,sql | Optional stderr output format. |
-d / --n-depth: 0 | Prefill the KV cache with this many tokens before each case. |
-b / --batch-size: 2048; -ub / --ubatch-size: 512 | Batch and microbatch size parameters. |
-t / --threads: system-dependent | Set explicit thread counts for comparable CPU runs. |
-ngl / --n-gpu-layers: -1; -ncmoe / --n-cpu-moe: 0 | GPU-layer and CPU-MoE parameters. |
-ctk / --cache-type-k: f16; -ctv / --cache-type-v: f16 | Key/value cache types. |
-fa / --flash-attn: auto; on,off,auto | Flash Attention mode. |
-sm / --split-mode: layer; none,layer,row,tensor | Multi-device split mode. |
-mg / --main-gpu: 0; -dev / --device: auto | Main GPU and device list; device names use / separators. |
-ts / --tensor-split: 0 | Per-device proportions, separated by /. |
-nkvo / --no-kv-offload: 0; accepted 0,1 | Control KV offload. |
-nopo / --no-op-offload: 0; --no-host: 0; --repack: 1 | Each accepts 0 or 1. |
-lm / --load-mode: auto; auto,none,mmap,mlock,mmap+mlock,dio | Model loading mode. |
-lzm / --lazy-mode: auto; on,auto,off | Lazy loading mode. |
-embd / --embeddings: 0; accepted 0,1 | Embedding-mode parameter. |
-ot / --override-tensor: disabled | Override tensor placement with <tensor name pattern>=<buffer type>; separate entries with semicolons. |
--numa: disabled; distribute,isolate,numactl | NUMA mode. |
--prio: 0; accepted -1,0,1,2,3; --delay: 0 seconds | Process/thread priority and nonnegative delay between cases. |
-C / --cpu-mask: 0x0; --cpu-strict: 0; --poll: 50 | CPU mask; strict accepts 0/1 and polling accepts 0 through 100. |
--no-warmup | Skip warmup runs; otherwise leave the warmup in place. |
-fitt / --fit-target: off; -fitc / --fit-ctx: 0 | Fit to device memory with a margin in MiB per device; minimum context size for fit-target. |
-rpc / --rpc | Register comma-separated RPC devices. |
-h / --help; --list-devices; -v / --verbose; --progress | Show help, list devices and exit, show verbose output, or show progress. |
A documented generation-only sweep:
./llama-bench -m models/7B/ggml-model-q4_0.gguf -m models/13B/ggml-model-q4_0.gguf -p 0 -n 128,256,512
Comma-separated values or repeated parameters run combinations. Range forms are first-last, first-last+step, and first-last*mult. The README exempts -r, -o, and -v from repeated-option sweeps.
Limits and open questions
- Timing excludes tokenization and sampling; this is not complete application latency.
- Hardware, backend, model and option choices affect throughput; the README example numbers are not measurements of your machine.
- The README supplies no release version/date for this option set.
Not for: Ollama server latency or llama-server end-to-end request timing.
Sources
- llama-bench README, ggml-org.
- Raw llama-bench README, ggml-org.
Checked
2026-11-17; read the linked llama-bench README, Raw llama-bench README; no command was run.
Started from a post by @ggml-org, packaged by the editor. Original post