Repository navigation
[Simulator] Add high-fidelity CPU-based inference simulator - #33824
Merged
hzh0425 merged 8 commits intoSep 4, 2026
Merged
Conversation
littlefatfat
requested review from
Fridge003,
HaiShaw,
Kangyan-Zhou,
bingxche,
ispobock and
merrymercy
as code owners
August 6, 2026 06:24
Collaborator
|
should fix the lint |
6 of 16 tasks
littlefatfat
force-pushed
the
sglang-simulator-v0.5.16-adaptation
branch
15 times, most recently
from
August 11, 2026 08:57
afec358 to
85abcc1
Compare
littlefatfat
force-pushed
the
sglang-simulator-v0.5.16-adaptation
branch
from
September 3, 2026 03:54
3d877c6 to
fd4918e
Compare
Contributor
Author
|
/rerun-failed-ci |
1 similar comment
Contributor
Author
|
/rerun-failed-ci |
Introduce packaging and worker bootstrap, simulator configuration and state, hook primitives, accelerator and model specifications, and AIC, ML, and replay latency predictors. Co-authored-by: zhouhaizhu.zhz <zhouhaizhu.zhz@alibaba-inc.com> Co-authored-by: LinSiyuan814 <linsiyuan.lsy@alibaba-inc.com>
Add random and Autobench workload parsing together with shared benchmark configuration and the serving benchmark entry point. Co-authored-by: zhouhaizhu.zhz <zhouhaizhu.zhz@alibaba-inc.com> Co-authored-by: LinSiyuan814 <linsiyuan.lsy@alibaba-inc.com>
Add simulator-aware scheduler, model runner, memory allocators, HiCache and Unified Radix Tree adapters, server launch support, request metrics, and kernel hooks. Co-authored-by: zhouhaizhu.zhz <zhouhaizhu.zhz@alibaba-inc.com> Co-authored-by: LinSiyuan814 <linsiyuan.lsy@alibaba-inc.com>
Document installation and simulator workflows, and provide reproducible configs, workloads, tokenizer data, replay data, and a small ML predictor asset. Co-authored-by: zhouhaizhu.zhz <zhouhaizhu.zhz@alibaba-inc.com> Co-authored-by: LinSiyuan814 <linsiyuan.lsy@alibaba-inc.com>
Cover runner and serving parity, OFFLINE and BLOCKING semantics, replay cache hits, reusable assets, and register the compatibility suite in CPU PR CI. Co-authored-by: zhouhaizhu.zhz <zhouhaizhu.zhz@alibaba-inc.com> Co-authored-by: LinSiyuan814 <linsiyuan.lsy@alibaba-inc.com>
Move simulator compatibility coverage to the opt-in extra workflow so failures remain visible without gating the base SGLang test path. Keep the simulator runtime single-process while preserving modeled parallelism in simulator configuration, and drop the redundant parallelism unit test. Co-authored-by: zhouhaizhu.zhz <zhouhaizhu.zhz@alibaba-inc.com> Co-authored-by: LinSiyuan814 <linsiyuan.lsy@alibaba-inc.com>
Cast paged decode indices before assigning int32 free pages, and cover a page-boundary decode with output_length greater than one. Keep cache-tier assertions in the cache-specific suite and support both current and legacy HiCache host-pool interfaces. Move the simulator-aware serving benchmark to benchmark/simulator and keep its source path wired into the extra CPU CI gate. Co-authored-by: zhouhaizhu.zhz <zhouhaizhu.zhz@alibaba-inc.com> Co-authored-by: LinSiyuan814 <linsiyuan.lsy@alibaba-inc.com>
littlefatfat
force-pushed
the
sglang-simulator-v0.5.16-adaptation
branch
from
September 3, 2026 14:44
4858539 to
6bbf550
Compare
Contributor
Author
|
/rerun-failed-ci |
ispobock
reviewed
Sep 3, 2026
Collaborator
|
we also need to add a CODEOWNERS entry for |
Co-authored-by: zhouhaizhu.zhz <zhouhaizhu.zhz@alibaba-inc.com> Co-authored-by: LinSiyuan814 <linsiyuan.lsy@alibaba-inc.com>
Contributor
Author
|
/rerun-failed-ci |
ispobock
approved these changes
Sep 4, 2026
Collaborator
let me add in next pr |
Collaborator
5 tasks
StevenChenSE
pushed a commit
to StevenChenSE/sglang
that referenced
this pull request
Sep 6, 2026
…ect#33824) Co-authored-by: zhouhaizhu.zhz <zhouhaizhu.zhz@alibaba-inc.com> Co-authored-by: LinSiyuan814 <linsiyuan.lsy@alibaba-inc.com> Co-authored-by: hzh0425 <hzh0425@apache.org>
1 task done
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.


Motivation
This PR introduces SGLang Simulator, a CPU-based inference simulator for
evaluating SGLang scheduling, latency, throughput, and prefix-cache behavior
without loading model weights or executing model kernels.
It is a current-main rework of the simulator prototype in
#22250, while retaining
SGLang v0.5.16 as the tested compatibility floor.
Large-scale inference configuration studies are expensive to run directly on
accelerators. SGLang Simulator reuses the real SGLang scheduler, radix cache,
hierarchical cache, and request lifecycle, while replacing model-forward
execution with a latency predictor. It supports measured traces, synthetic
workloads, and both in-process and HTTP serving workflows.
What This PR Adds
tools/sglang-simulatoras a monorepo component.and request lifecycle with dummy model weights and a minimal KV allocation.
SGLangBenchmarkRunner.metrics.
fixtures.
tools/sglang-simulatorchanges.Simulation Modes
The simulator provides two execution modes:
OFFLINE: advances a logical clock without sleeping, intended for fastconfiguration and workload studies.
BLOCKING: sleeps for predicted forward latency and visible L2-to-L1 loadlatency, intended for serving-path and timing-semantics validation.
Replay replaces model-forward latency only. CPU preprocessing and
postprocessing overhead remain enabled by default.
For
OFFLINEruns, latency, throughput, and duration should be read from theserver-side simulator metrics rather than benchmark-client wall-clock time.
Accuracy Validation
The following results compare simulator output with measured serving traces.
Latency, throughput, and duration values are absolute percentage errors.
Prefix reuse is reported as absolute percentage-point error.
The
SGLang baselinecolumn identifies the version used by the real servicethat produced the measurement trace.
TPOT and ITL are not applicable to the GLM-5.1-FP8,
DeepSeek-V4-Pro, and DeepSeek-V4-Flash validation traces because they use
one-token outputs(Prefill-Decode Disaggregation).
The SGLang v0.5.16 validation additionally covers four measured 32–128K
serving traces. Using AIConfigurator as the forward-latency predictor, the
simulator achieves a mean-TTFT MAPE of 5.89%. Duration and input-throughput
MAPE are both 0.011%, while the maximum absolute prefix-reuse error remains
below 0.011 percentage points.
Prefix-cache accuracy is particularly sensitive to
max_total_tokens. Thisvalue determines simulated device KV-cache capacity and also affects
hierarchical host-cache sizing and eviction behavior. For deployment-faithful
comparisons, use the
max_total_num_tokensvalue reported by the real SGLangserver startup log as the simulator's
--max-total-tokensvalue.CI States
Latest PR Test (Base): ⏳ Run #33785893262
Latest PR Test (Extra): 🚫 Run #33830599147
Latest PR Test (AMD ROCm 7.2): ➖ No AMD PR run found for this commit.