DeepSeek Open Infra Index

repository·main·Indexed 27 days ago

https://github.com/deepseek-ai/open-infra-index

A collection of high-performance, production-tested infrastructure components optimized for DeepSeek-V3 and R1 models. This index includes optimized kernels like FlashMLA and DeepGEMM, communication libraries such as DeepEP, parallelism strategies including DualPipe and EPLB, and high-performance storage solutions like 3FS and Smallpond.

Tokens
1.8K
Snippets
3
Records
12
Agent score
93%

What's inside open-infra-index

  1. Overview of DeepSeek Open Infra components

    main

    The open-infra-index repository serves as a central hub for DeepSeek's open-source infrastructure components, including optimized kernels, communication libraries, and file systems used in the DeepSeek-V3 and R1 inference and training systems.

    Key components include:

    • FlashMLA: Efficient MLA decoding kernels for Hopper GPUs.
    • DeepEP: An EP communication library for MoE models.
    • DeepGEMM: An FP8 GEMM library for dense and MoE workloads.
    • DualPipe: Bidirectional pipeline parallelism for computation-communication overlap.
    • EPLB: Expert-parallel load balancer.
    • 3FS: A high-performance parallel file system.
    • Smallpond: A data processing framework built on 3FS.
  2. Understand the DeepSeek Inference Engine open-source strategy

    main

    DeepSeek is not open-sourcing its full internal inference engine as a single monolithic repository due to codebase divergence from vLLM, tight coupling with internal infrastructure, and maintenance constraints. Instead, the strategy is to contribute to the existing open-source ecosystem by:

    1. Extracting Standalone Features: Modularizing and contributing reusable components as independent libraries.
    2. Sharing Optimizations: Contributing design improvements and implementation details directly to existing projects like vLLM.

    For future model releases (like DeepSeek-V3 or DeepSeek-R1), DeepSeek commits to synchronizing inference-related engineering efforts prior to launches to enable Day-0 SOTA support across diverse hardware platforms.

  3. Overlap computation and communication in DeepSeek inference

    main

    To mitigate cross-node communication overhead introduced by large-scale EP, DeepSeek employs specific overlapping strategies:

    • Prefilling Phase: Uses a dual-batch overlap strategy. A batch of requests is split into two microbatches that execute alternately, allowing the communication cost of one microbatch to be hidden behind the computation of the other.
    • Decoding Phase: Uses a 5-stage pipeline. Because execution durations are unbalanced, the attention layer is subdivided into two steps to achieve seamless communication-computation overlapping.

    Detailed profiling data for these mechanisms can be found at https://github.com/deepseek-ai/profile-data.

  4. 3FS and Smallpond: High-Performance Data Access

    main

    DeepSeek utilizes a high-performance storage stack for training and inference:

    • 3FS (Fire-Flyer File System): A parallel file system utilizing modern SSDs and RDMA networks. It features a disaggregated architecture with strong consistency semantics, supporting training data preprocessing, dataset loading, checkpointing, and KVCache lookups.
    • Smallpond: A data processing framework built on top of 3FS.
  5. FlashMLA: Efficient MLA Decoding Kernel for Hopper GPUs

    main

    FlashMLA is an optimized MLA (Multi-head Latent Attention) decoding kernel designed for Hopper GPUs. It is optimized for variable-length sequences and is battle-tested in production.

    Key Features:

    • BF16 support
    • Paged KV cache (block size 64)
    • Performance: 3000 GB/s memory-bound | BF16 580 TFLOPS compute-bound on H800

    For more details, visit the FlashMLA GitHub Repo.

    https://github.com/deepseek-ai/FlashMLA
  6. Parallelism strategies for DeepSeek-V3/R1 prefill and decode phases

    main

    DeepSeek-V3/R1 uses a prefill-decode disaggregation architecture with different parallelism degrees for each phase to optimize throughput and latency via cross-node Expert Parallelism (EP).

    • Prefilling Phase: Uses [Routed Expert EP32, MLA/Shared Expert DP32]. A deployment unit spans 4 nodes with 32 redundant routed experts. Each GPU handles 9 routed experts and 1 shared expert.
    • Decoding Phase: Uses [Routed Expert EP144, MLA/Shared Expert DP144]. A deployment unit spans 18 nodes with 32 redundant routed experts. Each GPU manages 2 routed experts and 1 shared expert.
  7. Load balancing mechanisms for DeepSeek-V3/R1 inference

    main

    DeepSeek implements three types of load balancers to prevent GPU bottlenecks caused by uneven computational or communication loads:

    1. Prefill Load Balancer

    Targets imbalanced core-attention computation and dispatch send load caused by varying request counts and sequence lengths.

    • Objectives: Balance core-attention computation across GPUs and equalize input token counts per GPU (dispatch send load balancing).

    2. Decode Load Balancer

    Targets disparities in core-attention computation (linked to KVCache usage) and dispatch send load.

    • Objectives: Balance KVCache usage across GPUs and equalize request counts per GPU.

    3. Expert-Parallel Load Balancer

    Targets imbalances in expert computational workloads caused by inherently high-load experts in MoE models.

    • Objective: Balance expert computation on each GPU by minimizing the maximum dispatch receive load across all GPUs.
  8. DeepGEMM: FP8 GEMM Library

    main

    DeepGEMM is an FP8 GEMM library that supports both dense and MoE GEMMs, used to power V3/R1 training and inference.

    Key Features:

    • High Performance: Up to 1350+ FP8 TFLOPS on Hopper GPUs.
    • Lightweight: No heavy dependencies; fully Just-In-Time (JIT) compiled.
    • Layout Support: Supports dense layout and two MoE layouts.

    For more details, visit the DeepGEMM GitHub Repo.

    https://github.com/deepseek-ai/DeepGEMM
  9. DeepEP: EP Communication Library for MoE

    main

    DeepEP is an open-source EP (Expert Parallel) communication library specifically designed for MoE (Mixture-of-Experts) model training and inference.

    Key Features:

    • All-to-all communication: Efficient and optimized.
    • Multi-tier support: Both intranode and internode support using NVLink and RDMA.
    • Kernel types: High-throughput kernels for prefilling and low-latency kernels for inference decoding.
    • FP8 support: Native FP8 dispatch support.
    • Resource control: Flexible GPU resource control for computation-communication overlapping.

    For more details, visit the DeepEP GitHub Repo.

    https://github.com/deepseek-ai/DeepEP