Unit 6 of 13 · about 5 hours · explain
Reconstructing the engine API, tokenizer path, scheduler and request state
Build on Reconstructing a real kernel path and making one bounded change. Serving adds request identity, queues and ownership before the runner ever selects a kernel.
You'll be able to
- Map API validation, templating, tokenization and request identity into exact source owners.
- Reconstruct scheduler state transitions and the iteration work order without relying on class names alone.
- Predict where Nano-vLLM responsibilities move in Mini-SGLang and vLLM V1.
Covers
Read
In this order, only the parts listed
0 of 4 done
- Nano-vLLM request and scheduler entryNano-vLLM and Mini-SGLang as Engine Reconstruction Bridges
LLMEngine.add_request,stepandgenerate; follow their calls intonanovllm/engine/sequence.pyandnanovllm/engine/scheduler.py:SequenceStatus,schedule,preemptandpostprocess - Mini-SGLang separates the frontend and schedulerNano-vLLM and Mini-SGLang as Engine Reconstruction Bridges
System Architecture: Key Components and Data Flow; Code Organization: server, tokenizer, message and scheduler modules; follow
python/minisgl/scheduler/scheduler.py,_process_one_msgand_schedule_next_batch - The production scheduling work orderHands-On LLM Serving and Optimization - Chapters 8 and 9, frameworks and optimization in practice
Chapter 8, Generation-Request Execution Workflow and Scheduler Deep Dive, printed pp. 278 to 284
Treat the prose as an architecture sketch, not a fairness guarantee. Use vLLM 0.31.0 source to resolve implementation details.
- vLLM 0.31.0 process and input boundariesvLLM V1 Architecture Overview
V1 Process Architecture: API Server Process and Engine Core Process; compare
vllm/v1/engine/input_processor.py,vllm/v1/request.pyandvllm/v1/core/sched/scheduler.pyin release 0.31.0Skip the later AsyncLLMEngine description as a V1 implementation guide. In release 0.31.0, the launcher imports
AsyncLLMfromvllm/v1/engine/async_llm.py; the older name is a compatibility alias.
Focus on
- Reuse your earlier request-state invariants. For every arrow, record caller, callee, process, message payload, request ID and owner of terminal cleanup.
- Nano-vLLM accepts token IDs or text but supplies no HTTP frontend. Mini-SGLang adds API, tokenizer and scheduler messages; API schema fields still need tracing to implementation.
- At the pinned Nano-vLLM commit, the scheduler returns a prefill batch before considering decode if prefill work was scheduled. Chunked prefill alone therefore does not prove decode protection.
- Compare the miniature phase flag with V1's token-progress scheduling. Identify admission and preemption decisions separately from batch tensor preparation.
Common mistakes · 3
- Assuming matching class names mean matching process boundaries or scheduling policy across engines.
- Reading only normal completion. Preemption can return a running request to waiting with a different cache state.
- Treating continuous batching as bounded fairness. Demonstrate bounded wait under the actual arrivals and admission policy.
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.Why trace a supported API field past validation?Answer
A schema can accept a field that is not forwarded or implemented. The actual request contract is determined by the whole path.
2.Does Nano-vLLM's chunked prefill automatically interleave decode?Answer
Not at the pinned commit.
schedulereturns scheduled prefill work before the decode loop; arrivals can keep prefill taking precedence.3.Which component should own the batch tensor layout?Answer
The runner or its preparation layer. The scheduler determines feasible token work and ownership metadata; the runner translates that plan into execution inputs. Verify the actual split in source.
You're done when
You can locate the source owner of validation, tokenization, admission, scheduling and preemption, and predict the next state of all three replay cases.
Only when you can do this without notes.
Leads to
Notes
Resources · 3 for this unit, 11 more in the section
- Hands-On LLM Serving and Optimization - Chapters 8 and 9, frameworks and optimization in practiceChi Wang and Peiheng Hu (O'Reilly) · primary
Read Chapter 9 as a worked sequence from traffic generation and baseline through quantized and distributed variants, then the vLLM architecture and scheduler sections of Chapter 8. Replace its model, engine version and hardware with your own fixed contract.
- vLLM V1 Architecture OverviewvLLM Project · required
Map API server, EngineCore, scheduler, KV cache manager, model executor and distributed deployment from the current documentation into exact source files. Select the bounded contribution only after identifying its state and fallback boundaries.
- Nano-vLLM and Mini-SGLang as Engine Reconstruction BridgesGeeeekExplorer and SGLang Project · required
Reconstruct Nano-vLLM first, then compare Mini-SGLang cache, scheduler, overlap and model-runner boundaries. Move to vLLM or SGLang only when you can predict where the same responsibility lives.
Also in this section
- TensorRT-LLM Benchmarking GuideNVIDIA · required
Use the benchmark workflow, configuration capture, startup metrics and online-serving path as a benchmark-governance reference. Apply the same discipline to your engine and never import NVIDIA results as your own evidence.
- UCSD CSE 291A (Spring 2026) - Guest lecture: Engineering vLLMUC San Diego · support
Read the scribe notes, Sections 3, 6 and 7: the architecture overview, model parallelism and serving topology, and the hybrid KV allocator with offloading. Use it to predict where a change would live before reading code.
- AI Performance Engineering - Inference Engine and Benchmark LanesWafer · reference
A curated index. Use Sections 4 and 5 only to find a mechanism source for the contribution.
- AI Systems Performance Engineering companion code - inference labsChris Fregly (O'Reilly) · required
Use
labs/dynamic_router,labs/cache_aware_disagg_inference,labs/speculative_decodeorlabs/flashinfer_attentionas a pattern for a controlled baseline, optimization and profile. Rerun everything under your own manifest. - Etalon: Holistic Performance Evaluation Framework for LLM Inference SystemsMicrosoft Research · required
Use its per-request SLO and goodput framing to audit the benchmark. Preserve raw outcomes, quality acceptance and load shape so a throughput increase cannot hide missed latency targets.
- Machine Learning Systems, Volume 2 - The Economics and Architecture of InferenceHarvard (Vijay Janapa Reddi) · support
Read the opening sections of Inference at Scale for cost per token, utilization and serving-architecture dimensions, then build your own capacity and cost model from measured numbers.
- MLPerf Inference Datacenter BenchmarkMLCommons · support
Study scenario definitions, audit discipline and reproducibility. Borrow governance ideas appropriate to the capstone; submitting to MLPerf or reproducing its fleet hardware is outside the gate.
- Artificial Analysis - Performance benchmarking methodologyArtificial Analysis · reference
Read how its latency, output speed and price figures are measured. Use its public numbers as an outside comparison for your capacity plan, never as your own evidence.
- LLM Inference Systems Laboratory - Full CapstoneRoadmap-Final · required
Complete the architecture map, contribution, fallbacks, correctness and fault suite, raw benchmark package, negative result, capacity and cost plan, independent reproduction and design defense. This artifact supplies the track milestone.
- SciPy bootstrap confidence intervalsSciPy · support
Read the resampling procedure, paired parameter, Notes on degenerate data and Examples. Apply it to independent trials; do not assume correlated serving requests are independent samples.
- Machine Learning Systems, Volume 2 - Sustainable AIVijay Janapa Reddi · support
For optional energy/carbon accounting, read Energy measurement techniques, System-level energy profiling and Operational carbon calculation. State meter boundaries and apply PUE only to complete IT energy, once.