Deep Dive into SGLang

Deep Dive into SGLang

A two-volume systems book on SGLang's inference runtime, from online request scheduling, KV memory, prefix reuse, and decoding algorithms to quantization, distributed serving, kernels, hardware backends, benchmarking, correctness, and extension work.

Hardcover mockup of Deep Dive into SGLang Volume I and Volume II

Volume I

Runtime, Scheduling, Memory, and Decoding

Volume I explains SGLang as a live inference system: requests arrive continuously, GPU memory is limited, and each decode step reshapes the next scheduling choice.

Volume II

Quantization, Distributed Serving, Kernels, and Measurement

Volume II follows SGLang beyond the core runtime path into scale, specialization, and measurement, including adapters, expert routing, disaggregation, hardware backends, multimodal workloads, and tests.

Public excerpts

Sample Chapters

Sample chapters are released under the CC BY-NC-ND 4.0 license.

Book contents

Table of Contents

Free chapter overview slides are released under the CC BY-NC-ND 4.0 license.

Volume I

  1. Preliminaries
  2. The Inference Serving Problem
  3. Transformer Inference Cost Model
  4. SGLang Runtime as a Distributed State Machine
  5. Continuous Batching
  6. Chunked Prefill and Overlap Scheduling
  7. KV Cache Memory Management
  8. RadixAttention and Prefix Reuse
  9. Hierarchical Caching
  10. Attention Backends
  11. MLA, MHA, Linear Attention, and Hybrid Models
  12. ModelRunner and Forward Batches
  13. Model Architecture Dispatch and Loader Boundaries
  14. Sampling and Logits Processing
  15. Structured Outputs
  16. Reasoning and Tool-Call Parsing
  17. Speculative Decoding
  18. Diffusion Language Models and Blockwise Decoding

Volume II

Volume II Preliminaries
  1. Quantized Serving Kernels and Dispatch
  2. LoRA as Runtime Low-Rank Updates
  3. Mixture-of-Experts
  4. Parallelism Taxonomy
  5. Collectives and Communication Kernels
  6. Prefill/Decode Disaggregation
  7. Routing and Load Balancing
  8. Kernel Design in SGLang
  9. Attention and GEMM Kernels
  10. CUDA Graphs, Piecewise Graphs, and Compilation
  11. Hardware Backends
  12. Multimodal Transformer Serving
  13. Diffusion Inference Runtime
  14. Diffusion Acceleration
  15. Benchmarking Methodology
  16. Correctness Testing for Systems Algorithms
  17. Extending SGLang Technically