<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[【实测】RX 7900 XT 20G 小顯存也跑 1M 上下文：Strata × Qwen4-35B-A3B UD-Q4_K_XL ＋ MTP 實測——decode 100 t/s、583K 深度測試與坑全記錄]]></title><description><![CDATA[<p dir="auto"><img src="https://forum.hws.hk/img/qwen4-19.png" alt="banner" class="img-markdown  img-fluid" /></p>
<h2>TL;DR</h2>
<ul>
<li><strong>機器</strong>：.19 — RX 7900 XT（<strong>20GB</strong> 顯存）＋ Ryzen 9 5900XT ＋ 121GB RAM</li>
<li><strong>引擎</strong>：Strata 0.2.28（build 0.1.75.0／engine 0.1.74.1）× Qwen4-35B-A3B <strong>UD-Q4_K_XL</strong> ＋ MTP</li>
<li><strong>關鍵數字</strong>：1M ctx；淺 prompt decode 92–100 t/s；286K–583K 深度 decode 64–68 t/s（MTP 接受率 72–76%）；prefill 2,400–3,800 t/s</li>
<li><strong>關鍵</strong>：20GB 顯存＋121GB RAM 的 tiering（expert cache＋KV streaming）——小顯存卡上，引擎 tiering 能力比量化档本身更重要</li>
</ul>
<h2>一、機器列表</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>項目</th>
<th>規格</th>
</tr>
</thead>
<tbody>
<tr>
<td>GPU</td>
<td>AMD RX 7900 XT（RDNA3，<strong>20GB</strong> 顯存）</td>
</tr>
<tr>
<td>CPU</td>
<td>AMD Ryzen 9 5900XT（Zen 3，16C/32T）</td>
</tr>
<tr>
<td>記憶體</td>
<td>121GB</td>
</tr>
<tr>
<td>OS</td>
<td>Ubuntu 24.04</td>
</tr>
<tr>
<td>ROCm</td>
<td>10.0（<code>/opt/rocm</code>）</td>
</tr>
</tbody>
</table>
<h2>二、引擎與模型版本</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>階段</th>
<th>引擎</th>
<th>模型</th>
<th>備註</th>
</tr>
</thead>
<tbody>
<tr>
<td>階段一（探路）</td>
<td>llama.cpp b13004（官方 ROCm 預編譯）</td>
<td>UD-Q4_K_XL（35GB，2 shards）</td>
<td>partial offload 探測</td>
</tr>
<tr>
<td>階段二（生產，2026-12-05 起）</td>
<td><strong>Strata 0.2.28</strong>（build 0.1.75.0，engine 0.1.74.1）</td>
<td>UD-Q4_K_XL ＋ MTP</td>
<td>官方 unsloth <code>mtp-Qwen4-35B-A3B-Q8_0.gguf</code>（2.0GB）→ pack 為 <code>mtp-rt</code></td>
</tr>
<tr>
<td>加測（12-05）</td>
<td>Strata（手動 pack）</td>
<td>Heretic Q4_K_M ＋ Heretic MTP head</td>
<td>四方對比矩陣</td>
</tr>
</tbody>
</table>
<h2>三、部署配置（階段二）</h2>
<pre><code class="language-bash">strata launch --model ud-q4_k_xl --family qwen4-35b-a3b --context 1048576 \
  --vision on --tune skip --access lan --no-api-key --port 8080 \
  --no-tui --yes --restart --drafting mtp --mtp on
</code></pre>
<ul>
<li>MTP draft layer：<strong>926 MiB 顯存</strong>（experts 816 ＋ dense 66）；engine args <code>--mtp &lt;rt&gt; --spec 3 --spec-min-p 0.5</code></li>
<li>Expert cache：5,974 slots／11.62 GiB（RAM tiering）</li>
<li>顯存約 19.9／20 GiB；RAM 60／121 GB</li>
</ul>
<h2>四、實測數據</h2>
<h3>4.1 MTP A/B（128K，engine 0.1.74.1）</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>場景</th>
<th style="text-align:right">suffix <code>--spec 2</code></th>
<th style="text-align:right">MTP <code>--spec 3</code></th>
<th style="text-align:right">提升</th>
<th style="text-align:right">Prefill</th>
</tr>
</thead>
<tbody>
<tr>
<td>short decode</td>
<td style="text-align:right">66.2</td>
<td style="text-align:right"><strong>100.5</strong></td>
<td style="text-align:right">+52%</td>
<td style="text-align:right">—</td>
</tr>
<tr>
<td>4k decode</td>
<td style="text-align:right">65.6</td>
<td style="text-align:right"><strong>92.5</strong></td>
<td style="text-align:right">+41%</td>
<td style="text-align:right">3,533 t/s</td>
</tr>
<tr>
<td>16k decode</td>
<td style="text-align:right">67.6</td>
<td style="text-align:right"><strong>90.3</strong></td>
<td style="text-align:right">+34%</td>
<td style="text-align:right">3,818 t/s</td>
</tr>
</tbody>
</table>
<p dir="auto">MTP 接受率：數數 91%（81/89）；代價為 draft layer 926 MiB、expert cache 6,444 → 5,974 slots。<strong>MTP 的甜頭在可預測輸出</strong>（自然文本接受率僅 72–76%）。</p>
<h3>4.2 1M vs 131K（同 engine ＋ MTP）</h3>
<p dir="auto">淺 prompt 代價（1M 設定連短 prompt 都變慢）：</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>場景</th>
<th style="text-align:right">131K＋MTP</th>
<th style="text-align:right">1M＋MTP</th>
<th style="text-align:right">差</th>
</tr>
</thead>
<tbody>
<tr>
<td>short decode</td>
<td style="text-align:right">100.5</td>
<td style="text-align:right">92.4</td>
<td style="text-align:right">-8%</td>
</tr>
<tr>
<td>4k prefill／decode</td>
<td style="text-align:right">3,533／92.5</td>
<td style="text-align:right">2,901／82.2</td>
<td style="text-align:right">-18%／-11%</td>
</tr>
<tr>
<td>16k prefill／decode</td>
<td style="text-align:right">3,818／90.3</td>
<td style="text-align:right">3,213／78.0</td>
<td style="text-align:right">-16%／-14%</td>
</tr>
</tbody>
</table>
<p dir="auto">原因：pinned RAM/slot 1.29 → 10.31 GiB、slot VRAM 1.16 → 3.81 GiB、expert cache 被壓縮、THP 碎片（<code>0 GiB free 2 MiB blocks for 19 GiB arena</code>）。</p>
<p dir="auto">深上下文（131K 直接回 HTTP 400，僅 1M 能做到）：</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>深度</th>
<th style="text-align:right">TTFT</th>
<th style="text-align:right">Prefill</th>
<th style="text-align:right">Decode</th>
<th style="text-align:right">MTP 接受率</th>
</tr>
</thead>
<tbody>
<tr>
<td>286K 自然文本</td>
<td style="text-align:right">約 96s</td>
<td style="text-align:right">約 2,830 t/s</td>
<td style="text-align:right">68.4 t/s</td>
<td style="text-align:right">76%</td>
</tr>
<tr>
<td>583K 自然文本</td>
<td style="text-align:right">約 235s</td>
<td style="text-align:right">約 2,410 t/s</td>
<td style="text-align:right">64.5 t/s</td>
<td style="text-align:right">72%</td>
</tr>
<tr>
<td>583K 數數</td>
<td style="text-align:right">約 235s</td>
<td style="text-align:right">約 2,410 t/s</td>
<td style="text-align:right"><strong>92.0 t/s</strong></td>
<td style="text-align:right"><strong>96.6%</strong>（168/174）</td>
</tr>
</tbody>
</table>
<p dir="auto">Expert cache 命中 83–91%、KV streaming VRAM 命中 90–93%——tiering 在 583K 仍然穩定。</p>
<h3>4.3 階段一對照（llama.cpp，同權重）</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>指標</th>
<th style="text-align:right">CPU-only</th>
<th style="text-align:right">GPU offload（ngl=30）</th>
</tr>
</thead>
<tbody>
<tr>
<td>Decode</td>
<td style="text-align:right">8.7 t/s</td>
<td style="text-align:right"><strong>17.5 t/s</strong>（2×）</td>
</tr>
<tr>
<td>Prefill（1K）</td>
<td style="text-align:right">約 91 t/s</td>
<td style="text-align:right"><strong>408 t/s</strong>（4–7×）</td>
</tr>
<tr>
<td>顯存</td>
<td style="text-align:right">0</td>
<td style="text-align:right">17.4GB／20GB</td>
</tr>
</tbody>
</table>
<p dir="auto">全 offload（ngl=99）→ OOM（35GB &gt; 20GB）。llama.cpp 最佳配置：ngl=30、ctx 8192、KV q4_0。</p>
<h3>4.4 Heretic Q4_K_M 四方對比（128K，手動 pack）</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>模型 × Drafter</th>
<th style="text-align:right">short</th>
<th style="text-align:right">4k</th>
<th style="text-align:right">16k</th>
<th style="text-align:right">4k prefill</th>
<th style="text-align:right">Sanity</th>
</tr>
</thead>
<tbody>
<tr>
<td>UD-Q4_K_XL suffix</td>
<td style="text-align:right">66.2</td>
<td style="text-align:right">65.6</td>
<td style="text-align:right">67.6</td>
<td style="text-align:right">3,604</td>
<td style="text-align:right">11/12</td>
</tr>
<tr>
<td>UD-Q4_K_XL MTP</td>
<td style="text-align:right">100.5</td>
<td style="text-align:right">92.5</td>
<td style="text-align:right">90.3</td>
<td style="text-align:right">3,533</td>
<td style="text-align:right">10/12</td>
</tr>
<tr>
<td>Heretic suffix</td>
<td style="text-align:right">69.7</td>
<td style="text-align:right">69.2</td>
<td style="text-align:right">69.5</td>
<td style="text-align:right">2,790</td>
<td style="text-align:right">7/12</td>
</tr>
<tr>
<td><strong>Heretic MTP</strong></td>
<td style="text-align:right"><strong>100.7</strong></td>
<td style="text-align:right">90.8</td>
<td style="text-align:right">88.4</td>
<td style="text-align:right">2,718</td>
<td style="text-align:right">9/12</td>
</tr>
</tbody>
</table>
<p dir="auto">Heretic MTP 專項：數數 <strong>117.8 t/s</strong>（接受率 96%，高於 UD 的 91%——Heretic MTP head 與其自身權重更匹配）；自然文本 91.3 t/s（79%）。Heretic prefill 略低（2,718–2,931 vs 3,533–3,925）。</p>
<h2>五、坑與注意事項</h2>
<ol>
<li><strong>Strata 不接受非標準 GGUF 指紋</strong>：qwen4exp builds 要求 1224 tensors；Heretic Q4_K_M 僅 882（無 in-file MTP block、PLE 表在檔內）→ <code>strata launch --model-path</code> 與 <code>models import</code> 皆拒絕。需手動 pack：<code>qwen4_split_gguf.py</code>（trunk40 view，剝離 21G PLE 表）→ <code>iq_pack.py --compat-bf16</code> → <code>mtp_qwen4_rt.py</code> → 復用 expert profile → <code>strata serve --profile</code>。</li>
<li><strong>iq_pack 拒絕 merged tensors</strong>：必須餵 trunk40 view，而非原始 GGUF。</li>
<li><strong>run config 的 model_name 陷阱</strong>：名稱不被識別時 <code>build_of_model_name</code> 回 None → qwen4_kind 邏輯誤判 MTP rt 目錄「file missing」→ 剝走 <code>--mtp</code> 跌回 <code>--spec 2</code>。解法：config 不放 <code>qwen4_mtp*</code> keys，直接將 <code>--mtp / --spec / --spec-min-p</code> 寫入 args。</li>
<li><strong>手動 <code>nohup engine --serve</code> 不會 bind port</strong>：engine 的 stdin 為控制通道，EOF 被當作 stop。必須經 <code>strata serve --profile</code> 管理生命週期。</li>
<li><strong>prefix cache 污染重複量測</strong>：同一 prompt 跑兩次 → TTFT 假快、prefill 假高（38,000+ t/s）。深度測試必須使用 unique prompt。</li>
<li><strong><code>--access lan</code> 未加 <code>--no-api-key</code></strong> → 自動生成 API key（LAN 探測 401）。fleet／客戶端直連必須加 <code>--no-api-key</code>。</li>
<li><strong>20GB 顯存塞不下 Q8_0</strong>（59.4GB）——UD-Q4_K_XL（35GB）已需 tiering；MTP 接受率隨深度下降（自然文本 72–76%），甜頭主要在可預測輸出。</li>
<li><strong>THP 碎片</strong>：1M 設定下出現 <code>0 GiB free 2 MiB blocks for 19 GiB arena</code>——記憶體碎片拖慢 expert arena 讀取（-8～-18% 代價的成因之一）。</li>
</ol>
<h2>六、結論</h2>
<p dir="auto">20GB 小顯存卡＋121GB RAM 足以運行 Qwen4-35B-A3B 的 1M 上下文：Strata 的 tiering（expert cache 5,974 slots＋KV streaming 命中 90%+）讓 decode 維持 64–100 t/s、prefill 2,400–3,800 t/s。UD-Q4_K_XL ＋ MTP 為速度角色；Heretic Q4_K_M 需手動 pack 但 MTP 接受率更高（96%）。llama.cpp 路線（ngl=30 partial offload）僅 17.5 t/s——<strong>小顯存卡上，引擎 tiering 能力比量化档本身更重要</strong>。</p>
<p dir="auto"><em>量測口徑：engine 0.1.74.1；128K standard-v1 ＋ 深度 streaming 測試；fresh prompt 避免 prefix cache；顯存 19.6–19.9 GiB、GPU busy 94–100%。</em></p>
]]></description><link>https://lcz.me/topic/3593</link><generator>RSS for Node</generator><lastBuildDate>Sun, 06 Dec 2026 22:11:05 GMT</lastBuildDate><atom:link href="https://lcz.me/topic/3593.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 06 Dec 2026 03:45:41 GMT</pubDate><ttl>60</ttl></channel></rss>