Unit 11 of 12 · about 5 hours · implement, measure
Policy ablation, a negative regime and a bounded real-engine change
A policy that only ever wins in reports is untested. Ablations separate the mechanism from the hype, and a bounded engine change proves the simulator result transfers.
You'll be able to
- Isolate one scheduling mechanism with ablations that freeze everything else, including the corpus.
- Preserve a negative regime where the change loses and explain the shifted bottleneck from traces.
- Implement one bounded policy change in a real engine with fallback and regression tests.
Covers
Read
In this order, only the parts listed
0 of 3 done
- Sarathi-Serve ablation of chunking and hybrid batchingSarathi-Serve: Tackling Throughput-Latency Tradeoffs in LLM Inference
Section 5.4 (arXiv:2403.02310v3): Fig 14 chunked-prefill overhead against no chunking for Yi-34B, and Table 4 with hybrid-batching-only, chunked-prefills-only and combined TTFT and TBT over 128 requests at token budget 1024
- Continuous-batching baseline against optimized pairAI Systems Performance Engineering - Continuous Batching Lab
baseline_continuous_batching.pyagainstoptimized_continuous_batching.pywith the shared harness incompare.py, run aspython -m ch15.compareunder CPU-safe or single-GPU settingsSkip the multigpu pair and the disaggregation and MoE targets in this unit. Re-measure on your hardware; the repo's bundled number is its result on its hardware, not your target.
- Bounded scheduler change in Nano-vLLMNano-vLLM - Scheduler, Block Manager and Engine Loop
Fork
nanovllm/engine/scheduler.pywithllm_engine.pyandblock_manager.py: add event logging that explains every admit, chunk, preempt and finish transition, then implement one bounded admission or chunking change with regression tests
Focus on
- Ablate one mechanism at a time with the corpus, seed, budgets and hardware frozen. The paper's three-way split of hybrid-only, chunked-only and combined is the template: each run differs by exactly one rule.
- The negative regime is a deliverable, not an embarrassment. Name the workload where the change loses, show the trace, and explain the shifted bottleneck in overhead, memory pressure or tail cost.
- Bound the engine change to one policy with a reference fallback and a versioned flag. Reviewers must be able to turn it off and get the old behavior with no stale state.
- Diagnose transfer explicitly when the simulator and the engine disagree. Execution times, kernel shapes, cache reuse and host overhead are the usual suspects, and each one is checkable.
Common mistakes · 3
- Sweeping every flag combination instead of isolating mechanisms. Combinatorial tuning attributes nothing; three runs that differ by one rule attribute everything.
- Promoting a simulator win without an engine check. The simulator ranks policies under a coarse cost model, so the bounded engine run is the result, not a formality.
- Dropping the negative regime from the write-up. A missing losing workload reads as an untested boundary, and the section checkpoint explicitly requires one win and one regression.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.What makes Table 4 an ablation rather than a benchmark?Answer
Same model, hardware, requests and budget across three runs that differ by exactly one mechanism each. The TTFT and TBT movements attribute to hybrid batching and chunking separately and combined.
2.Your chunking change wins in simulation and ties on the real engine. What do you check first?Answer
Transfer gaps in order: real iteration times against modeled ones, kernel shapes in mixed batches, prefix-cache hit differences, and host and scheduling overhead per step.
3.What bounds a real-engine policy change?Answer
One mechanism behind one flag with a reference fallback, regression tests that pin old behavior, and no stale state when toggled. Anything wider is a rewrite, not an experiment.
4.Why keep tuning traces separate from final traces?Answer
Tuning on the final numbers overfits the policy to one corpus and hides variance. Tuning traces choose the setting; fresh final traces with the invariant checks report the result.
Practice
- AI Systems Performance Engineering: continuous-batching pair
Run
baseline_continuous_batching.pyagainstoptimized_continuous_batching.pythroughpython -m ch15.compareunder CPU-safe or single-GPU settingsInspect the shared comparison contract first, re-measure rather than quoting the bundled number, and keep one workload where the optimized path does not win.
You're done when
Your ablation attributes a win and a regression to named mechanisms, and your bounded engine change toggles cleanly with regression tests green.
Only when you can do this without notes.
Leads to
Notes
Resources · 3 for this unit, 15 more in the section
- Sarathi-Serve: Tackling Throughput-Latency Tradeoffs in LLM InferenceMicrosoft Research · required
Focus on chunked prefills, stall-free batching and the throughput-latency trade-off. Implement a fixed-token chunk policy and preserve a workload where chunking loses to the simpler scheduler.
- Nano-vLLM - Scheduler, Block Manager and Engine LoopGeeeekExplorer · required
Trace scheduler.py with llm_engine.py and block_manager.py. Add event logging in your own fork or project, explain every transition, and implement one bounded admission or chunking change with regression tests.
- AI Systems Performance Engineering - Continuous Batching LabChris Fregly · support
Run the Chapter 15 baseline and optimized continuous-batching pair under CPU-safe or available-GPU settings. Inspect the shared comparison contract and re-measure rather than quoting bundled deltas.
Also in this section
- Hands-On LLM Serving and Optimization - Chapter 6, batching and schedulingChi Wang and Peiheng Hu (O'Reilly) · primary
Read "Request Batching and Scheduling-Level Optimizations" in Chapter 6: dynamic, continuous and chunked-prefill batching. Rebuild each policy in a small event simulator and state the user-visible metric it can improve or harm.
- Orca: A Distributed Serving System for Transformer-Based Generative ModelsUSENIX OSDI · required
Study iteration-level scheduling and selective batching, including the workload assumptions. Reproduce one scheduling timeline by hand and use it as the correctness baseline for the simulator.
- AI Systems Performance Engineering - Chapters 16 and 18, scheduling and admissionChris Fregly (O'Reilly) · required
Read "Dynamic Batching, Scheduling, and Routing" in Chapter 16 and "SLO-Aware Request Management and Fault Tolerance" in Chapter 18 (early rejection, quality of service).
- Mini-SGLang - Scheduler and Overlap SchedulingSGLang Project · required
Read docs/structures.md, scheduler implementation and tests/core/test_scheduler.py, then compare overlap scheduling with the Nano-vLLM loop. Use the online benchmark only after fixing the same workload and hardware contract.
- TensorTonic Language Modeling from Scratch - Simulate Continuous Decode BatchingTensorTonic · support
Solve after the continuous-batching unit, then compare its admission rule with your own simulator.
- LLM Inference: From scratch, one token at a time - Module 05Tushar Amrit · support
Work the Batching module's arithmetic and checkpoint before the static and continuous batching units.
- LLM Inference Systems Laboratory - SchedulerRoadmap-Final · support
Add token and memory admission, chunking, priority, cancellation, overload and fairness to the simulator, then carry one policy through the real engine path with a reference fallback.
- vLLM v0.31.0 serve CLI and scheduler argumentsvLLM Project · reference
Look up scheduler flags and defaults:
--max-num-seqs,--max-num-batched-tokens,--max-num-active-seqs,--enable-chunked-prefill,--long-prefill-token-thresholdand--scheduling-policy. Runtime defaults vary by GPU class, so check them against the installed v0.31.0 behavior. - vLLM v0.31.0 metrics designvLLM Project · reference
Read the WAITING, RUNNING and PREEMPTED request states and the queue, inference, prefill and decode interval definitions. Swapped-preemption metrics are legacy in v1. The exported counters, including
vllm:num_requests_waiting_by_reasonandvllm:num_preemptions, are listed on the Production Metrics page, https://docs.vllm.ai/en/v0.31.0/usage/metrics/ - vLLM v0.31.0 benchmark CLIvLLM Project · support
Use
vllm bench servewith--request-ratefor offered-load sweeps, andvllm bench throughputandvllm bench latencyfor offline endpoint and phase baselines. Fix the dataset, lengths, request rate, warmup and sampling, and keep raw per-request results; do not copy example rates as targets. - vLLM v0.31.0 online servingvLLM Project · reference
Read the
/abort_requestsendpoint and the Responses cancel API for request cancellation. Verify client-disconnect aborts on your engine; the page does not cover them. - vLLM v0.31.0 LoRA adaptersvLLM Project · reference
Read per-request
LoRARequestserving, server-wide--lora-moduleswithmax_lorasandmax_lora_rank, and why adapter-slot pressure rewards grouping same-adapter requests. - vLLM v0.31.0 structured outputsvLLM Project · reference
Read the xgrammar and guidance backends, the
choice,regex,json,grammarandstructural_tagoptions inStructuredOutputsParams, and the--structured-outputs-config.backendflag. - vLLM v0.31.0 multimodal inputsvLLM Project · reference
Read
limit_mm_per_prompt, content hashing withmulti_modal_uuidsin Cached Inputs, and the video pruning flags as examples of encoder-side scheduling cost. - TensorTonic Language Modeling from Scratch - Route Cache-Aware Prefill RequestsTensorTonic · support
Solve after the affinity unit: assign each request to a feasible worker by longest cached prefix, lowest projected uncached load, greatest remaining capacity, then lowest worker id, with -1 when infeasible.