[PENDING: #694] test: pin reported latency metrics to injected values - #734
Open
Bslabe123 wants to merge 2 commits into
Open
[PENDING: #694] test: pin reported latency metrics to injected values#734Bslabe123 wants to merge 2 commits into
Bslabe123 wants to merge 2 commits into
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Bslabe123 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Bslabe123
force-pushed
the
test/metric-accuracy-latency-726
branch
from
August 18, 2026 18:19
96c55ad to
6fda061
Compare
Bslabe123
marked this pull request as ready for review
August 18, 2026 20:12
Bslabe123
force-pushed
the
test/metric-accuracy-latency-726
branch
from
August 19, 2026 20:15
6fda061 to
132771f
Compare
Bslabe123
force-pushed
the
test/metric-accuracy-latency-726
branch
from
August 26, 2026 15:50
132771f to
1f983e2
Compare
Bslabe123
force-pushed
the
test/metric-accuracy-latency-726
branch
from
August 26, 2026 17:48
1f983e2 to
735cc72
Compare
Bslabe123
force-pushed
the
test/metric-accuracy-latency-726
branch
from
August 27, 2026 20:14
735cc72 to
a0cf90a
Compare
…s#559) Reasoning models stream delta.reasoning_content (or delta.reasoning) before, and when the output budget is exhausted instead of, any delta.content chunk. Only content chunks were timestamped, so time_to_first_token measured time-to-first-content (prefill plus the entire reasoning-decode phase) and reported null when the stream ended while still in the reasoning channel. parse_sse_stream now takes an optional extract_reasoning extractor and returns a named ParsedSSEStream instead of a positional 5-tuple; reasoning-bearing chunks are recorded in new reasoning_chunks and reasoning_chunk_times fields on StreamedResponseMetrics. TTFT anchors to the first generated token of either channel, matching server-side vllm:time_to_first_token. output_len, TPOT, and ITL stay content-based: reasoning is thinking, not user-facing output. The token-count mismatch accounting now includes reasoning tokens, since the server's completion_tokens counts them. Adds the first kubernetes-sigs#606 Integration-tier tests: an in-process fake OpenAI server (tests/required/integration/fake_openai_server.py) streams scripted reasoning/content sequences over real HTTP with recorded send timestamps, and the reported TTFT is asserted against the server's own timeline. Unit tests pin the TTFT arithmetic with synthetic timestamps and the content-only output_len semantics end to end.
Bslabe123
force-pushed
the
test/metric-accuracy-latency-726
branch
from
September 3, 2026 20:30
a0cf90a to
054bf3f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #726. Row in #606: Integration / "Metric accuracy gate, latency (#726)".
The gap
inference-perf reports four latency metrics per request: time to first token (TTFT), inter-token latency (ITL, the gap between streamed chunks), time per output token (TPOT) and request latency. The only test that checks these numbers against a known input is
e2e/tests/test_metrics_fidelity.py(#614), which runs in the e2e tier againstllm-d-inference-simwith fixed TTFT and inter-token latency, so it needs the sim binary and is not in the per-PR unit suite. Everything intests/requiredeither hands the latency math pre-made timestamps or only checks that a metric is present and plausible.That is how #564 happened: #410 changed how streamed chunks were tokenized, ITL was under-reported, and nothing caught it for about two months.
What this adds
One new file,
tests/required/integration/test_latency_metric_accuracy.py, 7 tests. Each:FakeOpenAIServerfrom fix: anchor TTFT to the first reasoning-channel token #694) that streams five word-chunks over real HTTP with scripted pauses: 250 ms to first token, then gaps of 400, 100, 400, 100 ms.The reference values are the fake server's own per-chunk send timestamps. Server and client share one process and clock, so each reported number is compared to when the bytes actually left, not to how long
asyncio.sleepwas asked for. Tolerances (50 ms delivery, 100 ms scheduling) are documented in the file; 100 vs 400 ms gaps stay separable.The seven checks:
neuralmagic/Meta-Llama-3.1-8B-Instruct-FP8#564 lived does not halve ITL or emit zero-length intervalsCompared with #614: runs in
tests/requiredon every PR with no external binary; the reference is the send timestamp, not the configured sleep, so each value is bounded on both sides; the gaps are uneven (400/100 ms) so ITL min, max, mean and median are each checked, where #614 uses a constant gap and asserts only the median; and the report-time re-tokenization branch is exercised directly rather than sidestepped withuse_server_output_tokens. The tokenizer here maps one word to one token, so the multi-token-per-chunk case #614 notes (zero-length gaps dragging the ITL mean down) is covered by neither test.Breaking
summarize_requestslocally four ways (the #564 re-tokenization, TTFT anchored to end of stream, first-token wait folded into TPOT, flat average as ITL) fails the matching test each time. Product code is unchanged.Status
Stacked on #694 (base
3b17a21), which suppliesfake_openai_server.py. Once #694 merges the diff shrinks to this file and the[PENDING]prefix comes off.Verified locally on #694: 7 new tests pass,
pdm run validateclean, unit suite 892 passed / 15 skipped. About 10 seconds, almost all injected sleep.Notes: the #606 row says this "requires giving
MockModelServerClienta controllable response profile"; that mock is unary-only with no chunk timeline and would bypass the HTTP client and parser, so the row should read "uses theFakeOpenAIServerfake from #694". Coordinated-omission correction (adjusting latency byschedule_delay) is out of scope: a metric-definition question, open on #726 after v0.7.0.