mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5260] [Benchmark] tools: a serving calibration for single and parallel requests #5369
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#5369
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/5260
Author: @suzuri-lollipop
Created: 11/5/2026
Status: 🔄 Open
Base:
main← Head:suzuri/serving-cal-pr📝 Commits (1)
31ef550tools: a serving calibration for single and parallel requests📊 Changes
3 files changed (+531 additions, -0 deletions)
View changed files
📝
docs/BATCHING.md(+43 -0)➕
tools/calibrate_serving.py(+436 -0)➕
tools/test_calibrate_serving.py(+52 -0)📄 Description
Problem and result
strata engine calibratemeasures a fixed single-stream workload. What a serving user waits for is different:with several requests in flight, a cold prompt's read is serialized with the others, so the later requests' time
is queue wait plus prompt time, not the solo decode rate. The env settings that change this
(
STRATA_PREFILL_ROUTED_STREAM,STRATA_PIPE_ADAPT_EVERY,STRATA_COALESCE_PREFILL) were compared by hand.Before: no serving-side calibration; the queue-wait and prompt-time parts are invisible to the existing suite.
After:
tools/calibrate_serving.pymeasures one request (--mode single) or several (--mode multi, with--shape both|loop|stagger), compares env-only arms, and writes the winner back with--apply. On the rig belowthe routed arm changed four 1.1K-token prompts sent 5 s apart from 6.9-10.4 s prompt reads and 18.9 s total queue
wait to 3.3-4.8 s reads and 0.31 s queue wait; the pipelined line went from 28.5-33.0 to 52.1 rows/s. No engine
code, default path or answer changes: every arm is an existing opt-in env setting, and nothing is applied without
--apply.Related discussion
None (a new opt-in tool; no engine or default change).
Approach
--mode single(--single): one request on the solo path; scored on throughput first (a 2% loss is refused),with the prompt time as the tie-break.
--mode multi(--multi, the default): several cold prompts; scored on queue wait, then the sum of prompttimes, then throughput (a 3% loss is refused), then the longest decode gap.
baseline,routed(STRATA_PREFILL_ROUTED_STREAM=1),routed_adapt(routed +STRATA_PIPE_ADAPT_EVERY=32), andcoalesce(STRATA_COALESCE_PREFILL=4, multi only).prompt_msandfirst_engine_token_s - prompt_msfrom the JSON/metrics; no new endpoint.--applywrites engine keys into the config'senvwith a.bak-<time>copy. Keys the server reads(
STRATA_COALESCE_PREFILL,STRATA_ADMIT_SHORT_FIRST) go to<config>.server-env.json, because the config'senvonly reaches the engine.--rootstarts a fork clone'sserve/server.py; the arms are env-only, so the same tool measures both.Validation
Environment: Linux, 2x NVIDIA RTX PRO 4000 Blackwell (CUDA1 on a Gen4 x4 link), CUDA 13.3, Qwen3.8-Flash-Next
NVFP4, 63 GiB arena,
--parallel 4 --batch-groups auto,STRATA_PIPED_CONCURRENT=1. PR branch head31ef550c(engine 0.1.56 =ffa80d73).Passed:
python -m pytest tools/test_calibrate_serving.pyat31ef550c-> 6 passed (single/multi score,throughput gates, server/engine env split, prompt seed).
python tools/calibrate_serving.py --help-> the--mode {single,multi} | --single | --multiand--shape both|loop|staggeroptions are present.baseline
p6.9-10.4 s andqsum 18.9 s;STRATA_PREFILL_ROUTED_STREAM=1p3.3-4.8 s andqsum 0.31 s.The pipelined batch line went from 28.5-33.0 to 52.1 rows/s. Fixed 64-token A/B (all four hit length):
per-request decode 29-78 -> 87-96 tok/s,
qsum 16.8 -> 0.08 s.entry into its existing slot, so the prompt products are the same bits (
include/strata/prefill/routed_stream.hpp;tests/prefill/routed_stream_test.cpp).Failed:
None observed.
Not run:
the GPU above.
serve/server.pyin CI;--rootis the local path for that, not exercised by the unit tests.0.1.56.
Limits
--batch-mtp, etc.).prompt_tokens; equal-length requests arriving in thesame instant can be matched to the wrong entry. The per-request rows stay in the report so this is visible.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.