llama.cpp で Mythos コーディングモデルをローカル実行
Pi は llama.cpp を活用して Mythos 強化型コーディングモデルをローカル環境で実行可能にする方法を提示し、開発者が高性能なコード生成 AI をオフラインかつ低コストで利用する道を開いた。
キーポイント
ローカル実行の実現
llama.cpp の技術を活用することで、Mythos モデルをクラウド依存なしのローカル環境で直接実行できることが示された。
コーディング能力の強化
Mythos として最適化されたモデルは、従来の汎用モデルよりも高度なコード生成とデバッグ支援を可能にする。
開発者への利点
データプライバシーの確保や、インターネット接続が不要な環境での利用など、実務における柔軟性が向上する。
重要な引用
Run the Mythos Enhanced Coding Model Locally with llama.cpp and Pi
影響分析・編集コメントを表示
影響分析
この記事は、大規模言語モデルをクラウドサービスからローカル環境へ移行させる動きを象徴しており、開発者にとってプライバシーとコスト管理の両立を実現する重要なステップとなる。特にコーディング支援ツールとしての実用性が高まることで、オフラインでの開発ワークフローがさらに強化されるだろう。
編集コメント
Mythos モデルのローカル実装は、プライバシー意識の高い開発者やセキュリティ要件が厳しい現場にとって極めて有用なアプローチです。llama.cpp の普及により、高性能 AI モデルのハードルが下がりつつある現状を反映した重要な事例と言えます。
image**
# イントロダクション
Qwythos-9B-Claude-Mythos-5-1M は、Qwen3.5 をベースにした 90 億パラメータの推論・コーディングモデルです。ローカルでの開発ワークフロー、エージェント型開発、そして長いコンテキストを扱うタスクに特化して設計されています。このモデルが注目される理由は、消費者向けのハードウェアでも動作するほど軽量でありながら、実用的なコーディングタスクをこなすのに十分な能力を持っている点にあります。
本ガイドでは、llama.cpp を用いて Mythos 強化版の Qwythos モデルをローカル環境で実行し、さらに Pi と接続してローカルコーディングエージェントとして活用する方法をご紹介します。私が使用する環境は VRAM 16GB の RTX 4070 Ti Super で、これなら Q6_K_MTP 量子化版も快適に動作します。もしお使いの GPU が VRAM 8GB の場合でも問題ありませんが、品質・速度・メモリ使用量のバランスを考慮すると、Q4_K_M バリアントから始めることをお勧めします。
# llama.cpp のインストール
まずは公式の llama.cpp コマンドラインインターフェース (CLI) をインストールしてください。これにより llama コマンドが利用可能になり、特にローカルでモデルを実行する際に使用する llama serve などの機能も使えるようになります。
curl -LsSf https://llama.app/install.sh | sh

次に、インストールディレクトリをシェルのパスに追加して、ターミナルから llama コマンドを実行できるようにします。
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
インストールが正常に行われたか確認するには、以下を実行してください。
llama help
すべて正しく設定されていれば、利用可能な llama.cpp のコマンドとオプションが表示されます。

Hugging Face キャッシュディレクトリの設定
Hugging Face のキャッシュ を、十分な空き容量がある場所に設定してください。これは特に、デフォルトのホームディレクトリにディスク領域が限られているクラウド環境で有効です。
export HF_HOME="/workspace/huggingface"
mkdir -p "$HF_HOME"
新しいターミナルセッションでもこの設定を維持するには、シェルの構成ファイルに追加します。
echo 'export HF_HOME="/workspace/huggingface"' >> ~/.bashrc
source ~/.bashrc
Qwythos MTP モデルの起動
利用可能なすべての GPU レイヤーを使って、Q6_K MTP GGUF モデルを実行します。
llama serve \
-hf "empero-ai/Qwythos-9B-Claude-Mythos-5-1M-GGUF:MTP-Q6_K" \
--alias "qwythos-9b-mtp" \
--host 0.0.0.0 \
--port 8910 \
--n-gpu-layers all \
--ctx-size 100000 \
--parallel 1 \
--batch-size 1024 \
--ubatch-size 512 \
--flash-attn on \
--cache-type-k q8_0 \
--cache-type-v q8_0 \
--spec-type draft-mtp \
--spec-draft-n-max 6 \
--threads 12 \
--threads-batch 24 \
--temp 0.6 \
--top-p 0.95 \
--top-k 20 \
--repeat-penalty 1.05 \
--jinja \
--perf
このコマンドを初めて実行すると、llama.cpp が Hugging Face からモデルファイルをダウンロードします。

