Prhub

#33083 [Docs] Add DeepSeek-V4 Flash Official (0731) recipe

原始 PR 作者 JustinTong0323 合并时间 2026-08-01 03:14 文件变更 4 提交数 11 评论 3 代码增减 +557 / -22

执行摘要

新增 DeepSeek-V4 Flash Official (0731) 部署指南与 DSpark 交互支持

DeepSeek 发布了新的 Flash Official (0731) checkpoint,内置 DSpark draft head,部署方式与原 Flash/Pro 的 EAGLE 配方不同。PR body 明确指出目标是“add a separate Flash Official option for deepseek-ai/DeepSeek-V4-Flash-0731”并“prevent unsupported DSpark combinations with DP Attention, PD disaggregation, and ROCm”,同时发布实测基准供用户参考。

值得精读,重点看两点:一是 DeepSeek-V4-Flash-0731 的 DSpark 部署配方与 --mem-fraction-static 选择依据,二是 _playground.jsx 中如何把“配置声明的禁用条件”与“引擎层的算法状态注入”结合,实现跨模型的 Playground 约束。建议后续为 Playground 引擎补充单元测试,并对 verified: false 的矩阵单元在页面上做显式标注。

讨论亮点

该 PR 没有触发人类 review 讨论:唯一一条 reviewer 批准来自 zijiexia,且没有附带说明。评论区只有三条机器人消息:两条 Gemini Code Assist 停用通知和一条 Mintlify 预览部署链接。所有设计权衡都由作者在 PR body 中以“实测数据 + 约束矩阵”形式说明,例如 TP4 DSpark 与 DP4 DeepEP target-only 的对比结论(concurrency 64 时 TP4 DSpark 提升 37% 吞吐,但 concurrency 256 时吞吐下降 13.7%,因此 balanced 单元仍保留 DP4 DeepEP target-only),以及 H200 首次运行因 FlashInfer MoE workspace OOM 失败后通过 --mem-fraction-static 0.88 恢复的经过。

实现拆解

  1. 新增模型 variant 与模型映射:在 docs_new/src/snippets/configs/deepseek-ai/deepseek-v4.jsx 中增加 flash-official variant,并将 flash-official|fp4 映射到 deepseek-ai/DeepSeek-V4-Flash-0731;同步为 flash-official 添加 GPQA / AIME25 的 reproduce 命令分支。

  2. 扩展 DeepSeek-V4 配置矩阵:在 speculative.options 中新增 dspark 预设(--speculative-algorithm DSPARK),对 flash/pro variant 隐藏,对 DP Attention 与 AMD MI 系列禁用;原有的 EAGLE / MTP 预设对 flash-official 隐藏。新增 dsparkDraftTokens slider(flagSelects),控制 --speculative-dspark-block-size 1–5 的扫描;pdDisagg 增加 showWhen: (base) => base.specAlgorithm !== "DSPARK"incompatibleSpeculativeAlgorithms: ["DSPARK"],从配置层阻断 DSpark 与 PD 拆分的组合。

  3. 改造 Playground 全局引擎docs_new/src/snippets/_playground.jsx 的 speculative axis 将 --speculative-dspark-block-size 纳入识别与 strip 集合;pdDisagg.applygetRenderHints 增加算法兼容性检查;applyAllDeltas 把当前生效的 specAlgorithm 注入 liveSel,传递给后续 axis;constraintBase 改为通过完整 apply 管线计算 pdModespecAlgorithm,并让 MTP 警告提示按实际算法(EAGLE / DSpark / NGRAM 等)显示名称。

  4. 补充基准数据与文档章节deepseek-v4-benchmarks.jsx 增加 GB300 flash-official 的三个策略 cell(low-latency / balanced / high-throughput)以及对应 P50 TTFT / TPOT、tok/s/GPU 和 accuracy;DeepSeek-V4.mdx 新增 3.4 DSpark 章节,给出 4xGB300 已验证的启动命令(--speculative-algorithm DSPARK--mem-fraction-static 0.90)、draft block-size 调优建议、以及排除 DP Attention / PD 拆分 / ROCm 的约束说明。

  5. 配置与验证配套:本次改动没有新增单元测试;PR body 列出 pre-commitnpx mint validatenpx mint broken-links --check-anchors、矩阵不变量检查(22 个 cell、无 EAGLE flags、无 DSpark on DP-Attention/MI cells)以及 live Mintlify preview 验证。

文件 模块 状态 重要度
docs_new/src/snippets/_playground.jsx 文档交互 modified 7.19
docs_new/src/snippets/configs/deepseek-ai/deepseek-v4.jsx 模型配置 modified 7.12
docs_new/src/snippets/configs/deepseek-ai/deepseek-v4-benchmarks.jsx 基准数据 modified 6.14
docs_new/cookbook/autoregressive/DeepSeek/DeepSeek-V4.mdx 指南文档 modified 4.11

关键符号

speculative.deriveFromBase speculative.apply pdDisagg.apply pdDisagg.getRenderHints applyAllDeltas dsparkDraftTokens

关键源码片段

docs_new/src/snippets/configs/deepseek-ai/deepseek-v4.jsx configuration

DeepSeek-V4 配置核心:新增 flash-official variant、DSpark 预设与禁用条件、PD 拆分兼容性声明及 22 个矩阵 cell。

