# Aider Polyglot上のUnsloth Dynamic GGUF

Unsloth Dynamic GGUFs により、次のような LLM を量子化できることを紹介できて嬉しく思います [DeepSeek-V3.1](/docs/jp/moderu/tutorials/deepseek-v3.1-how-to-run-locally.md) （671B）をわずか **1ビット** または **3-bit**まで圧縮しても、なお次のような SOTA モデルを上回れることを示せます **GPT-4.5、GPT-4.1** （2025年4月）および **Claude-4-Opus** （2025年5月）。

以前、 [私たちは実証しました](/docs/jp/ji-ben/unsloth-dynamic-2.0-ggufs.md) Unsloth Dynamic GGUFs が 5-shot MMLU と KL Divergence で他の量子化手法を上回ることを。今回は、第三者による独立評価における性能を、 **Aider Polyglot** **ベンチマークを使って紹介します。**

<div><figure><img src="/files/4f1c2bb2ed98c6a7bf224080a758a9e314fb9d77" alt="" width="563"><figcaption><p>Thinking Aider ベンチマーク</p></figcaption></figure> <figure><img src="/files/8b5a794d2673d4dcc10f77ec2eddb45ce507c350" alt="" width="563"><figcaption><p>No Thinking Aider ベンチマーク</p></figcaption></figure></div>

### ⭐**主要な結果**

* 私たちの **1ビット** Unsloth Dynamic GGUF は DeepSeek-V3.1 を **671GB → 192GB（サイズ -75%）** まで縮小し、non-thinking モードでは GPT-4.1（2025年4月）、GPT-4.5、DeepSeek-V3-0324 を大きく上回ります。
* **3-bit** Unsloth DeepSeek-V3.1（thinking）GGUF: Claude-4-Opus-20250514（thinking）を上回る。
* **5-bit** Unsloth DeepSeek-V3.1（non-thinking）GGUF: Claude-4-Opus-20250514（non-thinking）と同等の性能。
* Unsloth Dynamic GGUFs は、他の非 Unsloth の Dynamic imatrix GGUFs より一貫して高い性能を発揮します
* Unsloth 以外の 1-bit および 2-bit の DeepSeek-V3.1 量子化、ならびに選択的層量子化なしの標準的な 1-bit 量子化は、読み込みに失敗するか、意味不明な出力やループ出力を生成しました。これは、Unsloth Dynamic GGUFs が精度を大部分維持できる一方で、他の手法はそもそも動作しないことを示しています。

