mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2822] [Engine] Opt-in single-engine preemption for short requests #4282
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#4282
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/2822
Author: @Zcg2021
Created: 10/16/2026
Status: 🔄 Open
Base:
main← Head:codex/solo-priority📝 Commits (10+)
636e745feat(server): add opt-in cooperative priority for single-engine requestsb46002fdocs(bench): make base Qwen validation primary for solo priority82a9de8fix(server): retain restored prefixes before priority preemption99ab65ftest(server): add reproducible multi-conversation priority soakf01cb81fix(server): preserve exception identity for script-launched priority streams4a44890docs(bench): record original-model soak and corrected lifecycle validation35e4415fix(server): adapt solo priority to beta queue lifecyclef3063c1fix(server): report admitted solo requests in terminal telemetry7fc67ecdocs(bench): revalidate single-engine priority on 0.2.0-beta8155100test(server): preserve declared-tool restriction through solo priority📊 Changes
51 files changed (+11254 additions, -10 deletions)
View changed files
📝
README.md(+4 -0)➕
bench/results/2026-10-16-solo-priority-qwen-original/README.md(+145 -0)➕
bench/results/2026-10-16-solo-priority-qwen-original/results.json(+1302 -0)➕
bench/results/2026-10-16-solo-priority-qwen-soak/README.md(+269 -0)➕
bench/results/2026-10-16-solo-priority-qwen-soak/faults-after-requests.jsonl(+15 -0)➕
bench/results/2026-10-16-solo-priority-qwen-soak/faults-before-requests.jsonl(+12 -0)➕
bench/results/2026-10-16-solo-priority-qwen-soak/final-lifecycle-requests.jsonl(+15 -0)➕
bench/results/2026-10-16-solo-priority-qwen-soak/native-timings.txt(+45 -0)➕
bench/results/2026-10-16-solo-priority-qwen-soak/pilot-requests.jsonl(+24 -0)➕
bench/results/2026-10-16-solo-priority-qwen-soak/results.json(+771 -0)➕
bench/results/2026-10-16-solo-priority-qwen-soak/soak-requests.jsonl(+409 -0)➕
bench/results/2026-10-16-solo-priority-qwen-soak/test-output.txt(+7 -0)➕
bench/results/2026-10-16-solo-priority-rtx3090/README.md(+136 -0)➕
bench/results/2026-10-16-solo-priority-rtx3090/make_fixture.py(+75 -0)➕
bench/results/2026-10-16-solo-priority-rtx3090/results.json(+1021 -0)➕
bench/results/2026-10-19-solo-priority-v020-beta/README.md(+186 -0)➕
bench/results/2026-10-19-solo-priority-v020-beta/injected-engine-exit.json(+4 -0)➕
bench/results/2026-10-19-solo-priority-v020-beta/lifecycle-after-engine-recovery.json(+17 -0)➕
bench/results/2026-10-19-solo-priority-v020-beta/lifecycle-after-failure-delivery.json(+7 -0)➕
bench/results/2026-10-19-solo-priority-v020-beta/lifecycle-after-requests.jsonl(+15 -0)...and 31 more files
📄 Description
Problem and result
A short interactive request on a single native engine waits for a long response to finish. This experimental, opt-in Python scheduler lets a waiting higher-priority request interrupt and resume that response through the existing STOP/DONE protocol and conversation RAM cache. Only one native GEN runs at a time; it does not allocate batch slots or change defaults.
Related discussion
#2821; #2109 concerns batch admission rather than interruption of an already-running single-engine response. Maintainer scope agreement is still requested in #2821. This existing PR remains draft pending that discussion and hardware validation on the current base.
Approach
The scheduler drains all accepted tokens through DONE before changing ownership. Continuation uses original token IDs and keeps the original stream parser, UTF-8 decoder and tool-call identity alive. Minimum run time and waiting-age priority prevent short requests from indefinitely starving long work. Parked cancellation does not stop another owner; engine death fails affected streams.
The current rebase is onto main
870aedd9e1ebe1c91f94da93b59af17729f6c5c0(0.2.8). README retains upstream's new layout. The rebase also preserves the newprefill_onlyargument when the normal generator is extracted into_generate_single; an uncorrected automatic merge raisedNameErroron an ordinary request.split_serveis explicitly rejected withsolo_priority, because its proxy forwards single-engine attributes despite using two engines. Regression tests cover the default prefill-only protocol, invalid calls, split-mode rejection and logprob ownership across actual simulated preemption/resumption.No native source, model, tokenizer or cache-format changes. Production Maya/Strata services and settings were not changed for this update.
Validation
Tested revision:
1e1b2672eb104d4b4c56020ba529feeaeffa2646, 2026-10-30. Pinned runtime requirements in isolated environments; protocol/streaming tests use fake engines, not real GPUs.Passed:
python -m unittest serve.test_solo_priority serve.test_logprobs serve.test_split -v: 73 tests, OK, 25.258 s. Covers interruption/resumption, queued/active/parked cancellation, engine death, UTF-8, tool arguments, usage, logprobs and split-serving compatibility.python tools/minimal_server_smoke.py --report <new-absolute-path>: 51 tests, OK (4 skipped), 103.346 s.python -m unittest discover -s serve -p 'test_*.py': 1278 tests, OK (17 skipped), 424.214 s. Runtime smoke: 51 tests, OK (4 skipped), 106.664 s. CI on the tested commit.git diff --check origin/main: passed.Failed attempts:
python -m unittest serve.test_solo_priority.Streaming.test_terminal_state_tracks_an_admitted_solo_request -v: 1 test, 1 error (NameError: name 'prefill_only' is not defined). Corrected in the tested revision; included in the passing focused suite above.Not run:
Earlier hardware evidence (not rerun on this base)
Limits
Cold/partial-cache-hit prefill and restoration can still delay short requests. Historical soak short TTFT reached 46.663 s while reading an unfinished long prefix; this is not a real-time latency guarantee. Restored partial prefill reaches its first generated token before yielding to avoid discarding the checkpoint. Images and checkpoint opt-outs are non-preemptible. Batch, replicas and split serving cannot be combined with this option. The feature stays off by default; no universal speedup or token-identical native sampling across separate runs is claimed.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.