mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1869] [Bug]: BDONE replaces the request's accumulated decode_ms/generated — every finish=stop request reports a single-step decode time #740
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#740
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sdjger-xiaoniu on GitHub (Oct 10, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1869
What happened
Requests that end with
finish=stopreport a single-step decode time instead of the request's accumulated decode time, sopredicted_ms/predicted_per_secondare wrong by ~100-200x.finish=lengthrequests are fine, which is why this hides for a while.Measured on 0.1.41,
qwen3.8-flash-next-iq3_s(IQ3_S), 2x RTX 2080Ti 22GB, layer split,--slots 2, MTPspec=6.The same finished request, two numbers from the engine itself:
decode_tok_scomes out sane by accident: it is computed asgenerated / (decode_ms/1000)=1 / 0.0184, i.e. one token in one inter-token interval, which happens to be the right order of magnitude for a decode rate. Any client that computescompletion_tokens / predicted_ms(the llama.cpp convention, and what thetimingsblock is for) gets 7,337 tok/s for a 135-token answer at ~54 tok/s.finish=lengthrows are consistent (256 tokens / 7925.5 ms -> 32.3 tok/s), so the bad value is specific to the stop path:/metricsrows for stop-finished requests aredecode_ms18.4 / 18.5 / 18.8 / 19.3 / 19.4 / 22.2 / 22.5 / 24.7 ms withengine_generated1, while length-finished ones carry real totals.Where it comes from
serve/server.py, the streaming loop (around line 1363 in 0.1.41) — theBDONEhandler replaces the per-request stats instead of accumulating them:serve/test_request_accounting.pyis the contract here — it exercises thinking-budget continuations and asserts the totals are summed (assertEqual((row["prompt_ms"], row["decode_ms"]), (47.0, 280.0)), i.e. 40+7 / 200+80). The BDONE path overwrites, so a continuation's last segment wins over the request's totals.Suggested fix / workaround
A segment must never shrink the request's totals — accumulate, or keep whichever value is larger:
We have been running exactly this as a local patch since 0.1.41 (with
serve.test_request_accounting+serve.test_server+serve.test_prometheusgreen, 284 tests) and/v1/statusthen reportspredicted_ms 714.0 / predicted_per_second 42.0for a 30-token stop turn — consistent with the ~54 tok/s the engine is actually doing.Strata version, GPU, OS
0.1.41 · 2x RTX 2080Ti 22GB (layer split,
--slots 2, spec=6) · Ubuntu 26.04, driver 595.91.07@Niko1221 commented on GitHub (Oct 11, 2026):
Thank you, this was an exact report: the two numbers from the same request, the finish=stop vs finish=length split, and the local patch made it easy to find.
Cause, in two parts. First, the one you pointed at: when the engine's answer ends on its stop token, the server stopped reading at that token and never read the BDONE line right behind it (a background wait ate it), so the request kept the figures of its admission step: one token, one step. finish=length reads on until the BDONE, which is why only stop rows were wrong. 0.1.43 reads the BDONE before it lets the slot go. Second, a request that moves between the solo path and a batch slot (another request arrives, or its neighbour finishes) has one DONE/BDONE per leg, and the server replaced the request's figures with the last leg's. It now keeps each earlier leg's decode time and tokens, and the prompt figures of the leg that read the prompt, and adds them up. It is not a max(), because the server keeps the last figures per thread and a previous request's larger numbers must not leak into the next one. predicted_ms, predicted_per_second and /metrics decode_ms are totals again.
There are unit tests for both (serve/test_request_accounting.py, serve/test_parallel.py), and a concurrent pair on a --batch 2 engine on an RTX 3060 was checked against /metrics. If you still see a stop row that reports a single step on 0.1.43, please tell us.