> For the complete documentation index, see [llms.txt](https://unsloth.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unsloth.ai/docs/jp/ji-chu/dynamic-3.0-ggufs/unsloth-dynamic-ggufs-on-aider-polyglot.md).

# Aider Polyglot上のUnsloth Dynamic GGUF

Aider PolyglotベンチマークにおけるUnsloth Dynamic GGUFの性能

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

以前に、 [私たちは](https://unsloth.ai/docs/jp/ji-chu/dynamic-3.0-ggufs.md) Unsloth Dynamic GGUFs が 5-shot MMLU と KL ダイバージェンスで他の量子化手法を上回る方法を実証しました。今回は、 **Aider Polyglot** **ベンチマーク**

<div><figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-a114143bdd47add988182aabf9313ab40be38d7d%2Faider%20thinking.png?alt=media" alt="" width="563"><figcaption><p>Thinking Aider ベンチマーク</p></figcaption></figure> <figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-b085c16c7f8351308229f1341846cbf1a2617d0a%2Faider%20non.png?alt=media" alt="" width="563"><figcaption><p>非 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ビット** 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 動的量子化

{% hint style="success" %}
**動的 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 は、レイヤーを選択的に量子化するだけで、QLoRA の微調整とモデル精度を大部分復元できることを示しました。 <mark style="background-color:green;">**レイヤーを選択的に量子化する**</mark>ことで、という内容でした。その後、私たちは [DeepSeek-R1](https://unsloth.ai/docs/jp/moderu/tutorials/deepseek-r1-how-to-run-locally.md)のアーキテクチャを研究し、同様の手法を適用しました。いくつかの層を 1-bit まで量子化し、重要な層はより高いビット数（6、8-bit）にしました。この手法はすぐに人気を集め、特に MoE モデルで非常に有効であることが証明され、動的量子化が MoE 量子化の事実上の標準となりました。

私たちの Dynamic GGUFs は、以下と組み合わせるとさらに効果的です。 [imatrix キャリブレーションデータセット](https://unsloth.ai/pages/021c19d75a86d940ef9b83b7b41bee381657345b#whats-new-in-dynamic-v2.0)。これはチャットとコーディング性能向けに設計されています。これらすべてにより、品質を壊滅的に損なうことなく、LLM を極端に圧縮できるようになりました。

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

{% columns %}
{% column %}

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-379bd5cc72a8f8e9acb4b6a6ad9fe847bf1ec296%2FTrain_NPovU814oJVjqy9Gu3BSm.avif?alt=media" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column %}

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-38f5ea51c343a79bde7996d678761944f1dedaa7%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

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

{% columns %}
{% column %}

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-28c5aa4355f5c09aef43217f2a02131aa6e3517f%2Fimage.avif?alt=media" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column %}

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-db47ebf519863f334f58c925dd6b39d0e01c359b%2Fimage.avif?alt=media" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

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

DeepSeek-V3.1 の実験では、次のさまざまなビット数の **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>理由モデルの 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（高）                       | 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>非理由モデルの 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="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-b085c16c7f8351308229f1341846cbf1a2617d0a%2Faider%20non.png?alt=media" alt=""><figcaption></figcaption></figure>

## :sparkler:他の量子化との比較

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

1. 各 Unsloth 量子化と同程度のサイズおよびビット種別のファイルを選びます。
2. 私たちの **固定チャットテンプレート** を、コミュニティ量子化がベンチマークの実行に失敗した場合に使用します。いくつかのコミュニティ量子化では `{"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"}`が見つかり、これは私たちの固定チャットテンプレートを使うことで修正されます。

同じモデルサイズと量子化タイプで他のコミュニティ量子化と比べると、Unsloth の dynamic quants が驚くほど良好な結果を示していることがわかります！

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-bbebbacfa75126d246c3ca1ed2ca269bc815b028%2FOther%20quants.png?alt=media" alt=""><figcaption></figcaption></figure>

<details>

<summary>他の量子化との生の数値比較を展開</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:動的量子化のアブレーション

キャリブレーションデータセットと動的量子化手法が本当に機能するか確認するために、いくつかのアブレーションも行いました。Unsloth の動的手法のコツは、 **重要な層をより高いビット数に量子化する** たとえば 8bits にし、 **重要でない層は 2bits のような低いビット数に残す**.

というものです。私たちの手法をテストするために、特定のテンソルを 4bit のような低精度のままにした場合と、より高精度にした場合を比較します。たとえば以下では `attn_k_b` テンソルを 4bit（セミダイナミック）と 8bit（現在の Unsloth）で比較し、量子化サイズをわずか約 100MB しか増やしていないにもかかわらず（<0.1%）、精度が劇的に向上します！

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

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-3b4f8ac3af4ec8d09763c2e5f5d7de912d0b042e%2FSemi%20Dynamic.png?alt=media" alt=""><figcaption></figcaption></figure>

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

DeepSeek-V3.1 量子化のテスト中に、いくつかの低ビット量子化が `<think> </think>` を適切に囲んでいなかったり、奇妙なフォーマットになっていることがわかりました。これにより、いくつかのコミュニティ量子化は低ビットで動作しなくなり、不公平な比較になっていました。llama.cpp が使う minja（jinja のより簡易な版）は、 `.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 で報告されます。同じサイズのコミュニティ量子化と比較するために、Pass Rate 1 も報告しています。私たちの dynamic quants は、特に 2 bit 未満や 4bits を超える領域で、同程度のサイズの他のコミュニティ量子化よりも大幅に良い結果を示しています。3 bit と 4 bit は同様に良好に動作します。

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-dfea83b4ef3e0d1a1c835476270eeb4f3f6db798%2FPass%20Rate%201%20Non%20Thinking.png?alt=media" alt=""><figcaption></figcaption></figure>

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

こちらへ [DeepSeek V3.1 ガイド](https://unsloth.ai/docs/jp/moderu/tutorials/deepseek-r1-how-to-run-locally/deepseek-r1-dynamic-1.58-bit.md) に進むか、動的 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` を使って重みを直接ダウンロードします。温度、チャットテンプレートなどの推奨最適パラメータもすでに設定しています：

```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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://unsloth.ai/docs/jp/ji-chu/dynamic-3.0-ggufs/unsloth-dynamic-ggufs-on-aider-polyglot.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