// ----- Card 4: "Speculative Decoding" -----
// Flash Official (0731) 使用 checkpoint 内置的 DSpark draft head,
// 因此 EAGLE / MTP 预设在该 variant 下隐藏;DSpark 仅对 flash-official 开放,
// 并声明与 DP Attention、AMD ROCm 的互斥条件。
speculative: {
  options: [
    { id: "current", label: "Inherited from base" },
    { id: "off", label: "Off (greedy)" },
    { id: "mtp-314", label: "EAGLE / MTP 3-1-4",
      flags: ["--speculative-algorithm EAGLE", "--speculative-num-steps 3",
              "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 4"],
      hide: { variant: ["flash-official"] } },
    { id: "mtp-112", label: "EAGLE / MTP 1-1-2",
      flags: ["--speculative-algorithm EAGLE", "--speculative-num-steps 1",
              "--speculative-eagle-topk 1", "--speculative-num-draft-tokens 2"],
      hide: { variant: ["flash-official"] } },
    // DSpark:单 flag 预设,不附带 draft model 路径——权重内置于 checkpoint。
    { id: "dspark", label: "DSpark",
      flags: ["--speculative-algorithm DSPARK"],
      hide: { variant: ["flash", "pro"] },
      disable: [
        { when: { dpAttnOn: [true] },
          reason: "DSpark is not compatible with DP Attention on the current release." },
        { when: { hw: ["mi300x", "mi355x"] },
          reason: "DSpark currently requires CUDA." },
      ] },
    { id: "ngram", label: "NGRAM",
      flags: ["--speculative-algorithm NGRAM",
              "--speculative-num-draft-tokens 16",
              "--speculative-ngram-max-bfs-breadth 10"],
      disable: { dpAttnOn: [true] },
      disableReason: "NGRAM is incompatible with DP-Attention. Turn DP-Attention off in the Attention card above to use NGRAM." },
    { id: "dflash", label: "DFlash", disabled: true,
      disableReason: "Coming soon — pending DFlash kernel integration." },
  ],
},// ----- Card 5: "PD Disaggregation" -----
// DSpark 与 PD 拆分互斥:配置层直接声明不兼容算法,引擎据此隐藏整张卡。
pdDisagg: {
  showWhen: (base) => base.specAlgorithm !== "DSPARK",
  incompatibleSpeculativeAlgorithms: ["DSPARK"],
  modes: [
    { id: "off", label: "Off" },
    { id: "prefill", label: "Prefill role" },
    { id: "decode", label: "Decode role" },
  ],
  // ...transferBackends / ibDevices / router 保持不变,省略。
},// 新增的 Playground 调优控件:DSpark 每步提议的 draft token 数。
// showWhen 依赖引擎注入的 specAlgorithm——只有 Flash Official + DSPARK 才显示。
flagSelects: [
  {
    id: "dsparkDraftTokens",
    title: "DSpark Proposed Draft Tokens",
    showWhen: (base) => base.variant === "flash-official" && base.specAlgorithm === "DSPARK",
    control: "slider",
    stripPrefixes: ["--speculative-dspark-block-size"],
    options: [
      { id: "auto", label: "Checkpoint default" },
      { id: "1", label: "1", flags: ["--speculative-dspark-block-size 1"] },
      { id: "2", label: "2", flags: ["--speculative-dspark-block-size 2"] },
      { id: "3", label: "3", flags: ["--speculative-dspark-block-size 3"] },
      { id: "4", label: "4", flags: ["--speculative-dspark-block-size 4"] },
      { id: "5", label: "5", flags: ["--speculative-dspark-block-size 5"] },
    ],
  },
],

评论区精华

没有提炼出高价值讨论线程

当前评论区没有形成足够清晰的争议点或结论,后续有更多讨论时会体现在这里。

风险与影响

  1. 全局组件回归风险_playground.jsx 是所有模型 Playground 页面共用的引擎,本次修改了 pdDisagg.apply / getRenderHints 签名与 constraintBase 的推导方式,任何逻辑错误都会影响非 DeepSeek 页面;该文件没有任何单元测试覆盖。
  2. 约束管线重复执行constraintEffective = applyAllDeltas(...) 会在渲染阶段再次运行完整 apply 管线,若某个 handler 并非纯函数(例如依赖外部可变状态),可能导致 pdMode 或 flags 在两次执行间不一致。
  3. 未验证矩阵单元可见:B200 等 flash-official cell 的 verified: false 仍会向用户展示,文档页面可能呈现未被端到端验证的启动命令。
  4. DSpark 限制依赖配置状态:DSpark 与 DP Attention / PD 拆分 / ROCm 的互斥完全由配置与引擎逻辑共同保证,若未来 checkpoint 改变 draft 行为,配置矩阵需要同步维护,否则可能生成不兼容命令。

影响范围:文档站点用户(尤其是希望部署 DeepSeek-V4-Flash-0731 的工程师)可直接获得经过验证的低延迟配方与实测性能数据; 所有使用 Docs Playground 的模型页面都会受到 _playground.jsx 引擎改动的影响。影响程度中等偏低:不涉及运行时服务代码,但 DSpark 约束逻辑与 benchmark 数据直接决定用户生成的启动命令,错误信息会传导到生产部署。

全局组件无测试 未验证矩阵单元可见 约束管线重复执行 DSpark 限制依赖配置状态

关联 Issue

未识别关联 Issue

当前没有检测到明确关联的 Issue 链接,后续同步到相关引用后会出现在这里。

完整报告

参与讨论