> 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/tutorials/cogito-v2-how-to-run-locally.md).

# Cogito v2.1: ローカルでの実行方法

Cogito v2.1 LLMは、IDAで学習された世界最強クラスのオープンモデルの1つです。また、v1は70B、109B、405B、671Bの4サイズがあり、ハードウェアに最適なサイズを選べます。

{% hint style="success" %}
Deep Cogito v2.1 は、2025年11月19日時点で最も強力なオープンウェイトモデルである更新版 671B MoE です。
{% endhint %}

Cogito v2.1 は 671B MoE の1サイズのみで、一方 Cogito v2 Preview は [Deep Cogito](https://www.deepcogito.com/)のモデル公開は、70B から 671B までの4つのモデルサイズに及びます。を使用することで **IDA（Iterated Distillation & Amplification）**、これらのモデルは、推論時に単により長く探索する（DeepSeek R1 のように）のではなく、反復的な方策改善を用いてモデルが推論過程を内面化するように学習されています。

Deep Cogito の拠点は [サンフランシスコ（米国）](https://techcrunch.com/2025/04/08/deep-cogito-emerges-from-stealth-with-hybrid-ai-reasoning-models/) （Unsloth のように :flag\_us:）そして、4つすべてのモデルサイズ向けに量子化された動的モデルを提供できることを嬉しく思います！すべてのアップロードは Unsloth を使用します [Dynamic 2.0](/docs/jp/ji-chu/dynamic-3.0-ggufs.md) 最先端の5-shot MMLU と KL Divergence の性能のためで、これにより、精度低下を最小限に抑えつつ、これらの量子化 LLM を実行・ファインチューニングできます！

**チュートリアルナビゲーション:**

<a href="https://docs.unsloth.ai/basics/tutorials-how-to-fine-tune-and-run-llms/cogito-v2-how-to-run-locally#run-cogito-671b-moe-in-llama.cpp" class="button secondary">671B MoE を実行</a><a href="https://docs.unsloth.ai/basics/tutorials-how-to-fine-tune-and-run-llms/cogito-v2-how-to-run-locally#run-cogito-109b-moe-in-llama.cpp" class="button secondary">109B MoE を実行</a><a href="https://docs.unsloth.ai/basics/tutorials-how-to-fine-tune-and-run-llms/cogito-v2-how-to-run-locally#run-cogito-405b-dense-in-llama.cpp" class="button secondary">405B Dense を実行</a><a href="https://docs.unsloth.ai/basics/tutorials-how-to-fine-tune-and-run-llms/cogito-v2-how-to-run-locally#run-cogito-70b-dense-in-llama.cpp" class="button secondary">70B Dense を実行</a>

{% hint style="success" %}
お使いのハードウェアに合うモデルサイズを選んでください！4つすべてのモデルサイズについて、1.58bit から 16bit までのバリエーションをアップロードしています！
{% endhint %}

## :gem: モデルサイズとアップロード

4つのモデルサイズがあります:

1. Llama ベースの Dense モデルが2つあります - 70B と 405B
2. Llama 4 Scout (109B) と DeepSeek R1 (671B) ベースの MoE モデルが2つあります

<table data-full-width="false"><thead><tr><th>モデルサイズ</th><th width="256.9999694824219">推奨量子化 &#x26; リンク</th><th>ディスクサイズ</th><th>アーキテクチャ</th></tr></thead><tbody><tr><td>70B Dense</td><td><a href="https://huggingface.co/unsloth/cogito-v2-preview-llama-70B-GGUF">UD-Q4_K_XL</a></td><td><strong>44GB</strong></td><td>Llama 3 70B</td></tr><tr><td>109B MoE</td><td><a href="https://huggingface.co/unsloth/cogito-v2-preview-llama-109B-MoE-GGUF">UD-Q3_K_XL</a></td><td><strong>50GB</strong></td><td>Llama 4 Scout</td></tr><tr><td>405B Dense</td><td><a href="https://huggingface.co/unsloth/cogito-v2-preview-llama-405B-GGUF">UD-Q2_K_XL</a></td><td><strong>152GB</strong></td><td>Llama 3 405B</td></tr><tr><td>671B MoE</td><td><a href="https://huggingface.co/unsloth/cogito-v2-preview-deepseek-671B-MoE-GGUF">UD-Q2_K_XL</a></td><td><strong>251GB</strong></td><td>DeepSeek R1</td></tr></tbody></table>

{% hint style="success" %}
必須ではありませんが、最高の性能を得るには、VRAM + RAM の合計がダウンロードする量子化のサイズに等しくなるようにしてください。VRAM + RAM がそれより少ない場合でも量子化は動作しますが、かなり遅くなります。
{% endhint %}

## 🐳 llama.cpp で Cogito 671B MoE を実行

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

{% code overflow="wrap" %}

```shellscript
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
cp llama.cpp/build/bin/llama-* llama.cpp
```

{% endcode %}

2. を使いたい場合は `llama.cpp` モデルを直接読み込むには、以下を実行できます: (:IQ1\_S) は量子化タイプです。Hugging Face 経由でもダウンロードできます（3 を参照）。これは次と似ています `ollama run` に似ています。 `export LLAMA_CACHE="folder"` を使って `llama.cpp` 特定の場所に保存するには、

{% hint style="success" %}
ぜひお試しください `-ot ".ffn_.*_exps.=CPU"` を試して、すべての MoE 層を CPU にオフロードしてください！これにより、非MoE層すべてを1枚のGPUに収められるようになり、生成速度が向上します。GPU容量がさらにあれば、正規表現を調整してより多くの層を収めることもできます。

GPU メモリがもう少し多ければ、 `-ot ".ffn_(up|down)_exps.=CPU"` を試してください。これは up と down の projection MoE 層をオフロードします。

試してみてください `-ot ".ffn_(up)_exps.=CPU"` GPU メモリがさらに多い場合はこちら。これは up projection の MoE 層のみをオフロードします。

そして最後に、すべての層を `-ot ".ffn_.*_exps.=CPU"` でオフロードします。

これは最も少ない VRAM を使用します。 `-ot "\.(6|7|8|9|[0-9][0-9]|[0-9][0-9][0-9])\.ffn_(gate|up|down)_exps.=CPU"` は、6層目以降から gate、up、down の MoE 層をオフロードすることを意味します。
{% endhint %}

```shellscript
export LLAMA_CACHE="unsloth/cogito-671b-v2.1-GGUF"
./llama.cpp/llama-cli \
    -hf unsloth/cogito-671b-v2.1-GGUF:UD-Q2_K_XL \
    --n-gpu-layers 99 \\
    --temp 0.6 \
    --top-p 0.95 \\
    --min-p 0.01 \\
    --ctx-size 16384 \\
    --seed 3407 \\
    --jinja \\
    -ot ".ffn_.*_exps.=CPU"
```

3. 以下をインストールした後、( `pip install huggingface_hub hf_transfer` をインストール後）。 `UD-IQ1_S`（動的 1.78bit 量子化）または次のような他の量子化版 `Q4_K_M` をインストールした後で）。 <mark style="background-color:green;">**2.7bit の動的量子化版を使うことを推奨します**</mark><mark style="background-color:green;">**&#x20;**</mark><mark style="background-color:green;">**`UD-Q2_K_XL`**</mark><mark style="background-color:green;">**&#x20;**</mark><mark style="background-color:green;">**サイズと精度のバランスを取るために**</mark>。他のバージョンはこちら: <https://huggingface.co/unsloth/cogito-671b-v2.1-GGUF>

{% code overflow="wrap" %}

```python
# !pip install huggingface_hub hf_transfer
import os
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "0" # レート制限がかかる場合があるため、無効化するには 0 に設定してください
from huggingface_hub import snapshot_download
snapshot_download(
    repo_id = "unsloth/cogito-671b-v2.1-GGUF",
    local_dir = "unsloth/cogito-671b-v2.1-GGUF",
    allow_patterns = ["*UD-IQ1_S*"], # 動的 1bit (168GB) 動的 2bit (251GB) には "*UD-Q2_K_XL*" を使用
)
```

{% endcode %}

4. 編集 `--threads 32` CPUスレッド数は `--ctx-size 16384` コンテキスト長は `--n-gpu-layers 2` GPUオフロードする層数です。GPUがメモリ不足になったら調整してみてください。CPUのみで推論する場合は削除してください。

## :mouse\_three\_button:llama.cpp で Cogito 109B MoE を実行

1. 上記の [671B モデルの実行と同じ手順に従ってください](#run-cogito-671b-moe-in-llama.cpp).
2. その後、以下を実行してください:

```shellscript
export LLAMA_CACHE="unsloth/cogito-v2-preview-llama-109B-MoE-GGUF"
./llama.cpp/llama-cli \
    -hf unsloth/cogito-v2-preview-llama-109B-MoE-GGUF:Q3_K_XL \
    --n-gpu-layers 99 \\
    --temp 0.6 \
    --min-p 0.01 \\
    --top-p 0.9 \
    --ctx-size 16384 \\
    --jinja \\
    -ot ".ffn_.*_exps.=CPU"
```

## :deciduous\_tree:llama.cpp で Cogito 405B Dense を実行

1. 上記の [671B モデルの実行と同じ手順に従ってください](#run-cogito-671b-moe-in-llama.cpp).
2. その後、以下を実行してください:

```shellscript
export LLAMA_CACHE="unsloth/cogito-v2-preview-llama-405B-GGUF"
./llama.cpp/llama-cli \
    -hf unsloth/cogito-v2-preview-llama-405B-GGUF:Q2_K_XL \
    --n-gpu-layers 99 \\
    --temp 0.6 \
    --min-p 0.01 \\
    --top-p 0.9 \
    --jinja \\
    --ctx-size 16384
```

## :sunglasses: llama.cpp で Cogito 70B Dense を実行

1. 上記の [671B モデルの実行と同じ手順に従ってください](#run-cogito-671b-moe-in-llama.cpp).
2. その後、以下を実行してください:

```shellscript
export LLAMA_CACHE="unsloth/cogito-v2-preview-llama-70B-GGUF"
./llama.cpp/llama-cli \
    -hf unsloth/cogito-v2-preview-llama-70B-GGUF:Q4_K_XL \
    --n-gpu-layers 99 \\
    --temp 0.6 \
    --min-p 0.01 \\
    --top-p 0.9 \
    --jinja \\
    --ctx-size 16384
```

こちらを参照 <https://www.deepcogito.com/research/cogito-v2-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 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/moderu/tutorials/cogito-v2-how-to-run-locally.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.
