<?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[Strata ：Swift 1.5 IQ3_XXS （3×RTX 4090 48G，本来4张坏了一张，京东买才用了2天。。。）]]></title><description><![CDATA[<p dir="auto">部署日期：2026-10-03</p>
<p dir="auto">状态：<strong>已上线运行</strong>（systemd 服务 <code>strata.service</code>，active + enabled）<br />
<img src="https://upload.lcz.me/uploads/11043cb9-3b3b-40c4-a6e9-14f516d766c7.jpeg" alt="image.jpeg" class="img-markdown  img-fluid" /></p>
<hr />
<h2>一、需求核对与偏差</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>项目</th>
<th>原始需求</th>
<th>核实结论</th>
</tr>
</thead>
<tbody>
<tr>
<td>模型名</td>
<td>Swift-Qwen3.8-Flash-Next-GSQ-RCO-IQ4</td>
<td>拼凑名，现实中不存在。真实可选的是 4 个互斥家族。已按确认实现为 <strong>Swift 1.5 + IQ3_XXS</strong></td>
</tr>
<tr>
<td>引擎版本</td>
<td>Strata v0.1.31</td>
<td>v0.1.31 存在但过时；<code>setup.py</code> 的 <code>MIN_ENGINE=(0,1,38)</code> 强制要求 <strong>v0.1.38</strong></td>
</tr>
<tr>
<td>硬件</td>
<td>3×4090 48G</td>
<td><strong>准确</strong>。nvidia-smi 实测每张 49140 MiB（48GB 版 4090）</td>
</tr>
<tr>
<td>KV cache</td>
<td>INT8</td>
<td><code>--kv int8</code>（int8 码 + 每 64 值 fp16 scale，显存减半）</td>
</tr>
<tr>
<td>上下文</td>
<td>256K</td>
<td><code>--max-context 262144</code>，为模型训练原生长度，无需 rope 扩展</td>
</tr>
</tbody>
</table>
<p dir="auto">命名拆解：“GSQ-RCO” 是 ISTA-DASLab 的量化方法（2 至 3.5 bit）；“IQ4” 属于 Unsloth 4-bit 家族（UD-Q4_K_XL）。两者属不同家族，无法组合成单一模型（来源：<a href="http://huggingface.co/ukisai/Swift-1.5-Qwen3.8-Flash-Next-GSQ-RCO-GGUF%EF%BC%89%E3%80%82" rel="nofollow ugc">huggingface.co/ukisai/Swift-1.5-Qwen3.8-Flash-Next-GSQ-RCO-GGUF）。</a></p>
<h2>二、环境实测</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>项</th>
<th>实测值</th>
</tr>
</thead>
<tbody>
<tr>
<td>GPU</td>
<td>3× NVIDIA GeForce RTX 4090，49140 MiB/张，compute capability 8.9</td>
</tr>
<tr>
<td>驱动</td>
<td>580.178.04</td>
</tr>
<tr>
<td>CPU</td>
<td>Intel Xeon Gold 6148 @ 2.40GHz ×2，80 线程，<strong>无 AVX-512</strong>（走 AVX-2 专家内核）</td>
</tr>
<tr>
<td>RAM</td>
<td>252 GB</td>
</tr>
<tr>
<td>磁盘</td>
<td>/ 938G，用 253G（模型+包+MTP 共约 79G）</td>
</tr>
<tr>
<td>OS</td>
<td>Ubuntu 22.04.5 LTS</td>
</tr>
<tr>
<td>CUDA</td>
<td>13.0.88（部署时经 cuda-keyring apt 源安装）</td>
</tr>
<tr>
<td>PCIe</td>
<td>探针 12.3 GB/s host→device，引擎据此设 pcie_frac 0.34</td>
</tr>
</tbody>
</table>
<h2>三、多卡模型分片方案</h2>
<p dir="auto">Strata 采用<strong>层切分（流水线并行，layer split）</strong>，非张量并行。一个 token 每个验证窗口跨卡一次（数百 KB 经 pinned RAM），无需 NVLink 或 P2P。</p>
<p dir="auto">配置采用显式三段切分（比 <code>auto</code> 更可预测）：</p>
<pre><code>layers  0-15  →  CUDA0
layers 16-31  →  CUDA1
layers 32-47  →  CUDA2   （末卡另跑输出头与 MTP 草稿层）
</code></pre>
<p dir="auto">引擎启动日志实测确认：<code>layer split: layers 0-15 (CUDA0), 16-31 (CUDA1), 32-47 (CUDA2), one hand-off per window</code>。</p>
<p dir="auto">各卡持有：dense 权重副本、自身会话的 KV、验证窗口与 prompt 缓冲、以及<strong>仅限自身层</strong>的专家缓存。主机 RAM 持有共享的专家 arena（39.97 GiB），CPU 池计算任何卡未持有的专家。本次实测 <strong>100% experts resident</strong>，即全部专家已驻留显存，解码几乎不触 CPU 池。</p>
<p dir="auto"><strong>注意</strong>：<code>--peer-device</code> 不可与 <code>--layer-split</code> 同用（源码 <code>generate.cpp:1718</code> 直接报错），二者是互斥的两种多卡模式，本方案不使用它。</p>
<h2>四、引擎核心参数</h2>
<p dir="auto">配置文件：<code>/root/Strata/strata-swift-iq3_xxs.json</code></p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>参数</th>
<th>值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>--pack</code></td>
<td>/root/Strata-data/packs/swift-iq3_xxs</td>
<td>引擎格式包（1.5G，1079 张量，302 原生直供）</td>
</tr>
<tr>
<td><code>--native</code></td>
<td>.../Swift-...-IQ3_XXS-00001-of-00002.gguf</td>
<td>原生 GGUF 首分片</td>
</tr>
<tr>
<td><code>--ple-gguf</code></td>
<td>同上</td>
<td>N-gram 查表（PLE）</td>
</tr>
<tr>
<td><code>--expert-profile</code></td>
<td>../data/expert-profile.bin</td>
<td>专家热力画像</td>
</tr>
<tr>
<td><code>--expert-cache</code></td>
<td>auto</td>
<td>VRAM 专家槽位（实测 8192 专家 / 11.43 GiB）</td>
</tr>
<tr>
<td><code>--prefill</code></td>
<td>auto</td>
<td>预填充分块（实测 8192 tokens）</td>
</tr>
<tr>
<td><code>--spec</code> / <code>--spec-min-p</code></td>
<td>4 / 0.5</td>
<td>MTP 推测解码窗口</td>
</tr>
<tr>
<td><code>--mtp</code></td>
<td>/root/Strata-data/mtp/rt</td>
<td>MTP 草稿层（106299 tokens，178.4 MiB）</td>
</tr>
<tr>
<td><code>--max-context</code></td>
<td><strong>262144</strong></td>
<td>256K 上下文</td>
</tr>
<tr>
<td><code>--kv</code></td>
<td><strong>int8</strong></td>
<td>INT8 KV cache</td>
</tr>
<tr>
<td><code>--kv-resident</code></td>
<td>32768</td>
<td>KV 流式：每 QSA 层 32768 cell 留显存，其余走 pinned RAM（KV 共 3.6 GB，腾出显存给专家槽）</td>
</tr>
<tr>
<td><code>--vram-reserve-mib</code></td>
<td><strong>8192</strong></td>
<td>每卡预留 8GB 显存（关键修复，见第七节）</td>
</tr>
<tr>
<td><code>gpu</code></td>
<td>[0, 1, 2]</td>
<td>参与分片的卡</td>
</tr>
<tr>
<td><code>layer_split</code></td>
<td>16,32</td>
<td>三卡分层起点</td>
</tr>
<tr>
<td><code>host</code> / <code>port</code></td>
<td>0.0.0.0 / 8080</td>
<td>对外监听</td>
</tr>
</tbody>
</table>
<h2>五、模型准备（国内网络加速）</h2>
<p dir="auto">Strata 在 Linux 上<strong>没有预编译引擎</strong>（v0.1.38 release 仅 Windows 资产），必须源码编译；同时 GitHub 大数据传输被限速、HuggingFace 直连不通。实际采用如下加速路径：</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>环节</th>
<th>常规做法的问题</th>
<th>实际做法</th>
</tr>
</thead>
<tbody>
<tr>
<td>获取源码</td>
<td><code>git clone</code> 仅 ~45KB/s</td>
<td><strong>gh-proxy 拉 tarball，7.8 MB/s</strong></td>
</tr>
<tr>
<td>llama.cpp 源码</td>
<td>setup 从 GitHub 下载，不通</td>
<td>预先用 gh-proxy 下载并解压到 <code>third_party/llama.cpp/</code></td>
</tr>
<tr>
<td>CUDA 工具链</td>
<td>需 8-10GB</td>
<td><code>cuda-keyring</code> + apt 装 <code>cuda-toolkit-13-0</code></td>
</tr>
<tr>
<td>Python 依赖</td>
<td>慢</td>
<td>系统 pip 已配阿里云源</td>
</tr>
<tr>
<td>模型（70.75GiB）</td>
<td>setup 单线程 urllib 约 2.6MB/s</td>
<td><strong>aria2c <code>-x16 -s16</code> 实测 43-66 MiB/s</strong>，预下到 <code>Strata-data/models/swift-IQ3_XXS/</code> 并写 <code>.done</code> 标记</td>
</tr>
<tr>
<td>MTP 草稿层（4.97GB）</td>
<td><code>tools/mtp_fetch.py</code> 单线程仅 1.6MB/s</td>
<td>复用其 <code>mtp-inventory.json</code>，16 线程并行 range 抓取，7.5MB/s</td>
</tr>
</tbody>
</table>
<p dir="auto">关键点：setup 判断分片是否已下载，要求文件存在<strong>且</strong>有 <code>&lt;name&gt;.done</code> 标记（<code>setup.py:3395</code>）。模型目录为 <code>Strata-data/models/&lt;family tag&gt;&lt;SIZE&gt;</code>，swift 家族 tag 为 <code>swift-</code>。</p>
<p dir="auto">产物清单：</p>
<pre><code>71G   /root/Strata-data/models      （2 个 GGUF 分片，70.75 GiB）
6.5G  /root/Strata-data/mtp         （MTP 张量 + 打包后的 gguf/rt）
1.5G  /root/Strata-data/packs       （引擎格式包）
39M   /root/Strata/engine/strata    （编译产物）
</code></pre>
<h2>六、服务启动命令</h2>
<h3>systemd（当前生产方式）</h3>
<p dir="auto">单元：<code>/etc/systemd/system/strata.service</code></p>
<pre><code class="language-ini">[Unit]
Description=Strata inference server (Swift 1.5 IQ3_XXS, 3x RTX 4090 layer split)
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
WorkingDirectory=/root/Strata
Environment=HF_ENDPOINT=https://hf-mirror.com
ExecStart=/root/Strata/.venv/bin/python /root/Strata/serve/server.py \
  --engine strata \
  --config /root/Strata/strata-swift-iq3_xxs.json \
  --port 8080
Restart=on-failure
RestartSec=15
LimitMEMLOCK=infinity
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target
</code></pre>
<p dir="auto">操作：</p>
<pre><code class="language-bash">systemctl start strata        # 启动（首次加载约 1 分钟）
systemctl status strata       # 状态
journalctl -u strata -f       # 跟踪日志
systemctl restart strata      # 重启
systemctl stop strata         # 停止
</code></pre>
<p dir="auto"><code>LimitMEMLOCK=infinity</code> 必需：引擎要 pin 约 40GB 主机内存作专家 arena。</p>
<h3>手动启动（等价）</h3>
<pre><code class="language-bash">cd /root/Strata &amp;&amp; ./run-swift-iq3_xxs.sh
</code></pre>
<h3>重新生成配置（如需改参数）</h3>
<pre><code class="language-bash">cd /root/Strata
export HF_ENDPOINT=https://hf-mirror.com
./setup.sh --setup --family swift --model IQ3_XXS \
  --context 262144 --kv int8 --vision no \
  --gpus 0,1,2 --layer-split 16,32 \
  --vram-reserve-mib 8192 \
  --host 0.0.0.0 --api-key &lt;KEY&gt; --port 8080 --yes --no-start
</code></pre>
<h2>七、部署中遇到的两个关键问题</h2>
<h3>1. OOM：<code>native dense upload blk.26.attn_qkv.weight: out of memory</code></h3>
<p dir="auto">现象：GPU0/GPU1 各占 45GB，GPU2 空；dense 权重上传失败。</p>
<p dir="auto">根因：GPU0/GPU1 被现有 <strong>SGLang 服务</strong>占用（详见第八节），仅剩约 3GB 空闲。自动分片 <code>auto</code> 把层分到了几乎占满的卡上。</p>
<p dir="auto">引擎侧诱因：<code>--kv-resident</code> 把 KV 移出显存后，<code>--expert-cache auto</code> 把释放的显存全部填成专家槽，未给 dense 权重留空间。</p>
<p dir="auto">修复：</p>
<ol>
<li>释放 GPU0/1（停 SGLang）；</li>
<li>显式 <code>layer_split=16,32</code>，避免 <code>auto</code> 的不可预期放置；</li>
<li>加 <code>--vram-reserve-mib 8192</code>，为 dense 权重与缓冲留出固定空间。</li>
</ol>
<h3>2. 显式分片优于 auto</h3>
<p dir="auto"><code>auto</code> 会尝试所有放置并挑缓存命中最高者，但受 PCIe 探针（12.3GB/s → pcie_frac 0.34）影响会过度倾向把专家塞进显存。三卡等分（16,32）行为确定，便于容量规划。</p>
<h2>八、与现有 SGLang 服务的资源冲突（重要）</h2>
<p dir="auto">服务器原有 <code>sglang-dflash2.service</code>（systemd），提供 <code>Qwen/Qwen3.8-27B</code> + DFlash2 推测解码，TP=2，端口 30000，占用 GPU0/GPU1 各约 45GB。</p>
<p dir="auto">按确认执行了：<strong>停止并禁用该服务</strong>，三卡全部让给 Strata。</p>
<pre><code class="language-bash">systemctl stop sglang-dflash2.service
systemctl disable sglang-dflash2.service
</code></pre>
<p dir="auto">影响：Qwen3.8-27B 服务（30000 端口）中断，WorkBuddy 中指向 <code>http://192.168.1.79:30000/v1</code> 的自定义模型不可用。</p>
<h3>需要恢复 SGLang 时</h3>
<p dir="auto">注意：它与 Strata 争抢 GPU0/GPU1，二者不能同时运行（除非改用单卡或重排）。</p>
<pre><code class="language-bash"># 先停 Strata 释放显存
systemctl stop strata
systemctl enable --now sglang-dflash2.service
</code></pre>
<p dir="auto">完整原始启动命令已保存在服务器 <code>/root/sglang_restart_cmd.txt</code>，同时单元文件 <code>/etc/systemd/system/sglang-dflash2.service</code> 未改动，可直接复用。</p>
<h2>九、API 使用</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>项</th>
<th>值</th>
</tr>
</thead>
<tbody>
<tr>
<td>OpenAI 兼容</td>
<td><code>http://192.168.1.79:8080/v1</code>（<code>/v1/chat/completions</code>、<code>/v1/models</code>）</td>
</tr>
<tr>
<td>Anthropic 兼容</td>
<td><code>http://192.168.1.79:8080/v1/messages</code></td>
</tr>
<tr>
<td>模型名</td>
<td><code>swift-1.5-iq3_xxs</code></td>
</tr>
<tr>
<td>API Key</td>
<td><code>sk-strata-dbd01a2eca2adc9823153870c853973b</code></td>
</tr>
<tr>
<td>Web 聊天</td>
<td><code>http://192.168.1.79:8080/</code></td>
</tr>
</tbody>
</table>
<pre><code class="language-bash">curl http://192.168.1.79:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-strata-dbd01a2eca2adc9823153870c853973b" \
  -d '{"model":"swift-1.5-iq3_xxs","messages":[{"role":"user","content":"你好"}]}'
</code></pre>
<p dir="auto"><code>reasoning_content</code> 返回思考过程，<code>timings</code> 返回 <code>predicted_per_second</code> 等实测指标。</p>
<h2>十、实测性能</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>场景</th>
<th>结果</th>
</tr>
</thead>
<tbody>
<tr>
<td>短对话解码</td>
<td><strong>179.8 tokens/s</strong>（<code>1+1</code> 用例，draft 25/30）</td>
</tr>
<tr>
<td>一般对话解码</td>
<td>130.2 tokens/s（draft 54/41）</td>
</tr>
<tr>
<td>27,108 tokens 预填充</td>
<td>4,657 tokens/s，耗时 5.82s</td>
</tr>
<tr>
<td>27K 深度解码</td>
<td>152.6 tokens/s</td>
</tr>
<tr>
<td>长上下文检索</td>
<td>从 27K tokens 中部准确取出埋入密文，<strong>通过</strong></td>
</tr>
<tr>
<td>显存占用</td>
<td>GPU0 20.3G / GPU1 22.1G / GPU2 25.7G，加载完毕仍余 28.3G 空闲</td>
</tr>
<tr>
<td>鉴权</td>
<td>无密钥 HTTP 401</td>
</tr>
<tr>
<td>接口</td>
<td>OpenAI 200 / Anthropic 200</td>
</tr>
</tbody>
</table>
<h2>十一、运维速查</h2>
<pre><code class="language-bash">systemctl status strata                     # 服务状态
journalctl -u strata -n 50                  # 最近日志
tail -f /root/Strata/strata-swift-iq3_xxs.log   # 引擎日志（含分片与缓存命中）
nvidia-smi                                  # 显存占用
nvidia-smi --query-compute-apps=pid,process_name,used_memory --format=csv
</code></pre>
<p dir="auto">调优候选（当前未启用）：</p>
<ul>
<li>显存充裕时可下调 <code>--vram-reserve-mib</code>（8192 → 4096 或 2048），给专家缓存更多空间；</li>
<li>若显存吃紧，可把 <code>--kv</code> 降为 <code>k8v4</code>（INT8 K + 4bit V，816 B/cell，比 int8 的 1056 更省）；</li>
<li>短上下文场景可将 <code>--kv-resident 0</code>，令全部 KV 驻显存。</li>
</ul>
<h2>十二、来源</h2>
<ul>
<li>引擎仓库与发布：<a href="https://github.com/Niko1221/Strata%EF%BC%88v0.1.38%EF%BC%8CMIT%EF%BC%8C%E5%9F%BA%E4%BA%8E" rel="nofollow ugc">https://github.com/Niko1221/Strata（v0.1.38，MIT，基于</a> llama.cpp/ggml）</li>
<li>引擎文档：仓库内 <code>docs/INSTALL.md</code>、<code>docs/MODELS.md</code>、<code>docs/MULTI_GPU.md</code></li>
<li>模型：<a href="https://huggingface.co/ukisai/Swift-1.5-Qwen3.8-Flash-Next-GSQ-RCO-GGUF" rel="nofollow ugc">https://huggingface.co/ukisai/Swift-1.5-Qwen3.8-Flash-Next-GSQ-RCO-GGUF</a></li>
<li>量化基础模型：<a href="https://huggingface.co/ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF" rel="nofollow ugc">https://huggingface.co/ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF</a></li>
</ul>
]]></description><link>https://lcz.me/topic/2067</link><generator>RSS for Node</generator><lastBuildDate>Mon, 12 Oct 2026 13:28:56 GMT</lastBuildDate><atom:link href="https://lcz.me/topic/2067.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 03 Oct 2026 11:45:09 GMT</pubDate><ttl>60</ttl></channel></rss>