Skip to main content

1. Model Introduction

DeepSeek V3.1 is an advanced Mixture-of-Experts (MoE) large language model developed by DeepSeek, representing a major capability and usability upgrade over DeepSeek V3. As a refined iteration in the DeepSeek V3 family, DeepSeek V3.1 introduces a hybrid reasoning paradigm that supports both fast non-thinking responses and explicit multi-step reasoning, alongside significantly improved tool calling and agentic behavior. The model demonstrates strong performance across reasoning, mathematics, coding, long-context understanding, and real-world agent workflows, benefiting from continued training, alignment optimization, and inference-time refinements. DeepSeek V3.1 is designed to serve as a robust general-purpose foundation model, well suited for conversational AI, structured tool invocation, search-augmented generation, and complex multi-step tasks, while maintaining high efficiency through its sparse MoE architecture. DeepSeek-V3.1-Terminus is an experimental version designed for general conversations and long-context processing. It features hybrid thinking capabilities, allowing you to toggle between “Think” mode for deliberate reasoning and “Non-Think” mode for faster responses. Recommended for general conversations, long-context processing, and experimental use cases.

2. SGLang Installation

SGLang offers multiple installation methods. You can choose the most suitable installation method based on your hardware platform and requirements. Please refer to the official SGLang installation guide for installation instructions. For SGLang CPU installation, please refer to the CPU version installation guide.

3. Model Deployment

This section provides a progressive guide from quick deployment to performance optimization, suitable for users at different levels.

3.1 Basic Configuration

Interactive Command Generator: Use the configuration selector below to automatically generate the appropriate deployment command for your hardware platform, model variant, deployment strategy, and thinking capabilities.

3.2 Configuration Tips

DeepSeek-V3.1 shares the same model architecture as DeepSeek-V3, so the same hardware and optimization recommendations apply. Recommended GPU configurations by weight type:
Weight TypeSupported Hardware
FP8 (recommended)8× H200, 8× B200, 8× MI300X, 2×8× H100/H800/H20
BF16 (upcast from FP8)2×8× H200, 2×8× MI300X, 4×8× H100/H800, 4×8× A100/A800
INT816× A100/A800, 32× L40S, Xeon 6980P CPU, 4× Atlas 800I A3
W4A8 / AWQ / MXFP4 / NVFP48× H20/H100, 4× H200; 8× H100/A100; 8/4× MI355X/MI350X; 8/4× B200
The official DeepSeek-V3.1 checkpoint is already in FP8 format — do not add --quantization fp8 when serving it.
DeepGEMM precompilation (NVIDIA Hopper / Blackwell): Precompile GEMM kernels before the first server run to avoid JIT overhead (~10 min):
DeepGEMM is enabled by default on Hopper/Blackwell and can be disabled with SGLANG_ENABLE_JIT_DEEPGEMM=0. Data Parallelism Attention (--enable-dp-attention): Recommended for high-throughput scenarios with large batch sizes. Reduces KV-cache duplication across TP ranks. Use --enable-dp-attention --tp 8 --dp 8 on a single 8-GPU node. Not recommended for low-latency, small-batch workloads. NCCL timeout: If model loading is slow and you hit an NCCL timeout, increase it: --dist-timeout 3600. Xeon CPU service configuration: Please refer to the Notes part in the serving engine launching section in the SGLang CPU server document to better understand how to configure the arguments, especially for TP (tensor parallel) and NUMA binding settings.

4. Model Invocation

4.1 Basic Usage

For basic API usage and request examples, please refer to:

4.2 Advanced Usage

4.2.1 Reasoning Parser

DeepSeek-V3.1 supports reasoning mode. Enable the reasoning parser during deployment to separate the thinking and content sections:
Command
Streaming with Thinking Process:
Example
Output Example:
Output
Note: The reasoning parser captures the model’s step-by-step thinking process, allowing you to see how the model arrives at its conclusions.

4.2.2 Tool Calling

