sgl-project/mini-sglang
Compact SGLang engine for studying and self-hosting GPU LLM inference
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
Mini-SGLang is a compact SGLang implementation of roughly 5,000 lines of Python. The python -m minisgl entrypoint supports both an OpenAI-compatible API server and a terminal chat shell. The execution design combines prefix KV lookup and reuse through Radix Cache, chunked prompt prefill, and overlap between CPU scheduling and GPU work. Tensor parallelism distributes model execution across GPUs when enabled.
The minisgl package depends on PyTorch <2.10.0 and Transformers >=4.56.0,<=4.57.3, and integrates FlashAttention and FlashInfer. The Python layer makes the scheduling and caching logic easier to inspect, but GPU execution still depends on native CUDA kernels. The OpenAI-compatible API is the client integration boundary; compatibility should be tested against the calls an application actually makes.
Key Capabilities & Differentiators
The examples cover Qwen3-0.6B on one GPU and Llama-3.1-70B-Instruct with --tp 4. Radix Cache targets traffic with repeated prefixes, while chunked prefill lowers peak memory pressure from processing long prompts without removing the need to hold active KV state. The interactive shell supports /reset, and --model-source modelscope provides an alternate download path when Hugging Face is hard to reach.
The offline benchmark runs 256 sequences on one H200 with Qwen3-0.6B and Qwen3-14B, sampling input and output lengths between 100 and 1,024 tokens. The online benchmark replays the first 1,000 Qwen trace requests against Qwen3-32B on four NVLink-connected H200s. That comparison uses --cache naive for Mini-SGLang and --disable-radix for SGLang, so it is not a test of the benefit of radix prefix reuse. The configurations establish test scope, not performance on other hardware or traffic.
Trade-offs & Limitations
Mini-SGLang is a better fit than full SGLang when the goal is to trace or modify scheduling, prefill, and cache code. It is not a drop-in substitute just because both expose similar serving concepts. Evaluate full SGLang when broader serving functionality matters, and verify API coverage and behavior under load before selecting either engine. The benchmark configurations are useful starting points, but they do not establish production readiness or a general throughput or latency advantage.
Compared with the OpenAI API, self-hosting gives you control over model selection and where inference runs, but shifts GPU capacity planning, driver compatibility, and service operations to your team. VRAM depends on weights and active KV state, so size against realistic context lengths and concurrency. Tensor parallelism adds inter-GPU communication, making topology relevant. The engine is MIT-licensed; model weights and third-party dependencies have separate terms.
Hardware & Deployment Guide
Use Linux on x86_64 or aarch64 with an NVIDIA GPU, Python 3.10 or newer, and a CUDA Toolkit compatible with the NVIDIA driver for JIT-compiled kernels. Source installation uses uv pip install -e . inside a virtual environment; python -m minisgl --model Qwen/Qwen3-0.6B starts the server, and --shell switches to local terminal interaction. Windows users can use WSL2 with CUDA GPU support; native Windows and macOS are not supported.
The Dockerfile defaults to CUDA 12.8.1, Ubuntu 24.04, and Python 3.12. Build with docker build -t minisgl ., run with NVIDIA Container Toolkit and --gpus all, and publish 1919:1919 for the example that binds to 0.0.0.0. Mount /app/.cache/huggingface, /app/.cache/tvm-ffi, and /app/.cache/flashinfer to retain caches between runs. Package metadata marks version 0.1.0 as alpha, with no published GitHub release listed; pin a tested commit and record the working driver and dependency versions.
minisgl CLI exposes OpenAI-compatible serving and interactive --shell mode.--cache naive provides a comparison configuration.--tp selects tensor parallelism across GPUs, with FlashAttention and FlashInfer integrated as optimized kernels.MINISGL_DISABLE_OVERLAP_SCHEDULING=1 supports an offline scheduling ablation.CUDA-equipped teams studying serving internals, testing scheduling and KV-cache changes, or prototyping a self-hosted API with Qwen or Llama models.
You need native macOS or Windows support, have no NVIDIA CUDA environment, or require a managed or production-ready service without owning compatibility and load testing.
Quick Start & Installation
# Create a virtual environment (Python 3.10+ recommended) uv venv --python=3.12 source .venv/bin/activate
Comparison vs. Top LLMs & Inference Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| mini-sglang ★ | 5.7k | +47 | Python | MIT | Compact SGLang engine for studying and self-hosting GPU LLM inference |
| OmniRoute | 92.2k | +1.4k | TypeScript | MIT | Self-hosted OpenAI-compatible gateway for multi-provider routing and fallback |
| ollama | 189.1k | +741 | Go | MIT | Go-based LLM serving layer for local model management and inference |
| nano-vllm | 16.7k | +95 | Python | MIT | A compact vLLM-style Python engine for offline GPU batch inference |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/sgl-project/mini-sglang.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about mini-sglang
How do I connect an existing OpenAI-compatible client?
python -m minisgl --model Qwen/Qwen3-0.6B on a supported CUDA host, then point your OpenAI-compatible client at the local server. Verify the endpoints and request options your client uses before switching: API compatibility does not imply access to OpenAI-hosted models or full feature parity. For terminal-only testing, add --shell.What GPU and VRAM budget should I plan for?
Can we use Mini-SGLang in a commercial self-hosted service?
When should I choose Mini-SGLang over full SGLang or the OpenAI API?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy