<?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[实测-本人使用AMD Radeon AI PRO R9700+vLLM部署，依据官方vLLM优化方案后提示效果不错（适合小白）]]></title><description><![CDATA[<h1>Qwen3.8-27B · R9700 · vLLM V1 优化前后参数对比</h1>
<blockquote>
<p dir="auto"><strong>GPU</strong>：AMD Radeon AI PRO R9700（gfx1201 / RDNA4，32GB）<br />
<strong>服务</strong>：<code>vllm102</code> 容器（<code>stilldeadcode/vllm-radiance:0.9.3</code>，vLLM 0.27.1）<br />
<strong>优化动作</strong>：投机解码 <strong>MTP×4 → DFlash2×4</strong>（int4 draft + probabilistic 采样）</p>
</blockquote>
<hr />
<h2>一、结论速览</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>维度</th>
<th>优化前（MTP×4）</th>
<th>优化后（DFlash2×4）</th>
<th>变化</th>
</tr>
</thead>
<tbody>
<tr>
<td>单流 decode（短提示 ~49 tok）</td>
<td>40.3 tok/s</td>
<td>53.7 ~ 55.0 tok/s</td>
<td><strong>+33% ~ +37%</strong></td>
</tr>
<tr>
<td>单流 decode（2.4k 上下文）</td>
<td>46.1 ~ 48.5 tok/s</td>
<td>56.9 ~ 61.8 tok/s</td>
<td><strong>+23% ~ +34%</strong></td>
</tr>
<tr>
<td>prefill（2.4k 上下文）</td>
<td>~1700 tok/s</td>
<td>~1817 ~ 1823 tok/s</td>
<td>~+7%</td>
</tr>
<tr>
<td>引擎步速率（steps/s，短深度）</td>
<td>~15.1</td>
<td>~20.6</td>
<td><strong>+36%</strong></td>
</tr>
<tr>
<td>单步接受 draft 数（acc/step，短深度）</td>
<td>1.22 ~ 1.45</td>
<td>1.54</td>
<td>+7% ~ +26%</td>
</tr>
<tr>
<td>投机解码方式</td>
<td>目标模型自带 MTP head，K 次串行 forward</td>
<td>独立 DFlash2 draft，一次并行 forward 提 K 个 token</td>
<td>—</td>
</tr>
</tbody>
</table>
<p dir="auto"><strong>核心结论</strong>：DFlash2 用一次并行 forward 替代 MTP 的 K 次串行 forward，直接提升引擎步速率（steps/s +36%），同时 probabilistic 采样小幅提升接受率。两者叠加使单流 decode 提升 23% ~ 37%，与同机仓库实测参考值（57.31 tok/s @3.2k）吻合。</p>
<hr />
<h2>二、投机解码参数对比</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>参数</th>
<th>优化前（MTP）</th>
<th>优化后（DFlash2）</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>method</code></td>
<td><code>mtp</code></td>
<td><code>dflash</code></td>
</tr>
<tr>
<td>draft 模型</td>
<td>目标 checkpoint 自带 MTP head（无额外权重）</td>
<td>独立 draft：<code>syvai/Qwen3.8-27B-DFlash2-W4A16</code></td>
</tr>
<tr>
<td><code>num_speculative_tokens</code>（K）</td>
<td>4</td>
<td>4</td>
</tr>
<tr>
<td><code>attention_backend</code>（draft）</td>
<td><code>R4D</code>（与目标一致）</td>
<td><code>TRITON_ATTN</code>（非因果 draft 注意力）</td>
</tr>
<tr>
<td><code>draft_sample_method</code></td>
<td>—（无此参数）</td>
<td><code>probabilistic</code>（共享 Gumbel 耦合采样）</td>
</tr>
<tr>
<td><code>disable_padded_drafter_batch</code></td>
<td><code>true</code>（单流 unpad 路径）</td>
<td>无（DFlash2 不适用）</td>
</tr>
<tr>
<td>draft 权重规模</td>
<td>0（复用目标 head）</td>
<td>+1.19 GiB（compressed-tensors int4，W4A16 gs=128）</td>
</tr>
<tr>
<td>draft 结构</td>
<td>MTP 串行链</td>
<td>5 层 Qwen3，block_size=8（原生支持 K=7），sliding_window=2048</td>
</tr>
</tbody>
</table>
<p dir="auto"><strong>方法字符串说明</strong>：vLLM 0.27.1 中 DFlash2 的 <code>method</code> 为 <code>dflash</code>（<code>2</code> 体现在 draft 模型架构 <code>DFlash2DraftModel</code> 中，不在方法名里）。</p>
<hr />
<h2>三、服务启动参数（vllm 命令行）对比</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>启动参数</th>
<th>优化前</th>
<th>优化后</th>
<th>变化</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>--served-model-name</code></td>
<td><code>qwen3.8-27b-int4</code></td>
<td><code>qwen3.8-27b-int4</code></td>
<td>不变</td>
</tr>
<tr>
<td><code>--quantization</code></td>
<td><code>auto_gptq</code></td>
<td><code>auto_gptq</code></td>
<td>不变</td>
</tr>
<tr>
<td><code>--kv-cache-dtype</code></td>
<td><code>fp8</code></td>
<td><code>fp8</code></td>
<td>不变</td>
</tr>
<tr>
<td><code>--tensor-parallel-size</code></td>
<td><code>1</code></td>
<td><code>1</code></td>
<td>不变</td>
</tr>
<tr>
<td><code>--gpu-memory-utilization</code></td>
<td><code>0.95</code></td>
<td><code>0.95</code></td>
<td>不变</td>
</tr>
<tr>
<td><code>--max-model-len</code></td>
<td><code>131072</code></td>
<td><code>131072</code></td>
<td>不变</td>
</tr>
<tr>
<td><code>--max-num-seqs</code></td>
<td><code>2</code></td>
<td><code>2</code></td>
<td>不变</td>
</tr>
<tr>
<td><code>--max-num-batched-tokens</code></td>
<td><code>8192</code></td>
<td><code>8192</code></td>
<td>不变</td>
</tr>
<tr>
<td><code>--attention-backend</code></td>
<td><code>R4D</code></td>
<td><code>R4D</code></td>
<td>不变</td>
</tr>
<tr>
<td><code>--enable-prefix-caching</code></td>
<td>开</td>
<td>开</td>
<td>不变</td>
</tr>
<tr>
<td><code>--mamba-cache-mode</code></td>
<td><code>align</code></td>
<td><code>align</code></td>
<td>不变</td>
</tr>
<tr>
<td><code>--reasoning-parser</code></td>
<td><code>qwen3</code></td>
<td><code>qwen3</code></td>
<td>不变</td>
</tr>
<tr>
<td><code>--tool-call-parser</code></td>
<td><code>qwen3_xml</code></td>
<td><code>qwen3_xml</code></td>
<td>不变</td>
</tr>
<tr>
<td><code>--enable-auto-tool-choice</code></td>
<td>开</td>
<td>开</td>
<td>不变</td>
</tr>
<tr>
<td><code>--speculative-config</code></td>
<td><code>{"method":"mtp","num_speculative_tokens":4,"attention_backend":"R4D","disable_padded_drafter_batch":true}</code></td>
<td><code>{"method":"dflash","model":"/draft","num_speculative_tokens":4,"attention_backend":"TRITON_ATTN","draft_sample_method":"probabilistic"}</code></td>
<td><strong>变更</strong></td>
</tr>
<tr>
<td><code>--trust-remote-code</code></td>
<td>开</td>
<td>开</td>
<td>不变</td>
</tr>
<tr>
<td><code>--host</code> / <code>--port</code></td>
<td><code>0.0.0.0</code> / <code>8000</code></td>
<td><code>0.0.0.0</code> / <code>8000</code></td>
<td>不变</td>
</tr>
<tr>
<td><code>--api-key</code></td>
<td>沿用</td>
<td>沿用</td>
<td>不变（客户端零改动）</td>
</tr>
</tbody>
</table>
<blockquote>
<p dir="auto">除 <code>--speculative-config</code> 一项外，其余启动参数完全相同。</p>
</blockquote>
<hr />
<h2>四、模型文件对比</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>项</th>
<th>优化前</th>
<th>优化后</th>
</tr>
</thead>
<tbody>
<tr>
<td>目标模型（<code>/model</code>）</td>
<td><code>qwen3.8-27b-autoround</code>（18G，GPTQ auto_gptq W4A16 gs=128，含 int4 MTP head）</td>
<td>不变</td>
</tr>
<tr>
<td>目标模型加载量</td>
<td>17.93 GiB</td>
<td>17.69 GiB（checkpoint）</td>
</tr>
<tr>
<td>draft 模型（<code>/draft</code>）</td>
<td>无</td>
<td><code>qwen3.8-27b-dflash2-int4</code>（1.19 GiB，compressed-tensors int4 W4A16，<code>DFlash2DraftModel</code> 架构）</td>
</tr>
<tr>
<td>模型总加载量</td>
<td>17.93 GiB</td>
<td>18.91 GiB（+0.98 GiB）</td>
</tr>
</tbody>
</table>
<hr />
<h2>五、硬件与运行时状态（前后一致）</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>项</th>
<th>值</th>
</tr>
</thead>
<tbody>
<tr>
<td>GPU</td>
<td>AMD Radeon AI PRO R9700（gfx1201 / RDNA4），29.9 GiB 可用</td>
</tr>
<tr>
<td>镜像 / 运行时</td>
<td><code>stilldeadcode/vllm-radiance:0.9.3</code>（vLLM 0.27.1，radiance 0.9.3，aiter 0.1.17）</td>
</tr>
<tr>
<td>主机 ROCm</td>
<td>10.0.0~pre4（与容器一致）</td>
</tr>
<tr>
<td>RAS / UMC</td>
<td>0 correctable / 0 uncorrectable</td>
</tr>
<tr>
<td>Retired / Pending pages</td>
<td>无</td>
</tr>
<tr>
<td>原始显存带宽</td>
<td>494 GB/s（copy 读+写，健康）</td>
</tr>
<tr>
<td>时钟（decode 中）</td>
<td>SCLK ≈ 3140 MHz（顶格）· MCLK 1258 MHz</td>
</tr>
<tr>
<td>功耗</td>
<td>prefill ~280–297 W（300W 上限附近）</td>
</tr>
<tr>
<td>编译缓存</td>
<td>暖（<code>/cache/vllm</code> 共享挂载，warm boot ~3.3s 加载图）</td>
</tr>
<tr>
<td>CUDA graph</td>
<td>capture sizes [1,2,4,8,16]</td>
</tr>
</tbody>
</table>
<hr />
<h2>六、实测性能数据（2026-09-21，单流无并发）</h2>
<h3>6.1 decode / prefill / TTFT</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>指标</th>
<th>提示深度</th>
<th>优化前（MTP）</th>
<th>优化后（DFlash2）</th>
</tr>
</thead>
<tbody>
<tr>
<td>decode（tok/s）</td>
<td>~49 tok</td>
<td>40.3</td>
<td>53.7 / 55.0</td>
</tr>
<tr>
<td>decode（tok/s）</td>
<td>~2.4k tok</td>
<td>46.1 / 48.5</td>
<td>56.9 / 61.8</td>
</tr>
<tr>
<td>prefill（tok/s）</td>
<td>~2.4k tok</td>
<td>~1700</td>
<td>1817 / 1823</td>
</tr>
<tr>
<td>TTFT（s）</td>
<td>~2.4k tok</td>
<td>1.417 / 1.397</td>
<td>1.336 / 1.332</td>
</tr>
</tbody>
</table>
<blockquote>
<p dir="auto">decode 口径 = <code>usage.completion_tokens / (总时长 − TTFT)</code>，排除 TTFT；排除 SSE delta 计数误差。</p>
</blockquote>
<h3>6.2 投机解码计数（短深度 ~49 tok）</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>指标</th>
<th>优化前（MTP）</th>
<th>优化后（DFlash2）</th>
</tr>
</thead>
<tbody>
<tr>
<td>引擎步数（steps）/ 300 token</td>
<td>~127</td>
<td>~118（235 steps / 600 token）</td>
</tr>
<tr>
<td>被接受 draft 数（accepted）</td>
<td>—</td>
<td>363 / 600 token</td>
</tr>
<tr>
<td>acc/step（单步接受 draft 数）</td>
<td>1.22 ~ 1.45</td>
<td>1.54</td>
</tr>
<tr>
<td>tokens/step</td>
<td>~2.36</td>
<td>2.54</td>
</tr>
<tr>
<td>引擎步速率（steps/s）</td>
<td>~15.1</td>
<td>~20.6</td>
</tr>
</tbody>
</table>
<p dir="auto"><strong>生命周期累计统计</strong>（优化前，容器运行 10.5h）：</p>
<ul>
<li>每步接受 2.77 token；各位置接受率 72% / 49% / 33% / 23%（单调衰减，形态正常）</li>
<li>prompt 2.01M token，78.8% 为前缀缓存命中；0 次抢占</li>
</ul>
<hr />
<h2>七、优化过程中解决的两个问题</h2>
<ol>
<li>
<p dir="auto"><strong>int4 draft 加载崩溃</strong> — <code>AttributeError: 'QKVParallelLinear' object has no attribute 'weight'</code></p>
<ul>
<li>原因：镜像自带 <code>qwen3_dflash.py</code> 对 packed int4 draft 读 <code>qkv_proj.weight</code> 无 getattr 保护。</li>
<li>修复：挂载仓库 <code>patches/radiance-0.9.3/</code> 覆盖层中的 <code>qwen3_dflash.py</code>。</li>
</ul>
</li>
<li>
<p dir="auto"><strong>首次冷启动 KV 池不足</strong> — <code>5.25 GiB needed &gt; 4.04 GiB available</code>（max len 只能到 92112）</p>
<ul>
<li>原因：新 dflash 图首次冷编译，torch.compile 瞬态峰值（~2.28 GiB）压缩了 KV 池。</li>
<li>修复：重启一次（图已写入 <code>/cache</code>，warm boot 直接加载），池恢复后 131072 上下文正常服务。</li>
<li>提示：此为仓库已记录的首启陷阱，任何镜像/图变更后遇到同类报错，重启一次即可。</li>
</ul>
</li>
</ol>
<hr />
<p dir="auto"><strong>官网方案：</strong> <a href="https://rocm.docs.amd.com/projects/ai-ecosystem/en/latest/optimization/vllm-v1-optimization.html" rel="nofollow ugc">https://rocm.docs.amd.com/projects/ai-ecosystem/en/latest/optimization/vllm-v1-optimization.html</a></p>
<hr />
<p dir="auto">优化前：<br />
<img src="https://upload.lcz.me/uploads/e4b1e966-36dc-4598-8d92-02977f1213e7.jpeg" alt="bb402314-e320-4888-9652-6583215b091d-image.jpeg" class=" img-fluid img-markdown" /></p>
<hr />
<p dir="auto">优化后：<br />
<img src="https://upload.lcz.me/uploads/e07bd6b9-bc66-468a-84fe-7d247b36a098.jpeg" alt="6fb9aad5-6d67-4139-b81b-fc985d33727f-image.jpeg" class=" img-fluid img-markdown" /></p>
<p dir="auto"><img src="https://upload.lcz.me/uploads/2d4e90c7-26fa-4145-9c6d-9405cd251ad3.jpeg" alt="dfaca721-07a9-411f-9cd2-ef28d76f1dcf-image.jpeg" class=" img-fluid img-markdown" /></p>
]]></description><link>https://lcz.me/topic/1864</link><generator>RSS for Node</generator><lastBuildDate>Fri, 25 Sep 2026 21:27:24 GMT</lastBuildDate><atom:link href="https://lcz.me/topic/1864.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 21 Sep 2026 12:55:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 实测-本人使用AMD Radeon AI PRO R9700+vLLM部署，依据官方vLLM优化方案后提示效果不错（适合小白） on Mon, 21 Sep 2026 15:05:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry" aria-label="Profile: terry">@<bdi>terry</bdi></a> 好的，抱歉添麻烦了，以后我会注意检查格式再发，感谢修复！</p>
]]></description><link>https://lcz.me/post/19815</link><guid isPermaLink="true">https://lcz.me/post/19815</guid><dc:creator><![CDATA[Magic629]]></dc:creator><pubDate>Mon, 21 Sep 2026 15:05:45 GMT</pubDate></item><item><title><![CDATA[Reply to 实测-本人使用AMD Radeon AI PRO R9700+vLLM部署，依据官方vLLM优化方案后提示效果不错（适合小白） on Mon, 21 Sep 2026 13:40:01 GMT]]></title><description><![CDATA[<p dir="auto">以后发帖检查帖子格式，刚有很严重显示溢出，已经帮你修复，下不为例。</p>
]]></description><link>https://lcz.me/post/19798</link><guid isPermaLink="true">https://lcz.me/post/19798</guid><dc:creator><![CDATA[terry]]></dc:creator><pubDate>Mon, 21 Sep 2026 13:40:01 GMT</pubDate></item><item><title><![CDATA[Reply to 实测-本人使用AMD Radeon AI PRO R9700+vLLM部署，依据官方vLLM优化方案后提示效果不错（适合小白） on Mon, 21 Sep 2026 13:02:43 GMT]]></title><description><![CDATA[<p dir="auto">这篇的数据很干净，先帮你把归因钉准一点：<strong>这轮 DFlash2 的收益几乎全部来自 steps/s，不是接受率。</strong></p>
<p dir="auto">看你的计数：MTP 生命周期是 2.77 token/step，DFlash2 是 1.54 draft/step ≈ 2.54 token/step——也就是说 MTP 每步接受的 token 其实<strong>更多</strong>，但它每步要跑 K 次串行 forward，步速率只有 15.1；DFlash2 用一次并行 draft forward 把步速率拉到 20.6。decode ≈ tokens/step × steps/s，所以 2.36×15.1≈35.6 对 2.54×20.6≈52.3，量级你表里 40.3→53.7 也对得上。结论写成「并行 draft 换掉串行链、压的是步延迟」比「接受率提升」准确。</p>
<p dir="auto">可以补三组 A/B 把结论闭合：</p>
<ol>
<li><strong>K 扫描</strong>：DFlash2 原生 block_size=8、支持 K=7，你只用了 4。在 4/5/6/7 各测 <code>acc/step</code> 与 <code>steps/s</code>，看净收益拐点。</li>
<li><strong>上下文曲线</strong>：draft 的 <code>sliding_window=2048</code> 在长 ctx 下会限制接受率，建议在 0.5k / 2.4k / 8k / 32k 各记 <code>acc/step</code> 和 steps/s；你现在的 2.4k 还看不出这个拐点。</li>
<li><strong>并发</strong>：<code>--max-num-seqs 2</code> 下投机解码的净收益会明显缩水，补一组 2 并发数据，否则单流结论容易被外推到不该用的场景。</li>
</ol>
<p dir="auto">一个口径提醒：<code>draft_sample_method: probabilistic</code>（共享 Gumbel 耦合）不是 greedy 路径，做质量对照时别只比 tok/s，拿同一批 prompt 比一遍输出一致性和任务正确率，确认没被采样方式带偏。</p>
<p dir="auto">另外你记录的两点价值很高，尤其第二个：冷启动时 <code>torch.compile</code> 瞬态峰值（~2.28 GiB）挤爆 KV 池、导致 max-model-len 只能到 92112，重启 warm boot 后恢复 131072——这个是镜像/图变更后必踩的坑，写进文档能省很多人的排查时间。int4 draft 那个 <code>QKVParallelLinear has no attribute weight</code> 的 getattr patch 同理。</p>
<p dir="auto">R9700 单卡 494 GB/s 把 27B int4 跑到 55 tok/s，已经贴着带宽天花板了，这份对照很有参考意义，欢迎继续补长 ctx 和并发。</p>
]]></description><link>https://lcz.me/post/19787</link><guid isPermaLink="true">https://lcz.me/post/19787</guid><dc:creator><![CDATA[Xiaote]]></dc:creator><pubDate>Mon, 21 Sep 2026 13:02:43 GMT</pubDate></item></channel></rss>