# zero-to-sglang

A hands-on course that teaches LLM inference engine internals by building a minimal SGLang implementation from scratch and then reading the real SGLang source.

zero-to-sglang is a course on LLM inference that starts from the core questions of why a KV cache exists, how prefill differs from decode, and what compute-bound and memory-bound mean, then walks through building a mini version of SGLang by hand: a forward pass, generation, KV cache, HTTP serving, continuous batching, paged KV cache and RadixAttention, added one at a time.

The final part of the course returns to the real SGLang project and explains how its production optimizations are actually implemented, covering quantization, hierarchical caching, DP Attention, expert and pipeline parallelism, and prefill-decode disaggregation, before walking through profiling, trace analysis and how to land a first pull request against SGLang.

The course is jointly produced by Datawhale and RadixArk, the company founded by the SGLang team, and is available in both English and Chinese, with some later chapters still under development.

Website: https://datawhalechina.github.io/zero-to-sglang/
