> 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/moderu/diffusiongemma.md).

# DiffusionGemma - ローカルでの実行方法

DiffusionGemma **26B-A4B** は Google DeepMind の新しいオープン **マルチモーダル** モデルで、〜上に構築された [Gemma 4](/docs/jp/moderu/gemma-4.md) MoEアーキテクチャを採用しています。〜のサポート付きで **256Kのコンテキスト**, **140以上の言語**、DiffusionGemma は〜向けに設計されています **高速テキスト生成** テキスト、動画、画像入力全体にわたって。DiffusionGemma はローカルで実行できます **18GB RAM**、および [ファインチューニング](#fine-tune-diffusiongemma) は現在、〜を通じてサポートされています [Unsloth](https://github.com/unslothai/unsloth).

標準的なトークンごとのデコードの代わりに、DiffusionGemma は〜を使用します **拡散生成** 出力を並列に生成し、それらを徐々に最終回答へと洗練します。拡散画像モデルに似ていますが、テキスト向けです。モデルの実行は〜で [Unsloth Studio](/docs/jp/shii/studio.md) または llama.cpp。RTX 6000 では、DiffusionGemma は〜に達します **2000トークン/秒以上**. **GGUF:** [diffusiongemma-26B-A4B-it-GGUF](https://huggingface.co/unsloth/diffusiongemma-26B-A4B-it-GGUF)

<a href="/pages/67dde10a83f289f1c4d84bf59deafcd898794129#run-diffusiongemma-tutorials" class="button primary">DiffusionGemma を実行</a><a href="/pages/67dde10a83f289f1c4d84bf59deafcd898794129#fine-tune-diffusiongemma" class="button secondary">DiffusionGemma をファインチューニング</a>

{% hint style="success" %}
**6月12日:** 現在、DiffusionGemma は〜経由で実行できます [Unsloth Studio](#unsloth-studio-guide) ✨ 1.8倍高速な推論で！
{% endhint %}

### 使用ガイド

DiffusionGemma は、標準モデルよりも高速な生成を必要とするユーザー向けに設計されています。高速なローカル推論、長文脈の文書分析、画像/動画理解、OCR、文書解析、コード生成、ツール利用、エージェント的ワークフロー、低遅延の小バッチ推論に適しています。

標準的な Gemma 4 モデルとは異なり、DiffusionGemma には拡散対応の推論ランタイムが必要です。〜のような自己回帰設定は `temperature`, `top_p`、および `top_k` 必要な拡散サンプラーがなければ、推奨動作を再現するには十分ではありません。

<div data-with-frame="true"><figure><img src="/files/c3cb18ff1e86ab57357a3712b0511e41752c66b4" alt="" width="563"><figcaption></figcaption></figure></div>

### ハードウェア要件

4ビット精度でモデルを実行するには、通常少なくとも18GBのRAMがあるとよいです。 **GGUF:** [diffusiongemma-26B-A4B-it-GGUF](https://huggingface.co/unsloth/diffusiongemma-26B-A4B-it-GGUF)

**表: DiffusionGemma 推論 GGUF 推奨ハードウェア要件** （単位 = 総メモリ：RAM + VRAM、またはユニファイドメモリ）。

| 4ビット  | 5ビット  | 6ビット  | 8ビット  | BF16 / FP16 |
| ----- | ----- | ----- | ----- | ----------- |
| 18 GB | 20 GB | 24 GB | 28 GB | 52 GB       |

{% hint style="info" %}
目安として、利用可能な総メモリは少なくともダウンロードする量子化モデルのサイズを上回っている必要があります。そうでない場合でも、RAM/ディスクへの部分オフロードで実行できますが、生成は遅くなります。使用するコンテキストウィンドウに応じて、より多くの計算資源も必要になります。
{% endhint %}

## DiffusionGemma チュートリアルを実行

少なくとも4ビット精度を使うのが最善なので、ここでは4ビットを使用します `Q4_K_M` 量子化版を使用します。これは18GBのRAMを必要とします。 **GGUF:** [diffusiongemma-26B-A4B-it-GGUF](https://huggingface.co/unsloth/diffusiongemma-26B-A4B-it-GGUF)

<a href="/pages/67dde10a83f289f1c4d84bf59deafcd898794129#unsloth-studio-guide" class="button primary">🦥 Unsloth Studioガイド</a><a href="/pages/67dde10a83f289f1c4d84bf59deafcd898794129#llama.cpp-guide" class="button primary">🦙 Llama.cppガイド</a>

### 🦥 Unsloth Studioガイド

{% hint style="success" %}
現在、DiffusionGemma は〜経由で実行できます [Unsloth Studio](#unsloth-studio-guide) ✨。必ず〜を使用してください [`v0.1.463-beta`](https://github.com/unslothai/unsloth/tree/v0.1.462-beta) または `2026.6.6`.
{% endhint %}

DiffusionGemma は現在〜で実行および学習できます [Unsloth Studio](/docs/jp/shii/studio.md)。これはローカルAI向けの新しいオープンソースWeb UIです。Unsloth Studioでは、モデルをローカルで次の環境上で実行できます： **MacOS**, **Windows**、Linux、および次の機能：

{% columns %}
{% column %}

* 検索、ダウンロード、 [GGUFの実行](/docs/jp/shii/studio.md#run-models-locally) およびsafetensorモデル
* [**自己修復** ツール呼び出し](/docs/jp/shii/studio.md#execute-code--heal-tool-calling) + **ウェブ検索**
* [**コード実行**](/docs/jp/shii/studio.md#run-models-locally) （Python、Bash）
* [自動推論](https://unsloth.ai/docs/desktop#feature-deep-dive) パラメータ調整（temp、top-pなど）
* llama.cpp経由の高速CPU＋GPU推論
* [LLMの学習](/docs/jp/shii/studio.md#no-code-training) VRAMを70%削減しつつ2倍高速
  {% endcolumn %}

{% column %}

<div data-with-frame="true"><figure><img src="/files/c3cb18ff1e86ab57357a3712b0511e41752c66b4" alt=""><figcaption></figcaption></figure></div>
{% endcolumn %}
{% endcolumns %}

{% stepper %}
{% step %}

#### Unslothをインストール

最新の [`v0.1.463-beta`](https://github.com/unslothai/unsloth/tree/v0.1.462-beta) または `2026.6.6`を使用してください。ターミナルで実行：

**MacOS、Linux、WSL：**

```bash
curl -fsSL https://unsloth.ai/install.sh | sh
```

**Windows PowerShell：**

```bash
irm https://unsloth.ai/install.ps1 | iex
```

{% endstep %}

{% step %}

#### Unslothを起動

**MacOS、Linux、WSL、およびWindows：**

```bash
unsloth studio -H 0.0.0.0 -p 8888
```

次に開く `http://127.0.0.1:8888` （またはお使いのURL）をブラウザで。
{% endstep %}

{% step %}

#### DiffusionGemma を検索してダウンロード

初回起動時には、アカウントを保護するためのパスワードを作成し、再度サインインする必要があります。

次に〜へ移動し [Unsloth Chat](/docs/jp/shii/studio/chat.md) タブで、検索バーに DiffusionGemma を入力して検索し、目的のモデルと量子化版をダウンロードします。
{% endstep %}

{% step %}

#### DiffusionGemma を実行

Unsloth Studioを使うと推論パラメータは自動設定されますが、手動でも変更できます。コンテキスト長、チャットテンプレート、その他の設定も編集できます。

詳細については、次を参照してください [Unsloth Studio推論ガイド](/docs/jp/shii/studio/chat.md).

<div data-with-frame="true"><figure><img src="/files/c3cb18ff1e86ab57357a3712b0511e41752c66b4" alt="" width="563"><figcaption></figcaption></figure></div>
{% endstep %}
{% endstepper %}

### 🦙 Llama.cppガイド

このチュートリアルでは、Dynamic 4ビットを利用します `Q4_K_M` 量子化版を使用し、18GBのRAMが必要で [llama.cpp](llama.cpphttps://github.com/ggml-org/llama.cpp) 高速なローカル推論のために、特にCPUしかない場合に使用します。

{% stepper %}
{% step %}
特定の `llama.cpp` PRを [**GitHub はこちら**](https://github.com/ggml-org/llama.cpp/pull/24423)。以下のビルド手順に従うこともできます。変更してください `-DGGML_CUDA=ON` を `-DGGML_CUDA=OFF` GPU がない場合、または CPU 推論のみを使用したい場合。 **Apple Mac / Metal デバイスの場合**、次を設定し `-DGGML_CUDA=OFF` その後は通常どおり続行してください。Metal サポートはデフォルトで有効です。

```bash
git clone https://github.com/ggml-org/llama.cpp
cd llama.cpp
gh pr checkout 24423
# CUDA でビルド（CPUのみのビルドにするには -DGGML_CUDA=ON を外す）
cmake -B build -DGGML_CUDA=ON
cmake --build build -j --config Release --target llama-diffusion-cli
cd ..
```

{% endstep %}

{% step %}
（以下をインストールした後）モデルを次の方法でダウンロードしてください `pip install huggingface_hub`をインストールした後）。 `Q4_K_M` または、次のような他の量子化版を選ぶこともできます： `Q8_0` 。ダウンロードが止まる場合は、次を参照してください： [Hugging Face Hub、XETデバッグ](/docs/jp/ji-ben/troubleshooting-and-faqs/hugging-face-hub-xet-debugging.md)

```bash
pip install -U "huggingface_hub[cli]"
hf download unsloth/diffusiongemma-26B-A4B-it-GGUF \\
    --local-dir unsloth/diffusiongemma-26B-A4B-it-GGUF \\
    --include "*Q8_0*" # より小さい16 GBのダウンロードには "*Q4_K_M*" を使用
```

{% endstep %}
{% endstepper %}

### DiffusionGemma とチャット

次に以下を実行します:

{% code overflow="wrap" %}

```bash
./build/bin/llama-diffusion-cli \\
  -m unsloth/diffusiongemma-26B-A4B-it-GGUF/diffusiongemma-26B-A4B-it-Q8_0.gguf \\
  -ngl 99 -cnv -n 2048
```

{% endcode %}

次のように表示されます:

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

また、「Create a Flappy Bird Game」のような質問を入力すると、手順が表示されます:

<figure><img src="/files/72fe86bf54063a42a8d5348cd07715fb096d6569" alt=""><figcaption></figcaption></figure>

その後、出力が表示されます:

<figure><img src="/files/6daa207428749871a1d361985f850ee8f9d8c27b" alt="" width="375"><figcaption></figcaption></figure>

会話を続けることもできます！

変更してください `-n 2048` 予測したいトークン数を指定します。多いほど、より長い回答になります。

### 拡散のライブ可視化

拡散を実際にライブで見るには、以下を使用してください。特に〜を有効にします `--diffusion-visual`:

```bash
./build/bin/llama-diffusion-cli \\
  -m unsloth/diffusiongemma-26B-A4B-it-GGUF/diffusiongemma-26B-A4B-it-Q8_0.gguf \\
  -ngl 99 -cnv -n 2048 --diffusion-visual
```

再び次のように表示されます:

<figure><img src="/files/711f4cdbf0da0c6cf0c7ebfb0b6623b709f797ee" alt=""><figcaption></figcaption></figure>

すると、次の結果が得られます:

<figure><img src="/files/2d6916b526a6d1d602f096d40b13a6c8ee89bdd5" alt="" width="563"><figcaption></figcaption></figure>

ブランチを使用した llama.cpp の全パラメータ:

* `-n, --n-predict N` - 目標トークン; 導出されます `--diffusion-blocks` および増加します `-ub` / `-b` / `-c`.
* `-ngl 99` - すべてのレイヤーをGPUへオフロード（`-ngl 0` CPUのみの場合）。
* `-cnv` - 複数ターン会話モード。
* `--diffusion-visual` - ライブキャンバスのノイズ除去表示。
* Entropy-Boundサンプラーはデフォルトで有効です（`--diffusion-eb auto`）。次の項目で調整できます: `--diffusion-eb-max-steps` （デフォルト48）、 `--diffusion-eb-t-max` / `--diffusion-eb-t-min` (0.8 -> 0.4), `--diffusion-eb-entropy-bound` （0.1）、および `--diffusion-eb-confidence` (0.005).
* `--diffusion-kv-cache {auto,on,off}` - プロンプト先頭のKVキャッシュ（auto = 単一GPUではon）。

## DiffusionGemma をファインチューニング

現在、DiffusionGemma を直接〜で学習およびファインチューニングできます [**Unsloth**](#unsloth-studio-guide)。この例では、モデルを数独でファインチューニングすることで、ドメイン固有の学習の効果を示しています。ベースモデルは当初、数独タスクでうまく動作しませんが、対象を絞ったデータセットで学習すると、実際に数独を解く方法を学び、すべての例を正しく解けるようになります。

Colabノートブック（A100）を使って、以下の内容で DiffusionGemma をファインチューニングできます:

{% embed url="<https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/DiffusionGemma_(26B-A4B)-Sudoku.ipynb>" %}

<div data-with-frame="true"><figure><img src="/files/f272586b00e3025fb709accaf4270c773c3e6ca8" alt="" width="563"><figcaption></figcaption></figure></div>

## 推奨設定

[Unsloth Studio](#unsloth-studio-guide) モデルに最適な推論設定を自動的に設定します。必要に応じて以下を使用してください:

| カテゴリ   | 設定          | 値                           |
| ------ | ----------- | --------------------------- |
| サンプリング | 手法          | `diffusion_sampling`        |
| サンプリング | サンプラー       | `entropy_bounded_denoising` |
| サンプリング | 最大ノイズ除去ステップ | `48`                        |
| 温度     | 温度スケジュール    | `linear_decay`              |
| 温度     | 温度開始        | `0.8`                       |
| 温度     | 温度終了        | `0.4`                       |
| エントロピー | エントロピー境界    | `0.1`                       |
| 適応停止   | 適応停止が有効     | `true`                      |
| 適応停止   | エントロピーしきい値  | `0.005`                     |
| キャンバス  | キャンバス長      | `256`                       |

**適応停止のトリガー条件**

適応停止は、次の場合にのみトリガーされるべきです **両方** の条件が満たされたとき:

| 条件                  | 必要な値      |
| ------------------- | --------- |
| キャンバス平均エントロピー       | `< 0.005` |
| 最高確率トークンが2ステップ連続で安定 | `true`    |

各ノイズ除去ステップで、サンプラーは相互情報量境界が次のままである最小エントロピートークンを選択すべきです: `entropy_bound = 0.1`。選択されなかったトークンは、次のノイズ除去ステップの前に完全に再ノイズ化されるべきです。

### 思考モード

DiffusionGemma は Gemma 4 風の思考モードをサポートしています。思考を有効にするには、システムプロンプトの先頭に思考トークンを追加します:

```
<|think|>
```

思考が有効な場合、モデルは内部推論チャンネルの後に最終回答を出力することがあります:

```
<|channel>thought
[内部推論]
<channel|>
[最終回答]
```

思考を無効にするには、〜を削除します `<|think|>` トークンをシステムプロンプトから削除します。思考が無効でも、モデルは空の思考チャンネルを出力する場合があります:

```
<|channel>thought
<channel|>
[最終回答]
```

複数ターン会話では、〜しないでください **しない** 会話履歴に以前の隠れた思考を含める。次のユーザーターンの前には、最終的なアシスタント応答のみを含めてください。

## DiffusionGemma のベストプラクティス

### マルチモーダルプロンプト

DiffusionGemma は、テキストと画像を含むインターリーブされたマルチモーダル入力をサポートします。動画は画像フレームのシーケンスとして処理できます。

マルチモーダルプロンプトで最良の結果を得るには、画像またはフレームの内容をテキスト指示の前に配置します。例:

```
[画像]
このグラフを説明し、主要な傾向を要約してください。
```

文書解析、OCR、チャート理解、UI理解、または短いテキスト抽出には、より大きい視覚トークン予算を使用してください。

サポートされる視覚トークン予算:

| 視覚トークン予算 | 最適用途                 |
| -------- | -------------------- |
| 70       | 高速分類、簡単なキャプション作成     |
| 140      | 軽量な視覚QA              |
| 280      | 一般的な画像理解             |
| 560      | OCR、チャート、UIスクリーンショット |
| 1120     | 高密度文書、小さな文字、詳細抽出     |

動画形式の入力では、DiffusionGemma は最大〜を処理できます **60秒** 〜でサンプリングした場合 **1秒あたり1フレーム**.

### サンプリングの注意

DiffusionGemma は通常の次トークンのみのモデルではありません。これは、ノイズのあるトークン予測を繰り返し洗練することで、 **キャンバス**と呼ばれるトークンのブロックを生成します。生成プロセスはおおむね次のように進みます:

1. エンコーダーがプロンプトを処理し、コンテキストキャッシュを構築します。
2. デコーダーが256トークンの生成キャンバスを受け取ります。
3. 拡散サンプラーがキャンバスを反復的にノイズ除去します。
4. 確信度の高いトークンが選択され、保持されます。
5. 不確実なトークンは再ノイズ化され、再び洗練されます。
6. キャンバスが完成すると、コンテキストに追加されます。
7. モデルは次のキャンバスへ進みます。

このブロック自己回帰アプローチにより、DiffusionGemma は標準的な自己回帰モデルよりも少ない順伝播で多くのトークンを生成できます。

## ベンチマーク

DiffusionGemma は速度とマルチモーダル推論に最適化されていますが、標準の Gemma 4 は従来の推論ベンチマークでより強力です。

| ベンチマーク              | DiffusionGemma 26B-A4B | Gemma 4 26B-A4B |
| ------------------- | ---------------------: | --------------: |
| MMLU Pro            |                  77.6% |           82.6% |
| AIME 2026 no tools  |                  69.1% |           88.3% |
| LiveCodeBench v6    |                  69.1% |           77.1% |
| Codeforces ELO      |                   1429 |            1718 |
| GPQA Diamond        |                  73.2% |           82.3% |
| Tau2 Average        |                  56.2% |           68.2% |
| HLE no tools        |                  11.0% |            8.7% |
| HLE with search     |                  11.9% |           17.2% |
| BigBench Extra Hard |                  47.6% |           64.8% |
| MMMLU               |                  81.5% |           86.3% |

| 長文脈ベンチマーク                | DiffusionGemma 26B-A4B | Gemma 4 26B-A4B |
| ------------------------ | ---------------------: | --------------: |
| MRCR v2 8 needle 128K 平均 |                  32.0% |           44.1% |

**視覚ベンチマーク:**

| 視覚ベンチマーク                | DiffusionGemma 26B-A4B | Gemma 4 26B-A4B |
| ----------------------- | ---------------------: | --------------: |
| MMMU Pro                |                  54.3% |           73.8% |
| OmniDocBench 1.5、低いほど良い |                  0.319 |           0.149 |
| MATH-Vision             |                  70.5% |           82.4% |
| MedXPertQA MM           |                  49.0% |           58.1% |


---

# 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 dynamically by asking a question.

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

```
GET https://unsloth.ai/docs/jp/moderu/diffusiongemma.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
