<?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[【求助】有人对比过unsloth的Qwen3.8-27B-UD-Q4_K_M.gguf和Qwen3.8-27B-Q4_K_M.gguf在7900XTX上的表现么？]]></title><description><![CDATA[<p dir="auto">有人对比过unsloth的Qwen3.8-27B-UD-Q4_K_M.gguf和Qwen3.8-27B-Q4_K_M.gguf么？<br />
我是看了CHIA AN YANG的贴子准备抄作业，但是不管我怎么调试，最后跑出的结论只有写作23t/s，代码48t/s，问了DeepSeek，给我的结论是Qwen3.8-27B-UD-Q4_K_M.gguf ，是Unsloth Dynamic 混合精度量化，好像不匹配现在的vulkan。而我手里也没有Qwen3.8-27B-Q4_K_M.gguf，huggingface上也下不到这个版本了。<br />
跑了对比测试，差距还是很明显的，UD-Q4_K_M跑起来甚至不如Q5_K_M<br />
<img src="https://upload.lcz.me/uploads/313514c0-8bbe-4d8b-af80-d950cfcdda30.jpeg" alt="4114acab-6efa-4c68-b414-7785301b3ac1-image.jpeg" class=" img-fluid img-markdown" /><br />
结论清晰：</p>
<ol>
<li>模型是主因：Q5_K_M 在任何二进制下都明显快于 UD-Q4_K_M（工具-shell 63.6 vs 55.5，+15%；工具长参 54.9 vs 32.5，+69%）。b10604 二进制 + Q5 也达到 63.6 t/s，接近 70。</li>
<li>二进制差异次之：b10472 二进制 + Q5 比 b10604 二进制 + Q5 略快（69.5 vs 63.6，约 +9%）。</li>
<li>--kv-unified、context 大小等配置影响小（已排除）。<br />
为什么 Q5_K_M 比 UD-Q4_K_M 快？</li>
</ol>
<ul>
<li>UD-Q4_K_M 是 Unsloth Dynamic V3.0 混合精度量化，其张量布局可能不是 Vulkan 后端的最佳格式，dequant 开销大</li>
<li>Q5_K_M 是标准 K-quant，Vulkan 后端优化成熟</li>
<li>而且 UD-Q4 在工具调用场景的接受率也偏低，说明其 MTP 草稿质量可能也不如 Q5</li>
</ul>
<p dir="auto">分析结论汇总<br />
核心发现：性能差距的主因是模型文件，不是硬件、配置或二进制版本。<br />
通过 4 组对照实验（同一块 7900 XTX，工具-shell 负载）：<br />
<img src="https://upload.lcz.me/uploads/fc27d72c-77be-4b76-be53-1559c8842aba.jpeg" alt="17a4c6bf-62b3-4fe8-8f91-6a680d3224a8-image.jpeg" class=" img-fluid img-markdown" /><br />
三个结论：</p>
<ol>
<li>模型差异（主因）：Q5_K_M 在任何二进制下都比 UD-Q4_K_M 快 15-70%。UD-Q4_K_M（Unsloth Dynamic V3.0 混合精度）在 Vulkan 上明显吃亏，而标准 K-quant 的 Q5_K_M 优化成熟。</li>
<li>二进制版本（次因）：b10472 (0.1.1-dev) 比 b10604 (0.2.0-dev) 快约 9%，但远小于模型差异。</li>
<li>配置项影响小：--kv-unified、context 大小、-ub、n-max 均不是关键。<br />
建议：既然 b10472 + Q5_K_M 跑出 70+ t/s 是复现的，最佳方案是直接沿用那个配置。你可以：</li>
</ol>
<ul>
<li>方案 A：直接用 b10472 目录的 启动脚本 + Q5_K_M（保持现状，已验证 70+）</li>
<li>方案 B：把 b10604 的 启动脚本 改为加载 Q5_K_M 模型（用最新二进制 + 已验证的模型）</li>
</ul>
]]></description><link>https://lcz.me/topic/1309</link><generator>RSS for Node</generator><lastBuildDate>Thu, 10 Sep 2026 01:33:12 GMT</lastBuildDate><atom:link href="https://lcz.me/topic/1309.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 25 Aug 2026 10:13:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 【求助】有人对比过unsloth的Qwen3.8-27B-UD-Q4_K_M.gguf和Qwen3.8-27B-Q4_K_M.gguf在7900XTX上的表现么？ on Tue, 25 Aug 2026 13:21:18 GMT]]></title><description><![CDATA[<p dir="auto">我下载了Abiray的qwen3.8-27B-Q4_K_M，对比UD-Q4_K_M差距也有20%以上</p>
<p dir="auto"><img src="https://upload.lcz.me/uploads/f166c9eb-f069-4973-9e1e-9c88b4bbb9cb.jpeg" alt="96e2de41-5ed8-425d-bb83-8c8c4fcd1500-image.jpeg" class=" img-fluid img-markdown" /></p>
]]></description><link>https://lcz.me/post/13892</link><guid isPermaLink="true">https://lcz.me/post/13892</guid><dc:creator><![CDATA[kuntask]]></dc:creator><pubDate>Tue, 25 Aug 2026 13:21:18 GMT</pubDate></item><item><title><![CDATA[Reply to 【求助】有人对比过unsloth的Qwen3.8-27B-UD-Q4_K_M.gguf和Qwen3.8-27B-Q4_K_M.gguf在7900XTX上的表现么？ on Tue, 25 Aug 2026 13:16:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/abaalei" aria-label="Profile: abaalei">@<bdi>abaalei</bdi></a> 他用的不是unsloth的量化版本，我也是测了q5 和udq4，差距很大，他测完是差了22%，我用unsloth测完差了快70%</p>
]]></description><link>https://lcz.me/post/13890</link><guid isPermaLink="true">https://lcz.me/post/13890</guid><dc:creator><![CDATA[kuntask]]></dc:creator><pubDate>Tue, 25 Aug 2026 13:16:38 GMT</pubDate></item><item><title><![CDATA[Reply to 【求助】有人对比过unsloth的Qwen3.8-27B-UD-Q4_K_M.gguf和Qwen3.8-27B-Q4_K_M.gguf在7900XTX上的表现么？ on Tue, 25 Aug 2026 13:12:06 GMT]]></title><description><![CDATA[<p dir="auto">UD4 跟 Q5 倒是有<a href="https://lcz.me/topic/1300/%E5%8F%8C%E5%8D%A1%E5%88%AB%E6%97%A0%E8%84%91%E5%88%B7%E5%90%8C%E6%AC%BE%E6%A8%A1%E5%9E%8B-%E5%8F%8C-rx-7900-xtx-%E8%B7%91-qwen3.8-27b-%E7%9A%84%E5%BC%82%E6%9E%84%E5%88%86%E5%B7%A5%E4%B8%8E-mtp-%E5%AE%9E%E6%88%98%E8%B0%83%E4%BC%98">https://lcz.me/topic/1300/双卡别无脑刷同款模型-双-rx-7900-xtx-跑-qwen3.8-27b-的异构分工与-mtp-实战调优</a></p>
]]></description><link>https://lcz.me/post/13883</link><guid isPermaLink="true">https://lcz.me/post/13883</guid><dc:creator><![CDATA[abaalei]]></dc:creator><pubDate>Tue, 25 Aug 2026 13:12:06 GMT</pubDate></item><item><title><![CDATA[Reply to 【求助】有人对比过unsloth的Qwen3.8-27B-UD-Q4_K_M.gguf和Qwen3.8-27B-Q4_K_M.gguf在7900XTX上的表现么？ on Tue, 25 Aug 2026 11:35:59 GMT]]></title><description><![CDATA[<p dir="auto">这是Q5 的对比， 所有参数和提示都一样</p>
<h2>Q5_K_M</h2>
<p dir="auto"><img src="https://upload.lcz.me/uploads/b91a87a9-b656-4418-b1bd-986a52757dc8.png" alt="Screenshot 2026-08-25 at 19.32.27.png" class=" img-fluid img-markdown" /></p>
<h2>UD-Q5_K_M</h2>
<p dir="auto"><img src="https://upload.lcz.me/uploads/4a2697e6-8c32-4e7e-b5e4-de530d9b7874.png" alt="Screenshot 2026-08-25 at 19.34.19.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://lcz.me/post/13872</link><guid isPermaLink="true">https://lcz.me/post/13872</guid><dc:creator><![CDATA[exllm]]></dc:creator><pubDate>Tue, 25 Aug 2026 11:35:59 GMT</pubDate></item><item><title><![CDATA[Reply to 【求助】有人对比过unsloth的Qwen3.8-27B-UD-Q4_K_M.gguf和Qwen3.8-27B-Q4_K_M.gguf在7900XTX上的表现么？ on Tue, 25 Aug 2026 11:02:16 GMT]]></title><description><![CDATA[<p dir="auto">分享 rtxpro 4500 32gb 在 hauhau qwen3.8 27b 的速度，不算快，但是够我用</p>
<p dir="auto"><img src="https://upload.lcz.me/uploads/f1656106-c478-44b6-b0f1-7ef28590f02e.jpeg" alt="549fcf01-513e-46f4-8ef5-accc4f9f3a88-image.jpeg" class=" img-fluid img-markdown" /></p>
]]></description><link>https://lcz.me/post/13865</link><guid isPermaLink="true">https://lcz.me/post/13865</guid><dc:creator><![CDATA[imbiplaza ASUS]]></dc:creator><pubDate>Tue, 25 Aug 2026 11:02:16 GMT</pubDate></item><item><title><![CDATA[Reply to 【求助】有人对比过unsloth的Qwen3.8-27B-UD-Q4_K_M.gguf和Qwen3.8-27B-Q4_K_M.gguf在7900XTX上的表现么？ on Tue, 25 Aug 2026 10:51:24 GMT]]></title><description><![CDATA[<p dir="auto">呃，我只是想表述，这次unsloth 的UD量化对于7900XTX是负优化</p>
]]></description><link>https://lcz.me/post/13860</link><guid isPermaLink="true">https://lcz.me/post/13860</guid><dc:creator><![CDATA[kuntask]]></dc:creator><pubDate>Tue, 25 Aug 2026 10:51:24 GMT</pubDate></item><item><title><![CDATA[Reply to 【求助】有人对比过unsloth的Qwen3.8-27B-UD-Q4_K_M.gguf和Qwen3.8-27B-Q4_K_M.gguf在7900XTX上的表现么？ on Tue, 25 Aug 2026 10:26:21 GMT]]></title><description><![CDATA[<p dir="auto">我的Q4_K_M是 Abiray/Qwen3.8-27B-Q4_K_M.gguf. 下面是前两天让 AI 测的:<br />
<img src="https://upload.lcz.me/uploads/2ec947d0-f6f4-47e7-ba40-f471d428a677.jpeg" alt="c67480bb-c38a-4cd0-8a93-c79ae4d1dfb6-image.jpeg" class=" img-fluid img-markdown" /></p>
<p dir="auto">完整脚本如下, FYI:</p>
<pre><code>
bruin@lmde7 ~ $ cat run-model-3.8.sh
#!/bin/bash
set -uo pipefail

