sglang README

项目的 README,来自 github.com/sgl-project/sglang。合并为一个 markdown 文件:README.md。

SGLang: Fast inference for LLMs and multimodal models

SGLang

PyPI version License: Apache 2.0 PyPI downloads per month

Docs | Cookbook | Website | Blog | Slack

SGLang is an open-source inference framework for large language, vision-language, and diffusion models, optimized for agentic workloads, large-scale serving, and RL rollouts. SGLang Diffusion is its built-in engine for image, video, audio, and action generation, included in this repository and the sglang Python package.

👋 Get started below, or meet the community at SGLang Events, including meetups, developer meetings, workshops, and office hours.

SGLang Summit 2026: Meet the builders of open AI
Our flagship annual gathering · November 12–13 · San Francisco

Go deep on inference, training, and AI hardware through technical talks, live demos, and hands-on workshops. Bring your deployment challenges and meet the engineers and researchers building the stack.

Get Started

Pull the Docker image, which includes SGLang and its dependencies:

docker pull lmsysorg/sglang:latest

Alternatively, install SGLang in an activated Python environment with uv:

uv pip install --prerelease=allow sglang

Next, launch your model:

Supported Hardware

SGLang supports a wide range of GPUs, TPUs, NPUs, CPUs, and Apple Silicon platforms.

Platform Representative hardware
NVIDIA B200/B300/GB200/GB300; H100/H200/H800/H20; A100; RTX 30/40/50 series, RTX 6000 Ada / PRO 6000; DGX Spark, Jetson Orin
AMD Instinct MI300X, MI325X, MI350X, MI355X
Google TPU v6e, v7; SGLang-TorchTPU / SGL-JAX
Intel (GPU / CPU) Arc / Arc Pro B-Series GPUs, Xeon CPUs
Apple Silicon Macs via Metal / MLX
Huawei Ascend A2, A3, 950PR/DT NPUs
Moore Threads MTT S5000 GPUs

Integrations in progress: AWS Trainium, Alibaba T-Head PPU, Cambricon MLU, Qualcomm QAIC, MetaX, Hygon HCU/DCU, Iluvatar CoreX, and more.

SGLang-TorchTPU brings the SGLang serving engine to Google TPUs through PyTorch, torch_tpu, and Pallas kernels. It supports LLM and vision-language serving on TPU7x (Ironwood), including tensor and expert parallelism across hosts. SGL-JAX provides the JAX-based TPU serving path.

See the Cookbook and platform guides for model compatibility and setup.

SGL Ecosystem

Area Projects Purpose
Diffusion SGLang Diffusion Built into SGLang for image, video, audio, and action generation.
Audio SGLang Omni Audio model serving for text-to-speech (TTS) and automatic speech recognition (ASR).
Speculative Decoding SpecForge Train draft models for speculative decoding and deploy them with SGLang.
RL and Post-Training Miles, slime, AReaL, Tunix, verl Training frameworks that integrate SGLang for rollout generation.
Deployment and Orchestration RBG, llm-d, Ray Serve, NVIDIA Dynamo Deploy and scale SGLang inference services with routing, load balancing, and cluster orchestration.
Education Mini-SGLang, zero-to-sglang, DeepLearning.AI course Learn inference engine design and efficient text and image generation through code and hands-on courses.

Development and Contributing

Contributions are welcome, from bug fixes and documentation to model support and performance improvements.

Development setup

Start from the lmsysorg/sglang:dev Docker image, which provides development tools and most dependencies. Clone or mount your SGLang checkout inside the container, then install it in editable mode from the repository root so tests use your local Python changes:

pip install -e "python"

In an activated virtual environment, you can use uv pip install --prerelease=allow -e "python" instead. See the development guide for container setup and testing.

Contribute

  1. Fork the repository and create a branch for your changes. For larger changes, discuss your proposal in a GitHub issue or on Slack.
  2. Make your changes, run the relevant tests, and add regression coverage for fixes or new behavior. Run pre-commit run --all-files before submitting.
  3. Open a pull request describing the change and how you tested it. Include benchmarks or accuracy evaluations when relevant.

See the contributor guide for formatting, testing, and pull request instructions. Documentation contributors can start with the docs guide.

Community and Sponsorship

SGLang is hosted by LMSYS, a non-profit open-source organization.

Trusted by Industry and Research

SGLang serves production workloads across AI labs, cloud platforms, enterprises, and universities.

Organizations adopting SGLang

Acknowledgment

We learned the design and reused code from the following projects: Guidance, vLLM, LightLLM, FlashInfer, Outlines, and LMQL.

sglang (sgl-project/sglang)

正在搜索数据库…

39.3K ·GitHub
这是什么?SGLang 是一个高性能的推理服务框架,面向大语言模型和多模态模型,目标是在从单张 GPU 到大型分布式集群的各种规模下,都能提供低延迟、高吞吐的推理服务。
这是一个模型,还是运行模型的引擎?它是一个服务框架/运行时(推理引擎),用于部署已有模型以对外提供服务,本身不是模型。它兼容大多数 Hugging Face 模型以及 OpenAI 风格的 API。
我该怎么把它跑起来?请按照 README 中的“Install SGLang”和“Quick Start”指南,安装软件包,并为你选择的模型启动服务。
运行它需要什么硬件?你需要受支持的加速器。SGLang 可以运行在 NVIDIA GPU(GB200/B300/H100/A100/Spark/5090)、AMD GPU(MI355/MI300)、Intel Xeon CPU、Google TPU 或昇腾 NPU 上。
它是给笔记本用的,还是给生产级部署用的?它是为正式的大规模服务负载设计的:已在生产环境中使用,每天生成数万亿个 token,并且可以从单张 GPU 扩展到大型多 GPU 集群,支持解耦的 prefill/decode 和专家并行。想要充分发挥它的性能,通常需要真正的 GPU 基础设施。
谁在生产环境中真正使用 SGLang?它已被多家主流 AI 实验室、云服务商和研究机构采用,包括 xAI、NVIDIA、AMD、Microsoft Azure、AWS、LinkedIn、Cursor、Google Cloud、MIT、Stanford、阿里巴巴和腾讯。它也被用作 RL/后训练框架的 rollout 后端。
和其他 LLM 服务器相比,SGLang 快在哪里?其核心的 RadixAttention 机制可实现高效的前缀缓存,并结合零开销的 CPU 调度器、prefill-decode 解耦、投机解码、连续批处理、分页注意力以及多层并行(张量/流水线/专家/数据并行)。
我可以用它部署哪些模型?它支持多种语言模型(Llama、Qwen、DeepSeek、Kimi、GLM、GPT、Gemma、Mistral)、嵌入模型和奖励模型,以及 WAN、Qwen-Image 等扩散模型,并且可以方便地扩展到新模型。
SGLang 除了推理服务之外还能做别的吗?可以。它还被用作经过验证的强化学习和后训练 rollout 后端,并已与 AReaL、Miles、slime、Tunix 和 verl 等框架完成原生集成。
大小
566.5 MB
星标
39.3K
时长
2年
提交 · 90 天