その後、モデルが GPU メモリに読み込まれ、ローカルサーバーが起動します。

モデルの動作が開始したら、ブラウザでローカルインターフェースを開いてください。
http://localhost:8910
これにより、OpenAI と互換性のあるローカル API エンドポイントも利用可能になります。
http://localhost:8910/v1
Q6_K バリアントは出力品質が高い反面、より多くのメモリを消費します。VRAM や RAM の不足に直面した場合は、まず --ctx-size を減らしてみてください。それでも足りない場合は、代わりに Q4_K_M バリアントを試してください。
コマンド内で最も重要なフラグは以下の通りです。
Flag
Purpose
--n-gpu-layers all
サポートされているすべての層を GPU にオフロードします。
--ctx-size 100000
10 万トークンのコンテキストウィンドウを確保します。VRAM や RAM が不足する場合は、この値を小さくしてください。
--flash-attn on
サポートされている環境で Flash Attention を有効にします。
--cache-type-k q8_0 and --cache-type-v q8_0
KV キャッシュのメモリ使用量を削減しつつ、高い精度を維持します。
--spec-type draft-mtp
MTP による推測デコーディング(speculative decoding)を有効化します。
--spec-draft-n-max 6
1 ステップあたり最大 6 トークンまで推測トークンを許可します。
--jinja
モデルに埋め込まれたチャットテンプレートを使用します。
--perf
トークンスループットなどのパフォーマンス統計情報を出力します。
私の RTX 4070 Ti Super では、約 81.74 トークン/秒の速度が得られました。テストでは、このモデルはローカルエージェントワークフロー内で使用した際にもタスクを推論し、必要なツールを呼び出し、最新の金価格を返すことができました。

Pi と llama.cpp の統合方法
Pi はローカルの llama.cpp サーバーに接続し、モデルをコーディングエージェントとして利用できます。pi-llama プラグインは、外部 API キーが不要な状態で、Pi を実行中のローカル llama.cpp サーバーに接続するために設計されています。
Pi のインストール:
curl -fsSL https://pi.dev/install.sh | sh

Pi 用の llama.cpp プラグインのインストール:
pi install git:github.com/huggingface/pi-llama
小さなテストプロジェクトを作成:
mkdir new-project
cd new-project
デフォルトでは、このプラグインは llama.cpp をポート 8080 で探します。今回のガイドではローカルサーバーがポート 8910 で動作しているため、Pi を起動する前に正しいローカル API アドレスを設定する必要があります。
export LLAMA_BASE_URL="http://127.0.0.1:8910/v1"
これで Pi を起動します。
pi
Pi 内で以下を入力してください。
/model
ローカルモデルのエイリアスを選択します。
qwythos-9b-mtp

Pi 内にモデルがリスト表示され、選択するとローカルコーディングエージェントとして使用できるようになります。