# TODO (progress as of 2026-08-23):
#
# 1. [DONE]  find all qwen3.8-27b models under /opt/gguf-models
#            -&gt; 4 text models + 2 mmproj + 1 imatrix (see MODEL INVENTORY below)
# 2. [DONE]  pp/tg performance: extensive benchmark of each model (with
#            different KV quantization) at different context sizes (0/40/80K)
#            -&gt; results in the MEASURED BENCHMARK MATRIX below + bench-3.8-sweep.sh
# 3. [DONE]  reproduce the "repeating loop" at high context size and provide
#            flag combinations to suppress it: --repeat-penalty, --dry-*,
#            --min-p, and the froggeric Qwen-Fixed-Chat-Templates chat template
#            -&gt; bench-3.8-loop.sh reproduced it (rep_score 0.36 -&gt; 0.18 w/ DRY)
# 4. [DONE]  max context size: explore the max servable context (&lt;256KiB) with
#            24 GiB VRAM (7900 XTX) -&gt; Ridge is the only model that holds q8_0
#            at 256K (88% VRAM); see MEASURED BENCHMARK MATRIX
# 5. [DONE]  update the following comments and script to list all possibilities
# 6. [DONE]  convert all command line options to long format (--xxxx) with
#            comments, for clarity.

# =============================================================================
# run-model-3.8.sh — Qwen3.8-27B model selector (llama.cpp Vulkan / RX 7900 XTX)
#
# Interactive menu launcher. For API-driven dynamic switching (harness lists
# models via GET /v1/models and picks one per request via the "model" field),
# use run-model-3.8-router.sh + qwen3.8-models.ini instead.
#
# Menu-driven launcher in the style of run-model.sh, now covering ALL four
# Qwen3.8-27B GGUF quantizations present on this box (see MODEL INVENTORY):
#   * Q4_K_M        (Abiray)    16.8 GiB file, ~15.3 GiB weights  [in menu]
#   * Ridge 3.7bpw  (empero-ai) 12.6 GiB file, ~11.9 GiB weights  [in menu]
#   * UD-Q4_K_M     (unsloth)   16.5 GiB file, dynamic quant      [in menu]
#   * Q5_K_S        (unsloth)   19.3 GiB file, ~17.5 GiB weights  [in menu]
#
# GOAL: maximize the servable context while keeping generation throughput (tg)
#       usable. Benchmarked 2026-08-23 on this machine with llama-benchy
#       (pp=2048, tg=128, --no-cache) against ~/llama-server-vulkan-b10485.
#       "tg" below = tokens generated / second (llama-benchy t_s_mean). See the
#       MEASURED BENCHMARK MATRIX for the full per-model / per-KV / per-depth
#       picture; results are reproducible with bench-3.8-sweep.sh.
#
# -----------------------------------------------------------------------------
# !! 320K IS NOT SERVABLE WITH THIS BINARY !!
#   llama-server b10485 hard-caps the slot at the model's native training
#   context (262144). Loading --ctx-size 327680 logs:
#     "the slot context (327680) exceeds the training context of the model
#      (262144) - capping"        -&gt;   n_ctx_slot = 262144   (verified)
#   So a 320K entry would allocate KV for 327680 tokens but still only serve
#   262144, wasting ~1.2 GiB VRAM. The PRACTICAL ceiling is 262144 (256K).
#   To truly serve 320K you must patch server-context.cpp (remove the cap) and
#   rebuild llama-server; the ready YaRN flags for that are:
#     --rope-scaling yarn --rope-scale 1.25 --yarn-orig-ctx 262144
#   (see run-3.8-q4-320k.sh for the full story).
#
# -----------------------------------------------------------------------------
# MODEL INVENTORY (TODO #1) — every Qwen3.8-27B artifact under /opt/gguf-models:
#
#   text models                                    size         notes
#   -------------------------------------------    -----------  -----------------
#   Abiray/Qwen3.8-27B-Q4_K_M.gguf                 16.8 GiB     Q4_K_M (static)
#   empero-ai/Qwen3.8-27B-Ridge-3.7bpw.gguf        12.6 GiB     3.7bpw + imatrix
#   unsloth/Qwen3.8-27B-UD-Q4_K_M.gguf             16.5 GiB     Unsloth Dynamic Q4
#   unsloth/Qwen3.8-27B-Q5_K_S.gguf                19.3 GiB     Q5_K_S (static)
#
#   multimodal projectors (Qwen3.8-27B is a native VLM)
#   -------------------------------------------    -----------  -----------------
#   unsloth/mmproj-F16.gguf                         927 MiB     F16 vision tower
#   empero-ai/mmproj-Qwen3.8-27B-BF16.gguf          931 MiB     BF16 vision tower
#
#   unsloth/imatrix_unsloth.gguf                     13 MiB     imatrix data (NOT a model)
#
#   All four text models share the Qwen3.8-27B architecture (65 layers, only
#   every 4th block is full-attention; the rest are SSM/linear blocks with no
#   KV cache). Both mmproj files are interchangeable across the four text
#   models — add "--mmproj &lt;path&gt;" to serve vision. Enabling mmproj costs
#   ~1 GiB VRAM, so shave context accordingly if you want vision.
#
# -----------------------------------------------------------------------------
# MEASURED BENCHMARK MATRIX (re-measured 2026-08-23, llama-benchy:
#   pp=2048, tg=128, --no-cache, runs=1; tg = generation t/s, i.e. the
#   t_s_mean column). VRAM% is rocm-smi at idle@load (x 24.0 GiB =&gt; GiB).
#   tg@40K / tg@80K = generation t/s with 40K / 80K tokens already filled.
#   NOTE: tg=128 is a SHORT burst; long sustained generations run ~30-45%
#   faster once the GPU reaches full boost (e.g. Q4_K_M @256K q4_0 sustains
#   ~77 t/s on a 2K-token completion vs 52.9 t/s measured here).
#
#   model    ctx     KV     VRAM%  tg@0    tg@40K  tg@80K  pp@0    note
#   ------   ------- -----  -----  ------  ------  ------  -----   ---------------
#   Ridge    262144  q4_0    71%    55.3    50.7    38.9    538     BEST max-ctx
#   Q4_K_M   262144  q4_0    89%    52.9    43.1    38.3    546     max-ctx
#   UD-Q4    262144  q4_0    88%    54.0    48.3    35.6    504     max-ctx
#   Q5_K_S   262144  q4_0    94%    19.0     9.9     7.6    344     SPILLS (bad)
#   Ridge    131072  q8_0    67%    64.8    51.6    40.5    523     fastest + quality
#   Ridge    262144  q8_0    88%    60.3     TBD     TBD     528     quality KV @256K (fits!)
#   Q4_K_M   131072  q8_0    85%    58.7    46.4    37.2    522     quality KV @128K
#   UD-Q4    131072  q8_0    84%    52.9    43.5    35.0    513     quality KV @128K
#   Q5_K_S   131072  q8_0    93%    32.8    29.4    26.7    434     tight
#
#   q4_0 KV (~18 KiB/tok) is smaller AND faster than q8_0 (~33 KiB/tok), but
#   q8_0 holds more KV precision. Ridge's ~4 GiB smaller footprint means it
#   can afford q8_0 KV (quality) where the others must fall back to q4_0 — and
#   it is the ONLY model that holds q8_0 at the full 256K context (88% VRAM,
#   60.3 t/s), so Ridge @256K q8_0 is the quality+context champion.
#
#   tg falls as the context FILLS. e.g. Q4_K_M @256K q4_0: 52.9 -&gt; 43.1 @40K
#   -&gt; 38.3 @80K. Treat the tg@0 column as a ceiling; near-full runs slower.
#
# -----------------------------------------------------------------------------
# LOOP PREVENTION (TODO #3) — high-context self-repetition:
#   The original greedy sampling (temp 0.6 / top-p 0.5 / top-k 15 /
#   repeat-penalty 1.0 / DRY off) loops on long open-ended/reasoning tasks.
#   Measured 2026-08-23 (bench-3.8-loop.sh, n-gram repetition score, higher =
#   more stuck) on the hardest prompt ("explain thinking at length"):
#
#     sampling                              rep_score
#     ------------------------------------  ---------
#     baseline (no DRY, no template)        0.36
#     DRY only                              0.18      &lt;- ~50% cut (the fix)
#     froggeric chat-template only          0.30      &lt;- NO help here
#     DRY + template                        0.18      &lt;- same as DRY only
#     DRY + --min-p 0.1                     0.16      &lt;- no help (single-run noise)
#     DRY + --reasoning-budget 8192         0.17      &lt;- no help
#     DRY + --reasoning-budget 0            0.14      &lt;- marginal (thinking off)
#     DRY + min-p + budget                  0.15      &lt;- no better than DRY
#
#   =&gt; the jinja chat template, --min-p and --reasoning-budget do NOT
#   meaningfully suppress text self-repetition (they target other things:
#   tool-call loops, distribution tails, thinking length). The DRY sampler is
#   the only effective knob — it halves the loop but does not fully kill it.
#   If you still need more (untested), escalate:
#     1. --dry-multiplier lower (e.g. 0.5)  stronger DRY penalty
#     2. --spec-type none                   rule out an MTP draft bug re-injecting text
#     3. lower --temp / --top-k             tamer sampling (flat distributions
#                                            repeat more)
#     (froggeric/Qwen-Fixed-Chat-Templates is still useful for TOOL-CALL loops:
#      --chat-template-file &lt;jinja file&gt;)
# =============================================================================

