llamaperf

Open source · version 1.1.0

llamaperf-bench, a benchmark tool for local models

Find out how fast a model really runs on your own machine. One command times your local model server and prints time to first token, prompt speed and generation speed in tokens per second. It's a single file with no dependencies, and nothing leaves your machine unless you ask.

Run it

Start your model server, then point the tool at it. You need Node 18 or newer.

npx llamaperf-bench --endpoint http://localhost:8080/v1

It talks to the OpenAI chat API, so it runs against llama-server, Ollama, vLLM, LM Studio and any other server that speaks that API and reports token usage. Ollama listens on http://localhost:11434/v1. Add --model NAME when your server lists more than one model.

If you'd rather skip npm, the same file downloads straight from llamaperf.

curl -O https://llamaperf.com/llamaperf-bench.mjs
node llamaperf-bench.mjs --endpoint http://localhost:8080/v1

What a report looks like

The tool throws away a warmup run, measures five more and prints each one with the median. This is a real run of Qwen2.5 0.5B at Q4_K_M on an Apple M1 Pro with llama.cpp, with a depth sweep added.

llamaperf-bench 1.1.0
endpoint: http://localhost:18099/v1
model: bartowski/Qwen2.5-0.5B-Instruct-GGUF:Q4_K_M
server: llama.cpp b8680-15f786e65, context window 16384 tokens
workload: standard-1
prompt tokens: 590, max new tokens: 256, warmup runs: 1, measured runs: 5 (5 ok, 0 failed), concurrent requests: 1

run  prompt_tokens  gen_tokens  ttft_ms  prompt_tps  gen_tps
1    590            256         270      2189.1      100.1
2    589            256         268      2193.9      107.2
3    589            256         287      2055.4      105.5
4    589            256         277      2123.2      103.9
5    589            256         270      2183.2      99

median: ttft_ms 270, prompt_tps 2183.2, gen_tps 103.9
range: gen_tps 99 to 107.2

speed at context depth: the same model and settings, the prompt filled to each depth, 3 measured runs each
depth  runs_ok  prompt_tokens  ttft_ms   prompt_tps  gen_tps  gen_tps_range
4k     3        3993           2189      1823.8      96       93.1 to 97.4
8k     3        7975           5715      1395.5      73.8     73.5 to 78.3

The same test for everyone

Two people rarely benchmark the same way, which is why their numbers rarely line up. The defaults here are a fixed workload named standard-1: the same prompt of about 600 tokens and 256 generated tokens for everyone, one request at a time.

A report carries that name only when nothing was changed. Two reports that both say standard-1 timed the same request, so you can put your card next to someone else's and compare.

Speed at context depth

A model slows down as its context fills, and a short prompt hides that. Add --depths 4k,16k,32k and the tool times the model again with the prompt filled to each depth. In the run above, generation fell from 103.9 tokens per second on the short prompt to 73.8 with about 8,000 tokens of context.

That second figure is the one to plan around if you use the model for long chats or large files.

Numbers you can check

Token counts come from your server's own usage report. A server that sends none is refused, because counting tokens from text would be a guess.

A failed run is listed with its reason and left out of the median. A context depth your server refuses or quietly cuts short is listed as failed too, so you never get a figure for a depth the model didn't read. The engine is named only from what the server says about itself.

Every rule is written down in the specification, so another tool can produce figures that compare with these.

Add your result to llamaperf

Your numbers help the next person choosing a card or a model. Get a free key on the submit page, then add --submit and name your hardware.

LLAMAPERF_KEY=your-key npx llamaperf-bench --endpoint http://localhost:8080/v1 \
  --submit --hardware "NVIDIA RTX 4090 24GB"

The report goes through the same reading and checks as one pasted into the site. The hardware is never guessed, and the depth table stays on your machine because llamaperf doesn't record it yet.

Open source

llamaperf-bench is free under the MIT license. The code and its tests are in the repository on GitHub, and the package is on npm. If it gets something wrong on your setup, open an issue.

To see what other people measured, start with the leaderboard or look up your GPU.