分支标签打开更多操作菜单

最新提交

 

历史

20,472 次提交20,472 次提交

文件夹和文件

名称名称最后提交信息最后提交日期
.agents/skills.agents/skills  
.claude.claude  
.devcontainer.devcontainer  
.github.github  
3rdparty/amd3rdparty/amd  
assetsassets  
benchmarkbenchmark  
dockerdocker  
docsdocs  
examplesexamples  
experimental/sgl-routerexperimental/sgl-router  
protoproto  
pythonpython  
rustrust  
scriptsscripts  
sgl-model-gatewaysgl-model-gateway  
testtest  
tools/sglang-simulatortools/sglang-simulator  
.codespellrc.codespellrc  
.coveragerc.coveragerc  
.dockerignore.dockerignore  
.git-blame-ignore-revs.git-blame-ignore-revs  
.gitignore.gitignore  
.isort.cfg.isort.cfg  
.pre-commit-config.yaml.pre-commit-config.yaml  
CODE_OF_CONDUCT.mdCODE_OF_CONDUCT.md  
LICENSELICENSE  
README.mdREADME.md  

仓库文件导航

SGLang:面向大语言模型和多模态模型的快速推理

PyPI version License: Apache 2.0 PyPI downloads per month

文档 | 示例手册 | 网站 | 博客 | Slack

SGLang 是一个面向大语言模型、视觉语言模型和扩散模型的开源推理框架,针对智能体负载、大规模服务和强化学习 rollout 进行了优化。 SGLang Diffusion 是其内置的图像和视频生成引擎,包含在本仓库和 sglang Python 包中。

👋 从下方开始,或在 SGLang 活动, 包括聚会、开发者会议、研讨会和办公时间,与社区见面。

SGLang 峰会 2026:与开放 AI 的构建者见面
我们的旗舰年度盛会 · 11 月 12–13 日 · 旧金山

通过技术演讲、现场演示和动手研讨会,深入探讨推理、训练和 AI 硬件。带上您的部署挑战,与构建该技术栈的工程师和研究人员见面。

开始使用

拉取 Docker 镜像,其中包含 SGLang 及其依赖项:

docker pull lmsysorg/sglang:latest

或者,使用 uv 在已激活的 Python 环境中安装 SGLang:

uv pip install --prerelease=allow sglang

接下来,启动您的模型:

  • 快速入门: 运行您的第一个模型并发送请求。
  • 示例手册: 选择您的模型和硬件,获取可直接运行的启动命令。

支持的硬件

SGLang 支持多种 GPU、TPU、NPU、CPU 和 Apple Silicon 平台。

平台 代表性硬件
NVIDIA B200/B300/GB200/GB300;H100/H200/H800/H20;A100;RTX 30/40/50 系列、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 系列 GPU、Xeon CPU
Apple Silicon 通过 Metal / MLX 的 Mac
华为昇腾 A2、A3、950PR/DT NPU
摩尔线程 MTT S5000 GPU

集成进行中:AWS Trainium、 阿里巴巴平头哥 PPU, 寒武纪 MLU, 高通 QAIC、沐曦、海光 HCU/DCU、天数智芯等。

SGLang-TorchTPU 通过 PyTorch、torch_tpu 和 Pallas 内核将 SGLang 服务引擎引入 Google TPU。它支持在 TPU7x(Ironwood)上进行大语言模型和视觉语言模型服务,包括跨主机的张量并行和专家并行。SGL-JAX 提供基于 JAX 的 TPU 服务路径。

请参阅 示例手册 和各平台指南,了解模型兼容性和设置。

SGL 生态

领域 项目 用途
扩散 SGLang Diffusion 内置于 SGLang,用于使用扩散模型进行图像和视频生成。
音频 SGLang Omni 用于文本转语音(TTS)和自动语音识别(ASR)的音频模型服务。
投机解码 SpecForge 训练用于投机解码的草稿模型,并使用 SGLang 部署它们。
强化学习与后训练 Miles, slime, AReaL, Tunix, verl 集成 SGLang 以进行 rollout 生成的训练框架。
部署与编排 SMG, RBG, llm-d, Ray Serve, NVIDIA Dynamo 通过路由、负载均衡和集群编排来部署和扩展 SGLang 推理服务。
教育 Mini-SGLang, zero-to-sglang, DeepLearning.AI 课程 通过代码和动手课程学习推理引擎设计以及高效的文本和图像生成。

开发与贡献

欢迎贡献,包括缺陷修复、文档、模型支持和性能改进。

开发环境设置

从 lmsysorg/sglang:dev Docker 镜像开始,它提供开发工具和大多数依赖项。在容器内克隆或挂载你的 SGLang 检出,然后从仓库根目录以可编辑模式安装它,以便测试使用你本地的 Python 更改:

pip install -e "python"

在已激活的虚拟环境中,你可以使用 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.

  • Community discussions: Join Slack for technical questions and development discussions.
  • Events: Find meetups, workshops, and office hours on SGLang Events.
  • Updates: Follow X and LinkedIn for project updates, and the LMSYS Blog for release announcements and technical articles.
  • Project resources: Explore the documentation, Cookbook, roadmap, release notes, issue tracker, and contributor guide.
  • Contact Us: For enterprise adoption and deployment, technical consulting, sponsorship, or partnership inquiries, please contact sglang@lmsys.org.
  • Contributor sponsorship: Long-term active SGLang contributors are eligible for coding agent sponsorship, including Cursor, Claude Code, or OpenAI Codex. To apply, email sglang@lmsys.org with links to your key commits or pull requests.

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.

About

No description, website, or topics provided.

Resources

ReadmeApache-2.0 license

Code of conduct

Code of conduct

Contributing

ContributingActivityCustom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forksReport repository

Releases

Packages

Used by

Contributors

Languages