LLAMA_SERVER=/home/bruin/llama-server-vulkan-b10485
TIMEOUT=5
DEFAULT_MODEL=0

# =============================================================================
# FILE PATH VARIABLES
# =============================================================================
F_Q4KM="/opt/gguf-models/Abiray/Qwen3.8-27B-Q4_K_M-GGUF/Qwen3.8-27B-Q4_K_M.gguf"
F_RIDGE="/opt/gguf-models/empero-ai/Qwen3.8-27B-Ridge-3.7bpw/Qwen3.8-27B-Ridge-3.7bpw.gguf"
F_UDQ4="/opt/gguf-models/unsloth/Qwen3.8-27B-GGUF/Qwen3.8-27B-UD-Q4_K_M.gguf"
F_Q5KS="/opt/gguf-models/unsloth/Qwen3.8-27B-GGUF/Qwen3.8-27B-Q5_K_S.gguf"
F_MMPROJ_UNSLOTH="/opt/gguf-models/unsloth/Qwen3.8-27B-GGUF/mmproj-F16.gguf"
F_MMPROJ_EMPERO="/opt/gguf-models/empero-ai/Qwen3.8-27B-Ridge-3.7bpw/mmproj-Qwen3.8-27B-BF16.gguf"
F_FIXED_CHAT_TMPL="/opt/gguf-models/froggeric/Qwen-Fixed-Chat-Templates/chat_template.jinja"
# (Qwen3.8-27B is a native VLM; both mmproj files work with all four text
#  models. Text-only is the default; add --mmproj to a row's extra args to
#  serve vision — it costs ~1 GiB VRAM.)

