…#560)
A request that asks for temperature 0 leaves nothing to sample, yet llama-server still ran the top-p and
min-p passes over the whole vocabulary: on ZAYA1-8B's 262147 entries that is about 2.1 ms per token,
118 tok/s against llama-bench's 153. serve now forwards such a request with `top_k: 1`, which takes the
argmax and skips those passes. A request that names its own top_k keeps it, and any other temperature is
forwarded untouched; the change is in `forward()`, the one place every proxied request passes through,
so both OpenAI routes get it.
`tests/fake_backend.py` echoes the sampling fields it receives, and the new `tests/greedy_shortcut.sh`
(ctest `greedy_shortcut`) pins the four cases without a GPU: temperature 0 on /v1/chat/completions and on
/v1/completions gets top_k 1, an explicit top_k 5 survives, temperature 0.7 adds no top_k, and a body
with no temperature is not rewritten. Run against a locally built 1bit: PASS (5 checks).
docs/serve.md gains a "Greedy requests" section with the measurement and the escape hatch.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Fixes engine#560. A request that asks for
temperature: 0leaves nothing to sample, but llama-server still ran the top-p/min-p passes over the whole vocabulary — on ZAYA1-8B's 262147 entries that is most of the decode step.1bit servenow forwards such a request withtop_k: 1, which takes the argmax and skips them.The change is in
forward(), the single choke point every proxied request passes through, so both OpenAI routes get it. A request that names its owntop_kkeeps it (only the absent case is filled in), a request with any other temperature is forwarded untouched, and a body with notemperatureis not rewritten.Measured (strixhalo, HRX, packed candidate
llama-serverat851fa6c8d,1bit serveproxying it, greedy 256-token answers, median of 2,--no-mtp)top_k 1via serve)top_k 40)Two honest notes on those numbers:
top_k: 1on rawllama-server; this measurement goes through1bit serve, whose own request path (JSON, chat-template application, backend hop) is part of the wall clock, so the share the sampler's skip can recover is smaller here. The direction and the mechanism match; the ceiling does not.One run of this measurement was voided by a GPU reset on the box (
MES failed to respond to msg=REMOVE_QUEUE->MODE2 reset->reset(4) succeeded) during a plain ZAYA warm-up; the harness now restarts the backend once per arm, and the table above is from the clean re-run. Nothing in this change touches the GPU path.Test
tests/fake_backend.pynow echoestop_kandtemperatureback, and the newtests/greedy_shortcut.sh(ctestgreedy_shortcut, no GPU) pins the four cases:/v1/chat/completionsgetstop_k 1,/v1/completionsgetstop_k 1,top_k 5survives,top_k,temperatureis not rewritten.Run against a locally built
1bit: PASS (5 checks).tools/copyright.py --check→ rc 0.docs/serve.mdgains a "Greedy requests (temperature 0)" section with the numbers above and thetop_kescape hatch.🤖 Generated with Claude Code