Magpie benchmarking mode architecture#
2026-07-20
2 min read time
Magpie’s benchmark mode drives end-to-end performance evaluation of LLM inference frameworks—vLLM, SGLang, and Atom—by launching a server, running a client workload, and collecting throughput and latency metrics into a structured JSON report. Benchmarks can run inside a Docker container (the default), directly on the host, or on a remote Ray cluster, and they optionally capture torch profiler traces for downstream analysis with TraceLens and gap analysis. This page describes the components that make up the benchmark pipeline, the execution flow from configuration to report generation, and how the pieces connect.
Architecture#
Magpie benchmark mode is composed of the following key components that work together to run, profile, and analyze inference framework benchmarks.
Components#
Benchmark mode consists of the following Python modules.
Component |
File |
Description |
|---|---|---|
|
|
Main orchestrator |
|
|
Configuration dataclasses |
|
|
TraceLens CLI integration |
|
|
Inference-aware TraceLens split/report flow and simple roofline summaries |
|
|
Kernel bottleneck analysis |
|
|
Result data structures |
Execution flow#
Each benchmark run proceeds through the following stages.
Configuration Loading: Parse YAML config into
BenchmarkConfigRuntime Setup: For
run_mode: docker, prepare a container with InferenceX; forlocal, use the host environmentServer Launch: Start vLLM/SGLang server (in container or on host per
run_mode)Client Execution: Run benchmark client with profiling enabled
Trace Collection: Torch profiler traces saved to workspace
TraceLens Analysis: Split inference traces, run TraceLens CLI commands inside the runtime image for Docker inference mode or on host for local/classic mode, and write per-stage simple roofline summaries (if enabled)
Gap Analysis: Analyze kernel bottlenecks within time window (if enabled)
Result Generation: Aggregate metrics and generate reports
Architecture diagram#
The following diagram shows how Magpie orchestrates the benchmark pipeline.
┌─────────────────────────────────────────────────────────────────────┐
│ Benchmark Mode │
├─────────────────────────────────────────────────────────────────────┤
│ ┌───────────────┐ ┌───────────────┐ ┌────────────────────┐ │
│ │BenchmarkConfig│ → │ BenchmarkMode │ → │ BenchmarkResult │ │
│ │ (YAML) │ │ │ │ (JSON + CSV) │ │
│ └───────────────┘ └───────────────┘ └────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────┐ │
│ │ Runtime: docker │ local │ ray │ │
│ │ ┌─────────────┐ ┌─────────────────────────────────┐ │ │
│ │ │ InferenceX │ → │ vLLM / SGLang Server + Client │ │ │
│ │ │ scripts │ │ + Torch Profiler │ │ │
│ │ └─────────────┘ └─────────────────────────────────┘ │ │
│ │ Ray: Magpie driver → RayJobExecutor → GPU worker runs the │ │
│ │ same stack (local/docker on worker; NFS for cache/ │ │
│ │ results). See ray.md │ │
│ └──────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌────────┴────────┐ │
│ ▼ ▼ │
│ ┌────────────────────────┐ ┌─────────────────────────────────┐ │
│ │ Gap Analysis │ │ TraceLens Analysis │ │
│ │ • Time window filter │ │ • Inference stage reports │ │
│ │ • Category filter │ │ • Simple roofline summaries │ │
│ │ • Kernel stats CSV │ │ • Legacy per-rank reports │ │
│ └────────────────────────┘ └─────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