<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>SGLang on Echo的技术博客</title><link>https://cybersecurityerial.github.io/echo_blog/series/sglang/</link><description>Recent content in SGLang on Echo的技术博客</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Tue, 28 Jul 2026 20:55:18 +0800</lastBuildDate><atom:link href="https://cybersecurityerial.github.io/echo_blog/series/sglang/index.xml" rel="self" type="application/rss+xml"/><item><title>LLM System: SGLang 01 - 共享专家融合</title><link>https://cybersecurityerial.github.io/echo_blog/posts/llm-system-sglang-01-shared-expert-fusion/</link><pubDate>Tue, 28 Jul 2026 20:55:18 +0800</pubDate><guid>https://cybersecurityerial.github.io/echo_blog/posts/llm-system-sglang-01-shared-expert-fusion/</guid><description>&lt;blockquote&gt;
&lt;p&gt;这篇笔记把 SGLang 共享专家融合的计算语义、权重布局和执行路径压缩成六张结构图。图中的实现判断以 2026-07-29 的 SGLang &lt;code&gt;main&lt;/code&gt; 分支为准；正文只补充图中容易误读的部分。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="从双路径到一次-moe-gemm"&gt;从双路径到一次 MoE GEMM&lt;/h2&gt;
&lt;p&gt;&lt;img alt="SGLang 共享专家融合：从双路径到一次 MoE GEMM" loading="lazy" src="https://cybersecurityerial.github.io/echo_blog/images/llm-system-sglang-shared-expert-fusion/01-fusion-overview.png"&gt;&lt;/p&gt;
&lt;p&gt;融合不是让 Router 在 Shared Expert 与 Routed Expert 之间做选择。Shared Expert 仍然是必经计算，只是被追加为一个额外的 Expert Slot，并随路由结果一起交给 MoE Kernel。这样 Routed Expert 与 Shared Expert 可以在一次 MoE GEMM 中完成，省去独立的 Shared Expert GEMM 与 Kernel Launch。&lt;/p&gt;
&lt;h2 id="layouttop-k-与权重重映射"&gt;Layout、Top-K 与权重重映射&lt;/h2&gt;
&lt;p&gt;&lt;img alt="SGLang 共享专家融合的 Layout、Top-K 与权重重映射" loading="lazy" src="https://cybersecurityerial.github.io/echo_blog/images/llm-system-sglang-shared-expert-fusion/02-layout-topk-weight-remap.png"&gt;&lt;/p&gt;
&lt;p&gt;普通布局是在 &lt;code&gt;N&lt;/code&gt; 个 Routed Expert 后追加一个 Shared Expert，得到 &lt;code&gt;N + 1&lt;/code&gt; 个 Slot，并把实际执行的 Expert 数增加一。当前 DeepEP / Mega 系列后端还需要为各个 EP Rank 保留本地 Shared Expert Slot，因此布局会扩展为 &lt;code&gt;N + EP_size&lt;/code&gt;。Checkpoint Loader 随后把 &lt;code&gt;mlp.shared_experts&lt;/code&gt; 的权重重映射到追加的 Slot；只改 Expert ID 而不改加载布局，并不能得到正确结果。&lt;/p&gt;</description></item></channel></rss>