# =============================================================================
# MODEL MATRIX
# Columns (| delimited):
#   0: Name        1: Main model       2: CTX     3: KV quant   4: Extra args
#
# Extra args is a whitespace-separated string appended verbatim to the final
# command line (e.g. "--alias foo --mmproj /path").
# =============================================================================
MODELS=(
  "Ridge 3.7bpw @256K (q8_0) - quality @256K 60 t/s |${F_RIDGE}|262144|q8_0|--alias qwen3.8-ridge-256k-q8"
  "Ridge 3.7bpw @256K (q4_0) - 55 t/s (more headroom)|${F_RIDGE}|262144|q4_0|--alias qwen3.8-ridge-256k"
  "Q4_K_M @256K (q4_0) - max context 53 t/s       |${F_Q4KM}|262144|q4_0|--alias qwen3.8-q4-256k"
  "UD-Q4_K_M @256K (q4_0) - dynamic 54 t/s        |${F_UDQ4}|262144|q4_0|--alias qwen3.8-udq4-256k"
  "Q5_K_S @192K (q4_0) - max Q5 clean ctx         |${F_Q5KS}|196608|q4_0|--alias qwen3.8-q5-192k"
  "Q4_K_M @128K (q8_0) - quality KV 59 t/s        |${F_Q4KM}|131072|q8_0|--alias qwen3.8-q4-128k"
  "Q5_K_S @64K  (q8_0) - fast/quality             |${F_Q5KS}|65536 |q8_0|--alias qwen3.8-q5-64k"
  "Q5_K_S @256K (q4_0) - Q5 max ctx (SPILLS 19 t/s)|${F_Q5KS}|262144|q4_0|--alias qwen3.8-q5-256k"
  # Uncomment once the server 262144 cap is patched out (needs rebuild):
  # "Q4_K_M @320K (q4_0) - YaRN, needs patched server |${F_Q4KM}|327680|q4_0|--alias qwen3.8-q4-320k --rope-scaling yarn --rope-scale 1.25 --yarn-orig-ctx 262144"
  # Vision variants (append --mmproj to any text model row; ~1 GiB VRAM cost):
  # "Q4_K_M @256K (q4_0) + vision mmproj           |${F_Q4KM}|262144|q4_0|--alias qwen3.8-q4-256k-v --mmproj ${F_MMPROJ_UNSLOTH}"
  # "Ridge 3.7bpw @256K (q4_0) + vision mmproj     |${F_RIDGE}|262144|q4_0|--alias qwen3.8-ridge-256k-v --mmproj ${F_MMPROJ_EMPERO}"
)

