执行摘要
该PR为SGLang文档新增了InclusionAI Ling-2.6模型家族的cookbook,包含两个交互式部署选择器组件(Ling-2.6-flash和Ling-2.6-1T)、一个主文档页面(MDX)和导航配置更新。已合并,但review自动化检查提出了React import缺失、变量未使用等未解决问题。
功能与动机
Ling-2.6是InclusionAI的新一代语言模型,包含104B/7.4B活跃参数的BF16 MoE模型(flash)和约1T参数的FP8 MoE模型(1T)。PR body指出两者共享1:7 MLA + Lightning Linear hybrid attention backbone,旨在提升推理效率和agent工作负载表现。该cookbook提供部署命令生成器、thinking模式说明和工具调用配置,降低用户使用门槛。
实现拆解
- 新增Ling-2.6-flash部署选择器:
ling-26-flash-deployment.jsx 创建React组件,提供硬件(H20-3e/H100/H200/B200)、YaRN上下文长度(128K/256K)、工具调用parser和推理parser选项,根据选择生成glang serve命令。
- 新增Ling-2.6-1T部署选择器:
ling-26-1t-deployment.jsx 创建React组件,支持单节点(GB300/GB200 TP=4)和双节点(H200/B200 TP=8+PP=2)部署,包含相同的可选parser。
- 撰写cookbook文档:
Ling-2.6.mdx 包含模型架构描述、性能数据、安装指引、部署命令(通过导入组件嵌入)、thinking模式详细说明(默认关闭,需通过系统消息启用)和参考基准(GSM8K 96.21%)。
- 更新导航配置:在
docs.json 的InclusionAI分组中添加 Ling-2.6 页面入口。
- 修订与润色:经过7次后续提交,移除了dead envPrefix逻辑、统一使用
sglang serve CLI、修正thinking模式锚点slug、调整安装章节措辞。
docs_new/src/snippets/autoregressive/ling-26-1t-deployment.jsx
核心组件,实现1T模型的双节点/单节点部署命令生成,包含工具调用和推理parser逻辑。
docs_new/src/snippets/autoregressive/ling-26-flash-deployment.jsx
flash模型部署选择器,支持H20/H100/H200/B200单节点,并包含YaRN上下文长度切换。
关键源码片段
docs_new/src/snippets/autoregressive/ling-26-1t-deployment.jsx
核心组件,实现1T模型的双节点/单节点部署命令生成,包含工具调用和推理parser逻辑。
// Ling-2.6-1T 部署命令生成
const generateCommand = () => {
const { hardware, toolcall, reasoning } = values;
const isSingleNode = hardware === 'gb300' || hardware === 'gb200';
// 辅助函数:追加模型加载优化与可选 parser(注意参数内嵌双引号需转义)
const tail = (cmd) => {
let out = cmd;
out += ` \
--model-loader-extra-config '{"enable_multithread_load":"true","num_threads":64}'`;
if (toolcall === 'enabled') out += ` \
--tool-call-parser qwen`;
if (reasoning === 'enabled') out += ` \
--reasoning-parser qwen3`;
return out;
};
if (isSingleNode) {
// 单节点:GB300 或 GB200,TP=4
let cmd = `sglang serve \\n`;
cmd += ` --model-path inclusionAI/Ling-2.6-1T \\n`;
cmd += ` --tp-size 4 \\n`;
cmd += ` --trust-remote-code \\n`;
cmd += ` --host 0.0.0.0 \\n`;
cmd += ` --port \${PORT}`;
return tail(cmd);
}
// 双节点:H200 或 B200,TP=8 + PP=2
const generateNodeCmd = (rank) => {
let cmd = `sglang serve \\n`;
cmd += ` --model-path inclusionAI/Ling-2.6-1T \\n`;
cmd += ` --tp-size 8 \\n`;
cmd += ` --pp-size 2 \\n`;
cmd += ` --nnodes 2 \\n`;
cmd += ` --node-rank ${rank} \\n`;
cmd += ` --trust-remote-code \\n`;
if (rank === 0) {
cmd += ` --host 0.0.0.0 \\n`;
cmd += ` --port \${PORT} \\n`;
}
cmd += ` --dist-init-addr \${MASTER_IP}:\${DIST_PORT}`;
return tail(cmd);
};
let output = `# MASTER_IP 为节点 0 的 IP。PORT 和 DIST_PORT 可自行指定。
`;
output += `# 节点 0:\n`;
output += generateNodeCmd(0);
output += `
# 节点 1:\n`;
output += generateNodeCmd(1);
return output;
};
docs_new/src/snippets/autoregressive/ling-26-flash-deployment.jsx
flash模型部署选择器,支持H20/H100/H200/B200单节点,并包含YaRN上下文长度切换。
// Ling-2.6-flash 部署命令生成(始终单节点 TP=4)
const generateCommand = () => {
const { yarn, toolcall, reasoning } = values;
// 注意:hardware 选择未影响命令,所有硬件使用相同参数(可能未来扩展性能提示)
let cmd = `sglang serve \\n`;
cmd += ` --model-path inclusionAI/Ling-2.6-flash \\n`;
cmd += ` --tp-size 4 \\n`;
cmd += ` --trust-remote-code \\n`;
cmd += ` --host 0.0.0.0 \\n`;
cmd += ` --port \${PORT}`;
if (yarn === 'enabled') {
// YaRN 扩展到 256K 上下文
cmd += ` \
--context-length 262144`;
cmd += ` \
--json-model-override-args '{"rope_scaling": {"rope_type": "yarn", "factor": 2.0, "rope_theta": 6000000, "partial_rotary_factor": 0.5, "original_max_position_embeddings": 131072}}'`;
}
if (toolcall === 'enabled') {
cmd += ` \
--tool-call-parser qwen25`;
}
if (reasoning === 'enabled') {
cmd += ` \
--reasoning-parser qwen3`;
}
return cmd;
};
评论区精华
gemini-code-assist[bot]: “[Both components] use useState and useEffect hooks but does not import them from react. This will cause a ReferenceError at runtime unless these are provided globally by the build environment.” — 两个组件均缺少React hooks import,构成构建风险。
gemini-code-assist[bot]: “The logic for envPrefix is currently ineffective because isGB and isSingleNode are derived from the same hardware IDs. As a result, isGB && !isSingleNode is always false.” — 发现dead代码,已在后续commit中清理。
gemini-code-assist[bot]: “The hardware selection is extracted from values but never used to modify the generated command. If the command is indeed identical for all listed hardware, consider removing the selector.” — 建议移除或有效利用hardware选择器,目前未处理。
风险与影响
- 构建风险:两个JSX组件缺少React hooks import,虽可能被文档构建工具全局注入,但不符合标准要求,存在白屏风险。
- 命令准确性:flash模型部署命令未进行实际验证(PR body标注),用户可能遇到参数无效。同时
--model-loader-extra-config 的JSON转义方式在某些shell可能失败。
- 用户体验:flash选择器中的hardware选项对命令无影响,用户切选项后命令不变可能造成困惑。
- 影响范围:仅文档站点变化,不影响SGLang运行时。对用户是正向引导,降低新模型部署门槛。
关联脉络
该PR与近期多个模型cookbook(如 #23907 Nemotron 3 Nano Omni、#23945 MiMo V2.5 MTP)共同表明SGLang团队在扩展文档对新模型家族的支持,并逐渐采用交互式JSX部署选择器。这些PR通常遵循相同的模式:创建JSX片段、MDX文档和更新docs.json。此模式有助于降低模型集成文档的维护成本。
参与讨论