AIAny
AI Deploy2025
Icon for item

Mini-SGLang

A ~5,000-line Python LLM inference engine that re-implements SGLang's serving optimizations — radix KV-cache reuse, chunked prefill, overlap scheduling, tensor parallelism — as a fully type-annotated reference instead of a black box.

Introduction

Production LLM serving engines like vLLM and the full SGLang have grown into tens of thousands of lines, and their cleverest optimizations sit buried under layers of dispatch logic. Mini-SGLang takes the opposite bet: strip the same engine down to ~5,000 readable, fully type-annotated lines so you can actually trace how a request turns into tokens — without giving up state-of-the-art throughput.

What Sets It Apart
  • It keeps the optimizations that matter, not a toy subset: radix-tree KV-cache reuse across shared prefixes, chunked prefill to cap peak memory on long contexts, overlap scheduling that hides CPU work behind GPU compute, and tensor parallelism for multi-GPU. These are the four things that separate a real serving engine from a for-loop over model.generate().
  • It wires in FlashAttention and FlashInfer kernels rather than reimplementing attention, so "mini" applies to the scheduler and runtime, not to the math.
  • Because it derives directly from the SGLang codebase, the abstractions you learn here map onto the production system — it doubles as a reading guide for SGLang, not just a standalone engine.
Who It's For

Great fit if you're a systems researcher, a student, or an engineer who wants to understand modern inference internals — KV caching, scheduling, parallelism — by reading code that fits in your head, or who needs a hackable base for prototyping serving ideas. Look elsewhere if you need a battle-tested deployment with broad model coverage and a mature ecosystem; for that, run full SGLang or vLLM. It's Linux-only (x86_64/aarch64), with macOS and Windows reached through WSL2 or Docker.

Information

  • Websitegithub.com
  • OrganizationsLMSYS Org
  • Authorssgl-project
  • Published date2025/09/01

More Items

GitHub
AI Infra2025

Defines a vendor-neutral JSON/YAML semantic model specification and tooling to exchange metrics, dimensions, lineage and other business semantics across analytics, AI and BI platforms; includes a core spec, validators, converters (dbt, GoodData, Salesforce) and example models.

GitHub
AI Deploy2018

Serves machine learning and deep learning models for cloud, data center, edge and embedded environments. Supports multiple frameworks and backends, dynamic and sequence batching, HTTP/gRPC APIs, Docker deployment and NVIDIA-optimized runtimes.

GitHub
AI Train2025

An asynchronous, high-throughput framework for large-scale reinforcement learning and agentic training that scales to 1T+ MoE models and 1000+ GPUs, with native verifiers integration, end-to-end SFT/RL/evals, and Slurm/Kubernetes deployment; requires NVIDIA GPUs.