Repository navigation
fix(server-metrics): tag the agentic warmup-start baseline scrape as warmup - #49
Conversation
…warmup Root cause: the AGENTIC_REPLAY auto-warmup CreditPhaseConfig is synthesized without a phase_kind, and ServerMetricsManager.collect_baseline mapped any kind other than "warmup" to PROFILING. The warmup-start baseline scrape was therefore tagged PROFILING. For every counter series that already existed at that scrape (for example sglang:prompt_tokens on a prefill worker that served startup requests), the phase-filtered profiling series started at warmup start and its first profiling delta absorbed the whole warmup increment. Series that first appeared during warmup (sglang:cached_tokens, decode counters) were unaffected, so ratios such as the prefix cache hit rate were skewed: on a GB200 DeepSeek-V4 c1280 AgentX run, prefill prompt_tokens included exactly the warmup total (1,258,951,023 tokens), and the reported overall hit rate was 89.6% against 96.3% in the profiling window. Fix: give the synthesized agentic warmup phase_kind="warmup"; carry the credit phase on PhaseBaselineRequestMessage and let collect_baseline fall back to it when phase_kind is unset, instead of defaulting to PROFILING. Validation: new tests cover the agentic warmup kind and baseline phase tagging for set and unset kinds. tests/unit/server_metrics, tests/unit/timing and tests/unit/records: 2359 passed, 1 failed (test_records_manager::test_completed_excludes_analyzer_metrics, unrelated scenario MagicMock lookup; checked against the base commit). Signed-off-by: weireweire <20922698+weireweire@users.noreply.github.com>
Try out this PRQuick install: pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@5899651b7d3ed8a61a86ae571eedd2f0fb8234b9Recommended with virtual environment (using uv): uv venv --python 3.12 && source .venv/bin/activate
uv pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@5899651b7d3ed8a61a86ae571eedd2f0fb8234b9Last updated for commit: |
|
@cquil11 hi could you help to review this? |
|
Independent check of this PR against current
Happy to contribute the end-to-end test file (about 530 lines) to this branch or as a follow-up PR if that would be useful. |
|
Post-merge measurement of this fix in live AgentX runs Thanks for merging this. We measured its effect in paired live runs and are recording the results here; no action is needed on this PR. Setup. Each pair runs one frozen serving recipe (image, model, trace, durations) twice: H0 with AgentX 1.0.11 ( Measure. Within each run, we compare the prefix-cache hit rate that the current InferenceX result adapter derives from the AIPerf server-metrics export with a client-side reference computed from the same run's per-request
Four more vLLM B200 pairs (DeepSeek-V4-Pro, DeepSeek-V4.1-Flash) have only an interval reference for H0, and that interval contains the adapter value; with H1 their reference is exact and the difference is 0.00. Reading.
Limits. This isolates the collector effect. It does not show that every producer adapter is correct, and an H1 value is not by itself exact or eligible for pricing; that is the scope of SemiAnalysisAI/InferenceX#3964, #4163, #4164 and SemiAnalysisAI/InferenceX-app#1377. Most configurations have one pair (ATOM: Kimi-K3 4, DeepSeek-V4-Pro 3, GLM-5.2 and MiniMax-M3 2 each), all at concurrency 10 to 16. AMD runs used an internal MI355X cluster. NVIDIA runs are InferenceX E2E runs: B300 Kimi-K3 H0 and H1, B200 MiniMax-M3 vLLM H0 and H1, GB200 Kimi-K3 H0 and H1. Prepared by Claude Opus 5.5 (Cursor agent) for Chun Fang, who approved publishing verified results; the values are computed from the immutable per-run summaries. |
Summary
Tag the AgentX (AGENTIC_REPLAY) warmup-start server-metrics baseline scrape as warmup instead of profiling, so profiling counter deltas no longer absorb the whole warmup.
Root cause
_build_agentic_warmup_configsynthesizes the agentic warmupCreditPhaseConfigwithout aphase_kind.ServerMetricsManager.collect_baselinemapped every kind other than"warmup"toPROFILING, so the scrape taken at warmup start was taggedPROFILING.The phase-scoped profiling summary selects samples by tag. For any counter series that already existed at that scrape, the profiling series therefore started at warmup start, and its first delta covered the entire warmup. Series that first appeared during warmup were unaffected, so ratios between counters were skewed.
Observed on a GB200 DeepSeek-V4 Dynamo-SGLang disaggregated AgentX run at concurrency 1280:
sglang:prompt_tokenson each prefill endpoint started its profiling timeslices 1674 s before profiling start, with a single jump of 1,258,951,023 tokens. That is exactly the warmup total for the same series inwarmup_metrics.sglang:cached_tokensand the decode endpoint's counters started at profiling start.Fix
phase_kind="warmup"on the synthesized agentic warmup phase.phaseonPhaseBaselineRequestMessage(filled in by the phase publisher).collect_baselineuses it whenphase_kindis unset, instead of defaulting toPROFILING.Validation
phase_kind == "warmup".phase_kindwarmup/profiling/unset.pytest tests/unit/server_metrics tests/unit/timing tests/unit/records: 2359 passed, 1 failed. The failure istest_records_manager.py::TestRecordsManagerAnalyzerMetrics::test_completed_excludes_analyzer_metrics, which fails identically on the base commit (scenario lookup on a MagicMock).ruff checkandruff format --checkpass on the changed files.prompt_tokensprofiling timeslices start at profiling start.Note
Low Risk
Localized server-metrics phase tagging and message fields; behavior change is limited to baseline scrape labels with new unit tests.
Overview
Fixes agentic (AGENTIC_REPLAY) warmup-start server-metrics baseline scrapes being labeled profiling, which made phase-scoped counter deltas include the whole warmup (e.g. skewed prefix-cache hit rates).
Synthesized agentic warmup now sets
phase_kind="warmup"onCreditPhaseConfig. Phase boundary baseline requests carry optionalphase(CreditPhase); the phase publisher fills it from config.ServerMetricsManager.collect_baselinemapsphase_kindto warmup/profiling explicitly and, when kind is missing, usesmessage.phaseinstead of defaulting non-warmup to profiling.Unit tests cover agentic warmup
phase_kindand parametrized boundary scrape tagging.Reviewed by Cursor Bugbot for commit 5899651. Bugbot is set up for automated code reviews on this repo. Configure here.