**なぜ** [**Aider Polyglot**](https://aider.chat/docs/leaderboards/) **ベンチマークなのか？** Aider は、LLM がどれだけうまく文章作成、コーディング、指示遵守、そして人手介入なしに変更適用できるかを測る、最も包括的な指標のひとつであり、実世界での利用において最も難しく、かつ価値の高いベンチマークのひとつです。

{% hint style="success" %}
この **主な利点** Unsloth パッケージとモデルを使うことのは、私たちが ***重大なバグの修正*** に積極的に関わっていることです。私たちは以下のチームと直接協力してきました [Qwen3](https://www.reddit.com/r/LocalLLaMA/comments/1kaodxu/qwen3_unsloth_dynamic_ggufs_128k_context_bug_fixes/), [Meta（Llama 4）](https://github.com/ggml-org/llama.cpp/pull/12889), [Mistral（Devstral）](https://app.gitbook.com/o/HpyELzcNe0topgVLGCZY/s/xhOjnexMCB3dmuQFQ2Zq/~/changes/618/basics/tutorials-how-to-fine-tune-and-run-llms/devstral-how-to-run-and-fine-tune), [Google（Gemma 1–3）](https://news.ycombinator.com/item?id=39671146) および [Microsoft（Phi-3/4）](https://simonwillison.net/2025/Jan/11/phi-4-bug-fixes)、これにより精度を大きく向上させる重要な修正に貢献しています。
{% endhint %}

## 🦥Unsloth Dynamic Quantization

{% hint style="success" %}
**Dynamic 1 bit では重要な層を 8 または 16 bit にし、重要でない層を 1,2,3,4,5,6 bit にします。**
{% endhint %}

2024年11月、私たちの [4-bit Dynamic](https://unsloth.ai/blog/dynamic-4bit) Quants は、わずかに <mark style="background-color:green;">**層を選択的に量子化する**</mark>だけで QLoRA のファインチューニングとモデル精度を大部分回復できることを示しました。その後、私たちは [DeepSeek-R1](/docs/jp/moderu/tutorials/deepseek-r1-how-to-run-locally.md)のアーキテクチャを調査し、同様の手法を適用しました。そこでは一部の層を 1-bit まで量子化し、重要な層をより高い bit（6-bit、8-bit）にしました。このアプローチはすぐに人気を集め、特に MoE モデルで効果が高いことが証明され、dynamic quantization は MoE 量子化の事実上の標準となりました。

私たちの Dynamic GGUFs は、 [imatrix calibration dataset](https://unsloth.ai/docs/jp/ji-ben/unsloth-dynamic-2.0-ggufs/pages/021c19d75a86d940ef9b83b7b41bee381657345b#whats-new-in-dynamic-v2.0)と組み合わせるとさらに効果的です。これはチャットとコーディング性能向けに設計されています。これらすべてにより、品質の致命的な低下なしに、極端な LLM 圧縮が可能になりました。

たとえば Qwen2-VL-2B-Instruct では、すべての層を単純に 4bit に量子化すると、下の画像を理解できなくなります。これは列車であって、海岸の風景ではありません！

{% columns %}
{% column %}

<figure><img src="/files/a30ce5b746d83a671d2468303c3ad5e9f00f6ab1" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column %}

<figure><img src="/files/52b175255152dd6f08a65a654df79387513e53e6" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

また、次でも dynamic ベンチマークを示しました <https://docs.unsloth.ai/basics/unsloth-dynamic-2.0-ggufs> Gemma 3 と Llama 4 Scout で、私たちの手法がどれほど有効かを示しています：

{% columns %}
{% column %}

<figure><img src="/files/e0ac9693904548db6d0360da3e7f6585d981d67e" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column %}

<figure><img src="/files/3066ab646078a0dad545d4932a951f78b7324154" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

### ⚙️ベンチマーク設定

DeepSeek-V3.1 の実験では、異なる bit 数の **Unsloth Dynamic GGUFs** を次と比較しました：

* **フル精度の未量子化 LLM** GPT 4.5、4.1、Claude-4-Opus、DeepSeek-V3-0324 などを含む
* ***その他*****&#x20;dynamic imatrix V3.1 GGUFs**
* ***セミ*****dynamic** （一部の選択的層量子化）imatrix V3.1 GGUFs を **アブレーション目的で**.

ベンチマーク実験は主に [David Sluys](https://www.linkedin.com/in/david-sluys-231348208/) （neolithic5452、 [Aider Discord](https://discord.com/channels/1131200896827654144/1408293692074360914)）によって実施されました。彼は Aider Polyglot 評価における信頼できるコミュニティ貢献者です。テストは約3回実行して中央値スコアを平均し、慣例に従って Pass-2 の精度を報告しています。Aider の Discord には再現可能なベンチマークコード片がいくつかあります。

<details>

<summary>Reasoning モデルの Aider ベンチマークを表示</summary>

| モデル                              | 精度       |
| -------------------------------- | -------- |
| GPT-5                            | 86.7     |
| Gemini 2.5 Pro（6月）               | 83.1     |
| o3                               | 76.9     |
| DeepSeek V3.1                    | 76.1     |
| **（3 bit）DeepSeek V3.1 Unsloth** | **75.6** |
| Claude-4-Opus（5月）                | 72       |
| o4-mini（High）                    | 72       |
| DeepSeek R1 0528                 | 71.4     |
| **（2 bit）DeepSeek V3.1 Unsloth** | **66.7** |
| Claude-3.7-Sonnet（2月）            | 64.9     |
| **（1 bit）DeepSeek V3.1 Unsloth** | **57.8** |
| DeepSeek R1                      | 56.9     |

</details>

<details>

<summary>Non Reasoning モデルの Aider ベンチマークを表示</summary>

| モデル                              | 精度       |
| -------------------------------- | -------- |
| DeepSeek V3.1                    | 71.6     |
| Claude-4-Opus（5月）                | 70.7     |
| **（5 bit）DeepSeek V3.1 Unsloth** | **70.7** |
| **（4 bit）DeepSeek V3.1 Unsloth** | **69.7** |
| **（3 bit）DeepSeek V3.1 Unsloth** | **68.4** |
| **（2 bit）DeepSeek V3.1 Unsloth** | **65.8** |
| Qwen3 235B A22B                  | 59.6     |
| Kimi K2                          | 59.1     |
| **（1 bit）DeepSeek V3.1 Unsloth** | **55.7** |
| DeepSeek V3-0324                 | 55.1     |
| GPT-4.1（2025年4月）                 | 52.4     |
| ChatGPT 4o（2025年3月）              | 45.3     |
| GPT-4.5                          | 44.9     |

</details>

DeepSeek V3.1 には reasoning モードと non reasoning モードの両方があり、私たちは両方をテストしました。non reasoning では、私たちの dynamic quantization の性能が以下のように明確に見て取れます。dynamic 5-bit は Aider Pass-2 で 70.7% を達成し、dynamic 1-bit は 55.7% を達成しました。サイズと精度の観点では、3bit と 4bit が非常に強力です！

<figure><img src="/files/8b5a794d2673d4dcc10f77ec2eddb45ce507c350" alt=""><figcaption></figcaption></figure>

## :sparkler:他の quants との比較

また、コミュニティによる他の dynamic imatrix GGUFs についても Aider Polyglot ベンチマークを実行し、私たちのものと比較しました。 **公平な比較**を行うために、以下を実施します：

1. 各 Unsloth quant と似たサイズのファイルと bit 種類を選びます。
2. コミュニティ quant がベンチマークの実行に失敗する場合は、私たちの **固定チャットテンプレート** を使用します。いくつかのコミュニティ quants で `{"code":500,"message":"split method must have between 1 and 1 positional arguments and between 0 and 0 keyword arguments at row 3, column 1908"}`という問題が見つかりましたが、これは私たちの固定チャットテンプレートを使うことで修正されます。

同じモデルサイズと quant 種類で比べると、Unsloth の dynamic quants が他のコミュニティ量子化より著しく良い結果を出していることがわかります！

<figure><img src="/files/d44d2c92d28fd74bbbf78a293631dfd0b4bab503" alt=""><figcaption></figcaption></figure>

<details>

<summary>他の quants との生の数値データ比較を表示</summary>

<table><thead><tr><th width="109.25">量子化</th><th width="171.25006103515625">Quant サイズ（GB）</th><th>Unsloth 精度 %</th><th>比較精度 %</th></tr></thead><tbody><tr><td>IQ2_XXS</td><td>164</td><td></td><td>43.6</td></tr><tr><td>TQ1_0</td><td>170</td><td>50.7</td><td></td></tr><tr><td>IQ1_M</td><td>206</td><td>55.7</td><td></td></tr><tr><td>IQ2_M</td><td>215</td><td></td><td>56.6</td></tr><tr><td>IQ2_XXS</td><td>225</td><td>61.2</td><td></td></tr><tr><td>IQ2_M</td><td>235</td><td>64.3</td><td></td></tr><tr><td>Q2_K_L</td><td>239</td><td></td><td>64.0</td></tr><tr><td>Q2_K_XL</td><td>255</td><td>65.8</td><td></td></tr><tr><td>IQ3_XXS</td><td>268</td><td>65.6</td><td>65.6</td></tr><tr><td>IQ3_XXS</td><td>279</td><td>66.8</td><td></td></tr><tr><td>Q3_K_S</td><td>293</td><td></td><td>65.2</td></tr><tr><td>Q3_K_XL</td><td>300</td><td>68.4</td><td></td></tr><tr><td>IQ4_XS</td><td>357</td><td>69.2</td><td></td></tr><tr><td>IQ4_XS</td><td>360</td><td></td><td>66.3</td></tr><tr><td>Q4_K_XL</td><td>387</td><td>69.7</td><td></td></tr><tr><td>Q4_K_M</td><td>405</td><td>69.7</td><td></td></tr><tr><td>Q4_K_M</td><td>409</td><td></td><td>67.7</td></tr><tr><td>Q5_K_M</td><td>478</td><td></td><td>68.9</td></tr><tr><td>Q5_K_XL</td><td>484</td><td>70.7</td><td></td></tr></tbody></table>

</details>

### :cake:Dynamic quantization のアブレーション

私たちの calibration dataset と dynamic quantization 手法が本当に機能するかを確認するために、いくつかのアブレーションも行いました。Unsloth の dynamic 手法のコツは、 **重要な層をより高い bit に量子化する** たとえば 8bit にし、 **重要でない層は 2bit のようなより低い bit に残す**.

ことです。手法を検証するため、特定のテンソルを 4bit のような低精度にするか、高精度にするかを試します。以下の例では `attn_k_b` テンソルを 4bit（semi-dynamic）対 8bit（Unsloth current）で残し、量子化サイズをたった約100MB（<0.1%）増やすだけで、精度が劇的に向上します！

{% hint style="success" %}
`attn_k_b` また、DeepSeek V3.1 の他のテンソルは非常に重要／量子化に敏感であり、精度を保つためにはより高い精度のまま残すべきです！
{% endhint %}

<figure><img src="/files/f88560a0730bb6fd03b388687b6a6b296a4478c5" alt=""><figcaption></figcaption></figure>

### :bug:チャットテンプレートのバグ修正

DeepSeek-V3.1 の quant をテストしている最中に、いくつかの低 bit quant が properly で囲まれていなかったり、妙なフォーマットになっていたりすることが見つかりました。これにより、一部のコミュニティ quants は低 bit で動作しなくなり、不公平な比較になっていました。llama.cpp の minja（より सरलな jinja 版）の使用では、 `<think> </think>` で位置引数を受け付けないことがわかりました `.split`。そこで、次のように変更する必要がありました：

```
{%- set content = content.split("</think>", 1)[1] -%}
```

を以下に：

```
{%- set splitted = content.split("</think>") -%}
{%- set content = splitted[1:] | join("</think>") -%}
```

参照 [こちら](https://huggingface.co/unsloth/DeepSeek-V3.1-GGUF?chat_template=default\&format=true) 私たちの固定チャットテンプレート用に、あるいは [こちら](https://huggingface.co/unsloth/DeepSeek-V3.1/raw/main/chat_template.jinja) 生の jinja ファイル用に。

### :bar\_chart:Pass Rate 1

Aider は主に pass rate 2 で報告されます。サイズの同じ community quants を比較するために、pass rate 1 も報告します。私たちの dynamic quants は、特に 2 bit 未満と 4 bit 超で、同規模の他の community quants よりかなり良い結果を出していることがわかります。3 bit と 4 bit は同様に良好に動作します。

<figure><img src="/files/a2f861b1754d9da88905fe9e1a11a35cfb18c649" alt=""><figcaption></figcaption></figure>

## :computer:DeepSeek V3.1 Dynamic quants を実行

私たちの [DeepSeek V3.1 ガイド](/docs/jp/moderu/tutorials/deepseek-r1-how-to-run-locally/deepseek-r1-dynamic-1.58-bit.md) にアクセスするか、すぐに dynamic 2bit 版を取得するには、次を実行してください：

```bash
apt-get update
apt-get install pciutils build-essential cmake curl libcurl4-openssl-dev -y
git clone https://github.com/ggml-org/llama.cpp
cmake llama.cpp -B llama.cpp/build \\
    -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=ON -DLLAMA_CURL=ON
cmake --build llama.cpp/build --config Release -j --clean-first --target llama-quantize llama-cli llama-gguf-split llama-mtmd-cli llama-server
cp llama.cpp/build/bin/llama-* llama.cpp
```

その後、 `llama.cpp` を使って重みを直接ダウンロードします。temperature や chat template などの最適な推奨パラメータもすでに設定しています：

```bash
export LLAMA_CACHE="unsloth/DeepSeek-V3.1-GGUF"
./llama.cpp/llama-cli \\
    -hf unsloth/DeepSeek-V3.1-GGUF:Q2_K_XL \
    --jinja \
    --n-gpu-layers 99 \\
    --temp 0.6 \\
    --top-p 0.95 \
    --min-p 0.01 \\
    --ctx-size 8192 \\
    --seed 3407 \\
    -ot ".ffn_.*_exps.=CPU"
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://unsloth.ai/docs/jp/ji-ben/unsloth-dynamic-2.0-ggufs/unsloth-dynamic-ggufs-on-aider-polyglot.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