# =============================================================================
# BUILD MODEL ID LIST FROM MATRIX
# =============================================================================
declare -a MODEL_IDS=()
declare -A MODEL_NAMES=()

for i in "${!MODELS[@]}"; do
    MODEL_IDS+=("$i")
    IFS='|' read -r _name _ &lt;&lt;&lt; "${MODELS[$i]}"
    MODEL_NAMES[$i]="$_name"
done

MODEL_COUNT="${#MODELS[@]}"

# =============================================================================
# GRUB-LIKE MENU WITH LIVE COUNTDOWN
# =============================================================================
clear
echo -e "\n=== Qwen3.8-27B Llama Server Model Selector ==="
printf "%-3s %-50s\n" "ID" "Model"
echo "----------------------------------------------------------"
for id in "${MODEL_IDS[@]}"; do
    mark="$([ "$id" -eq "$DEFAULT_MODEL" ] &amp;&amp; echo "[*]" || echo "   ")"
    printf "%-3s %-50s %s\n" "$id" "${MODEL_NAMES[$id]}" "$mark"
done
echo "----------------------------------------------------------"

CHOICE=""
for ((t=TIMEOUT; t&gt;0; t--)); do
    printf "\rSelect model [${DEFAULT_MODEL}] (timeout: %ds): " "$t"
    if read -r -t 1 -n 1 char 2&gt;/dev/null; then
        [[ "$char" == $'\n' || "$char" == $'\r' ]] &amp;&amp; continue
        if [[ " ${MODEL_IDS[*]} " == *" ${char} "* ]]; then
            CHOICE="$char"
            break
        fi
    fi