これで、Pi 内で実際のコーディングタスクにローカルモデルを試す時が来ました。私が選んだのは、ブラウザゲームと小さな Python CLI ツールという、シンプルながら実用的な 2 つのタスクです。
// シンプルなブラウザゲームの構築
まず、Pi に「Beat the AI」という名前の小さなブラウザゲームを作成するよう指示するプロンプトから始めましょう。
"Beat the AI" というシンプルなブラウザゲームを作成してください。
プレイヤーには 30 秒間で短いパターン認識クイズに答える時間を与えられます。正解するたびにスコアが 1 つずつ加算されます。カウントダウンタイマー、スコア表示、プログレスバー、そして終了後の結果画面を表示してください。
要件:
- HTML、CSS、バニラ JavaScript のみを使用すること。
- 数字のパターン、簡単な計算、言葉の論理など、少なくとも 3 種類の質問タイプを生成すること。
- ゲーム終了後にリスタートボタンを追加すること。
- インターフェースは遊び心があり、洗練されたものにすること。
- コードは常に理解しやすく、不要なファイルは作らないようにする。
完成前にブラウザ上でゲームをテストすること。
私のテストでは、Pi は CSS と JavaScript を埋め込んだ単一の HTML ファイルとしてゲーム全体を作成しました。これによりプロジェクトがシンプルになり、中身を確認しやすくなります。

次に Pi は、作成した内容の要約を行いました。30 秒のカウントダウン、スコア表示、進行状況バー、質問の種類、そしてリスタートボタンが含まれています。

その後、ブラウザでゲームを開いて動作確認を行いました。

完成したゲームは洗練されたもので、以下の特徴を備えていました:
- カウントダウンタイマー
- スコア表示
- 進行状況バー
- 複数の質問タイプ
- ゲーム終了後のリスタートフロー
これは、外部 API を必要とせず、ローカル環境だけでフロントエンドのタスクを完遂できるモデルの能力を示す良い例です。
// CSV から Excel への Python CLI ツールの構築
2 つ目のテストでは、Pi に CSV ファイルを Excel の .xlsx ファイルに変換する小さな Python コマンドラインツール(CLI)の開発を依頼しました。
CSV ファイルを Excel の .xlsx ファイルに変換するシンプルな Python CLI を作成しましょう。入力ファイルと出力ファイルのパスを引数として受け取り、列見出しを保持し、存在しないファイルを検証して、明確な成功またはエラーメッセージを表示します。
完了前に、サンプルデータを含む小さなダミー CSV ファイルを作成し、CLI でテストを実行して Excel ファイルが正しく作成されたか確認した上で、その結果を要約してください。
Pi は csv2excel.py という名前の Python スクリプトを作成し、サンプル CSV ファイルを生成してテストコマンドを実行、その後結果の要約を行いました。

python csv2excel.py sample_data.csv output.xlsx
私の実行では、要約内容に以下の点が含まれていました。
- 入力ファイルと出力ファイルのパスを正常に受け付けた
- 列見出しを保持した
- サンプルデータを正しく変換した
- 存在しないファイルに対して明確なエラーメッセージで対応した
- 出力パスが指定されていない場合も適切に処理した
また、生成された Excel ファイルを開いて出力内容を確認しました。

サンプル出力では行と見出しが正しく保持されており、CLI が期待通りに動作したことが確認できました。
# 総括
この小規模なローカルコーディングモデルは、非常に気に入っています。動作が速く、日常のコーディングタスクには十分な精度を備えており、有用に活用するために巨大な VRAM 容量を必要としません。
Pi や Claude Code、OpenCode と組み合わせて使用したり、ローカルの OpenAI 互換エンドポイントや Anthropic 互換エンドポイントをサポートするあらゆるコーディング環境で活用できます。
基本的なフロントエンドアプリ、Python スクリプト、CLI ツール、そしてクイックプロトタイプにおいては、驚くほどよく機能します。外部 API に依存したり、リクエストごとに課金されたりすることなく、ローカル環境で有用なプロジェクトを構築可能です。
Abid Ali Awan (@1abidaliawan) は、機械学習モデルの構築を愛する認定データサイエンティストです。現在はコンテンツ制作に注力し、機械学習やデータサイエンス技術に関する技術ブログの執筆を行っています。Abid 氏はテクノロジー経営学修士号と電気通信工学学士号を取得しており、精神疾患で悩む学生向けにグラフニューラルネットワークを活用した AI プロダクトを構築するというビジョンを持っています。
原文を表示