DeepSeek-V3.1 and DeepSeek-V3.1-Terminus support tool calling capabilities. Enable the tool call parser: Deployment Command:
Command
For DeepSeek-V3.1, use --tool-call-parser deepseekv31 as well. Python Example (with Thinking Process):
Example
Output Example:
Output
Note:
  • The reasoning parser shows how the model decides to use a tool
  • Tool calls are clearly marked with the function name and arguments
  • You can then execute the function and send the result back to continue the conversation
Handling Tool Call Results: Please attach the code blocks below to the previous Python script.
Example

4.2.3 Multi-Token Prediction (EAGLE Speculative Decoding)

DeepSeek-V3.1 shares the same architecture as DeepSeek-V3 and supports the same EAGLE-based MTP speculative decoding path. Refer to DeepSeek-V3 §4.2.3 for the full configuration, tuning guidance, and bench_speculative.py reference. The --speculative-num-steps, --speculative-eagle-topk, and --max-running-requests recommendations apply equally to V3.1.

5. Benchmark

5.1 Speed Benchmark

Test Environment:
  • Hardware: AMD MI300X GPU (8x)
  • Model: DeepSeek-V3.1-Terminus
  • Tensor Parallelism: 8
  • sglang version: 0.5.7
Benchmark Methodology: We use industry-standard benchmark configurations to ensure results are comparable across frameworks and hardware platforms.

5.1.1 Standard Test Scenarios

Three core scenarios reflect real-world usage patterns:
ScenarioInput LengthOutput LengthUse Case
Chat1K1KMost common conversational AI workload
Reasoning1K8KLong-form generation, complex reasoning tasks
Summarization8K1KDocument summarization, RAG retrieval

5.1.2 Concurrency Levels

Test each scenario at different concurrency levels to capture the throughput vs. latency trade-off:
  • Low Concurrency: --max-concurrency 1 (Latency-optimized)
  • Medium Concurrency: --max-concurrency 16 (Balanced)
  • High Concurrency: --max-concurrency 100 (Throughput-optimized)

5.1.3 Number of Prompts

For each concurrency level, configure num_prompts to simulate realistic user loads:
  • Quick Test: num_prompts = concurrency × 1 (minimal test)
  • Recommended: num_prompts = concurrency × 5 (standard benchmark)
  • Stable Measurements: num_prompts = concurrency × 10 (production-grade)

5.1.4 Benchmark Commands

Scenario 1: Chat (1K/1K) - Most Important
  • Model Deployment
Command
  • Low Concurrency (Latency-Optimized)
Command
Output
  • Medium Concurrency (Balanced)
Command
Output
  • High Concurrency (Throughput-Optimized)
Command
Output
Scenario 2: Reasoning (1K/8K)
  • Low Concurrency
Command
Output
  • Medium Concurrency
Command
Output
  • High Concurrency
Command
Output
Scenario 3: Summarization (8K/1K)
  • Low Concurrency
Command
Output
  • Medium Concurrency
Command
Output
  • High Concurrency
Command
Output

5.1.5 Understanding the Results

Key Metrics:
  • Request Throughput (req/s): Number of requests processed per second
  • Output Token Throughput (tok/s): Total tokens generated per second
  • Mean TTFT (ms): Time to First Token - measures responsiveness
  • Mean TPOT (ms): Time Per Output Token - measures generation speed
  • Mean ITL (ms): Inter-Token Latency - measures streaming consistency
Why These Configurations Matter:
  • 1K/1K (Chat): Represents the most common conversational AI workload. This is the highest priority scenario for most deployments.
  • 1K/8K (Reasoning): Tests long-form generation capabilities crucial for complex reasoning, code generation, and detailed explanations.
  • 8K/1K (Summarization): Evaluates performance with large context inputs, essential for RAG systems, document Q&A, and summarization tasks.
  • Variable Concurrency: Captures the Pareto frontier - the optimal trade-off between throughput and latency at different load levels. Low concurrency shows best-case latency, high concurrency shows maximum throughput.
Interpreting Results:
  • Compare your results against baseline numbers for your hardware
  • Higher throughput at same latency = better performance
  • Lower TTFT = more responsive user experience
  • Lower TPOT = faster generation speed

5.2 Accuracy Benchmark

Document model accuracy on standard benchmarks:

5.2.1 GSM8K Benchmark

  • Benchmark Command
Command
Test Results:
Output