done
printf "\rSelect model [${DEFAULT_MODEL}] (timeout:  0s): "

CHOICE="${CHOICE:-$DEFAULT_MODEL}"
if [[ ! " ${MODEL_IDS[*]} " == *" ${CHOICE} "* ]]; then
    echo -e "\nInvalid/No selection. Using default model: ${DEFAULT_MODEL}"
    CHOICE=$DEFAULT_MODEL
fi

SELECTED_NAME="${MODEL_NAMES[$CHOICE]}"
echo -e "\n&gt;&gt; Loading: ${SELECTED_NAME}\n"

# =============================================================================
# EXTRACT CONFIG FROM MATRIX ROW
# =============================================================================
IFS='|' read -r _ MAIN_MODEL CTX_SIZE KV_QUANT EXTRA_ARGS &lt;&lt;&lt; "${MODELS[$CHOICE]}"

MAIN_MODEL="$(&lt;&lt;&lt;"${MAIN_MODEL}" xargs)"
CTX_SIZE="$(&lt;&lt;&lt;"${CTX_SIZE}" xargs)"
KV_QUANT="$(&lt;&lt;&lt;"${KV_QUANT}" xargs)"
EXTRA_ARGS="$(&lt;&lt;&lt;"${EXTRA_ARGS}" xargs)"