**
# Introduction
Qwythos-9B-Claude-Mythos-5-1M** is a 9B reasoning and coding model based on Qwen3.5, designed for local coding workflows, agentic development, and long-context tasks. What makes it interesting is that it is small enough to run on consumer hardware, while still being capable enough to help with practical coding tasks.
In this guide, I will show you how to run the Mythos-enhanced Qwythos model locally using llama.cpp, then connect it to Pi so you can use it as a local coding agent. I will be using an RTX 4070 Ti Super with 16GB of VRAM, which allows me to run the Q6_K MTP quantization comfortably. If you have an 8GB GPU, I recommend starting with the Q4_K_M variant because it offers a better balance between quality, speed, and memory usage.
# Installing llama.cpp
**
First, install the official llama.cpp command-line interface (CLI). This will give you access to the llama command, including llama serve, which we will use to run the model locally.
curl -LsSf https://llama.app/install.sh | sh
Next, add the installation directory to your shell path so your terminal can find the llama command:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrcTo confirm that the installation worked, run:
llama helpIf everything is installed correctly, you should see the available llama.cpp commands and options.

# Setting a Hugging Face Cache Directory
Set the Hugging Face** cache somewhere with enough free storage. This is especially useful on cloud machines where the default home directory has limited disk space.
export HF_HOME="/workspace/huggingface"
mkdir -p "$HF_HOME"To persist it across new terminal sessions, add it to your shell configuration:
echo 'export HF_HOME="/workspace/huggingface"' >> ~/.bashrc
source ~/.bashrc# Starting the Qwythos MTP Model
**
Run the Q6_K MTP GGUF model with all available GPU layers:
llama serve \
-hf "empero-ai/Qwythos-9B-Claude-Mythos-5-1M-GGUF:MTP-Q6_K" \
--alias "qwythos-9b-mtp" \
--host 0.0.0.0 \
--port 8910 \
--n-gpu-layers all \
--ctx-size 100000 \
--parallel 1 \
--batch-size 1024 \
--ubatch-size 512 \
--flash-attn on \
--cache-type-k q8_0 \
--cache-type-v q8_0 \
--spec-type draft-mtp \
--spec-draft-n-max 6 \
--threads 12 \
--threads-batch 24 \
--temp 0.6 \
--top-p 0.95 \
--top-k 20 \
--repeat-penalty 1.05 \
--jinja \
--perfThe first time you run this command, llama.cpp will download the model files from Hugging Face.

After that, it will load the model into GPU memory and start a local server.

Once the model is running, open the local interface in your browser:
http://localhost:8910This also gives you an OpenAI-compatible local API endpoint at:
http://localhost:8910/v1The Q6_K variant gives better output quality, but it also uses more memory. If you run into VRAM or RAM issues, reduce --ctx-size first. If that is still not enough, try the Q4_K_M variant instead.
Here are the most important flags in the command:
Flag
Purpose
--n-gpu-layers all
Offloads all supported layers to the GPU.
--ctx-size 100000
Allocates a 100K-token context window. Reduce this if you run out of VRAM or RAM.
--flash-attn on
Enables Flash Attention where supported.
--cache-type-k q8_0 and --cache-type-v q8_0
Reduces KV-cache memory usage while keeping good quality.
--spec-type draft-mtp
Enables MTP speculative decoding.
--spec-draft-n-max 6
Allows up to six speculative tokens per step.
--jinja
Uses the model's embedded chat template.
--perf
Prints performance stats such as token throughput.
On my RTX 4070 Ti Super, I was getting around 81.74 tokens per second. In my test, the model was also able to reason through the task, call the required tools, and return the latest gold price when used inside the local agent workflow.

