SGLang CLI Cheatsheet - sglang.launch_server Inference Full Reference

Standing up a self-hosted model API is easy; making it fast is the real work. SGLang leans on RadixAttention, which organizes prompt prefixes into a radix tree so multi-turn conversations and shared system prompts reuse KV cache automatically, cutting time-to-first-token noticeably on long prefixes. This table groups launch_server options into startup, quantization and precision, and performance, covering tensor parallel splitting, speculative or expert parallel sizing, quantization choice, and the memory fraction reserved for the KV cache. A workable decision order: check whether the model fits on one GPU, add tensor parallelism if it does not, quantize only if adding cards is not an option, and touch the KV cache ratio last because it directly costs throughput. Reach for it when you need a local OpenAI-compatible endpoint, when benchmarking throughput, or when production latency is high but GPU utilization looks unremarkable. The real difference from vLLM is prefix cache efficiency, so pick by request shape.

AI CLI·20 commands·Last updated 2026-09-10
sglanginferenceservergpullmcliserving

Basic Launch 5

python -m sglang.launch_server --model-path meta-llama/Meta-Llama-3-8B-Instruct
Minimal launch
python -m sglang.launch_server --model-path model --host 0.0.0.0 --port 30000
Set host and port
python -m sglang.launch_server --model-path model --tp 2
2-GPU tensor parallel
python -m sglang.launch_server --model-path model --dp 2 --tp 2
Data plus tensor parallel
python -m sglang.launch_server --model-path model --mem-fraction-static 0.7
Lower KV cache VRAM share

Quantization and Precision 5

python -m sglang.launch_server --model-path model --quantization fp8
Weight fp8 quantization
python -m sglang.launch_server --model-path model --kv-cache-dtype fp8_e4m3
KV cache fp8 quantization
python -m sglang.launch_server --model-path model --dtype bfloat16
Set compute dtype
python -m sglang.launch_server --model-path model --context-length 32768
Extend context length
python -m sglang.launch_server --model-path model --trust-remote-code
Allow custom model code

Performance and Advanced 10

python -m sglang.launch_server --model-path model --chunked-prefill-size 4096
Chunked prefill for long prompts
python -m sglang.launch_server --model-path model --enable-torch-compile
Enable torch.compile
python -m sglang.launch_server --model-path model --max-running-requests 64
Raise concurrent requests
python -m sglang.launch_server --model-path model --schedule-policy lpm
Longest-prefix-match scheduling
python -m sglang.launch_server --model-path model --config config.yaml
Launch from a config file
python -m sglang_router.launch_server --model-path model --dp 2 --tp 2
Data parallel via Router
python -m sglang.launch_server --help
All flags
python -m sglang.launch_server --model-path model --nnodes 2
Multi-node tensor parallel
python -m sglang.launch_server --model-path model --enable-deterministic-inference
Deterministic inference
python -m sglang.launch_server --model-path model --disable-cuda-graph
Disable CUDA Graph (debug)

Tips

  • --tp splits across GPUs; if one card is too small, add cards or lower --mem-fraction-static or quantize.
  • RadixAttention is on by default; repeated prefixes (system prompt, RAG context) are reused automatically.
  • On OOM, try --quantization fp8 or --mem-fraction-static 0.8 first.

FAQ

How is SGLang different from vLLM?

Both are high-throughput frameworks; SGLang leads with RadixAttention prefix reuse and structured generation, vLLM with PagedAttention memory management. Both serve OpenAI-compatible endpoints.

What protocol does it expose?

OpenAI-compatible /v1/chat/completions and /generate; point a client base_url at it.

Official References

Each command links to its official documentation below, so you can verify the latest usage and read deeper.

Maintained by LaoHand

Publicly updated on Sep 10, 2026, continuously proofread against official docs.

Contact Us

Wrong command or description? Send us corrections, business inquiries or product feedback by email.

Contact Us