# =============================================================================
# BUILD ARGUMENTS (tuned for Qwen3.8-27B / RX 7900 XTX)
# All options are long-format (--xxxx) for clarity; comments note the why.
# =============================================================================
ARGS=(
  # --- device &amp; model -----------------------------------------------------
  --device             Vulkan0                       # GPU backend (RX 7900 XTX / RADV)
  --model              "${MAIN_MODEL}"               # main text model
  --ctx-size           "${CTX_SIZE}"                 # servable context window (tokens)
  --parallel           1                             # single sequence slot (max per-request ctx)

  # --- KV cache -----------------------------------------------------------
  --cache-type-k       "${KV_QUANT}"                 # K-cache quantization (q4_0/q8_0)
  --cache-type-v       "${KV_QUANT}"                 # V-cache quantization (q4_0/q8_0)
  --gpu-layers         -1                            # offload ALL layers to VRAM
  --flash-attn         on                            # flash attention (faster, less VRAM)

  # --- speculative decoding (MTP) ----------------------------------------
  --spec-type          draft-mtp                     # speculate with the model's MTP head
  --spec-draft-n-max   2                             # max draft tokens per step

  # --- compute / batching --------------------------------------------------
  --threads            10                            # CPU threads for generation
  --batch-size         512                           # logical prompt batch size
  --ubatch-size        256                           # physical micro-batch size

  # --- context handling -----------------------------------------------------
  --no-context-shift                                  # disable KV shifting (keep full ctx)

  # --- template &amp; reasoning -------------------------------------------------
  --jinja                                              # use the model's jinja chat template
  --reasoning          on                             # enable &lt;think&gt; reasoning tokens
  --reasoning-effort   medium                         # thinking effort level
  --no-reasoning-preserve                             # strip old turns' reasoning (lean ctx)

  # --- serving ---------------------------------------------------------------
  --kv-unified                                         # unified KV (required for VLM layout)
  --host               0.0.0.0                        # listen on all interfaces
  --port               8000                           # OpenAI-compatible API port
  --metrics                                            # expose Prometheus /metrics
  --load-mode          none                           # no special mmap/mlock mode

  # --- sampling (loop-suppression set — see LOOP PREVENTION header) ---------
  --temp               0.6                            # temperature
  --top-p              0.5                            # nucleus sampling
  --top-k              15                             # top-k sampling
  --repeat-penalty     1.1                            # light anti-repetition penalty
  --dry-multiplier     0.8                            # DRY: exponential penalty on repeats
  --dry-base           1.75                           # DRY: base value (default)
  --dry-allowed-length 2                              # DRY: trigger length (default)
  # Escalate if loops persist (uncomment as needed):
  # --reasoning-budget 8192                            # cap thinking so a loop terminates
  # --min-p            0.02                            # floor tokens below p*max-prob
  # --chat-template-file "${F_FIXED_CHAT_TMPL}"        # froggeric fixed template
  # --spec-type        none                            # rule out an MTP draft bug
)

if [[ -n "${EXTRA_ARGS}" ]]; then
  read -ra EXTRA_SPLIT &lt;&lt;&lt; "${EXTRA_ARGS}"
  ARGS+=("${EXTRA_SPLIT[@]}")
fi

# =============================================================================
# PRINT &amp; EXECUTE
# =============================================================================
echo "Running: ${LLAMA_SERVER}"
for arg in "${ARGS[@]}"; do
  printf '  %s\n' "$arg"
done
echo "---"

</code></pre>
]]></description><link>https://lcz.me/post/13853</link><guid isPermaLink="true">https://lcz.me/post/13853</guid><dc:creator><![CDATA[laobenxiong]]></dc:creator><pubDate>Tue, 25 Aug 2026 10:26:21 GMT</pubDate></item></channel></rss>