mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4837] [Engine] add vLLM's ignore_eos request field, as server-side continuation #5209
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#5209
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/4837
Author: @gdevenyi
Created: 10/31/2026
Status: 🔄 Open
Base:
main← Head:api/ignore-eos📝 Commits (1)
e899700Server: ignore_eos (vLLM's request field), opt-in: the reply runs to its token budget over the model's stop tokens, as new generate passes from the server; no engine change; refused with tools, MCP, a structured format and logprobs📊 Changes
3 files changed (+526 additions, -1 deletions)
View changed files
📝
docs/DETAILS.md(+13 -0)📝
serve/server.py(+67 -1)➕
serve/test_ignore_eos.py(+446 -0)📄 Description
Problem and result
Strata had no way to make a reply run to a fixed length. A client can send vLLM's
ignore_eos, but the server ignored it, so "Say hi." ended after about 10 tokens.With this PR,
"ignore_eos": trueruns the reply on to its token budget and ends it withlength. It is opt-in. With the field false, null or absent, nothing changes.The main limit: it is slower, and it is not a speed test. Total wall time on engine 0.1.55, 3 runs each, was 2.66x a plain reply at 256 tokens (18.32 s against 6.89 s) and 5.15x at 1024 (135.66 s against 26.36 s). The prompts differ: "Say hi." with
ignore_eos, "Write a long essay." plain. At 1024, two of the threeignore_eosruns also ended early (see Failed), so they made fewer tokens in that time. vLLM users often want this field for throughput runs. Do not use these replies for that here.Related discussion
No issue asks for this, so scope is not agreed in an issue. It is a small opt-in server change. Please say if you want an issue first.
Search for
ignore_eos: #2275 and #3411 only name it as a condition of a benchmark. #363 (closed, not merged) timed its change with "a local patch that lets a request ask for a fixed length" (ignore_eos,suffix=0,adapt=0). That patch is not in this repository.Approach
Why not a native engine flag. The engine stops at EOS by itself at many sites in
src/program/generate.cpp,sycl/src/program/generate.cpp,src/qwen35/q36_engine.cuandsrc/dsv41. A flag would need CUDA, HIP, SYCL and Metal changes, and only CUDA can be built here. This PR changes no C++.What it does. When the engine ends a pass on a stop token and budget is left,
Service._runsends a new generate. The prompt is the last prompt plus what that pass produced, including the stop token. The budget is what is left. The thinking-budget wrap-up continues the same way.Rules, checked by tests:
completion_tokensand is not in the text.<|im_start|>are counted and left out of the text, as vLLM'sskip_special_tokensdoes.truewith no budget above 0;logprobs;tools;strata_mcp;response_formatortext.formatother than plain text.tools: []andtool_choice: nonecount as no tools.tool_callswith finishlength, where the control gave 1. MCP tools did not run. A structured format gave a 502 after the whole budget.stop.fit_max_tokensshortens it, orfalseanswers 400.repeat_stop_tokens(#606) stays on and now counts stop tokens too.KEEPALIVE_Sat 0.1.prompt_tokensis the real prompt.cached_tokenscomes from the first pass. Time spent reading again on later passes counts inpredicted_ms, notprompt_ms.Routes.
/v1/chat/completions,/v1/responsesand/v1/messages.--parallelneeded no code of its own.Validation
Revision: this branch on base
c62d5e3a. The real runs on engine 0.1.55 ran on commit 3f422dc8. The commit was then amended to 2379625e, which changes one doc bullet only, soserve/server.pyis the same file.Raw results, with local paths scrubbed: https://gist.github.com/gdevenyi/812e4781a015f9caedfbfa8081a139d6
Passed
Without a GPU:
python -m unittest serve.test_ignore_eos: 39 tests OK. 30 of the 39 fail on the unchanged server. The 9 that pass there check behaviour that does not change.python -m unittest serve.test_server serve.test_responses serve.test_anthropic_base_url serve.test_chat_tool_results serve.test_context_overflow serve.test_images serve.test_ignore_eos: 476 tests, 1 skipped, 1 failure, listed under Failed.ignore_eosfalse and null. Nine cases cover the refused fields with the flag off or absent: tools, empty tools,strata_mcp,response_format, Anthropic tools, Responses tools andtext.format.On a real engine: RTX 5080 16 GB, Qwen3.8-Flash-Next IQ3_S, engine 0.1.55 from release v0.2.9 (the release's asset, its sha256 checked against the release's list), context 65536, 127.0.0.1 only, thinking off unless noted.
The table has every run of these requests, one server for each column. On the base,
ignore_eosis ignored, so those rows are normal replies. The base's third plain 1024 run was cut off when its run was interrupted, so it is left out.ignore_eos, 256ignore_eos, 1024ignore_eosagainst plain: 2.66x at 256 and 5.15x at 1024. The prompts differ, and there are 3 runs each. Per run, against the mean plain run,ignore_eoswas 1.5x to 4.7x at 256 and 3.4x to 7.7x at 1024.stop, 10-11 tokens,cached_tokens8. Its text varies ("Hi! How can I help you today?", "Hi there! ...") as it does before the runs.tools(whole and stream),response_format,logprobs, no budget and a non-boolean value by plain HTTP;toolson/v1/responsesand/v1/messages. Through the real SDKs (openai 3.42.0, anthropic 2.3.0):toolson chat, Responses and Messages, andresponse_format, each raisedBadRequestError. A normal request after them:stop, 10 tokens.length. The longest silence was 2.39 s.length, 256 tokens. Anthropic stream at 256,max_tokens, 256 tokens. Responses at 128,incomplete,max_output_tokens, 128 tokens./v1/responsesat 128 by plain HTTP:incomplete,max_output_tokens, 128 tokens./v1/messagesat 128:max_tokens, 128 tokens.Earlier, on a local engine build reporting
strata 0.1.54and on older code of this branch, before the refusals and the keep-alive fix. These were not run again on 0.1.55:cached_tokens3323 and 3324 after anignore_eosrun, the same as after a normal request.length, 1024 tokens, 38 passes sent again.A normal request beside
ignore_eoson--parallel 2. Same card, model and engine 0.1.55, on commit 3f422dc8, one server, 10 rounds, shuffled inside each round. The rule was written before the runs and is in the raw results. One warm-up round is left out.ignore_eosreply.The checks:
lengthat 256.ignore_eosis not refused on--parallel.ignore_eosreply as beside a normal one, 7.83 s against 4.76 s, permutation p below 0.001. The longest was 8.38 s. Please say if you want it refused on--parallelfor this reason.ignore_eosneighbours in D1 endedlengthat 256, and all 30 normal essay neighbours in C1 did too.ignore_eosanywhere: beside two looping short requests 0/10; beside an essay with other requests between the runs 0/10; on--parallel 4beside three essays 0/10. So clean on 0.1.55 is not one shape only.ignore_eosneighbours, where the essay was 7.12 s against 6.91 s. Its table is in the raw results.Failed
serve.test_server.GpuChoice.test_hip_ordinal: fails on the base too. I ran it there.length, because the model wrote<|im_end|>256 times in a row and the repeat guardrepeat_stop_tokensstopped it. All runs at 256 and 128 reached their budget. So a fixed length is not promised on long replies with the default guard. On the local 0.1.54 build, all three whole runs at 1024 reached it.A fault of older engines, not from this change (
--parallel). With noignore_eosanywhere, on serverc62d5e3a, a reply loses, repeats or splices tokens when a second request is admitted during it, on released engine 0.1.54 and earlier. It was not reproduced on released engine 0.1.55. The cause is not named here.The 0.1.54 data is in the raw results.
Not run
On real hardware:
The 10-second keep-alive itself. It needs 10 s with no text, and the longest silence in six streamed runs was 2.39 s. So the keep-alives counted above came from the engine's own heartbeat, from reading the code. The idle clock over a new pass is tested on the mock engine only, because
KEEPALIVE_Sis not a setting and lowering it would be a patch.On 0.1.55: thinking on, a second conversation's
cached_tokensafter a run, and a stop string. They ran on the local 0.1.54 build only, on older code.On 0.1.55: an
ignore_eosneighbour looping (D2) and two looping short neighbours beside an essay (C2), and mode A, the base alone. The stack switches were not turned off on 0.1.55.HIP, SYCL and Metal, Windows and macOS.
Engines other than 0.1.55, except the 0.1.54 and 0.1.52 runs above.
DeepSeek and Qwen3.6. DeepSeek's
stop_idsdiffer fromEOS_IDSon the batched path, and that combination is untested.Pictures,
--replicasand--split-serve. From reading the code, a pass goes through the samegenerate; unconfirmed static analysis.ignore_eoswithreasoning_loop_recovery.A real-engine run of a stop string hit in normal text after a stop token.
The shared Chat settings budget on a real engine. It counts as a budget, from reading the code.
Limits
<think>tags or long runs of new lines. On the local 0.1.54 build, a second<think>block went out ascontent, notreasoning_content."stop": ["\n"]was found only when the budget ran out (256 tokens, 18.41 s on the local 0.1.54 build, finishstop). For that request the[strata] done:log line and the/metricshistory still saylength.length. See Failed for how often. The log line then says to restart the server and report it, which is not needed for anignore_eosreply.ignore_eostologprobs,toolsor a structured format, and with nomax_tokensit generates up to the model's length. This is unconfirmed static analysis; vLLM was not run.strata_mcpis Strata's own field.seedis sent again with each pass, but two seeded runs already differed in their first words.🤖 Generated with Claude Code
https://claude.ai/code/session_01W53iURzvDQMjnYemag8uvv
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.