Skip to content
View original post on X: meng shao
Published
Pick85/100

DeepSeek publishes technical report on DeepSeek V4.1 Flash serving internals

AIDeepSeek has published a technical report on Zhihu detailing the internals behind its DeepSeek V4.1 Flash serving stack, including Prefill and Decode hardware choices and KVCache goals. The post says a single cluster serves 1.55 trillion tokens per day, with overall revenue of $38 per card per hour at valley prices.
meng shaoVerified on X
@shao__meng
View on X

DeepSeek has open-sourced DeepInfer, and the corresponding technical report has been published on Zhihu. As usual, it's extremely high in technical content, with a great many internal details made public. There's so much to learn, it's simply impossible to get through it all!

For example, the report covers the design goals of DeepSeek V4.1 Flash: its hardware selection and technical judgments for Prefill and Decode, KVCache targets, and even actual data from a single cluster. The current service throughput of a single cluster is 155 trillion tokens/day, with overall revenue of $38 per GPU per hour (at valley prices).

https://zhuanlan.zhihu.com/p/2095560295930508953

AITranslated from Chinese
meng shao@shao__meng
DeepSeek has actually open-sourced the high-performance inference framework that powers its large-scale production services: DeepInfer This is the first public release of the same technology stack DeepSeek runs live for its own services. This release focuses on offline inference, is licensed under Apache 2.0, and is mainly built on @vllm_project, with ideas borrowed from @sgl_project and TensorRT-LLM. Open-source repository: https://github.com/deepseek-ai/DeepInfer DeepSeek had previously open-sourced parts of its inference stack: FlashMLA (MLA attention kernel), DeepGEMM (matrix multiplication kernel), DeepEP (MoE communication library), EPLB (expert load balancing), and others, but it had lacked the "skeleton" that assembles them into a complete engine. DeepInfer fills that gap: it integrates these kernels and adds complete system-layer implementations for scheduling, parallelism, speculative decoding, and more. Together with the DeepSeek-V4.1-Flash model released at the same time, it forms a complete open-source inference solution of "model + engine." On the hardware side, it supports both NVIDIA SM100 GPUs and Huawei Ascend 950 NPUs, and dual-platform support is a distinctive feature. # Core Technical Breakdown 1. Kernels and runtime. Integrates FlashMLA, DeepGEMM, DeepEP, TileKernels, DeepSelect, and custom kernels written in TileLang (located in deepinfer/model_executor/layers/tilelang_ops). These are the low-level guarantees of throughput and latency. 2. Parallelism strategy: separate handling for attention and MoE. The attention part uses DP (data parallelism) or balanced CP (context parallelism, for handling very long sequences); the MoE part uses EP (expert parallelism) plus EPLB (expert-parallel load balancing), and supports redundant experts (32 by default, rounded up to be divisible by the EP count) to ease uneven expert load. This "attention DP/CP + MoE EP" combination is an architecture validated in DeepSeek's production. 3. DSpark speculative decoding. Accelerates decoding based on MTP (multi-token prediction) draft tokens. Its highlight is "confidence-based scheduled verification": the number of draft tokens accepted is decided by confidence rather than a fixed rule. The default maximum draft length is 5. This is one of the main sources of the inference speedup. 4. YoCo SWA bounded replay. An optimization for YoCo-style decoders with sliding window attention (SWA): during prefill, only a bounded suffix of tokens is retained and replayed (140 by default, which must cover the SWA window plus the maximum lookback length), greatly reducing the compute for decoder prefill. The repository also provides YoCo mask/compact equivalence verification. 5. Asynchronous scheduling. Batch scheduling on the CPU overlaps with execution on GPU/NPU, achieving a "zero-overhead scheduler," enabled by default. 6. Batch-invariant and deterministic inference. With DEEPINFER_BATCH_INVARIANT=1 enabled, results are fully identical across different batch compositions; combined with a fixed seq_seed and disabled MTP varlen, token-by-token deterministic sampled output can be achieved. This is critical for reproducible evaluation and regression testing (the repository uses per-sample exact-comparison PPL baselines as a check). Currently it is limited to the NVIDIA platform. 7. Structured output. Natively supports three types of constrained generation: regex, JSON schema, and EBNF, passed via so_args in SamplingParams.
AITranslation · show original

DeepSeek 居然把支撑他们大规模生产服务的高性能推理框架开源了:DeepInfer 这是 DeepSeek 线上真实跑 DeepSeek 服务的同源技术栈首次对外公开,本次发布聚焦离线推理,采用 Apache 2.0 许可证,主要基于 @vllm_project 构建,并借鉴了 @sgl_project 和 TensorRT-LLM。 开源地址:https://github.com/deepseek-ai/DeepInfer DeepSeek 此前已陆续开源了推理栈的“零件”:FlashMLA(MLA 注意力内核)、DeepGEMM(矩阵乘法内核)、DeepEP(MoE 通信库)、EPLB(专家负载均衡)等,但一直缺少把它们组装成完整引擎的“骨架”。DeepInfer 补上了这一环:它是这些内核的集成者,加上调度、并行、投机解码等系统层的完整实现。配合本次同时出现的 DeepSeek-V4.1-Flash 模型,构成了“模型 + 引擎”的完整开源推理方案。硬件层面同时支持 NVIDIA SM100 GPU 和华为昇腾 950 NPU,双平台支持是它的一个鲜明特征。 # 核心技术拆解 1. 内核与运行时。 集成 FlashMLA、DeepGEMM、DeepEP、TileKernels、DeepSelect,以及用 TileLang 编写的自定义内核(位于 deepinfer/model_executor/layers/tilelang_ops)。这些是吞吐和延迟的底层保障。 2. 并行策略:Attention 与 MoE 分治。 注意力部分采用 DP(数据并行)或均衡的 CP(上下文并行,处理超长序列);MoE 部分采用 EP(专家并行)加 EPLB(专家并行负载均衡),并支持冗余专家(默认 32 个,向上取整到能被 EP 数整除)来缓解专家负载不均。这种“注意力 DP/CP + MoE EP”的组合是 DeepSeek 生产验证过的架构。 3. DSpark 投机解码。 基于 MTP(multi-token prediction)draft token 加速解码,亮点是“置信度调度验证”;按置信度决定接受多少 draft token,而非固定规则。默认最大 draft 长度 5。这是推理加速比的主要来源之一。 4. YoCo SWA 有界重放。 针对 YoCo 式解码器 + 滑动窗口注意力(SWA)的优化:prefill 时只保留并重放有界的 token 后缀(默认 140 个,需覆盖 SWA 窗口加最大回溯长度),大幅削减 decoder prefill 的计算量。仓库还专门提供了 YoCo mask/compact 等价性验证。 5. 异步调度。 CPU 上的批调度与 GPU/NPU 上的执行重叠,做到“零开销调度器”,默认开启。 6. 批不变与确定性推理。 开启 DEEPINFER_BATCH_INVARIANT=1 后,不同批次组合下结果完全一致;再配合固定 seq_seed、关闭 MTP varlen,可实现逐 token 确定性的采样输出。这对可复现评测和回归测试(仓库用逐样本精确对比的 PPL 基线来把关)很关键,目前仅限 NVIDIA 平台。 7. 结构化输出。 原生支持 regex、JSON schema、EBNF 三种约束生成,通过 SamplingParams 的 so_args 传入。

View quoted post on X
Source details

meng shao · x.comPublished

Original title: DeepSeek 开源 DeepInfer 对应的技术报告,发布在知乎了,还是一贯的技术含量极高,非常多的内部细节都公开了,学不完,根本学不完!