# PR #26004 完整报告

- 仓库：`sgl-project/sglang`
- 标题：Default MegaMoE to W4A8 for Max-Throughput recipe
- 合并时间：2026-05-22 02:54
- 原文链接：http://prhub.com.cn/sgl-project/sglang/pull/26004

---

## 执行摘要

PR 26004 针对 DeepSeek-V4 的部署配置 UI 进行增强：当用户选择 Max-Throughput 配方且硬件为 Blackwell 时，自动将 MegaMoE 默认设为 W4A8（最佳吞吐配置），同时避免与 DeepEP 标志冲突。变更仅涉及一个前端 JSX 文件，风险低，逻辑清晰。

## 功能与动机

此 PR 旨在提升 Blackwell 硬件上 Max-Throughput 配方的开箱即用体验。当用户切换至 Max-Throughput 配方时，自动选择 W4A8 量化，无需手动设置，且确保 MegaMoE 启用时不传递与 DeepEP 相关的命令行标志。

## 实现拆解

1. **自动默认逻辑**：在 `handleRadioChange` 函数中，当配方或硬件切换为 `max-throughput` 且当前 `megamoe` 为 `disabled` 且硬件支持时，将 `megamoe` 设为 `w4a8`。
2. **条件化 DeepEP 标志**：在生成命令的两处代码中，将原本的无条件推入 `DEEPEP_LARGE_SMS_FLAG` 改为仅在 `megamoe === "disabled"` 时推入，避免与 MegaMoE 后端冲突。

### `docs_new/src/snippets/autoregressive/deepseek-v4-deployment.jsx`

该文件是唯一的变更文件，包含所有逻辑修改：自动默认 MegaMoE 为 W4A8 以及条件化 DeepEP 标志。

```jsx
// ... 前面的代码

const handleRadioChange = (optionName, value) => {
    setValues((prev) => {
      const next = { ...prev, [optionName]: value };
      // Switching to a Marlin (FP4) Hopper path while cp / pd-disagg is
      // selected: fall back to low-latency since those recipes are not
      // supported on Marlin.
      if (
        optionName === "hardware" &&
        MARLIN_HARDWARE.has(value) &&
        MARLIN_UNSUPPORTED_RECIPES.has(next.recipe)
      ) {
        next.recipe = "low-latency";
      }
      // Switching to a hardware/recipe combo that doesn't support MegaMoE
      // while w4a8 / w4a4 is selected: fall back to disabled.
      if (
        (optionName === "hardware" || optionName === "recipe") &&
        next.megamoe !== "disabled" &&
        isMegamoeUnsupported(next)
      ) {
        next.megamoe = "disabled";
      }
      // Switching to max-throughput on supported hardware: default MegaMoE to
      // W4A8 if it's currently disabled (best throughput config).
      if (
        (optionName === "recipe" || optionName === "hardware") &&
        next.recipe === "max-throughput" &&
        next.megamoe === "disabled" &&
        !isMegamoeUnsupported(next)
      ) {
        next.megamoe = "w4a8";
      }
      return next;
    });
  };

// ... generateCommand 中的修改
// allinone H200 gates DEEPEP_LARGE_SMS_FLAG on !multinode — only H200 big
// is multi-node; all Blackwell cells get the flag unconditionally.
// Skip when MegaMoE is enabled (uses its own backend, not DeepEP).
if (!multinode && megamoe === "disabled") flags.push(DEEPEP_LARGE_SMS_FLAG);
// ... 另一个类似位置
if (!multinode && megamoe === "disabled") flags.push(DEEPEP_LARGE_SMS_FLAG);

```

## 评论区精华

无 Review 评论。

## 风险与影响

风险极低。变更仅影响 UI 交互逻辑，不涉及后端或核心推理路径。若 `isMegamoeUnsupported` 判断有误，可能导致错误默认，但现有逻辑已作保护。用户仍可手动调整至 W4A4 或禁用。

## 关联脉络

此 PR 为 DeepSeek-V4 部署配置的持续优化，与之前的 MoE 重构和性能调优工作一脉相承，但无直接关联 PR。