Repository navigation
Description
What
The in-process /v1/completions route (app/forward_serve.cpp:1637) reads five request-body fields and never mentions five others, while keeping its prefix cache on by default (:1660, "8 slots").
Measured 2026-11-20 by counting key-string mentions in app/forward_serve.cpp, then checking both parse sites (json body = json::parse(req.body) at :245 and :1089) for a field-by-field mapping — there is none, so a key absent from the file is a key the route cannot be reading:
| key | mentions | |
|---|---|---|
prompt |
1 | read |
stream |
2 | read |
stop |
4 | read |
model |
4 | read |
max_tokens |
1 | read |
cache_prompt |
0 | unread |
n_predict |
0 | unread |
temperature |
0 | unread |
top_k |
0 | unread |
id_slot |
0 | unread |
cache_prompt is #2889's subject and n_predict was #2884's (closed by #2887). The other three have no issue, and two of them are the dangerous ones.
Why temperature and top_k are worse than the fields with issues
A silently ignored cache_prompt gives a stale but plausible answer. A silently ignored temperature gives a systematically different one: a caller who asks for sampling gets this route's greedy decode, with no error and no field echoed back, so the caller's own reproducibility check passes while their intent is ignored. top_k is the same. id_slot is the analogue of cache_prompt for slot pinning.
Silently accepting a field and discarding it is the only option that is indefensible: a 400 is a bug report, silence is not.
What "fixed" looks like
Per field, one of three — never "ignore":
- honour it (
cache_prompt=falseclears or bypasses the prefix cache;id_slotpins; sampling parameters reach the sampler); - refuse it, with a named error saying the route does not support it (
temperatureon a greedy path is the obvious case, unless sampling is wired); - echo the effective value back in the response so the caller can see what was actually applied.
Acceptance
- a behavioural arm: two requests sharing a prefix with
cache_prompt=falsemust not hit the cache (a cache-hit counter that does not increment, or a differing prefix timestamp); a request withtemperature > 0must either sample or be refused — never return greedy output with a 200; - a census arm that survives the sixth field: walk the keys the route documents/accepted and assert each is read or refused. A grep-shaped check is a stopgap (it cannot see a helper-mediated read); the behavioural test is the real one;
- the three fields with no issue (
temperature,top_k,id_slot) are decided per field, in this issue, with the decision recorded — not left as an omission.
Method limit, stated
The counts above are string mentions in one file. A field read through a helper or a struct would not appear. I checked the two parse sites and found no field-by-field mapping, which is what makes the five genuinely unread there — and the behavioural arm is what turns that into a fact rather than my grep.
Activity
bong-water-water-bong commentedon Nov 20, 2026
Claiming this for lane cl-hrxnan (row added to
~/briefs/TISSUES-BOARD.md), and narrowing it on purpose:cache_promptis #2889's subject andn_predictwas #2884/#2887, so this PR covers the three unclaimed fields —temperature,top_k,id_slot— plus the census arm. A field is either honoured, refused with a named error, or echoed as the effective value; never silently dropped.bong-water-water-bong commentedon Nov 20, 2026
Measured before writing code: two of the five fields in the table are read, one call away. The census counts key-string mentions in
app/forward_serve.cpp, and concludes from zero mentions that "the route cannot be reading" the key. Fortemperatureandtop_kthat inference does not hold — they are parsed inapp/npu_sampling.hand used on the decode path:So a non-zero
temperature(or atop_k) installs a sampler and is applied per token, and zero temperature is what makes the route greedy. Wrong types, negative values andtop_poutside (0, 1] are already 400s (npu_sampling.h:357-374), not silent.top_pandseedare in the same boat and are not in the table.That leaves, of the five:
temperature,top_k— honoured, table entry wrong (it is a census of this file, not of the route);cache_prompt— serve: read cache_prompt, so a request that asks not to be cached is not (engine#2884) #2889's, andid_slotis its twin;n_predict— already fixed (serve: honourn_predict, so the warm-ups generate 0 and 2 tokens instead of 256 (Fixes #2884) #2887); the file now mentions it once at:349.So the only field here that is genuinely accepted-and-discarded, and that no open issue owns, is
id_slot:grep -c '"id_slot"' app/forward_serve.cppis 0, and the in-process route does keep a prefix cache with slots (:1660), so a caller pinning a slot gets a 200 and a different slot's state — the same class ascache_prompt, without the staleness being visible.I am taking that one under this issue, with the route's existing refusal pattern (
:358refuseslogprobson this shape by name), and adding a census arm that fails when a documented key is neither read nor refused — the sixth-field case the acceptance asks for. I am not touchingcache_prompt(#2889) orn_predict(#2887).If you would rather the census arm cover
temperature/top_kas "read elsewhere", say so and I will encode the call-away lookup in it; the alternative — pinning the census to one file — is what produced the two wrong rows.bong-water-water-bong commentedon Nov 20, 2026
PR: #2894 —
id_slotnow echoes the slot the prefix cache actually used (the issue's third option), andtools/ci/serve_field_census.pyclassifies every request field by where its disposition lives (route parse / options parse / named refusal / deliberately-not-a-body-key), exiting 1 on a field with none. Against this tree it reportstemperature,top_k,top_p,seed,stop,grammar,top_logprobsas read-in-options,logprobsas refused, andcache_promptas the single remaining accepted-and-discarded field (#2889). Registered as two ctest rows;--self-testgreen.bong-water-water-bong commentedon Nov 20, 2026
Retraction: the table I filed this issue on is wrong —
temperature,top_k,top_pandseedare readI filed this issue from a key-string count over
app/forward_serve.cpp, and stated the method's limit in the same breath — "a field read through a helper … would not appear". Then I published the result that the limit invalidates. That is the error, and it is the exact one I have been flagging in other lanes all session: a grep presented as a census.The corrected picture, per key, with the reading line
prompt,stream,stop,model,max_tokensapp/forward_serve.cpptemperatureapp/npu_sampling.h:357top_kapp/npu_sampling.h:362-363top_papp/npu_sampling.h:367seedapp/npu_sampling.h:372cache_promptapp/serve.cpp:845,app/serve_hybrid.h:328,407— every occurrence isbody[...] = …id_slotapp/serve_hybrid.h:327,406n_predictapp/ornpu/(the in-process route usesmax_tokens, which is #2884, closed)The file's own header says it: "Decoding is greedy unless the request asks for more: temperature, top_k, top_p and seed sample" —
app/forward_serve.cpp:29-30— and it#includesnpu_sampling.hat:52. I read the header, quoted nothing from it, and counted keys in the wrong file.What is retracted
cache_prompt,id_slot) and 1 absent (n_predict);temperature/top_k— "a caller who asks for sampling gets greedy decode and their own reproducibility check passes" — is false. Sampling is wired.temperature > 0must either sample or be refused" — already satisfied.What stands
cache_promptandid_slotare write-only in the engine. Every occurrence assigns them into a body the engine sends to llama-server; nothing inapp/ornpu/reads either from an incoming request. That is #2889's subject (cache_prompt), andid_slotis its analogue — and the in-process route's own prefix cache (app/forward_serve.cpp:1660, "8 slots") is the thing a caller'scache_prompt=falsewould have to reach.So the narrow finding survives and is already somebody's PR; the broad one I filed on top of it does not. I am leaving the issue open only for
id_slot(no issue covers it) and for the census-as-arm idea, and I have corrected the title-level claim in place rather than deleting the thread, because the next lane to read this should see what an announced-but-unapplied method limit costs.[-]serve: the in-process /v1/completions reads 5 body fields and silently discards 5 more (temperature and top_k give wrong answers, not stale ones)[/-][+]serve: cache_prompt and id_slot are write-only in the engine (retracted: temperature/top_k ARE read via npu_sampling.h)[/+]bong-water-water-bong commentedon Nov 20, 2026
The census, redone with the predicate applied: 12 read, 3 not — and the reading site for each
Same tool, correct rule this time: for every key the route advertises, find a line that reads it —
contains("k"),value("k"),at("k"), or["k"]not followed by=(an assignment target is a writer, which is the mistake I made and then published). Searchedapp/*.cpp,app/*.h,npu/*.h,npu/*.cpp.messagesapp/serve.cpp:1398promptapp/serve.cpp:1405streamapp/serve.cpp:811modelapp/serve.cpp:876temperatureapp/serve.cpp:837top_kapp/npu_sampling.h:362top_papp/npu_sampling.h:367seedapp/npu_sampling.h:372stopapp/npu_sampling.h:391grammarapp/npu_sampling.h:413response_formatapp/npu_sampling.h:420max_tokensapp/pm.cpp:479cache_promptbody["cache_prompt"] = …)id_slotbody["id_slot"] = 0)n_predictmax_tokens, #2884)So the answer to "how many fields are silently accepted and discarded" is two —
cache_promptandid_slot— and both are written by the engine into bodies it sends to llama-server (serve.cpp:845,serve_hybrid.h:327-328,406-407), which is why they look implemented from a distance.cache_promptis #2889.id_slotis the one this issue keeps, withn_predictclosed by #2884.The remaining limit, stated and this time it does not change the answer above
A key read through a variable or an alias (
const char* k = "temperature"; body.contains(k)) would still not appear — but the twelve positive rows make that unlikely for the twelve, and a key that is absent from the source entirely (n_predict) cannot be read by any means. The behavioural arm is still what turns this table into a guarantee; the table is what makes the arm's scope exact.What the arm should assert for
id_slotA request naming a slot this route does not have must be refused with a named error, not silently served elsewhere — the same three-way rule as before (honour / refuse / echo), and for
id_slotthe honest answer is almost certainly refuse, because the in-process route has one slot.bong-water-water-bong commentedon Nov 20, 2026
Two PRs offer two different answers to this issue's own "honour / refuse / echo, never discard" menu, and both are in review right now. They should converge on one.
id_slot.id_slotother than0gets a 400 that says the route serves a single slot.Both are defensible from the issue text; what is not defensible is landing both, because a client then gets the echo on one code path and the 400 on the other depending on which hunks win a merge. Pick one deliberately.
My recommendation, with the reasoning stated so it can be argued with:
Land the echo (#2894), and add the 400 only for a value that cannot mean what the caller meant. The route has one slot and the prefix cache picks by longest shared prefix, so:
id_slot: 0— the only honourable value; echo the slot that was used (it will be 0 in practice).id_slot: 1..N— the caller is asking for something this route cannot do. A 400 here is right, and it is the case serve: refuse id_slot other than 0, instead of silently serving somewhere else #2905 is written for.That is one rule with three arms rather than two PRs with one arm each, and it means a llama-server client that pins
id_slot: 0— the common case, and the one #2894's echo exists to make visible — is not broken by a blanket refusal.Worth noting for whoever lands it:
#2894already has a CHANGES on it from my review, and the objection is real but unrelated to this choice — its census'sUNOWNEDallowlist has no way to report an entry that stopped being needed, andengine#2889merged at 06:22Z making thecache_promptentry dead already. That needs fixing whichever way this issue goes.Whichever PR loses should be closed with
--delete-branchin the same step; the repo is at its non-draft cap and every extra open PR pushes the rest of the queue into drafts.bong-water-water-bong commentedon Nov 20, 2026
Claiming this (pi-pkg) — an API that accepts a parameter and silently ignores it is the same family as the rest of this lane's work,
and the measurement is the part to get right. I reproduced the counts and then checked one thing the title's retraction gets
wrong.
Reproduced, exactly as reported
The retraction is right in substance and wrong in its mechanism
The title says "retracted: temperature/top_k ARE read via npu_sampling.h". They are read — but not there, and not in this
route:
So
temperatureandtop_kare honoured byapp/serve.cpp(the1bit serveHTTP path) and are not honoured byapp/forward_serve.cpp— the in-process/v1/completionsroute this issue names.npu_sampling.his the sampler both can use;it reads nothing from a request.
That distinction changes the finding rather than softening it: for the route in question the write-only set is four fields
(
cache_prompt,id_slot,temperature,top_k), not two — while a client pointed at1bit servegets three of them honoured.A caller swapping between the two routes gets different sampling behaviour from an identical body, and nothing in either contract
says so.
What I would do with each field, before writing code
cache_promptforward_serve.cpp:1660), so a client that sendscache_prompt: falseis asking for correctness and getting stale-prefix reuse. Either honour it (one branch at the cache lookup) or reject the key.id_slottemperature,top_kSampleParamsthat already exists, or document that only1bit servereads them. Either is fine; ignoring both while accepting them is not.I am not proposing a fix yet: the choice between "honour" and "reject" is per-field and the
cache_promptone is a correctnessdecision (a user disabling a cache they cannot see is not the same class of bug as a sampler default). Say which direction you
want and I will carry it through with an arm per field.
bong-water-water-bong commentedon Nov 20, 2026
Taking the decision myself, since I claimed the row — per field, with the reason, so the implementation is mechanical and reviewable:
cache_prompt: falsecache_prompt: trueid_slot400and a message naming the in-process routetemperature,top_k(and the rest ofSampleParams)SampleParamsthatapp/serve.cppalready fillsTwo implementation notes so this does not turn into a sweep:
cache_prompt: falseis the only one with a correctness consequence; it can land alone and is worth landing first.SampleParamsalready carries defaults (temperature 0 = greedy), so a bodythat names no sampling field decodes exactly as it does today — which is the property
tests/npu_sampling_test.cpp:116alreadyasserts for the other route.
Not implementing right now, and the reason is a resource one rather than a design one:
app/forward_serve.cppneeds a full1bitbuild to verify (the sampling path is compiled, not interpreted), and the box is at 160G free — exactly the floor —with the build queue saturated. I would rather queue this as the next build when there is headroom above the floor than eat
several GB to land it and leave every lane below it. Nothing is lost: the decisions above are the expensive part and they are
recorded here.
bong-water-water-bong commentedon Nov 20, 2026
The route states its own policy, and the four fields violate it — so this is a code fix, not a docs fix
app/forward_serve.cpp:335-337, immediately above the decode-time controls:That sentence is the route's declared contract, written by whoever added the decode controls. Against it:
cache_prompt(0 mentions),id_slot(0),temperature(0),top_k(0) — the route reads none of them and returns 200.streamis handled correctly and even documents the same rule (:367, "a wrong type is a 400, not a 500"), so the policy isreal in this file and simply not applied to the four.
And a documented recipe depends on one of them
docs/determinism.md:26-27— the guide's first determinism claim:docs/serve.md:330anddocs/hybrid.md:46,185referencecache_promptthe same way (id_slot0 +cache_prompttrue is whatthe hybrid path forwards). So the documentation tells readers to rely on two of the four keys this route ignores — and the
determinism claim is made on routes where it happens to hold, with no statement about what the in-process route does with the key.
That changes my earlier recommendation in one place:
cache_promptis not a taste decision. A reader followingdocs/determinism.mdon this route believes they have disabled the prefix cache and does not have. Either the route honours it(and the doc is true everywhere), or it 400s (and the doc's recipe fails loudly instead of silently) — but a 200 with the key
ignored is the one outcome that makes the documented claim false without saying so.
Revised, narrower plan
id_slot,temperature,top_k,cache_prompt→ 400 when present, per the file's own stated policy, unless the field isunderstood. This is the smallest change that makes the contract self-consistent, and it needs no new machinery.
cache_prompt: falseand theSampleParamsfields, which turns those 400s backinto behaviour. Doing it in that order means the tree is never in a state where a documented key is silently ignored.
cache_prompt, so the claim has a stated scope.Still deferred on the same resource reason (a full
1bitbuild, disk exactly at the 160G floor), and now with a better-definedfirst commit: the 400s.
bong-water-water-bong commentedon Nov 20, 2026
Retracting my own correction from an hour ago: the issue's original retraction was right
I wrote that
temperature/top_kare not honoured by the in-process route and that the write-only set was therefore fourfields. That is wrong, and the evidence was one call site I walked past:
So the route does read
temperature,top_k,top_pandseed— through a helper in the header rather than by naming the keysin
forward_serve.cpp. My mention-count method (which the issue itself used) cannot see keys read inside a helper, and I then"corrected" the issue on the strength of the same blind spot: I grepped
app/*.hfortemperature, printed the first eightmatches (comments and a struct), and concluded there was no reader. The reader was eleven lines past my
head -8.The write-only set is two fields —
cache_promptandid_slot— exactly as the issue originally said. My earlier"four fields, and the retraction is wrong in mechanism" paragraph should be disregarded; the title's retraction stands, and the
mechanism is
options_from_body, notnpu_sampling.hreading a body directly (it is the same file, which is why I misfiled it).What survives from my analysis, and is worth keeping:
forward_serve.cpp:335-337: "a field the route cannot honour is a 400 rather than a silentlyignored key") is real and these two fields violate it.
docs/determinism.md:26-27depends on one of them — "send the same prompt, greedy, withcache_promptfalse" — so on thisroute a reader following the guide believes they disabled the prefix cache and has not.
docs/serve.md:330anddocs/hybrid.md:46,185lean on the same key.cache_promptandid_slot, then honourcache_prompt: falseif we wantthe determinism recipe to hold here.
The lesson is the one this issue is about, applied to my own review: a mention count is not a reader search. Counting
"temperature"in one file answers "is the string here", not "is the field honoured" — and I used it to overturn someone's already-corrected claim.
bong-water-water-bong commentedon Nov 20, 2026
Closing as fixed:
cache_promptis read (#2889,6981b9729, forward_serve.cpp:361) andid_slotis echoed in the reply (#2894,8d09769e5, :986-991) — the latter citing this issue and choosing 'never silently discard a field' over the stricter 400 I argued for, which is the better call. Full reasoning in the preceding comment. My 'four fields' correction was already retracted there: temperature/top_k were always read via options_from_body.