← all repositories
datawhalechina/zero-to-sglang

An SGLang Course That Makes You Write the Engine First

A tutorial that bridges the gap between inference theory and production code by making you build a working mini-sglang first.

682 stars Python LearningInference · Serving
zero-to-sglang
Collecting fresh signals — velocity needs a few days of history.
collecting data…
star history

What it does

This is a structured course—backed by the SGLang team’s own company, RadixArk—for developers who want to move past API calls and understand high-performance LLM inference. It starts with conceptual foundations like KV Cache, prefill/decode phases, and roofline models, then walks through building a mini-sglang piece by piece, and finally maps those concepts onto the actual SGLang codebase and its advanced optimizations.

The interesting bit

Most framework tutorials either stay at the API level or throw you into a mature codebase with no map. This one forces you to implement the abstractions yourself—starting from roughly 200 lines—so that by the time you meet the real RadixAttention or speculative decoding, you have already built a naive version with your own hands.

Key highlights

  • Co-created by Datawhale and RadixArk (the SGLang team’s company), with advanced chapters written by core maintainers.
  • Part I covers theory without requiring a GPU or even writing code.
  • Part II is a from-scratch build: forward pass, generation loop, KV Cache, HTTP server, scheduler, Paged KV Cache, and RadixAttention.
  • Part III dives into real SGLang internals: FlashInfer/FA3 backends, quantization, hierarchical caching, DP Attention/EP/PP, and prefill-decode disaggregation.
  • Closes with profiling, trace analysis, and a walkthrough of submitting a PR to the official SGLang repository.

Caveats

  • Most of the course is still under construction: Part II through Part IV are largely marked as 🚧 or 📝, with only Part 0 and most of Part I currently available.
  • The English translation is just getting started; the primary material is in Chinese.

Verdict

Worth bookmarking if you are a Python-savvy developer who wants to understand what an inference engine actually does under the hood. Skip it if you need a fully finished course today or are looking for a drop-in library rather than educational material.

Frequently asked

What is datawhalechina/zero-to-sglang?
A tutorial that bridges the gap between inference theory and production code by making you build a working mini-sglang first.
Is zero-to-sglang open source?
Yes — datawhalechina/zero-to-sglang is an open-source project tracked on heatdrop.
What language is zero-to-sglang written in?
datawhalechina/zero-to-sglang is primarily written in Python.
How popular is zero-to-sglang?
datawhalechina/zero-to-sglang has 682 stars on GitHub.
Where can I find zero-to-sglang?
datawhalechina/zero-to-sglang is on GitHub at https://github.com/datawhalechina/zero-to-sglang.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.