Prhub

#28340 feat(cookbook): MTP --max-running-requests callout + skill sync

原始 PR 作者 zijiexia 合并时间 2026-06-16 06:53 文件变更 5 提交数 1 评论 2 代码增减 +107 / -37

执行摘要

MTP callout 提示 + 技能文档同步

若未明确设置 --max-running-requests,SGLang 的 speculative hook 会将其强制重置为 48,可能导致高并发下性能不佳,需通过 UI 提前警示。同时,技能文档的同步是为了完成之前迁移轮次中 deferred 的工作,统一 benchmark 版本锚定规则。

值得查阅,特别是技能文档的 benchmark 规则部分,对 cookbook 作者有约束力。UI 提示的设计(flag-based 而非 strategy-based)也值得借鉴。

讨论亮点

无显著讨论。审核人 wisdomlmy0611 已批准。

实现拆解

  1. Engine UI:在 _deployment.jsx 的 derived values 部分添加 mtpHint 变量(检测 --speculative-algorithm 存在且无 --max-running-requests),并在命令区域下方渲染琥珀色 div 提示;_playground.jsx 同理,但作用于用户调整后的有效 flags pgFlagsLatest
  2. 技能文档更新cookbook-migrate-model/SKILL.md 重写 benchmark 规则(sglang_version 必须可复现:release/commit/PR,否则丢弃整个结果;禁止继承跨模型数据);明确 flagSelects 作为标准轴(无需引擎变更);更新 NEXTN→EAGLE 别名。
  3. 引用文档同步dimension-mapping.md 新增 flagSelects 轴说明,重申引擎不可变原则;authoring-reference.md 添加可复现 anchor 要求和 MTP callout 自动显示说明。
文件 模块 状态 重要度
docs_new/src/snippets/_deployment.jsx 文档 UI modified 5.98
docs_new/src/snippets/_playground.jsx 文档 UI modified 5.98
.claude/skills/cookbook-migrate-model/SKILL.md 技能文档 modified 3.72
.claude/skills/cookbook-migrate-model/references/dimension-mapping.md 技能文档 modified 3.82
.claude/skills/cookbook-add-model/references/authoring-reference.md 技能文档 modified 2.78

关键源码片段

docs_new/src/snippets/_deployment.jsx core-logic

核心引擎变更,添加 MTP callout 提示,基于 flags 检测显示。

// mtpWarn: 琥珀色提示框样式
mtpWarn: {
  margin: "8px 0 0", padding: "8px 12px", borderRadius: "8px",
  fontSize: "12px", lineHeight: "1.45",
  background: isDark ? "#78350f" : "#fef3c7",
  color: isDark ? "#fde68a" : "#92400e",
  border: `1px solid ${isDark ? "#92400e" : "#fcd34d"}`,
},
// 在 derived values 中:基于当前 cell 的 flags 判断是否触发提示
const mtpHint =
  !!cell &&
  (cell.flags || []).some((f) => f.split(/[\s=]/)[0] === "--speculative-algorithm") &&
  !(cell.flags || []).some((f) => f.split(/[\s=]/)[0] === "--max-running-requests");
// 在命令显示区域下方渲染提示
{mtpHint && (
  <div style={s.mtpWarn}>
    ⚠️ Speculative decoding (MTP) is on  SGLang resets <code>--max-running-requests</code> to <strong>48</strong> when it isn't set.
    Add <code>--max-running-requests &lt;N&gt;</code> sized for your target concurrency.
  </div>
)}
docs_new/src/snippets/_playground.jsx core-logic

核心引擎变更,添加 Playground 面板中的 MTP callout。

// mtpWarn 样式同 _deployment.jsx
mtpWarn: {
  margin: "8px 0 0", padding: "8px 12px", borderRadius: "8px",
  fontSize: "12px", lineHeight: "1.45",
  background: isDark ? "#78350f" : "#fef3c7",
  color: isDark ? "#fde68a" : "#92400e",
  border: `1px solid ${isDark ? "#92400e" : "#fcd34d"}`,
},
// 基于 post-override 的有效 flags 判断
const pgMtpHint =
  pgFlagsLatest.some((f) => f.split(/[\s=]/)[0] === "--speculative-algorithm") &&
  !pgFlagsLatest.some((f) => f.split(/[\s=]/)[0] === "--max-running-requests");
// 渲染提示
{pgMtpHint && (
  <div style={s.mtpWarn}>
    ⚠️ Speculative decoding (MTP) is on  SGLang resets <code>--max-running-requests</code> to <strong>48</strong> when it isn't set.
    Add <code>--max-running-requests &lt;N&gt;</code> sized for your target concurrency.
  </div>
)}

评论区精华

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

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

风险与影响

风险极低。Engine 变更仅为前端 UI 提示,不影响后端逻辑;技能文档更新对实际功能无影响。但需确保 callout 的触发条件与引擎行为一致(基于 flag 而非 strategy),避免误报或漏报。

对用户:使用 spec 但未设 max-running-requests 的用户会受到提示,可能调整参数。对系统:无性能影响。对团队:技能文档统一规则后,未来迁移更规范。

低风险 UI 变更 文档变更

关联 Issue

#28128 feat(cookbook): generic config-declared `flagSelects` playground axis

完整报告

参与讨论