SGLang is the official recommended inference engine by the DeepSeek team for DeepSeek-V3/R1.
Overview
Supported DeepSeek Models
- DeepSeek R1 (0528, 0730) - Latest reasoning models with RL
- DeepSeek V3.1/V3 - 671B MoE (37B active) with MLA
- DeepSeek V2 - Previous generation MLA+MoE
- DeepSeek-VL2 - Vision-language model
- DeepSeek-OCR / OCR-2 - Document understanding
- DeepSeek-Janus-Pro - Image understanding & generation
Key Features
- Multi-head Latent Attention (MLA): Compressed KV cache for efficiency
- Mixture-of-Experts (MoE): 671B total, 37B active parameters
- FP8 Native: Official models already in FP8 format
- Advanced Reasoning: Trained with reinforcement learning
Quick Start
Single Node (8×H200)
Multi-Node Example (2×8 H100)
Hardware Requirements
Recommended configurations for DeepSeek V3/R1:SGLang Optimizations for DeepSeek
SGLang provides several model-specific optimizations:1. Multi-head Latent Attention (MLA)
Description: MLA compresses KV cache for improved efficiency. SGLang implements:- Weight Absorption: Reordered computation for balanced memory access
- Multiple MLA Backends: FlashAttention3, Flashinfer, FlashMLA, CutlassMLA, TRTLLM MLA (Blackwell), Triton
- FP8 Quantization: W8A8 FP8 and KV Cache FP8
- CUDA Graph & Torch.compile: Reduced latency for small batches
- Chunked Prefix Cache: Long sequence optimization (FlashAttention3 only)
2. Data Parallelism Attention (DP Attention)
Description: Reduces KV cache size by distributing attention across DP workers, enabling larger batch sizes. KV cache is stored per DP rank instead of duplicating across all TP ranks. Performance: Up to 1.9× throughput improvement in high batch size scenarios. Usage:3. Block-wise FP8 Quantization
Description: Optimized FP8 quantization with:- Activation: E4M3 format with per-token-per-128-channel sub-vector scales
- Weight: Per-128×128-block quantization for numerical stability
- DeepGEMM: Kernel library optimized for FP8 matrix multiplications
4. Multi-token Prediction (MTP)
Description: EAGLE-based speculative decoding for DeepSeek models. Performance:- 1.8× speedup for batch size 1
- 1.5× speedup for batch size 32
5. Multi-Node Tensor Parallelism
Deploy DeepSeek across multiple nodes for models that don’t fit in single-node memory. Examples:- 2×H20*8 nodes
- 2×H200*8 nodes with Docker
- 4×A100*8 nodes
- GB200 NVL72 with PD and EP
- 96 H100 GPUs with PD disaggregation
Reasoning Content (DeepSeek R1 & V3.1)
DeepSeek R1 and V3.1 models can separate reasoning tokens from final answers.Enable Reasoning Parser
Using Reasoning in Requests
Thinking Budget
Control reasoning token budget with custom logit processors:Function Calling
Enable tool calling for DeepSeek models:Example Request
Multimodal DeepSeek Models
DeepSeek-VL2
Vision-language model for image understanding:DeepSeek-OCR / OCR-2
Document understanding and text extraction:DeepSeek-Janus-Pro
Image understanding & generation:Platform-Specific Deployment
AMD GPUs (MI300X)
CPU (Xeon 6980P)
Ascend NPU (Atlas 800I A3)
See: Ascend NPU GuideQuantization Options
INT8 Quantization
AWQ Quantization
W4A8 Quantization
Performance Tips
Download Weights First
Ensure weights are fully downloaded before starting:Increase Timeout for Large Models
Parallel Weight Loading
Memory Optimization
Resources
- DeepSeek Official Repository
- SGLang DeepSeek Roadmap
- DeepSeek V3 Benchmark Examples
- GB200 Deployment Blog (Part 1)
- GB200 Deployment Blog (Part 2)
- 96 H100 Deployment Blog
- H20 Best Practices
- MLA Optimization Blog
- DP Attention Blog
