Serve: the engine of seven, configured
Which engine should serve this model for your workload, and with which flags?
onpar run answers by planning before it starts anything. It sizes the model
with the fit solver, picks one of seven engines, decides each setting from your
workload, and translates those settings into that engine’s own flags. The
engines are vLLM, vLLM on TPU, SGLang, llm-d, llama.cpp, MLX and Ollama. Then
it starts the engine. It is the only command in onpar that starts anything.
The plan is written in settings, not flags. There are thirteen: context length, maximum concurrency, prefill chunk, prefix reuse, speculative decoding, memory fraction, tensor parallelism, structured output, quantisation, KV cache dtype, a LoRA fleet, tool calling and thinking. Thinking is set only for models whose chat template reasons before it answers. Each setting carries the sentence that produced it, so a value you disagree with can be argued with.
Follow a requirement from the left to the setting it decides, and note which fork in the middle sends it there.
Three forks decide almost everything
Section titled “Three forks decide almost everything”- Prefix sharing picks the engine. When 55% or more of prompt tokens are shared across requests, SGLang’s RadixAttention reuses that prefix’s KV rather than recomputing it. On NVIDIA that wins. SGLang ships CUDA-only builds, so on an AMD GPU the plan names vLLM and says the better stack is unavailable, not unconsidered.
- Concurrency decides speculative decoding. Above 16 concurrent requests there is no spare compute for a draft pass, so drafting is off. Batch work turns it off too.
- A latency budget decides scheduling. Interactive work gets chunked prefill at 2,048 tokens, so one long prompt cannot stall every response behind it. Batch work gets large chunks, because no token is waiting.
The thresholds are PREFIX_SHARING_FOR_RADIX, MAX_SPEC_DECODE_CONCURRENCY and
PREFILL_CHUNK_TOKENS in src/onpar/plan.py.
The run
Section titled “The run”$ onpar run qwen3-30b-a3b --structured-output --port 8001 --dry-run
MODEL Qwen3 30B-A3B (MoE) @ q8 (80.2 GB of 96.0 GB usable) WEIGHTS Qwen/Qwen3-30B-A3B-GGUF:Q8_0 (confirmed; 1 candidate(s) checked) ENGINE llama.cpp Apple silicon with structured output required: llama.cpp enforces response_format with a grammar; mlx_lm.server cannot. ENDPOINT http://127.0.0.1:8001/v1 SPEED ~60 tok/s single-stream (roofline estimate, not measured)
RUN llama-server --hf-repo Qwen/Qwen3-30B-A3B-GGUF:Q8_0 --ctx-size 524288 --parallel 16 --ubatch-size 2048 --chat-template-kwargs '{"enable_thinking":false}' --reasoning-budget 0 --host 127.0.0.1 --port 8001
NOT EXPRESSED · prefix_reuse: no flag disables the prompt cache · speculative: llama.cpp speculation needs a draft GGUF: --model-draft takes a file, not a method name like 'eagle3' · memory_fraction: no VRAM fraction; --n-gpu-layers decides how much of the model is offloaded, and a fraction does not become a layer count without knowing the layer sizes · quantization: llama.cpp serves GGUF, which is already quantised on disk: fetch a q8-flavoured .gguf rather than converting at start-up
NOTES · 16 slots, not the 32 interactive headroom would give: llama.cpp reserves KV for every slot at start-up, and 32 x 32,768 tokens does not fit this machine. Checked at 16; 4 was asked for. · weights repo came from the local cache; nothing was fetched to plan this · the engine downloads the weights itself on first start; this does not
--dry-run: nothing was started.
# recorded 2026-11-03 on M4 Max · 128 GB · onpar 1.5.2The RUN line is the engine’s own command. It runs with onpar uninstalled:
there is no wrapper, no sidecar and nothing to keep onpar around for. Copy it
into a unit file or a container spec and it starts the same engine.
NOT EXPRESSED is the honest list. When an engine has no verified flag for a
setting, the plan says so and why, rather than inventing a flag the engine would
reject or silently ignore.
NOTES carries what the planner changed its mind about. llama.cpp reserves KV
for every slot at start-up, so when the 32 slots of interactive headroom would
not fit, the planner halves the count until the fit holds and says which count
it checked. That is how this run serves 16 slots at 32k context in 96 GB.
Describe the workload instead of tuning it
Section titled “Describe the workload instead of tuning it”onpar build reads a sentence and plans from it. It quotes back each value it
inferred and the words that produced it:
$ onpar build support assistant for 20 agents --context 32k --concurrency 8 --tool-calling
Qwen3 30B-A3B (MoE) at q8 on M4 Max — 56.2 GB of 96.0 GB, 5 candidates fit. Engine: mlx.
understood: · workload = interactive (from "assistant") · concurrency = 4 (from "20 agents — about a fifth in flight at once, since people read and think between requests") · prefix_sharing = 0.7 (from "agents — implies requests share a long prefix, which changes which engine is correct")
MODEL Qwen3 30B-A3B (MoE) @ q8 (56.2 GB)MACHINE M4 Max (detected locally)ENGINE mlx Apple silicon: the CUDA engines cannot run here at all. MLX has the better batching story of the two Metal options.
RUN mlx_lm.server --model Qwen/Qwen3-30B-A3B --decode-concurrency 32 --prompt-concurrency 32 --prefill-step-size 2048 --chat-template-args '{"enable_thinking":false}'
NOT EXPRESSED · context_length: mlx_lm.server takes no context-length flag; context is bounded by the model config and by unified memory · speculative: --draft-model needs a draft model repo (org/name), not 'eagle3'; mlx has no method-name speculative flag · memory_fraction: unified memory: there is no separate VRAM pool to reserve a fraction of · tool_calling: no verified tool-calling flag in mlx_lm.server --help; tool calls are returned as structured text output · quantization: mlx bakes precision into the weights: serve an -q8 repo rather than converting at start-up
WORTH CHANGING [medium] Try a higher-precision quantisation, or more context. [low] State a TTFT or ITL budget.
THEN PROVE IT onpar observe record real requests, redacted before storage onpar distill turn them into an eval set onpar prove evalset.json --candidate qwen3-30b-a3b \ --incumbent <your-current-model> --incumbent-cost <$/mo> \ --candidate-cost <$/mo> --traffic-window '14 days' onpar brief receipt.json --out brief.html
Nothing above has been run. Deployment is yours to trigger, and noeval result moves production traffic without a human.
# recorded 2026-11-03 on M4 Max · 128 GB · onpar 1.5.2--tool-calling asks for the engine’s tool-call parser for this model family.
Without the right parser, tool calls come back as plain text with
finish_reason: stop, which looks like an answer and is a failure. The parser
tables cover vLLM and SGLang and cite their sources. A family outside them, or an
engine without a verified flag, lands in NOT EXPRESSED, as MLX does above.
Reasoning models answer with thinking off
Section titled “Reasoning models answer with thinking off”A model whose chat template thinks first, such as Qwen3, spends a small token
budget on reasoning and has nothing left for the answer. onpar run and
onpar build turn thinking off by default for every catalogue model marked
reasoning. Each engine gets its own spelling:
| Engine | Flag that turns thinking off |
|---|---|
| vLLM, SGLang, llm-d | --default-chat-template-kwargs '{"enable_thinking":false}' |
| MLX | --chat-template-args '{"enable_thinking":false}' |
| llama.cpp | --chat-template-kwargs '{"enable_thinking":false}' --reasoning-budget 0 |
| Ollama | none server-wide: send "think": false on each request |
Pass --thinking to keep the reasoning phase on.
When it says no
Section titled “When it says no”A budget the hardware cannot meet is not configured around. The plan records it
in Plan.warnings, prints it under CANNOT MEET, and still shows the flags so
you can see what was tried. Here a 2 ms inter-token budget meets a roofline
estimate of about 17 ms per token:
$ onpar build chat assistant --context 32k --concurrency 8 --itl-ms 2
Qwen3 30B-A3B (MoE) at q8 on M4 Max — 56.2 GB of 96.0 GB, 5 candidates fit. Engine: mlx. Cannot meet: inter-token budget is 2ms, but decode is a roofline estimate of 60 tok/s — about 17ms per token. Roofline estimate, not measured; the gap is large enough that no flag closes it. Needs a smaller model, a heavier quant, or more bandwidth.
understood: · workload = interactive (from "chat")
? Do your requests share a long system prompt? (an agent fleet usually does)
MODEL Qwen3 30B-A3B (MoE) @ q8 (56.2 GB)MACHINE M4 Max (detected locally)ENGINE mlx Apple silicon: the CUDA engines cannot run here at all. MLX has the better batching story of the two Metal options.
RUN mlx_lm.server --model Qwen/Qwen3-30B-A3B --decode-concurrency 32 --prompt-concurrency 32 --prefill-step-size 2048 --chat-template-args '{"enable_thinking":false}'
NOT EXPRESSED · context_length: mlx_lm.server takes no context-length flag; context is bounded by the model config and by unified memory · speculative: --draft-model needs a draft model repo (org/name), not 'eagle3'; mlx has no method-name speculative flag · memory_fraction: unified memory: there is no separate VRAM pool to reserve a fraction of · quantization: mlx bakes precision into the weights: serve an -q8 repo rather than converting at start-up
CANNOT MEET · inter-token budget is 2ms, but decode is a roofline estimate of 60 tok/s — about 17ms per token. Roofline estimate, not measured; the gap is large enough that no flag closes it. Needs a smaller model, a heavier quant, or more bandwidth.
WORTH CHANGING [high] Measure prefix sharing before accepting this plan. [medium] Try a higher-precision quantisation, or more context.
THEN PROVE IT onpar observe record real requests, redacted before storage onpar distill turn them into an eval set onpar prove evalset.json --candidate qwen3-30b-a3b \ --incumbent <your-current-model> --incumbent-cost <$/mo> \ --candidate-cost <$/mo> --traffic-window '14 days' onpar brief receipt.json --out brief.html
Nothing above has been run. Deployment is yours to trigger, and noeval result moves production traffic without a human.
# recorded 2026-11-03 on M4 Max · 128 GB · onpar 1.5.2The warning also leads the summary line at the top. A model that does not fit gets a warning as well: every setting is moot until that is resolved. On hardware whose memory bandwidth is unknown, a stated budget is reported as unchecked, never as met.
A speed measurement can say no as well. onpar measure times decode on a running
endpoint and refuses to call the result a measurement when the samples disagree
by more than 20% of their median, or the load average is above 0.80 per core.
Both limits are set in src/onpar/measure.py. This run passed both checks:
$ onpar measure --endpoint http://127.0.0.1:8001/v1 --served-model Qwen/Qwen3-30B-A3B-GGUF:Q8_0 --model qwen3-30b-a3b --quant q8 --samples 3
Qwen/Qwen3-30B-A3B-GGUF:Q8_0 via http://127.0.0.1:8001/v1
sample 1 91.78 tok/s decode ttft 122 ms 127 tokens sample 2 92.07 tok/s decode ttft 15 ms 127 tokens sample 3 91.69 tok/s decode ttft 15 ms 127 tokens
median 91.78 tok/s spread 0.4% roofline 118.59 tok/s estimate measured is 77% of the estimate
roofline basis: --quant q8; at the 152-token context the samples ran at (prompt + output) — pass --context to compare against a ceiling instead; measured implies 56% of theoretical bandwidth, against the 72% the planner assumes
before: load 8.96 over 16 cores (0.56/core) · busiest: mediaanalysisd 154%, perl 100%, Python 83% after: load 10.09 over 16 cores (0.63/core) · busiest: mediaanalysisd 104%, perl 100%, WindowServer 45%
Usable. Still one machine, one moment, one prompt shape — report it as measured here, not as this model's speed.
# recorded 2026-11-03 on M4 Max · 128 GB · onpar 1.5.2Three samples within 0.4% of each other, at a load of 0.56 per core, is usable. When it is not, the refusal names the processes that were busy and exits 1, and the roofline estimate stands. The measured 92 tok/s is 77% of the 119 tok/s roofline at the 152-token context the samples ran at.
An earlier version of this page compared the same measurement against the
roofline at 32k context, 60 tok/s, and called the estimate “deliberately
conservative” when the measurement came out at 144% of it. That was the wrong
comparison. Every decoded token reads the whole KV cache, so the roofline is a
function of context, and a 150-token decode set against a 32k ceiling is two
different workloads. The tool now computes the roofline after measuring, at the
context the samples reached, and prints what the measurement implies for the
bandwidth-efficiency knob: 56% here, against the 72% that BANDWIDTH_EFFICIENCY
in src/onpar/fit.py assumes. One machine is a calibration reading, not a new
constant, so the knob stays and the gap stays visible on every run. Pass
--context 32k to compare against the ceiling instead. The output still says
what it is: one machine, one moment, one prompt shape.
What the engine itself will not do
Section titled “What the engine itself will not do”A plan can only promise what the engine enforces. tools/engine_probe.py sends
three real requests to a running endpoint and reports which behaviours hold.
This run is against the llama.cpp server that onpar run started, with
thinking off and structured output required:
$ python3 tools/engine_probe.py --endpoint http://127.0.0.1:8001/v1 --model Qwen/Qwen3-30B-A3B-GGUF:Q8_0
probing http://127.0.0.1:8001/v1 · model Qwen/Qwen3-30B-A3B-GGUF:Q8_0 ok answers answered 'billing' in 2 tokens ok json a JSON object came back even for a prose prompt: the server enforces the format ok tool-call structured tool call to 'lookup_order'
# recorded 2026-11-03 on M4 Max · 128 GB · onpar 1.5.2Each line is a behaviour the proof depends on:
answers. Served with thinking on, Qwen3-30B-A3B spends a small token budget on reasoning and returns empty content. Served with thinking off, asonpar rundoes by default, it answeredbillingin 2 tokens.json. The probe asks a prompt that invites prose and requests a JSON object, as the collector does. A JSON object came back, so the server enforces the format by grammar.mlx_lm.serverhas no grammar, which is why--structured-outputsteers the plan to llama.cpp on Apple silicon and why, with--engine mlx, the plan listsstructured_outputunderNOT EXPRESSED.tool-call. The call arrived as a structuredtool_callsentry, not as text that looks like one.
Run the probe before you prove against an endpoint. A cluster that fails because the server ignores a request field is a server finding, not a model finding, and the collector names it as one:
python3 tools/engine_probe.py --endpoint http://127.0.0.1:8001/v1 --model Qwen/Qwen3-30B-A3B-GGUF:Q8_0It exits 0 when all three probes pass and 1 otherwise.
Measure on a quiet machine
Section titled “Measure on a quiet machine”Every speed above is a roofline estimate. onpar measure replaces one with an
observation, when the machine lets it:
onpar measure --endpoint http://127.0.0.1:8001/v1 --served-model Qwen/Qwen3-30B-A3B-GGUF:Q8_0 --model qwen3-30b-a3b--served-model is the name the endpoint knows the model by. Pass it whenever
that differs from the catalogue id: onpar run serves the GGUF
Qwen/Qwen3-30B-A3B-GGUF:Q8_0, not qwen3-30b-a3b. --model keeps the
catalogue id for the roofline comparison. --warmup N discards the first decodes
on hardware that throttles, and --quant names what the endpoint actually
serves. A usable run still says it is one machine, one moment and one prompt
shape.
The knobs that matter
Section titled “The knobs that matter”--contextand--concurrencysize and tune the server. The defaults are 32k and 4.--engineforces an engine.--engine ollamaalso needs--tag, because Ollama’s registry names are not catalogue ids.--quantforces a quantisation. The default is the best that fits.--hostand--portset the bind address: loopback and 8000 by default.--dry-runprints the plan and the exact command, and starts nothing.- On
build:--ttft-msand--itl-msstate latency budgets,--prefix-sharingstates the shared fraction, and--onplans for a hardware profile you do not have.
Next: prove the candidate on your own traffic with
onpar prove evalset.json --candidate-endpoint URL, where URL is the
endpoint onpar run printed.