|
| 1 | +# TAGLINE |
| 2 | + |
| 3 | +Prefill and generation speed benchmark for DwarfStar |
| 4 | + |
| 5 | +# TLDR |
| 6 | + |
| 7 | +**Sweep prefill/generation speed** across context frontiers |
| 8 | + |
| 9 | +```ds4-bench --prompt-file [long.txt] --ctx-max [32768]``` |
| 10 | + |
| 11 | +**Write results as CSV** |
| 12 | + |
| 13 | +```ds4-bench --prompt-file [long.txt] --ctx-max [32768] --csv [speed.csv]``` |
| 14 | + |
| 15 | +**Prefill only** (no generation tokens) |
| 16 | + |
| 17 | +```ds4-bench --prompt-file [long.txt] --gen-tokens [0]``` |
| 18 | + |
| 19 | +**Measure with reduced GPU power** |
| 20 | + |
| 21 | +```ds4-bench --prompt-file [long.txt] --power [70]``` |
| 22 | + |
| 23 | +**Benchmark a chat-rendered prompt** |
| 24 | + |
| 25 | +```ds4-bench --chat-prompt-file [prompt.txt] --ctx-max [16384]``` |
| 26 | + |
| 27 | +**SSD-streamed model** on a memory-constrained machine |
| 28 | + |
| 29 | +```ds4-bench -m [ds4flash.gguf] --ssd-streaming --prompt-file [long.txt]``` |
| 30 | + |
| 31 | +# SYNOPSIS |
| 32 | + |
| 33 | +**ds4-bench** [_options_] |
| 34 | + |
| 35 | +# PARAMETERS |
| 36 | + |
| 37 | +**-m**, **--model** _FILE_ |
| 38 | +> Path to the GGUF model. Default: **ds4flash.gguf**. |
| 39 | +
|
| 40 | +**--prompt-file** _FILE_ |
| 41 | +> Raw benchmark text; the token sequence is sliced at each measured frontier. |
| 42 | +
|
| 43 | +**--chat-prompt-file** _FILE_ |
| 44 | +> Render _FILE_ as one no-thinking chat user message instead of raw text. |
| 45 | +
|
| 46 | +**-sys**, **--system** _TEXT_ |
| 47 | +> System prompt used only with **--chat-prompt-file**. |
| 48 | +
|
| 49 | +**--ctx-start** _N_ |
| 50 | +> First measured context frontier. Default: **2048**. |
| 51 | +
|
| 52 | +**--ctx-max** _N_ |
| 53 | +> Last measured context frontier. Default: **32768**. |
| 54 | +
|
| 55 | +**--ctx-alloc** _N_ |
| 56 | +> Allocated context size. Default: **ctx-max + gen-tokens + 1**. |
| 57 | +
|
| 58 | +**--step-incr** _N_ |
| 59 | +> Linear step between frontiers when **--step-mul** is 1. Default: **2048**. |
| 60 | +
|
| 61 | +**--step-mul** _F_ |
| 62 | +> Multiplicative step between frontiers. Default: **1** (linear). |
| 63 | +
|
| 64 | +**--gen-tokens** _N_ |
| 65 | +> Greedy decode tokens per frontier. **0** for pure prefill. Default: **128**. |
| 66 | +
|
| 67 | +**--csv** _FILE_ |
| 68 | +> Write CSV to _FILE_ instead of stdout. |
| 69 | +
|
| 70 | +**--power** _N_ |
| 71 | +> GPU duty-cycle target from 1 to 100. |
| 72 | +
|
| 73 | +**--metal** | **--cuda** | **--rocm** | **--cpu** |
| 74 | +> Select the inference backend explicitly. |
| 75 | +
|
| 76 | +**--ssd-streaming** |
| 77 | +> Opt into SSD-backed model streaming for the benchmark run. |
| 78 | +
|
| 79 | +# DESCRIPTION |
| 80 | + |
| 81 | +**ds4-bench** measures prefill and generation throughput for the **DwarfStar** (**ds4**) inference engine across a sweep of context lengths. You supply a long prompt file; the tool tokenizes it once, then at each frontier runs prefill (and optional greedy decode) so you can compare tokens/s as context grows. |
| 82 | + |
| 83 | +It is the project's standard speed-bench entry point for Metal, CUDA, and ROCm paths, and for comparing full-resident versus **--ssd-streaming** configurations. Results can be printed to the terminal or written as CSV for charts and regression tracking in **speed-bench/** workflows. |
| 84 | + |
| 85 | +# CAVEATS |
| 86 | + |
| 87 | +Needs a DwarfStar-compatible GGUF and enough memory (or SSD bandwidth) for the chosen **--ctx-alloc**. Timings depend heavily on backend, power limit, thermal state, and cold vs warm expert cache; treat single runs as indicative, not absolute rankings across hardware. Prefill-only mode (**--gen-tokens 0**) does not exercise the decode path. |
| 88 | + |
| 89 | +# HISTORY |
| 90 | + |
| 91 | +**ds4-bench** is part of the **DwarfStar** toolkit by **Salvatore Sanfilippo** (**antirez**) and contributors, used to gate performance work on large MoE models (DeepSeek V4 Flash/PRO and experimental forks) where long-context prefill cost dominates. |
| 92 | + |
| 93 | +# SEE ALSO |
| 94 | + |
| 95 | +[ds4-server](/man/ds4-server)(1), [ds4-eval](/man/ds4-eval)(1), [ds4-agent](/man/ds4-agent)(1), [llama-cli](/man/llama-cli)(1) |
| 96 | + |
| 97 | +# RESOURCES |
| 98 | + |
| 99 | +```[Source code](https://github.com/antirez/ds4)``` |
| 100 | + |
| 101 | +```[Documentation](https://github.com/antirez/ds4/tree/main/speed-bench)``` |
| 102 | + |
| 103 | +<!-- verified: 2026-07-18 --> |
0 commit comments