These three GGUFs were quantized independently from the same pinned Qwen3.8-27B QSA BF16 checkpoint using the QSA-enabled llama.cpp fork. IQ3_S, IQ2_S, and IQ1_M are mixed-precision GGUF presets in the 3-, 2-, and 1-bit classes. The full-model average includes higher-precision tensors, and the optional BF16 vision projector is shared by all three. The 80 FP32 QSA indexer tensors, 15 tensors in the original MTP block, and 96 BF16 DeltaNet alpha and beta weights retain the values and types of the BF16 GGUF export. Source checkpoint · Runtime source
Use the pinned QSA-enabled fork. For full CUDA offload, choose a GGUF that fits in the selected GPU's available memory together with the context buffers and optional projector. One GGUF is sufficient for text. Add the shared mmproj-Qwen3.8-27B-QSA-BF16.gguf for vision. The original model weights and QSA additions are licensed under Apache 2.0. Upstream credits and licenses · License
| Preset | Main GGUF | Average bits per weight | Checks passed, MTP off / on |
|---|---|---|---|
| IQ3_S | 13.52 GB | 3.95 | 4/4 · 4/4 |
| IQ2_S | 10.46 GB | 3.05 | 4/4 · 4/4 |
| IQ1_M | 8.73 GB | 2.55 | 4/4 · 4/4 |
The shared BF16 projector is 0.93 GB. SHA-256 manifest
The checks ran on Linux with CUDA 13.2, all model layers on one RTX 5090, a 4,096-token context allocation, and temperature 0. They covered an arithmetic answer, a Japanese answer, red-image recognition, and a 2,460-token passage. These are functional smoke tests. Full quality and performance benchmarks remain unevaluated. In a separate Linux CUDA check, IQ1_M also passed all four tests with full offload to a 12 GB RTX 3060, a 4,096-token context, and the BF16 projector. IQ1_M found the correct numeric result but returned the equation 17 + 25 = 42 when asked for the number alone.
Install Git, CMake, Make, a C/C++ compiler, the CUDA Toolkit, and the Hugging Face hf CLI. Put nvcc on PATH and use the same directory for each step. The validated Linux toolchain used CMake 4.2.3, GCC 15.2, and CUDA 13.2.
Check out the pinned fork and add the <algorithm> header required by std::copy_n. CMake's native target detects the architecture of the CUDA GPU or GPUs visible during configuration. The build produces the server and quantizer.
git clone https://github.com/kuraneko1/Qwen3.8-27B-QSA-llama.cpp.git
git -C Qwen3.8-27B-QSA-llama.cpp checkout --detach \
864934c78136ad75274f202b8eb1e7c751d81fb1
sed -i '1i#include <algorithm>' \
Qwen3.8-27B-QSA-llama.cpp/src/llama-graph.cpp
cmake -S Qwen3.8-27B-QSA-llama.cpp -B qsa-build \
-DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=ON \
-DCMAKE_CUDA_ARCHITECTURES=native
cmake --build qsa-build --target llama-server llama-quantize --parallel 8
Set preset to IQ3_S, IQ2_S, or IQ1_M. Sign in with a Hugging Face account that can read this private repository. Then download the selected model, shared projector, and checksum manifest. The check requires both downloaded GGUFs to have matching SHA-256 hashes.
preset=IQ3_S
model="Qwen3.8-27B-QSA-$preset.gguf"
projector=mmproj-Qwen3.8-27B-QSA-BF16.gguf
hf auth login
hf download Kiyo1130/Qwen3.8-27B-QSA-LowBit-GGUF \
"$model" "$projector" SHA256SUMS --local-dir ./qsa-lowbit
(
set -o pipefail
cd ./qsa-lowbit &&
awk -v model="$model" -v projector="$projector" \
'$2 == model || $2 == projector { print; seen[$2]++ }
END { if (seen[model] != 1 || seen[projector] != 1) exit 1 }' SHA256SUMS |
sha256sum --check
)
The server loads all layers on the selected CUDA GPU and serves the OpenAI-compatible endpoint at http://127.0.0.1:8080/v1/chat/completions. Use --list-devices to confirm the device number and adjust CUDA0 if needed. Omit --mmproj for text-only serving. Append --spec-type draft-mtp --spec-draft-n-max 2 to enable MTP.
./qsa-build/bin/llama-server --list-devices
./qsa-build/bin/llama-server \
--host 127.0.0.1 --port 8080 --alias qsa-lowbit \
--model "./qsa-lowbit/$model" --mmproj "./qsa-lowbit/$projector" \
--device CUDA0 --n-gpu-layers all --flash-attn on --ctx-size 4096 \
--parallel 1 --batch-size 256 --ubatch-size 128
Use native Windows x64 with PowerShell 7.4 or later, Git, CMake 4.2.3, and the Hugging Face hf CLI. Install Visual Studio 2022 or its Build Tools with Desktop development with C++ and a Windows SDK, followed by CUDA Toolkit 13.2 with Visual Studio integration and a compatible driver. Start pwsh from Developer PowerShell for VS 2022 and work in the same directory. Windows compilation and inference have yet to be tested on target hardware.
Add the missing <algorithm> header in the pinned checkout and build the Release configuration for the CUDA GPUs visible to CMake using native. Visual Studio places the executables in bin/Release.
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true
git clone https://github.com/kuraneko1/Qwen3.8-27B-QSA-llama.cpp.git
git -C .\Qwen3.8-27B-QSA-llama.cpp checkout --detach 864934c78136ad75274f202b8eb1e7c751d81fb1
$graph = (Resolve-Path .\Qwen3.8-27B-QSA-llama.cpp\src\llama-graph.cpp).Path
$source = [IO.File]::ReadAllText($graph)
if ($source -notmatch '(?m)^\s*#include\s*<algorithm>\s*$') {
[IO.File]::WriteAllText($graph, "#include <algorithm>`r`n" + $source, [Text.UTF8Encoding]::new($false))
}
cmake -S .\Qwen3.8-27B-QSA-llama.cpp -B .\qsa-build-win `
-G 'Visual Studio 17 2022' -A x64 -DGGML_CUDA=ON `
'-DCMAKE_CUDA_ARCHITECTURES=native'
cmake --build .\qsa-build-win --config Release --target llama-server llama-quantize --parallel 8
Set $preset to one of the three presets. Sign in with a Hugging Face account that can read this private repository. Then download the selected GGUF and shared projector. PowerShell checks the SHA-256 of both files and stops on a missing or mismatched entry.
$preset = 'IQ3_S'
$model = "Qwen3.8-27B-QSA-$preset.gguf"
$projector = 'mmproj-Qwen3.8-27B-QSA-BF16.gguf'
hf auth login
hf download Kiyo1130/Qwen3.8-27B-QSA-LowBit-GGUF `
$model $projector SHA256SUMS --local-dir .\qsa-lowbit
$manifest = Get-Content -LiteralPath .\qsa-lowbit\SHA256SUMS
foreach ($file in @($model, $projector)) {
$pattern = '^(?<hash>[0-9a-fA-F]{64}) ' + [regex]::Escape($file) + '$'
$entry = @($manifest | Where-Object { $_ -match $pattern })
if ($entry.Count -ne 1 -or $entry[0] -notmatch $pattern) {
throw "Missing or invalid SHA-256 entry for $file"
}
$expected = $Matches.hash
$path = Join-Path .\qsa-lowbit $file
$actual = (Get-FileHash -LiteralPath $path -Algorithm SHA256 -ErrorAction Stop).Hash
if ($actual -ine $expected) { throw "SHA-256 mismatch for $file" }
Write-Output "$file OK"
}
Identify the CUDA GPU you want to use with --list-devices and adjust CUDA0 if needed. Full offload loads all layers on that card. The example enables image input and serves http://127.0.0.1:8080/v1/chat/completions.
& .\qsa-build-win\bin\Release\llama-server.exe --list-devices
& .\qsa-build-win\bin\Release\llama-server.exe `
--host 127.0.0.1 --port 8080 --alias qsa-lowbit `
--model ".\qsa-lowbit\$model" --mmproj ".\qsa-lowbit\$projector" `
--device CUDA0 --n-gpu-layers all --flash-attn on --ctx-size 4096 `
--parallel 1 --batch-size 256 --ubatch-size 128
The matrix was collected by evaluating the pinned BF16 export on 48 chunks of 512 tokens. Input came from 16 evenly spaced excerpts of bartowski's rendered v6 calibration corpus, with special token parsing enabled. All three quantizations used the same matrix. Allow about 150 GB of free disk space for the BF16 checkpoint, intermediate GGUF, and final outputs. The first commands install the conversion dependencies and export the pinned checkpoint to BF16 GGUF. The last commands read the shipped importance matrix, preserve the QSA indexers, MTP block, and DeltaNet alpha and beta weights, and write the three quantizations to a separate directory. Rendered calibration source
python3.12 -m venv .qsa-convert
source .qsa-convert/bin/activate
python -m pip install torch==2.14.0 --index-url https://download.pytorch.org/whl/cu130
python -m pip install numpy==2.3.5 transformers==5.20.2 safetensors==0.8.0 \
huggingface_hub==2.4.0 sentencepiece protobuf tqdm pyyaml requests
hf download higa2515/Qwen3.8-27B-QSA-BF16 \
--revision aedae2c5304698f58d30c5ec709ebf5b37339b1d --local-dir ./qsa-bf16
hf download Kiyo1130/Qwen3.8-27B-QSA-LowBit-GGUF \
reproducibility/Qwen3.8-27B-QSA-imatrix.gguf --local-dir .
python ./Qwen3.8-27B-QSA-llama.cpp/convert_hf_to_gguf.py ./qsa-bf16 \
--outtype bf16 --model-name Qwen3.8-27B-QSA --outfile ./qsa-bf16.gguf
mkdir -p ./qsa-lowbit-rebuilt
for preset in IQ3_S IQ2_S IQ1_M; do
./qsa-build/bin/llama-quantize \
--imatrix ./reproducibility/Qwen3.8-27B-QSA-imatrix.gguf \
--tensor-type '.*[.]indexer[.].*=f32' \
--tensor-type 'blk[.]64[.].*=bf16' \
--tensor-type 'blk[.][0-9]+[.]ssm_(alpha|beta)[.]weight=bf16' \
./qsa-bf16.gguf "./qsa-lowbit-rebuilt/Qwen3.8-27B-QSA-$preset.gguf" "$preset" 16
done
QSA対応llama.cppで、固定リビジョンのQwen3.8-27B QSA BF16から3種類をそれぞれ直接量子化しました。IQ3_S、IQ2_S、IQ1_Mは3bit級・2bit級・1bit級の混合精度プリセットです。本体全体の平均ビット数は高精度で残した重みを含みます。FP32のQSAインデクサー80個、元のMTPブロックの15テンソル、DeltaNetのBF16 α・β投影96個は、BF16 GGUF版と同じ型と値を保持しています。 変換元 · QSA対応ランタイム
起動には固定コミットのQSA対応フォークを使います。全層をオフロードする場合は、空きVRAMに本体、コンテキスト用バッファ、必要に応じて視覚プロジェクターが収まる版を選びます。テキスト生成は本体1ファイルで実行できます。画像入力には3種共通の mmproj-Qwen3.8-27B-QSA-BF16.gguf を指定します。元のモデル重みとQSAの追加部分はApache 2.0です。 元モデルのクレジット · ライセンス
| プリセット | 本体GGUF | 重みあたり平均bit | 通過数 MTPなし / あり |
|---|---|---|---|
| IQ3_S | 13.52 GB | 3.95 | 4/4 · 4/4 |
| IQ2_S | 10.46 GB | 3.05 | 4/4 · 4/4 |
| IQ1_M | 8.73 GB | 2.55 | 4/4 · 4/4 |
共通のBF16視覚プロジェクターは0.93 GBです。 SHA-256一覧
LinuxとCUDA 13.2の環境で、RTX 5090 1枚に全層を載せ、コンテキスト4,096、温度0で検証しました。項目は計算、日本語回答、赤色画像の認識、2,460トークンの文章読解です。基本動作を確認する試験で、品質と性能の定量比較は未実施です。 LinuxのCUDA環境で、12 GBのRTX 3060にIQ1_Mを全層オフロードし、コンテキスト4,096とBF16プロジェクターを使って同じ4項目を確認しました。 IQ1_Mでは「数字のみ」と指示した計算に、正しい結果を含む式 17 + 25 = 42 が返りました。
Git、CMake、Make、C/C++コンパイラ、CUDA Toolkit、Hugging Faceの hf CLIを導入します。nvcc をPATHに通し、各手順を同じ作業ディレクトリで実行します。Linuxでの検証環境はCMake 4.2.3、GCC 15.2、CUDA 13.2です。
フォークの固定コミットを取得し、std::copy_n に必要な <algorithm> を追加します。native を指定すると、CMakeが構成時に認識したCUDA GPUに合わせてサーバーと量子化ツールをビルドします。
git clone https://github.com/kuraneko1/Qwen3.8-27B-QSA-llama.cpp.git
git -C Qwen3.8-27B-QSA-llama.cpp checkout --detach \
864934c78136ad75274f202b8eb1e7c751d81fb1
sed -i '1i#include <algorithm>' \
Qwen3.8-27B-QSA-llama.cpp/src/llama-graph.cpp
cmake -S Qwen3.8-27B-QSA-llama.cpp -B qsa-build \
-DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=ON \
-DCMAKE_CUDA_ARCHITECTURES=native
cmake --build qsa-build --target llama-server llama-quantize --parallel 8
preset に IQ3_S、IQ2_S、IQ1_M のいずれかを指定します。この非公開リポジトリを閲覧できるHugging Faceアカウントでログインし、選んだ本体、共通プロジェクター、ハッシュ一覧を取得します。両GGUFのSHA-256を照合します。
preset=IQ3_S
model="Qwen3.8-27B-QSA-$preset.gguf"
projector=mmproj-Qwen3.8-27B-QSA-BF16.gguf
hf auth login
hf download Kiyo1130/Qwen3.8-27B-QSA-LowBit-GGUF \
"$model" "$projector" SHA256SUMS --local-dir ./qsa-lowbit
(
set -o pipefail
cd ./qsa-lowbit &&
awk -v model="$model" -v projector="$projector" \
'$2 == model || $2 == projector { print; seen[$2]++ }
END { if (seen[model] != 1 || seen[projector] != 1) exit 1 }' SHA256SUMS |
sha256sum --check
)
選んだCUDA GPUに全層を載せ、http://127.0.0.1:8080/v1/chat/completions で待ち受けます。--list-devices で番号を確認し、必要に応じて CUDA0 を変更します。テキスト専用なら --mmproj を省略できます。MTPを使う場合は --spec-type draft-mtp --spec-draft-n-max 2 を加えます。
./qsa-build/bin/llama-server --list-devices
./qsa-build/bin/llama-server \
--host 127.0.0.1 --port 8080 --alias qsa-lowbit \
--model "./qsa-lowbit/$model" --mmproj "./qsa-lowbit/$projector" \
--device CUDA0 --n-gpu-layers all --flash-attn on --ctx-size 4096 \
--parallel 1 --batch-size 256 --ubatch-size 128
Windows x64にPowerShell 7.4以降、Git、CMake 4.2.3、Hugging Faceの hf CLIを導入します。Visual Studio 2022またはBuild Toolsで「C++によるデスクトップ開発」とWindows SDKを入れ、続いてVisual Studio連携付きのCUDA Toolkit 13.2と対応NVIDIAドライバーを導入します。VS 2022の開発者向けPowerShellから pwsh を起動し、各手順を同じ作業ディレクトリで実行します。Windows実機でのビルドと推論は未検証です。
固定コミットに <algorithm> を追加し、native を指定してCMakeが認識したCUDA GPU向けのReleaseビルドを作成します。実行ファイルは bin/Release に出力されます。
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true
git clone https://github.com/kuraneko1/Qwen3.8-27B-QSA-llama.cpp.git
git -C .\Qwen3.8-27B-QSA-llama.cpp checkout --detach 864934c78136ad75274f202b8eb1e7c751d81fb1
$graph = (Resolve-Path .\Qwen3.8-27B-QSA-llama.cpp\src\llama-graph.cpp).Path
$source = [IO.File]::ReadAllText($graph)
if ($source -notmatch '(?m)^\s*#include\s*<algorithm>\s*$') {
[IO.File]::WriteAllText($graph, "#include <algorithm>`r`n" + $source, [Text.UTF8Encoding]::new($false))
}
cmake -S .\Qwen3.8-27B-QSA-llama.cpp -B .\qsa-build-win `
-G 'Visual Studio 17 2022' -A x64 -DGGML_CUDA=ON `
'-DCMAKE_CUDA_ARCHITECTURES=native'
cmake --build .\qsa-build-win --config Release --target llama-server llama-quantize --parallel 8
$preset で3種類のうち1つを選びます。この非公開リポジトリを閲覧できるHugging Faceアカウントでログインし、本体と共通プロジェクターを取得します。PowerShellで両ファイルのSHA-256を照合します。ファイルの欠落や不一致があれば停止します。
$preset = 'IQ3_S'
$model = "Qwen3.8-27B-QSA-$preset.gguf"
$projector = 'mmproj-Qwen3.8-27B-QSA-BF16.gguf'
hf auth login
hf download Kiyo1130/Qwen3.8-27B-QSA-LowBit-GGUF `
$model $projector SHA256SUMS --local-dir .\qsa-lowbit
$manifest = Get-Content -LiteralPath .\qsa-lowbit\SHA256SUMS
foreach ($file in @($model, $projector)) {
$pattern = '^(?<hash>[0-9a-fA-F]{64}) ' + [regex]::Escape($file) + '$'
$entry = @($manifest | Where-Object { $_ -match $pattern })
if ($entry.Count -ne 1 -or $entry[0] -notmatch $pattern) {
throw "Missing or invalid SHA-256 entry for $file"
}
$expected = $Matches.hash
$path = Join-Path .\qsa-lowbit $file
$actual = (Get-FileHash -LiteralPath $path -Algorithm SHA256 -ErrorAction Stop).Hash
if ($actual -ine $expected) { throw "SHA-256 mismatch for $file" }
Write-Output "$file OK"
}
--list-devices で使用するCUDA GPUを確認し、必要に応じて CUDA0 を変更します。指定GPUに全層を載せ、画像入力に対応するAPIを http://127.0.0.1:8080/v1/chat/completions で起動します。
& .\qsa-build-win\bin\Release\llama-server.exe --list-devices
& .\qsa-build-win\bin\Release\llama-server.exe `
--host 127.0.0.1 --port 8080 --alias qsa-lowbit `
--model ".\qsa-lowbit\$model" --mmproj ".\qsa-lowbit\$projector" `
--device CUDA0 --n-gpu-layers all --flash-attn on --ctx-size 4096 `
--parallel 1 --batch-size 256 --ubatch-size 128
固定したBF16版を512トークンのチャンク48個で動かして、重要度行列を作成しました。bartowskiのv6キャリブレーションデータから等間隔に選んだ16箇所を、特殊トークンを解釈して入力しました。3種類は同じ行列を使っています。変換元のBF16、変換途中のGGUF、最終出力のために約150 GBの空きを確保します。以下では固定リビジョンをBF16 GGUFへ変換し、同梱の重要度行列で3種類を別ディレクトリへ書き出します。QSAインデクサー、MTPブロック、DeltaNetのα・β投影は元の精度を維持します。 キャリブレーションの元データ
python3.12 -m venv .qsa-convert
source .qsa-convert/bin/activate
python -m pip install torch==2.14.0 --index-url https://download.pytorch.org/whl/cu130
python -m pip install numpy==2.3.5 transformers==5.20.2 safetensors==0.8.0 \
huggingface_hub==2.4.0 sentencepiece protobuf tqdm pyyaml requests
hf download higa2515/Qwen3.8-27B-QSA-BF16 \
--revision aedae2c5304698f58d30c5ec709ebf5b37339b1d --local-dir ./qsa-bf16
hf download Kiyo1130/Qwen3.8-27B-QSA-LowBit-GGUF \
reproducibility/Qwen3.8-27B-QSA-imatrix.gguf --local-dir .
python ./Qwen3.8-27B-QSA-llama.cpp/convert_hf_to_gguf.py ./qsa-bf16 \
--outtype bf16 --model-name Qwen3.8-27B-QSA --outfile ./qsa-bf16.gguf
mkdir -p ./qsa-lowbit-rebuilt
for preset in IQ3_S IQ2_S IQ1_M; do
./qsa-build/bin/llama-quantize \
--imatrix ./reproducibility/Qwen3.8-27B-QSA-imatrix.gguf \
--tensor-type '.*[.]indexer[.].*=f32' \
--tensor-type 'blk[.]64[.].*=bf16' \
--tensor-type 'blk[.][0-9]+[.]ssm_(alpha|beta)[.]weight=bf16' \
./qsa-bf16.gguf "./qsa-lowbit-rebuilt/Qwen3.8-27B-QSA-$preset.gguf" "$preset" 16
done
三个 GGUF 均使用支持 QSA 的 llama.cpp,从同一固定版本的 Qwen3.8-27B QSA BF16 检查点直接量化。IQ3_S、IQ2_S 和 IQ1_M 分别是 3 位级、2 位级和 1 位级的混合精度预设。全模型平均位宽计入高精度张量。80 个 FP32 QSA 索引器张量、原 MTP 模块的 15 个张量以及 96 个 BF16 DeltaNet α、β 投影张量均保留 BF16 GGUF 导出版本的数据类型和数值。 源检查点 · 运行时源码
请使用固定提交的 QSA 分支。若要将全部模型层加载到 GPU,请选择可与上下文缓冲区及可选视觉投影器一同装入可用显存的 GGUF。文本生成只需要一个主模型文件。图像输入可使用三个版本共用的 mmproj-Qwen3.8-27B-QSA-BF16.gguf。原模型权重和新增的 QSA 部分采用 Apache 2.0 许可证。 上游署名与许可 · 许可证
| 预设 | 主 GGUF | 每个权重的平均位数 | 通过数,MTP 关闭 / 开启 |
|---|---|---|---|
| IQ3_S | 13.52 GB | 3.95 | 4/4 · 4/4 |
| IQ2_S | 10.46 GB | 3.05 | 4/4 · 4/4 |
| IQ1_M | 8.73 GB | 2.55 | 4/4 · 4/4 |
共用的 BF16 视觉投影器为 0.93 GB。 SHA-256 清单
测试使用 Linux、CUDA 13.2,在一张 RTX 5090 上加载所有层,上下文设为 4,096 token,温度为 0。测试项目为算术、日语回答、红色图像识别及 2,460 token 的长文理解。这些测试用于确认基本功能。完整的质量和性能基准评估尚未开展。 另在 Linux CUDA 环境中,将 IQ1_M 全层加载到 12 GB RTX 3060,使用 4,096 token 上下文和 BF16 投影器,四项测试均通过。 IQ1_M 在被要求只输出数字时,返回了包含正确结果的算式 17 + 25 = 42。
安装 Git、CMake、Make、C/C++ 编译器、CUDA Toolkit 和 Hugging Face 的 hf CLI。将 nvcc 加入 PATH,并在同一工作目录中运行所有步骤。Linux 测试工具链为 CMake 4.2.3、GCC 15.2 和 CUDA 13.2。
检出分支的固定提交,为 std::copy_n 补充 <algorithm>。用 native 让 CMake 按配置时可见的 CUDA GPU 架构构建服务程序和量化工具。
git clone https://github.com/kuraneko1/Qwen3.8-27B-QSA-llama.cpp.git
git -C Qwen3.8-27B-QSA-llama.cpp checkout --detach \
864934c78136ad75274f202b8eb1e7c751d81fb1
sed -i '1i#include <algorithm>' \
Qwen3.8-27B-QSA-llama.cpp/src/llama-graph.cpp
cmake -S Qwen3.8-27B-QSA-llama.cpp -B qsa-build \
-DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=ON \
-DCMAKE_CUDA_ARCHITECTURES=native
cmake --build qsa-build --target llama-server llama-quantize --parallel 8
将 preset 设为 IQ3_S、IQ2_S 或 IQ1_M。请使用有权访问此私有仓库的 Hugging Face 账户登录,然后下载所选模型、共用投影器及校验清单。最后核对两个 GGUF 的 SHA-256。
preset=IQ3_S
model="Qwen3.8-27B-QSA-$preset.gguf"
projector=mmproj-Qwen3.8-27B-QSA-BF16.gguf
hf auth login
hf download Kiyo1130/Qwen3.8-27B-QSA-LowBit-GGUF \
"$model" "$projector" SHA256SUMS --local-dir ./qsa-lowbit
(
set -o pipefail
cd ./qsa-lowbit &&
awk -v model="$model" -v projector="$projector" \
'$2 == model || $2 == projector { print; seen[$2]++ }
END { if (seen[model] != 1 || seen[projector] != 1) exit 1 }' SHA256SUMS |
sha256sum --check
)
将所有模型层加载到所选 CUDA GPU 并在 http://127.0.0.1:8080/v1/chat/completions 提供服务。使用 --list-devices 确认设备编号,按需调整 CUDA0。仅处理文本时可省略 --mmproj,添加 --spec-type draft-mtp --spec-draft-n-max 2 可启用 MTP。
./qsa-build/bin/llama-server --list-devices
./qsa-build/bin/llama-server \
--host 127.0.0.1 --port 8080 --alias qsa-lowbit \
--model "./qsa-lowbit/$model" --mmproj "./qsa-lowbit/$projector" \
--device CUDA0 --n-gpu-layers all --flash-attn on --ctx-size 4096 \
--parallel 1 --batch-size 256 --ubatch-size 128
在 Windows x64 上安装 PowerShell 7.4 或更新版本、Git、CMake 4.2.3 和 Hugging Face 的 hf CLI。为 Visual Studio 2022 或其 Build Tools 安装「使用 C++ 的桌面开发」工作负载和 Windows SDK,再安装启用 Visual Studio 集成的 CUDA Toolkit 13.2 及兼容驱动。在 VS 2022 开发人员 PowerShell 中启动 pwsh,并在同一工作目录执行所有步骤。Windows 原生构建和推理尚未在目标设备上验证。
在固定提交中添加 <algorithm>,然后用 native 为 CMake 可见的 CUDA GPU 构建 Release 版本。可执行文件位于 bin/Release。
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true
git clone https://github.com/kuraneko1/Qwen3.8-27B-QSA-llama.cpp.git
git -C .\Qwen3.8-27B-QSA-llama.cpp checkout --detach 864934c78136ad75274f202b8eb1e7c751d81fb1
$graph = (Resolve-Path .\Qwen3.8-27B-QSA-llama.cpp\src\llama-graph.cpp).Path
$source = [IO.File]::ReadAllText($graph)
if ($source -notmatch '(?m)^\s*#include\s*<algorithm>\s*$') {
[IO.File]::WriteAllText($graph, "#include <algorithm>`r`n" + $source, [Text.UTF8Encoding]::new($false))
}
cmake -S .\Qwen3.8-27B-QSA-llama.cpp -B .\qsa-build-win `
-G 'Visual Studio 17 2022' -A x64 -DGGML_CUDA=ON `
'-DCMAKE_CUDA_ARCHITECTURES=native'
cmake --build .\qsa-build-win --config Release --target llama-server llama-quantize --parallel 8
用 $preset 选择一个预设。用有权访问此私有仓库的 Hugging Face 账户登录,然后下载所选 GGUF 和共用投影器。PowerShell 对两个文件分别校验 SHA-256,遇到缺失或不匹配时停止。
$preset = 'IQ3_S'
$model = "Qwen3.8-27B-QSA-$preset.gguf"
$projector = 'mmproj-Qwen3.8-27B-QSA-BF16.gguf'
hf auth login
hf download Kiyo1130/Qwen3.8-27B-QSA-LowBit-GGUF `
$model $projector SHA256SUMS --local-dir .\qsa-lowbit
$manifest = Get-Content -LiteralPath .\qsa-lowbit\SHA256SUMS
foreach ($file in @($model, $projector)) {
$pattern = '^(?<hash>[0-9a-fA-F]{64}) ' + [regex]::Escape($file) + '$'
$entry = @($manifest | Where-Object { $_ -match $pattern })
if ($entry.Count -ne 1 -or $entry[0] -notmatch $pattern) {
throw "Missing or invalid SHA-256 entry for $file"
}
$expected = $Matches.hash
$path = Join-Path .\qsa-lowbit $file
$actual = (Get-FileHash -LiteralPath $path -Algorithm SHA256 -ErrorAction Stop).Hash
if ($actual -ine $expected) { throw "SHA-256 mismatch for $file" }
Write-Output "$file OK"
}
用 --list-devices 确认所选 CUDA GPU 的设备编号,按需修改 CUDA0。将所有模型层加载到该显卡,通过 http://127.0.0.1:8080/v1/chat/completions 提供服务,并启用图像输入。
& .\qsa-build-win\bin\Release\llama-server.exe --list-devices
& .\qsa-build-win\bin\Release\llama-server.exe `
--host 127.0.0.1 --port 8080 --alias qsa-lowbit `
--model ".\qsa-lowbit\$model" --mmproj ".\qsa-lowbit\$projector" `
--device CUDA0 --n-gpu-layers all --flash-attn on --ctx-size 4096 `
--parallel 1 --batch-size 256 --ubatch-size 128
使用固定版本的 BF16 模型处理 48 个长度为 512 token 的分块,采集重要性矩阵。输入来自 bartowski v6 渲染语料中均匀抽取的 16 个片段,启用了特殊 token 解析。三种预设使用同一矩阵。请为 BF16 检查点、中间 GGUF 和最终输出预留约 150 GB 磁盘空间。以下命令将固定的检查点导出为 BF16 GGUF,再读取随附的矩阵,将三个版本写入单独的目录;QSA 索引器、MTP 模块和 DeltaNet α、β 投影保留原有精度。 校准语料来源
python3.12 -m venv .qsa-convert
source .qsa-convert/bin/activate
python -m pip install torch==2.14.0 --index-url https://download.pytorch.org/whl/cu130
python -m pip install numpy==2.3.5 transformers==5.20.2 safetensors==0.8.0 \
huggingface_hub==2.4.0 sentencepiece protobuf tqdm pyyaml requests
hf download higa2515/Qwen3.8-27B-QSA-BF16 \
--revision aedae2c5304698f58d30c5ec709ebf5b37339b1d --local-dir ./qsa-bf16
hf download Kiyo1130/Qwen3.8-27B-QSA-LowBit-GGUF \
reproducibility/Qwen3.8-27B-QSA-imatrix.gguf --local-dir .
python ./Qwen3.8-27B-QSA-llama.cpp/convert_hf_to_gguf.py ./qsa-bf16 \
--outtype bf16 --model-name Qwen3.8-27B-QSA --outfile ./qsa-bf16.gguf
mkdir -p ./qsa-lowbit-rebuilt
for preset in IQ3_S IQ2_S IQ1_M; do
./qsa-build/bin/llama-quantize \
--imatrix ./reproducibility/Qwen3.8-27B-QSA-imatrix.gguf \
--tensor-type '.*[.]indexer[.].*=f32' \
--tensor-type 'blk[.]64[.].*=bf16' \
--tensor-type 'blk[.][0-9]+[.]ssm_(alpha|beta)[.]weight=bf16' \
./qsa-bf16.gguf "./qsa-lowbit-rebuilt/Qwen3.8-27B-QSA-$preset.gguf" "$preset" 16
done
higa2515/Qwen3.8-27B-QSA-BF16