mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
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#4894
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4056
Author: @gdevenyi
Created: 10/25/2026
Status: 🔄 Open
Base:
main← Head:anyjev-completions-logprobs📝 Commits (6)
e04fe08serve: add the legacy /v1/completions endpoint7e08755fix(serve): restore structured SSE errors and avoid duplicate completion textb6132c9Merge branch 'pr-3332-v3' into v2-on-mainc56ee93[Engine] serve: logprobs on legacy /v1/completions (vLLM's shape), token-id prompts78a130b[Docs] DETAILS: logprobs on /v1/completionsd032be9[Other] serve: /v1/completions takes logprobs: false as not asked; a two-request ownership test📊 Changes
7 files changed (+544 additions, -28 deletions)
View changed files
📝
docs/DETAILS.md(+10 -0)📝
serve/frontend.py(+12 -0)📝
serve/server.py(+260 -25)📝
serve/test_logprobs.py(+111 -0)📝
serve/test_monitor.py(+17 -0)📝
serve/test_server.py(+122 -0)📝
serve/test_structured.py(+12 -3)📄 Description
Problem and result
Decision clients such as AnyJev render their own chat prompt and read the label tokens' log-probabilities from
vllm serve's legacy/v1/completions. Strata 0.2.7 has logprobs on/v1/chat/completions(#3200, landed as9ea04496), and #3332 adds/v1/completionsbut refuseslogprobs. So a client can have its own prompt or the logprobs, but not both.This PR puts the 0.2.7 logprobs on #3332's route.
/v1/completionstakeslogprobs: N(ortruewithtop_logprobs),allowed_token_idsandreturn_tokens_as_token_ids, and the prompt can be a list of token ids. It returns vLLM's legacylogprobsobject.Related discussion
StrataBackend, which reads this route withallowed_token_idsandreturn_tokens_as_token_ids) and nokia-applied-research/AnyJev#21 (its HTTP decision gateway,anyjev.serve --backend strata, one gateway per Strata server). The scope discussion on the AnyJev side is nokia-applied-research/AnyJev#22.main(46c152a1, after 0.2.7.1) + #3332 merged unchanged (clean merge) + three commits,b6132c9a..d032be99(+216/−20 inserve/server.py,serve/test_logprobs.py,docs/DETAILS.md). When #3332 lands, it is just these commits.maininstead of re-merging #3200's branch.Approach
check_logprobs(req, svc, max_req)holds 0.2.7's two checks, now shared by both routes:--parallelrefuses logprobs unlessmax_tokensis 1.CompletionLogprobs. It reads only the LP lines tagged with this request's cancelEvent, the ownership rule 0.2.7'sLogprobEntriesuses. That includes the lines a batch admission keeps on theEvent(_strata_lp_lines). It lists every generated token, the stop token too, so a one-token read whose top token is<|im_end|>still has its row.allowed_token_idsreports the named ids' full-vocabulary values. For those ids these are the numbers vLLM's defaultraw_logprobsgives. A decision client checks how much of the mass its labels hold, and renormalised values always sum to 1. Chat keeps 0.2.7's renormalised shape. Both are documented indocs/DETAILS.md.stream: trueare refused (400) to keep the change small.Validation
d032be99, engine 0.1.53 built from this branch, with Qwen3.8-Flash-Next IQ3_S and the argsstrata launchwrites (--expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5 --mtp … --kv int8 --ple-io ram --kv-resident 32768, no--vision). Two machines:-DSTRATA_EXPERIMENTAL_SM60=ON,g++-14Passed:
python -m unittest discover -s serve -p 'test_*.py'(as CI runs it): 1,234 tests, 2 failures.GpuChoice.test_hip_ordinalfails onmainhere too.LiveRate.test_the_live_number_is_a_ratefailed once while the machine was under memory pressure; it passes 3/3 on this branch and onmainwhen re-run.serve.test_logprobs: 41 OK. That is main's tests plus 11 for completions:allowed_token_ids, token-id keys, token-id prompts;logprobs: false, no length cap, the refusals;max_tokensand with ajson_schema;allowed_token_idsraw values equal to the top-K read, token-id prompt,max_tokens: 0,logprobs: false;--adapt-swaps 0andSTRATA_PREFILL_CPU_SHARE=0.5: 12/12 on both. Chat, text-prompt completions and token-id completions give the same values to 6 decimals (epicB−0.027356, monster −0.035613).--parallel 2on epic: completionsmax_tokens: 1withallowed_token_ids→ 200 with both ids.max_tokens: 2→ 400 naming--parallel. Two overlapping one-token reads (fruit/vegetable) each returned their own answer (B,A) through batch admission.StrataBackend(nokia-applied-research/AnyJev#20), on epic with--adapt-swaps 0andSTRATA_PREFILL_CPU_SHARE=0.5: engine smoke test 7/7. Its parity check (named-id read vs the server's own top-20) givesmax_abs_diff 0.000000in two runs, and theDeciderat L0 decides 5 states × 3 questions in 14 s.Failed:
test_hip_ordinal.Not run:
--parallelon monster (11 GB).Limits
--adapt-swaps 0 --pcie-frac 0withSTRATA_PREFILL_CPU_SHARE=0.5makes them identical, the first run after a start included. Without--pcie-frac 0that first run still differs. The recipe costs about 38% of decode speed on an RTX 5080 (none for one-token reads); the measurements are on #4059.prompt: [[…], […]]). AnyJev'sTacit(engine="server")client batches, so it still needs its own path; itsDeciderbackend (nokia-applied-research/AnyJev#20) sends one prompt per request.Merge danger
Door: two-way. It is server-only Python behind an opt-in request field.
Blast radius: small. Callers of
/v1/completionsthat sendlogprobsused to get a 400 and now get logprobs. Chat logprobs go through the moved, otherwise unchanged checks.🤖 Generated with Claude Code
https://claude.ai/code/session_01Cix1XJhNhNNuKXi26KvXnU
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.