Favicon of SGLang

SGLang

SGLang is an open-source serving framework for LLMs and multimodal models with RadixAttention, quantization, and broad hardware support.

SGLang website screenshot
SGLang GitHub repository preview

SGLang is a serving framework for large language models and multimodal models, built for low-latency and high-throughput inference. It targets teams and researchers who need to run open-weight LLMs, embedding models, reward models, or diffusion models in production, from a single GPU box up to large distributed clusters. It's used both as a standalone inference server and as the rollout backend for reinforcement learning and post-training pipelines.

Key features

  • RadixAttention: prefix caching that reuses shared KV cache across requests to cut redundant computation.
  • Zero-overhead scheduler: a CPU scheduler designed to minimize scheduling overhead in the request pipeline.
  • Prefill-decode disaggregation: separates prefill and decode phases for better resource utilization at scale.
  • Speculative decoding: includes newer approaches (DFlash, Spec V2) to speed up generation.
  • Continuous batching and paged attention: standard techniques for maximizing GPU utilization under variable request loads.
  • Parallelism options: tensor, pipeline, expert, and data parallelism for scaling across multiple GPUs and nodes.
  • Quantization support: FP4, FP8, INT4, AWQ, and GPTQ for reduced memory footprint and faster inference.
  • Multi-LoRA batching: serve multiple LoRA adapters in the same batch.
  • Structured outputs: constrained decoding for JSON and other structured formats, backed by a compressed finite state machine.
  • Broad model support: Llama, Qwen, DeepSeek, Kimi, GLM, GPT, Gemma, Mistral, embedding models (e5-mistral, gte, mcdse), reward models (Skywork), and diffusion models (WAN, Qwen-Image), with OpenAI API compatibility.
  • Hardware coverage: NVIDIA GPUs (GB200/B300/H100/A100/5090), AMD GPUs (MI355/MI300), Intel Xeon CPUs, Google TPUs, and Ascend NPUs.

Ideal use cases

SGLang fits teams deploying open-weight LLMs or multimodal models in production and needing to squeeze out throughput and latency, particularly at scale (multi-GPU or multi-node clusters, mixture-of-experts models like DeepSeek). It's a solid choice if you need day-0 support for newly released open models, structured/JSON output guarantees, or an RL rollout backend, since it's already used by frameworks like verl, slime, and AReaL for post-training.

It also works well if you need to run on non-standard hardware, such as AMD GPUs, TPUs, or Ascend NPUs, without switching serving stacks.

It is less of a fit if you just want to prototype with a hosted API and don't need self-hosted inference, or if your workload is a single small model on a single consumer GPU where a simpler runtime (like plain Hugging Face transformers or llama.cpp) would be easier to set up. Teams without GPU infrastructure or without the operational capacity to manage a serving cluster may find the setup more than they need.

Installation

SGLang is distributed as a Python package and installable via pip. Full details, including hardware-specific instructions, are in the official docs:

pip install sglang

After installing, you can launch a server and send requests through an OpenAI-compatible API. Consult these guides for the full flow:

Because hardware and driver requirements vary significantly (CUDA versions, ROCm, TPU runtime, etc.), the install docs are the authoritative source for exact commands per platform.

Frequently asked questions

Share:

Stars
37.2K
Forks
9.6K
Last commit
13 hours ago
Repository age
3 years
License
Apache-2.0
Self-hosted
No
Activity score
86/100
View Repository
Ad
Favicon

 

  
 

Similar to SGLang

Favicon

 

  
 
Favicon

 

  
 
Favicon