7.09 MB
87 files
Updated 21 days ago
Name
Size
CMakeLists.txt245 Bytes
xet
LICENSE41 Bytes
xet
LICENSE.md1.09 kB
xet
README-dev.md24.2 kB
xet
README.md5.29 kB
xet
bench.py13.9 kB
xet
json.hpp953 kB
xet
json_fwd.hpp6.66 kB
xet
main.cpp117 Bytes
xet
mcp_burst_server.py3.52 kB
xet
mcp_crash_server.py3.23 kB
xet
mcp_echo_server.py4.29 kB
xet
mcp_grandchild_server.py3.15 kB
xet
mcp_malformed_server.py3.16 kB
xet
mcp_slow_server.py3.6 kB
xet
miniaudio.h4.11 MB
xet
nexus-axiom-ai.zip32.9 kB
xet
perplexity.cpp82.2 kB
xet
prometheus.yml183 Bytes
xet
quantize.cpp28 kB
xet
requirements.txt23 Bytes
xet
results.cpp6.9 kB
xet
rotate-bits.h1.02 kB
xet
rpc-server.cpp9.51 kB
xet
script.js6.39 kB
xet
server-chat.cpp30.6 kB
xet
server-chat.h853 Bytes
xet
server-common.cpp70.6 kB
xet
server-common.h24 kB
xet
server-context.cpp227 kB
xet
server-context.h6.92 kB
xet
server-cors-proxy.h2.56 kB
xet
server-http.cpp37.3 kB
xet
server-http.h3.15 kB
xet
server-mcp.cpp26.3 kB
xet
server-mcp.h6.46 kB
xet
server-models.cpp101 kB
xet
server-models.h16.8 kB
xet
server-queue.cpp22.1 kB
xet
server-queue.h9.28 kB
xet
server-schema.cpp33 kB
xet
server-schema.h3.22 kB
xet
server-stream.cpp23.2 kB
xet
server-stream.h3.03 kB
xet
server-task.cpp67.4 kB
xet
server-task.h18.4 kB
xet
server-tools.cpp88.2 kB
xet
server-tools.h1.53 kB
xet
server.cpp23.2 kB
xet
sha1.c7.68 kB
xet
sha1.h689 Bytes
xet
sha256.c5.28 kB
xet
sha256.h549 Bytes
xet
speed_bench.py16.5 kB
xet
speed_bench_compare.py3.15 kB
xet
stb_image.h283 kB
xet
subprocess.h68.5 kB
xet
test_basic.py4.72 kB
xet
test_chat_completion.py24.9 kB
xet
test_compat_anthropic.py36.7 kB
xet
test_compat_gcp.py1.8 kB
xet
test_compat_oai_responses.py3.83 kB
xet
test_completion.py24.6 kB
xet
test_ctx_shift.py3.1 kB
xet
test_embedding.py10.3 kB
xet
test_ignore_eos.py1.27 kB
xet
test_infill.py2.58 kB
xet
test_kv_keep_only_active.py3.52 kB
xet
test_lora.py4.63 kB
xet
test_mcp_servers.py24.4 kB
xet
test_metrics.py7.78 kB
xet
test_proxy.py1.88 kB
xet
test_rerank.py4.84 kB
xet
test_router.py21 kB
xet
test_security.py8.43 kB
xet
test_sleep.py4.93 kB
xet
test_slot_save.py18.7 kB
xet
test_speculative.py6.09 kB
xet
test_stream.py5.44 kB
xet
test_template.py3.99 kB
xet
test_tokenize.py1.57 kB
xet
test_tool_call.py35.7 kB
xet
test_tools_builtin.py15.5 kB
xet
test_vision_api.py7.97 kB
xet
tests.sh1.63 kB
xet
xxhash.c1.86 kB
xet
xxhash.h265 kB
xet
README.md

SPEED-Bench server benchmark

A lightweight SPEED-Bench client for benchmarking an already-running llama-server through its OpenAI-compatible API. It is primarily meant to evaluate speculative decoding (draft model, n-gram, MTP, EAGLE3, ...) by reporting per-category throughput, latency, and draft acceptance.

The dataset handling follows the aiperf SPEED-Bench tutorial, which also documents the dataset layout in more detail.

Install

pip install -r tools/server/bench/speed-bench/requirements.txt

Start a server

The client does not launch the server, so start llama-server yourself first. If you care about throughput numbers, set the client --concurrency to the server's slot count (--np):

llama-server \
  -m target.gguf \
  -c 8192 \
  --port 8080 \
  -ngl 99 -fa on \
  --np 1 \
  --jinja

For speculative decoding, start the server with the appropriate flags for your setup (e.g. a draft model with -md, or --spec-type ngram-mod). See the speculative decoding doc for details.

Run

python tools/server/bench/speed-bench/speed_bench.py \
  --url localhost:8080 \
  --bench qualitative \
  --category coding \
  --osl 1024 \
  --concurrency 1

Options

Option Default Description
--url localhost:8080 Server URL. The scheme and /v1 are optional and a trailing slash is fine, so localhost:8080 and http://localhost:8080/v1/ both work.
--model none Optional model field sent in each request.
--bench qualitative SPEED-Bench config, e.g. qualitative, throughput_1k. See available dataset variants.
--category all Category filter within the bench; comma-separated list or all. For qualitative the categories are coding, humanities, math, multilingual, qa, rag, reasoning, roleplay, stem, summarization, writing. For the throughput_{ISL} splits they are high_entropy, low_entropy, mixed.
--osl 1024 Output sequence length, mapped to max_tokens.
--extra-inputs {"temperature":0} Extra request fields as a JSON object.
--concurrency 1 Concurrent client requests; usually match --np.
--limit none Max samples per category (handy for smoke tests).
--timeout 600 Per-request timeout in seconds.
--output none Save raw per-request results and the summary to JSON.

A few common ones:

  • --category all runs every category in the bench.
  • --category coding,math runs just those two.
  • --bench throughput_8k runs a fixed-input-length throughput split.
  • --limit 8 keeps at most 8 samples per category, which is enough for a quick check.

The throughput_{ISL} splits use fixed input lengths (1k - 32k), so they are handy for long-context testing and for comparing different llama-server batching settings (e.g. sweeping -ub / --ubatch-size) on prompts of a known size. Make sure the server -c is large enough for the chosen split. When raising -ub, also raise -b to at least the same value, since the physical ubatch cannot exceed the logical batch.

When --output is given, the JSON file holds the run config, the selected_samples / completed_samples / failed_samples counts, the per-category summary rows, and the per-sample results.

Metrics

The summary prints one row per category plus an overall row:

  • samples - how many samples finished successfully.
  • avg_prompt_t/s - prefill throughput from llama.cpp (timings.prompt_per_second), averaged over the category's samples.
  • avg_pred_t/s - decode throughput from llama.cpp (timings.predicted_per_second), averaged over the category's samples.
  • avg_latency - average end-to-end request latency seen by the client.
  • accept_rate - accepted / draft_n over the category, or n/a if nothing was drafted (draft_n == 0).

Baseline vs speculative decoding

Save a run from each server with --output, then diff the two JSON files with speed_bench_compare.py.

First, start a plain llama-server (no speculative decoding) and save a baseline:

python tools/server/bench/speed-bench/speed_bench.py \
  --url localhost:8080 \
  --bench qualitative \
  --category all \
  --osl 1024 \
  --concurrency 1 \
  --output baseline.json

Then restart llama-server with speculative decoding enabled and save another run:

python tools/server/bench/speed-bench/speed_bench.py \
  --url localhost:8080 \
  --bench qualitative \
  --category all \
  --osl 1024 \
  --concurrency 1 \
  --output spec.json

Finally compare the two:

python tools/server/bench/speed-bench/speed_bench_compare.py \
  --baseline baseline.json \
  --speculative spec.json

The comparison table adds:

  • decode_speedup = spec_avg_pred_t/s / base_avg_pred_t/s
  • latency_speedup = base_avg_latency / spec_avg_latency

Keep --bench, --category, --osl, and --limit the same across both runs, otherwise they won't be using the same prompts.

Total size
7.09 MB
Files
87
Last updated
Nov 8
Pre-warmed CDN
US EU US EU

Contributors