1/27/2025

This article introduces new ways about how to run deepseek model locally.

DeepSeek-V3: A Comprehensive Guide to Local Deployment and Optimization

The DeepSeek-V3 model represents a significant advancement in AI inference capabilities, offering state-of-the-art performance across a variety of hardware and software configurations. This article provides a detailed overview of how to deploy DeepSeek-V3 locally, leveraging cutting-edge hardware and open-source community software to achieve optimal results.

Hardware and Software Requirements

DeepSeek-V3 is designed to be highly versatile, supporting deployment on a wide range of hardware platforms. Below are the key components and tools required for local deployment:

  1. DeepSeek-Infer Demo:
    We provide a lightweight and user-friendly demo for FP8 and BF16 inference. This demo is an excellent starting point for users looking to experiment with DeepSeek-V3's capabilities in a simplified environment.

  2. SGLang:
    SGLang is a powerful framework that fully supports the DeepSeek-V3 model in both BF16 and FP8 inference modes. It is optimized for performance, with features such as MLA optimizations, DP Attention, FP8 (W8A8), FP8 KV Cache, and Torch Compile. These optimizations ensure state-of-the-art latency and throughput performance, making SGLang one of the most efficient open-source frameworks available.

    • Multi-Node Tensor Parallelism: SGLang supports running DeepSeek-V3 across multiple network-connected machines, enabling scalable deployment.
    • Multi-Token Prediction (MTP): Currently in development, MTP will further enhance the model's capabilities. Progress can be tracked in the optimization plan.
    • Cross-Platform Support: SGLang v0.4.1 fully supports DeepSeek-V3 on both NVIDIA and AMD GPUs, making it a highly versatile solution.
  3. LMDeploy:
    LMDeploy is another robust tool that enables efficient FP8 and BF16 inference for both local and cloud deployment. It is particularly well-suited for users seeking flexibility in deployment environments.

  4. TensorRT-LLM:
    TensorRT-LLM currently supports BF16 inference and INT4/8 quantization, with FP8 support coming soon. This tool is ideal for users looking to leverage NVIDIA's TensorRT ecosystem for optimized inference.

  5. vLLM:
    vLLM supports DeepSeek-V3 in both FP8 and BF16 modes, with additional features for tensor parallelism and pipeline parallelism. This makes it a strong choice for users requiring advanced parallelism techniques.

  6. AMD GPU Support:
    DeepSeek-V3 can be run on AMD GPUs via SGLang, supporting both BF16 and FP8 modes. This expands the model's accessibility to a broader range of hardware configurations.

  7. Huawei Ascend NPU Support:
    For users with Huawei Ascend devices, DeepSeek-V3 is fully supported, enabling deployment on this specialized hardware.

FP8 and BF16 Weights

DeepSeek-V3 natively adopts FP8 training, and as such, we provide FP8 weights by default. However, for users requiring BF16 weights for experimentation, a conversion script is available to facilitate the transformation. This ensures flexibility for users with varying hardware and software requirements.

Performance and Optimization

SGLang stands out as a particularly robust solution for DeepSeek-V3 deployment, offering unparalleled performance optimizations. Key features include:

  • MLA Optimizations: Enhance the model's efficiency and reduce latency.
  • DP Attention: Improves attention mechanisms for better inference accuracy.
  • FP8 KV Cache: Optimizes memory usage and throughput.
  • Torch Compile: Accelerates model execution for faster inference.

These optimizations collectively deliver the best-in-class latency and throughput performance among open-source frameworks, making SGLang an ideal choice for DeepSeek-V3 deployment.

Getting Started

To begin deploying DeepSeek-V3, follow the launch instructions provided by the SGLang team:
SGLang DeepSeek-V3 Benchmark

This guide will walk you through the setup process, ensuring a smooth and efficient deployment experience.

Conclusion

DeepSeek-V3 is a highly versatile and powerful model, supported by a robust ecosystem of hardware and software tools. Whether you are deploying locally or in the cloud, leveraging FP8 or BF16 inference, or utilizing specialized hardware like AMD GPUs or Huawei Ascend NPUs, DeepSeek-V3 offers unparalleled performance and flexibility. By following the guidelines and optimizations outlined in this article, you can unlock the full potential of DeepSeek-V3 for your AI inference needs.