# AI use cases for Zero to Sglang (datawhalechina/zero-to-sglang)

Repo: [datawhalechina/zero-to-sglang](https://github.com/datawhalechina/zero-to-sglang) | Use cases: 5 | Page: https://dedupedai.com/use-cases/datawhalechina-zero-to-sglang/

A free, open course from Datawhale and RadixArk that teaches LLM inference by building a mini-sglang from scratch and then reading the real SGLang source.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Learn LLM inference concepts without a GPU: https://dedupedai.com/use-cases/datawhalechina-zero-to-sglang/learn-llm-inference-concepts-without-gpu/
- Build a mini inference engine step by step: https://dedupedai.com/use-cases/datawhalechina-zero-to-sglang/build-mini-sglang-from-scratch/
- Run Qwen3-0.6B on SGLang on your own GPU: https://dedupedai.com/use-cases/datawhalechina-zero-to-sglang/deploy-first-sglang-server-on-own-gpu/
- Map RadixAttention from the course to SGLang source: https://dedupedai.com/use-cases/datawhalechina-zero-to-sglang/trace-radixattention-from-course-to-real-source/
- Share a mini-sglang build log with the community: https://dedupedai.com/use-cases/datawhalechina-zero-to-sglang/write-community-build-log-for-course/

## How to learn LLM inference concepts without a GPU with Zero to Sglang

Repo: [datawhalechina/zero-to-sglang](https://github.com/datawhalechina/zero-to-sglang) | Difficulty: Beginner | Time: 60 minutes | Basis: From the README

Read Part I to understand KV Cache, prefill vs. decode, and the benchmark metrics before touching code.

**Who it is for:** A developer or analyst new to LLM serving who needs a conceptual foundation before working with inference engines and has no GPU available.

**The problem:** Most inference material either stays abstract or drops you into engine source code without context.

**The outcome:** A working mental model of inference bottlenecks, KV Cache, and how to read TTFT, TPOT, ITL, and Goodput.

### Steps

1. `git clone https://github.com/datawhalechina/zero-to-sglang.git`
2. `cd zero-to-sglang`
3. Open course-material/eng/part1/Chapter1_Introduction_to_LLM.md and read it.
4. Read the Introduction to Inference chapter and the KV Cache chapter in Part I, which cover prefill/decode, compute-bound vs. memory-bound, and the Roofline model.
5. Read course-material/eng/part1/Chapter5_Introduction_to_Benchmark.md to learn TTFT, TPOT, ITL, Goodput, and tail latency.

### Prompt to paste into your agent

```text
Clone https://github.com/datawhalechina/zero-to-sglang and read the Part I chapters in course-material/eng/part1/. Write a one-page summary of how KV Cache reduces repeated attention work and list the four benchmark metrics with a one-line definition each. Verify that every definition matches the chapter text.
```

### Caveat

Part I is complete in English, but the Introduction to Inference and KV Cache chapter links in the README syllabus are blank, so find them by filename under course-material/eng/part1/.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/datawhalechina-zero-to-sglang/learn-llm-inference-concepts-without-gpu/

## How to build a mini inference engine step by step with Zero to Sglang

Repo: [datawhalechina/zero-to-sglang](https://github.com/datawhalechina/zero-to-sglang) | Difficulty: Advanced | Time: 8 hours | Basis: From the README

Follow Part II to add forward pass, KV Cache, HTTP serving, paging, and RadixAttention to a mini-sglang.

**Who it is for:** An engineer who wants to understand inference engine internals by writing one, usually over several weeks alongside the course.

**The problem:** Reading a production engine like SGLang first is hard without knowing which parts do what.

**The outcome:** A self-built mini-sglang with forward pass, KV Cache, concurrent HTTP requests, Paged KV Cache, and RadixAttention, plus an understanding of the real engine's structure.

### Steps

1. `git clone https://github.com/datawhalechina/zero-to-sglang.git`
2. `cd zero-to-sglang`
3. Read course-material/eng/part2/Chapter1_mini-sglang-What-an-Inference-Engine-Looks-Like.md for the architecture overview.
4. Work through Chapter 3 (forward pass and generation) and Chapter 4 (KV Cache) using their concept files and Code Walkthrough files.
5. Implement Chapter 5 (HTTP and concurrent requests), then Chapter 7 (Paged KV Cache) and Chapter 8 (RadixAttention), checking each step against the code walkthrough.
6. Install dependencies as each chapter requires, then compare your result with the reference implementation at https://github.com/sgl-project/mini-sglang. (inferred, check the README)

### Prompt to paste into your agent

```text
Use the repo https://github.com/datawhalechina/zero-to-sglang and implement Chapter 4 (KV Cache) of Part II in <target-directory>. Expected output: a generation loop that reuses cached keys and values for a short prompt. Verify that the output tokens match a run without the cache for the same prompt.
```

### Caveat

Chapters 6 (Continuous Batching) and 10 (Speculative Decoding) are still planned, so the build path has gaps that you must fill yourself.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/datawhalechina-zero-to-sglang/build-mini-sglang-from-scratch/

## How to run Qwen3-0.6B on SGLang on your own GPU with Zero to Sglang

Repo: [datawhalechina/zero-to-sglang](https://github.com/datawhalechina/zero-to-sglang) | Difficulty: Intermediate | Time: 90 minutes | Basis: From the README

Follow Part 0.2 to set up the environment and serve a small Qwen3 model with SGLang.

**Who it is for:** A developer with access to an NVIDIA GPU, local or cloud, who wants a first working SGLang server before studying internals.

**The problem:** Setting up an inference server for the first time has many environment pitfalls and unclear steps.

**The outcome:** A running SGLang server serving Qwen3-0.6B that you can send a test request to.

### Steps

1. `git clone https://github.com/datawhalechina/zero-to-sglang.git`
2. `cd zero-to-sglang`
3. Open course-material/eng/part0/Part0-Deploy-Your-First-SGLang-Server.md and follow its environment setup section.
4. Install SGLang in your Python environment as the Part 0.2 chapter describes. (inferred, check the README)
5. Launch Qwen3-0.6B with SGLang as the chapter shows, then send one test request to the running server.

### Prompt to paste into your agent

```text
Clone https://github.com/datawhalechina/zero-to-sglang and follow course-material/eng/part0/Part0-Deploy-Your-First-SGLang-Server.md on the host <gpu-host>. Expected output: an SGLang server running Qwen3-0.6B that returns a completion. Verify the server responds to a single test prompt before reporting success.
```

### Caveat

The README does not list the exact install or launch commands, so you must take them from the Part 0.2 chapter file rather than from the README.

Risk, remote script: Install commands and model downloads from the chapter and any inferred install step run code from external sources, so review them before executing on a shared machine.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/datawhalechina-zero-to-sglang/deploy-first-sglang-server-on-own-gpu/

## How to map RadixAttention from the course to SGLang source with Zero to Sglang

Repo: [datawhalechina/zero-to-sglang](https://github.com/datawhalechina/zero-to-sglang) | Difficulty: Advanced | Time: 3 hours | Basis: From the README

Compare the Chapter 8 prefix caching walkthrough with Part III caching chapters and the real SGLang code.

**Who it is for:** An engineer optimizing repeated-prompt workloads, such as shared system prompts, who wants to know how prefix caching is implemented in SGLang.

**The problem:** Prefix caching is easy to misunderstand when only the high-level idea is known.

**The outcome:** A clear mapping from your mini-sglang RadixAttention code to the real SGLang implementation, plus an understanding of hierarchical cache tiers.

### Steps

1. `git clone https://github.com/datawhalechina/zero-to-sglang.git`
2. `cd zero-to-sglang`
3. Read course-material/eng/part2/Chapter8_RadixAttention-and-Prefix-Caching.md and its Code Walkthrough file.
4. Read course-material/eng/part3/Chapter3_Hierarchical-Caching.md for L1/L2/L3 cache tiers and prefix matching.
5. Clone https://github.com/sgl-project/sglang and locate the RadixAttention and cache code paths referenced in the chapters. (inferred, check the README)

### Prompt to paste into your agent

```text
Using https://github.com/datawhalechina/zero-to-sglang, read the RadixAttention chapter and the Hierarchical Caching chapter, then find the matching functions in a local clone of https://github.com/sgl-project/sglang at <path>. Expected output: a table of course concept to source location. Verify each file path exists in the clone before listing it.
```

### Caveat

Part III chapters 2, 4, and 5 are still planned, so this mapping covers attention backends and hierarchical caching only.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/datawhalechina-zero-to-sglang/trace-radixattention-from-course-to-real-source/

## How to share a mini-sglang build log with the community with Zero to Sglang

Repo: [datawhalechina/zero-to-sglang](https://github.com/datawhalechina/zero-to-sglang) | Difficulty: Intermediate | Time: 60 minutes | Basis: From the README

Write down the bugs you hit while following Part II and submit them under community/eng/.

**Who it is for:** A learner who finished some Part II chapters and wants to help future readers avoid the same pitfalls.

**The problem:** Build pitfalls and unclear doc spots are often lost, leaving the next learner stuck on the same issue.

**The outcome:** A community note in community/eng/ and a pull request that follows the repo's PR requirements.

### Steps

1. `git clone https://github.com/datawhalechina/zero-to-sglang.git`
2. `cd zero-to-sglang`
3. Read the PR requirements at community/eng/ and the Contributing section of the README.
4. Write your build log or pitfall notes in community/eng/ as a Markdown file.
5. Fork the repository, create a branch from main, commit the note, and open a pull request.

### Prompt to paste into your agent

```text
Clone https://github.com/datawhalechina/zero-to-sglang and read the PR requirements in community/eng/. Draft a build-log file in community/eng/ for <chapter-name> that lists each bug, its cause, and the fix. Verify that the file follows the PR requirements before opening the pull request.
```

### Caveat

The README points to community/eng/PR requirements but the exact file name is cut off in the excerpt, so open the community/eng/ directory to find the current guideline.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/datawhalechina-zero-to-sglang/write-community-build-log-for-course/
