HomeMachine LearningRun the Mythos Enhanced Coding Model locally with llama.cpp and Pi

Run the Mythos Enhanced Coding Model locally with llama.cpp and Pi

Introduction

The Qwythos-9B-Claude-Myth-5-1M represents a significant leap in local coding and reasoning capabilities. Built on the foundation of Qwen3.5, this 9B reasoning and coding model is tailored for local coding workflows, agent development, and extended context tasks. The model is optimized for consumer hardware, providing an accessible yet powerful tool for developers.

This article will guide you through running the Mythos-enhanced Qwythos model locally using llama.cpp and interfacing it with Pi to serve as a local coding agent. Utilizing an RTX 4070 Ti Super with 16GB of VRAM, I demonstrate the process of executing MTP Q6_K quantization, while also offering advice for setups with more limited resources, such as an 8GB GPU using the Q4_K_M variant.

Installing llama.cpp

To begin, install the official llama.cpp command line interface (CLI). This will provide access to the llama command suite, including llama serve for running the model locally.


curl -LsSf https://llama.app/install.sh | sh

Next, ensure the installation directory is included in your shell path for ease of access:


echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Verify the successful installation by running the following command:

If installed correctly, you should see a list of available llama.cpp commands and options.

Setting a Cuddly Face Cache Directory

Configure a Cuddly face cache directory with ample storage space. This is particularly beneficial for cloud machines with limited default home directory space.


export HF_HOME="/workspace/huggingface"
mkdir -p "$HF_HOME"

To make this configuration persistent across terminal sessions, add it to your shell configuration:


echo 'export HF_HOME="/workspace/huggingface"' >> ~/.bashrc
source ~/.bashrc

Starting the Qwythos MTP Model

Execute the Q6_K MTP GGUF model with full GPU layer utilization:


lama 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

On the first execution, llama.cpp will download model files from Hugging Face. Subsequently, it will load the model into GPU memory and initiate a local server.

This setup also provides a local OpenAI-compatible API endpoint. If VRAM or RAM issues arise, consider reducing –ctx-size or opting for the Q4_K_M variant.

Key parameters include:

FlagAim
–n-gpu-layers allOffloads all supported layers to the GPU.
–ctx-size 100000Allocates a pop-up of 100,000 tokens. Reduce it if you are low on VRAM or RAM.
–flash-attn enabledActive Flash Caution where supported.
–cache-type-k q8_0 and –cache-type-v q8_0Reduces KV cache usage while maintaining good quality.
–spec-type draft-mtpEnables MTP speculative decoding.
–spec-draft-n-max 6Allows up to six speculative tokens per stage.
–jinjaUses the template’s built-in chat template.
–perfPrints performance statistics such as token throughput.

On the RTX 4070 Ti Super, the model processes approximately 81.74 tokens per second, demonstrating effective task handling, tool invocation, and real-time data retrieval.

Installing Pi and llama.cpp Integration

Integrate Pi with the local llama.cpp server to employ the model as an encoding agent. The pi-llama plugin enables this connection without requiring 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-llama

Create a test project:


mkdir new project
cd new project

Set the local API address before launching Pi, since the local server operates on port 8910:


export LAMA_BASE_URL="http://127.0.0.1:8910/v1"

Launch Pi and select the local model alias to begin using it as your coding agent.

Testing the Mythos Enhanced Coding Model with Pi

To assess the model’s practical utility, I experimented with two tasks: building a browser game and creating a Python CLI tool.

Building a Simple Browser Game

The task involved creating a browser game titled “Beat the AI,” featuring pattern recognition questions, a countdown timer, and a scoring system. The model successfully generated the game using HTML, CSS, and JavaScript within a single file.

The game included a countdown, a score display, a progress bar, multiple question types, and a restart feature, illustrating the model’s capability in handling front-end tasks locally.

Creating a Python CSV to Excel CLI

In this task, the model developed a Python CLI to convert CSV files to Excel format, handling file paths, column headers, and error messaging. The resulting script, csv2excel.py, functioned as intended, converting sample data accurately and managing file-related errors effectively.

Final Thoughts

The Qwythos-9B-Claude-Myth-5-1M model impresses with its speed and accuracy across various coding tasks without demanding excessive VRAM. It integrates seamlessly with tools like Pi, Claude Code, and Open Code, enhancing its utility for local development.

For enhanced results, consider incorporating web search skills, Context7, and additional Pi integrations. Explore further optimization techniques in the guide: “How to Set Up Kimi K2.7 Code with Pi: The Ultimate AI Coding Environment.”

Abid Ali Awan (@1abidaliawan) is a certified professional data scientist passionate about machine learning. With a master’s in technology management and a bachelor’s in telecommunications engineering, he aspires to create AI products to assist students dealing with mental health challenges.

For further details, visit the source: Here

“`

Must Read
Related News

LEAVE A REPLY

Please enter your comment!
Please enter your name here