← Back to Leaderboard
Ssgl-project

sgl-project/sglang-torchtpu

A PyTorch-native SGLang plugin for self-hosted LLM inference on Google TPUs

View on GitHub ↗
Engineering Health (Methodology)
A+ · 89/100
Maintenance Activity
● Updated today
Latest Release
tpu-v0.1.0
Commercial License Check
Apache-2.0 · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption17/25
Release Cadence17/20
License Clarity20/20
DockerSelf-HostedAPI
Total Stars
★ 98
24h Growth
+0
7d Growth
+9
Forks
69

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

sgl-project/sglang-torchtpu Star History (2026-05-19 - 2026-12-03) ALL-TIME STAR HISTORY (2026-05 – 2026-12) +97 in 198d · avg +0/day 104 52 0 2026-05-19: ★ 12026-06-06: ★ 12026-06-20: ★ 22026-07-04: ★ 32026-07-18: ★ 32026-08-01: ★ 32026-08-15: ★ 32026-08-29: ★ 52026-09-12: ★ 72026-09-26: ★ 82026-10-10: ★ 102026-10-24: ★ 652026-11-05: ★ 742026-11-17: ★ 852026-12-03: ★ 98 ★ 98 2026-05 2026-08 2026-12

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

SGLang-TorchTPU pairs the SGLang engine in python/ with sglang-tpu, an out-of-tree plugin backed by torch_tpu. Applications enter through the SGLang serving API, including /v1/chat/completions; the TPU backend handles execution on the accelerator through PyTorch, with torch.compile and direct compilation available. TPU kernels, memory management, and backend integrations live in sglang_tpu/.

The plugin declares a dependency on sglang and registers tpu_oot = sglang_tpu:activate in sglang.srt.platforms and tpu_oot_hooks = sglang_tpu.hooks:register in sglang.srt.plugins. That separates TPU-specific code from the serving engine, but it does not make the plugin interchangeable with arbitrary SGLang builds: the release requires the engine and plugin wheels to be installed together.

Key Capabilities & Differentiators

TPU7x (Ironwood) is the development and testing focus: one host provides four chips and eight TensorCores, with TP up to 8; the two-host configuration reaches TP16. A four-host topology separates prefill and decode into two hosts each, with TP resharding. The backend supports tensor, expert, data, pipeline, and context parallelism, plus prefix caching and HiCache offload to host memory.

Low-precision options include FP8, MXFP4, INT4 W4A16, and FP8 KV cache. EAGLE3, DFlash, DFlash2, DSPark, and MTP are available for supported model configurations. Integration depth varies: GPT-OSS 20B/120B have serving recipes and Qwen3.8-27B has accuracy and MTP recipes, whereas Kimi-K3 is represented by a small-model compile test with dummy weights. For vision-language serving, the encoder can run on a separate host or chip allocation. In one 235B-A22B comparison at 5 requests/s, time to first token was 392 ms with a separate encoder versus 2,091 ms with the encoder on the same host; this is a topology-specific result, not a general latency target.

Trade-offs & Limitations

Compared with SGL-JAX, this is the SGLang TPU path for teams that want PyTorch rather than JAX. Its plugin structure keeps TPU code separate, but the release still depends on the forked engine. Treat the engine and plugin as one upgrade unit, and check model and topology coverage in SUPPORT.md and SUPPORT_MATRIX.md. Compared with the managed OpenAI API, self-hosting gives you control over model selection and placement, while leaving capacity planning, warmup, and availability to your team. A compatible chat endpoint does not imply full API parity.

Use a single-host recipe as the baseline before paying for more hosts. Splitting the vision encoder can reduce contention and language-server HBM use, but it adds a service to operate. TPU encoder-only mode requires --enable-torch-compile, encoder data parallelism is not supported on TPU, and a language-only server returns HTTP 503 for image requests without a registered encoder. Size HBM and host memory against your actual model, precision, context lengths, and concurrency rather than extrapolating from one benchmark.

Hardware & Deployment Guide

