|
|
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="720" viewBox="0 0 1200 720" role="img" aria-labelledby="title desc">
|
|
|
<title id="title">FreeToken 的磁盘、内存、CPU 和 GPU 内存层次</title>
|
|
|
<desc id="desc">模型从磁盘进入主机内存,完整专家池留在内存;非专家权重、KV Cache 和热点专家位于 GPU,缓存未命中可传输到 GPU 或交由 CPU 计算。</desc>
|
|
|
<defs>
|
|
|
<marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto">
|
|
|
<path d="M0,0 L0,6 L9,3 z" fill="#53606b"/>
|
|
|
</marker>
|
|
|
<style>
|
|
|
.t{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;fill:#17212b}
|
|
|
.muted{fill:#5d6873;font-size:16px}
|
|
|
.head{font-size:24px;font-weight:700}
|
|
|
.label{font-size:18px;font-weight:650}
|
|
|
.line{stroke:#53606b;stroke-width:3;fill:none;marker-end:url(#arrow)}
|
|
|
.dash{stroke:#53606b;stroke-width:2.5;stroke-dasharray:9 8;fill:none;marker-end:url(#arrow)}
|
|
|
</style>
|
|
|
</defs>
|
|
|
<rect width="1200" height="720" fill="#f6f8fa"/>
|
|
|
<text class="t" x="50" y="55" font-size="30" font-weight="700">FreeToken 不是把模型塞进显存,而是建立两级专家内存</text>
|
|
|
|
|
|
<rect x="45" y="160" width="210" height="255" rx="8" fill="#ffffff" stroke="#8f99a3" stroke-width="2"/>
|
|
|
<text class="t head" x="150" y="207" text-anchor="middle">NVMe / 磁盘</text>
|
|
|
<g transform="translate(85 240)">
|
|
|
<rect x="0" y="0" width="130" height="86" rx="8" fill="#e7eaed" stroke="#727d87" stroke-width="2"/>
|
|
|
<circle cx="105" cy="22" r="6" fill="#1f8a70"/>
|
|
|
<path d="M18 24 H85 M18 43 H112 M18 62 H98" stroke="#727d87" stroke-width="7"/>
|
|
|
</g>
|
|
|
<text class="t muted" x="150" y="362" text-anchor="middle">HF checkpoint / FTW</text>
|
|
|
<text class="t muted" x="150" y="388" text-anchor="middle">容量大,启动时读取</text>
|
|
|
|
|
|
<path class="line" d="M265 287 H337"/>
|
|
|
<text class="t muted" x="301" y="270" text-anchor="middle">加载</text>
|
|
|
|
|
|
<rect x="350" y="100" width="360" height="500" rx="8" fill="#ffffff" stroke="#1f8a70" stroke-width="3"/>
|
|
|
<text class="t head" x="530" y="145" text-anchor="middle">Host RAM</text>
|
|
|
<text class="t muted" x="530" y="173" text-anchor="middle">完整专家池,始终是 source of truth</text>
|
|
|
<rect x="385" y="205" width="290" height="250" rx="8" fill="#e7f5ef" stroke="#1f8a70" stroke-width="2"/>
|
|
|
<text class="t label" x="530" y="240" text-anchor="middle">所有 routed experts</text>
|
|
|
<g fill="#64b69f">
|
|
|
<rect x="415" y="270" width="48" height="38" rx="4"/>
|
|
|
<rect x="476" y="270" width="48" height="38" rx="4"/>
|
|
|
<rect x="537" y="270" width="48" height="38" rx="4"/>
|
|
|
<rect x="598" y="270" width="48" height="38" rx="4"/>
|
|
|
<rect x="415" y="321" width="48" height="38" rx="4"/>
|
|
|
<rect x="476" y="321" width="48" height="38" rx="4"/>
|
|
|
<rect x="537" y="321" width="48" height="38" rx="4"/>
|
|
|
<rect x="598" y="321" width="48" height="38" rx="4"/>
|
|
|
<rect x="415" y="372" width="48" height="38" rx="4"/>
|
|
|
<rect x="476" y="372" width="48" height="38" rx="4"/>
|
|
|
<rect x="537" y="372" width="48" height="38" rx="4"/>
|
|
|
<rect x="598" y="372" width="48" height="38" rx="4"/>
|
|
|
</g>
|
|
|
<text class="t muted" x="530" y="438" text-anchor="middle">例如 40 × 256 个 layer-expert</text>
|
|
|
<rect x="385" y="488" width="290" height="76" rx="8" fill="#fff0d6" stroke="#d59224" stroke-width="2"/>
|
|
|
<text class="t label" x="530" y="520" text-anchor="middle">Pinned expert banks</text>
|
|
|
<text class="t muted" x="530" y="548" text-anchor="middle">按 flat_id = layer × E + expert 排列</text>
|
|
|
|
|
|
<path class="line" d="M720 250 H790"/>
|
|
|
<text class="t muted" x="755" y="230" text-anchor="middle">PCIe DMA</text>
|
|
|
<path class="dash" d="M710 490 C770 490 760 605 835 605"/>
|
|
|
<text class="t muted" x="754" y="530" text-anchor="middle">miss 直接计算</text>
|
|
|
|
|
|
<rect x="805" y="75" width="350" height="480" rx="8" fill="#ffffff" stroke="#2979b9" stroke-width="3"/>
|
|
|
<text class="t head" x="980" y="120" text-anchor="middle">GPU VRAM</text>
|
|
|
<text class="t muted" x="980" y="148" text-anchor="middle">小而快,按运行时需求分配</text>
|
|
|
<rect x="840" y="180" width="280" height="76" rx="8" fill="#e8f1fb" stroke="#2979b9" stroke-width="2"/>
|
|
|
<text class="t label" x="980" y="214" text-anchor="middle">非专家权重</text>
|
|
|
<text class="t muted" x="980" y="240" text-anchor="middle">Attention / Router / GDN 等</text>
|
|
|
<rect x="840" y="280" width="280" height="135" rx="8" fill="#fdebe8" stroke="#e85d4a" stroke-width="2"/>
|
|
|
<text class="t label" x="980" y="314" text-anchor="middle">全局 LRU 专家 slot</text>
|
|
|
<g>
|
|
|
<rect x="870" y="340" width="45" height="42" rx="4" fill="#e85d4a"/>
|
|
|
<rect x="925" y="340" width="45" height="42" rx="4" fill="#e85d4a"/>
|
|
|
<rect x="980" y="340" width="45" height="42" rx="4" fill="#e85d4a"/>
|
|
|
<rect x="1035" y="340" width="45" height="42" rx="4" fill="#cfd6dc"/>
|
|
|
</g>
|
|
|
<text class="t muted" x="980" y="400" text-anchor="middle">只保留最近使用的一部分专家</text>
|
|
|
<rect x="840" y="440" width="132" height="76" rx="8" fill="#eee9fb" stroke="#7559b8" stroke-width="2"/>
|
|
|
<text class="t label" x="906" y="474" text-anchor="middle">KV Cache</text>
|
|
|
<text class="t muted" x="906" y="498" text-anchor="middle">随上下文增长</text>
|
|
|
<rect x="988" y="440" width="132" height="76" rx="8" fill="#fff0d6" stroke="#d59224" stroke-width="2"/>
|
|
|
<text class="t label" x="1054" y="474" text-anchor="middle">工作区</text>
|
|
|
<text class="t muted" x="1054" y="498" text-anchor="middle">Graph / 激活</text>
|
|
|
|
|
|
<rect x="835" y="580" width="290" height="88" rx="8" fill="#ffffff" stroke="#8f99a3" stroke-width="2"/>
|
|
|
<text class="t head" x="980" y="616" text-anchor="middle">CPU Executor</text>
|
|
|
<text class="t muted" x="980" y="644" text-anchor="middle">用剩余内存带宽计算部分 miss</text>
|
|
|
<path class="line" d="M980 575 V530"/>
|
|
|
|
|
|
<text class="t" x="535" y="674" font-size="18" font-weight="650" text-anchor="middle">8GB 只是最上面这一层;完整模型还使用了系统内存</text>
|
|
|
</svg>
|