# Installing Pi and the llama.cpp Integration
Pi can connect to the local llama.cpp server and use the model as a coding agent. The pi-llama plugin is designed to connect Pi with a running local llama.cpp server, without needing an external API key.
Install Pi:
curl -fsSL https://pi.dev/install.sh | sh
Install the llama.cpp plugin for Pi:
pi install git:github.com/huggingface/pi-llamaCreate a small test project:
mkdir new-project
cd new-projectBy default, the plugin looks for llama.cpp on port 8080. In this guide, our local server is running on port 8910, so we need to set the correct local API address before starting Pi:
export LLAMA_BASE_URL="http://127.0.0.1:8910/v1"Now launch Pi:
piInside Pi, type:
/modelSelect the local model alias:
qwythos-9b-mtp
You should see the model listed inside Pi, and once selected, you can start using it as a local coding agent.

Now it is time to test the local model on real coding tasks inside Pi. I used two simple but practical tasks: a browser game and a small Python CLI tool.
// Building a Simple Browser Game
Start with a prompt that asks Pi to create a small browser game called "Beat the AI."
Create a simple browser game called "Beat the AI".
The player has 30 seconds to answer short pattern-recognition questions. Each correct answer increases the score by one. Show a countdown timer, score display, progress bar, and a final results screen.
Requirements:
- Use HTML, CSS, and vanilla JavaScript only.
- Generate at least three types of questions, such as number patterns, quick math, and word logic.
- Add a restart button after the game ends.
- Make the interface feel playful and polished.
- Keep all code easy to understand and avoid unnecessary files.
Test the game in the browser before finishing.
In my test, Pi created the full game in a single HTML file with embedded CSS and JavaScript, which keeps the project simple and easy to inspect.

Pi then summarized what it built, including the 30-second countdown, score tracking, progress bar, question types, and restart button.

After that, I opened the game in the browser to verify that it worked correctly.

The result was a polished little game with:
- A countdown timer
- A score display
- A progress bar
- Multiple question types
- A restart flow after the game ends
This is a good example of how the model can handle a complete front-end task locally without needing an external API.
// Building a CSV-to-Excel Python CLI
For the second test, ask Pi to build a small Python CLI that converts a CSV file into an Excel .xlsx file.
Build a simple Python CLI that converts a CSV file into an Excel .xlsx file, accepts input and output file paths as arguments, preserves column headers, validates missing files, and prints clear success or error messages. Before finishing, create a small dummy CSV file with sample data, use it to test the CLI, verify that the Excel file is created correctly, and then summarize the test result.
Pi created a Python script named csv2excel.py, generated a sample CSV file, ran the test command, and then summarized the results.

python csv2excel.py sample_data.csv output.xlsxIn my run, the summary showed that the script:
- Accepted input and output file paths.
- Preserved the column headers.
- Correctly converted the sample data.
- Handled missing files with clear error messages.
- Handled missing output paths properly.
I also opened the generated Excel file to confirm that the output was correct.

The sample output preserved the rows and headers correctly, which confirmed that the CLI worked as expected.
# Final Thoughts
I really like this small local coding model. It is fast, accurate enough for everyday coding tasks, and does not need a huge amount of VRAM to be useful. You can use it with Pi, Claude Code, OpenCode**, or any coding setup that supports local OpenAI-compatible or Anthropic-compatible endpoints.
For basic front-end apps, Python scripts, CLI tools, and quick prototypes, it works surprisingly well. You can build useful projects locally without depending on external APIs or paying for every request.
Abid Ali Awan (@1abidaliawan) is a certified data scientist professional who loves building machine learning models. Currently, he is focusing on content creation and writing technical blogs on machine learning and data science technologies. Abid holds a Master's degree in technology management and a bachelor's degree in telecommunication engineering. His vision is to build an AI product using a graph neural network for students struggling with mental illness.
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み