The tpu-v0.1.0 release tracks SGLang 0.5.22. The shortest self-hosting path is lmsysorg/sglang:v0.1.0-tpu on a TPU7x host. The documented Docker launch uses --privileged, --net=host, --shm-size=64g, and SGLANG_PLATFORM=tpu_oot. Review the broad privileges and host-network exposure before deployment; 64 GB is the example's shared-memory setting, not a universal capacity requirement.

For a wheel install, use Linux x86_64 with Python 3.11–3.14 and install both release wheels together, using the PyTorch CPU wheel index as an extra index. A source install instead uses python/pyproject_tpu.toml for the engine before installing the root plugin. Clone the repository to run the GPT-OSS-20B recipe via benchmark.tpu.launch_server, then verify the local OpenAI-compatible endpoint on port 30000. CPU-only unit tests are available, but kernel and end-to-end validation require TPU hardware.

Plugin boundary: tpu_oot activates the TPU platform and tpu_oot_hooks registers runtime hooks for the paired SGLang build.
Topology: TPU7x configurations include single-host TP8, two-host TP16, and a four-host split with two prefill and two decode hosts.
KV management: Prefix caching reuses common prompt state, while HiCache can offload KV data to host memory.
Precision: FP8, MXFP4, INT4 W4A16, and FP8 KV cache are available for applicable configurations.
Multimodal serving: The vision encoder can use a separate host or chip allocation and its own TP size; TPU encoder data parallelism is not supported.
Deployment: tpu-v0.1.0 pairs the SGLang 0.5.22 engine build with the TPU plugin and offers both a Docker image and matching wheels.
Best For

Teams with TPU7x capacity and PyTorch expertise that want to self-host a supported language or vision-language model behind an OpenAI-compatible endpoint, starting with a validated serving recipe.

Skip If

You lack TPU7x access, need a backend for an existing GPU fleet, or want a managed API without owning model serving, compilation warmup, or multi-host operations.

Reviewed on 2026-12-02 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

DockerSelf-HostedAPI
docker pull lmsysorg/sglang:v0.1.0-tpu

Comparison vs. Top LLMs & Inference Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
sglang-torchtpu ★98+9PythonApache-2.0A PyTorch-native SGLang plugin for self-hosted LLM inference on Google TPUs
OmniRoute92.1k+1.5kTypeScriptMITSelf-hosted OpenAI-compatible gateway for multi-provider routing and fallback
freellmapi62k+2.6kTypeScriptMITSelf-hosted LLM gateway for routing across free tiers and custom endpoints
bifrost10.2k+125GoApache-2.0Self-hosted Go gateway for routing and governing multi-provider LLM traffic

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/sgl-project/sglang-torchtpu.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

sgl-project/sglang-torchtpu Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about sglang-torchtpu

How does the TPU plugin attach to SGLang, and can I use stock SGLang?

Use the SGLang engine build and sglang-tpu plugin from the same release, then set SGLANG_PLATFORM=tpu_oot. The plugin registers platform activation and runtime hooks through separate SGLang entry-point groups. Do not substitute the stock PyPI sglang package for the paired engine wheel.

What TPU capacity and memory should I budget for?

The documented baseline is TPU7x (Ironwood). A single host has four chips and eight TensorCores, with tensor parallelism up to TP8. There is no universal HBM requirement: on the exact model and topology you plan to serve, measure post-warmup HBM and peak host memory at your target context lengths and concurrency. HiCache can offload KV data to host memory, but does not remove the need to size accelerator memory.

Can we self-host it commercially and redistribute our deployment image?

The engine and plugin are Apache-2.0 licensed, which permits commercial use and self-hosting subject to the license terms. If you redistribute the software or container, review the applicable license and notice requirements. Check model weights and bundled third-party components separately; the repository license does not determine their terms.

When should I choose it over SGL-JAX or the OpenAI API?

Choose TorchTPU when you want to run supported models on your own TPU capacity with PyTorch workflows. Use SGL-JAX as the comparison if your team already operates a JAX stack. The OpenAI API is a managed alternative when you do not want to run the serving stack. SGLang-TorchTPU exposes an OpenAI-compatible chat endpoint, but verify the request fields and behavior your clients depend on before migrating.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining sgl-project/sglang-torchtpu? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature sgl-project/sglang-torchtpu on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

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

Saved in your browser · Export Markdown RFC tables or jump into /vs compare