Instructions to use p4ik/Qwen3.8-27B-MLX-OptiQ-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use p4ik/Qwen3.8-27B-MLX-OptiQ-4bit with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("p4ik/Qwen3.8-27B-MLX-OptiQ-4bit") config = load_config("p4ik/Qwen3.8-27B-MLX-OptiQ-4bit") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use p4ik/Qwen3.8-27B-MLX-OptiQ-4bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "p4ik/Qwen3.8-27B-MLX-OptiQ-4bit"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "p4ik/Qwen3.8-27B-MLX-OptiQ-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use p4ik/Qwen3.8-27B-MLX-OptiQ-4bit with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "p4ik/Qwen3.8-27B-MLX-OptiQ-4bit"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default p4ik/Qwen3.8-27B-MLX-OptiQ-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use p4ik/Qwen3.8-27B-MLX-OptiQ-4bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "p4ik/Qwen3.8-27B-MLX-OptiQ-4bit"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "p4ik/Qwen3.8-27B-MLX-OptiQ-4bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Qwen3.8-27B-MLX-OptiQ-4bit
A mixed-precision quant of
Qwen/Qwen3.8-27B for Apple Silicon,
built with mlx-optiq 0.4.21 at
5.54 bits per weight: sensitive tensors keep 8 bits, the rest run at 4.
As with Q4_K_M in llama.cpp, 4bit in the name is the dominant precision,
not the average.
The vision tower ships as a bf16 sidecar and the multi-token-prediction
head as a quantized one: under stock mlx-lm this repo loads text-only,
optiq serve adds image input and MTP speculative decoding.
Use with mlx
pip install mlx-optiq
optiq serve --model p4ik/Qwen3.8-27B-MLX-OptiQ-4bit --kv-config kv_config.json --mtp
from mlx_lm import load, generate
model, tokenizer = load("p4ik/Qwen3.8-27B-MLX-OptiQ-4bit")
prompt = "Write a Python function to merge two sorted linked lists."
if tokenizer.chat_template is not None:
messages = [{"role": "user", "content": prompt}]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True)
response = generate(model, tokenizer, prompt=prompt, verbose=True)
mlx-lm selects weights with glob("model*.safetensors") — the sidecars
under optiq/ stay invisible to it.
Quantization
optiq convert Qwen/Qwen3.8-27B \
--method static \
--target-bpw 5.0 \
--candidate-bits 4,8 \
--skip-baselines
| Property | Value |
|---|---|
| Method | static |
| Target BPW | 5.00 |
| Effective BPW | 5.54 |
| Weights | 17.78 GiB, 234 tensors @ 4-bit, 264 @ 8-bit |
| Group size | 64 |
| KV cache | measured, 16 layers, 5.00 bits average (details below) |
| MTP | 29 tensors, 300 MiB |
| Vision tower | bf16, 879 MiB |
Files
| File | Purpose |
|---|---|
model-*.safetensors |
Mixed-precision weights |
kv_config.json |
Measured per-layer KV bit-widths for optiq serve --kv-config |
optiq/mtp.safetensors |
Multi-token prediction head for --mtp |
optiq/optiq_vision.safetensors |
Vision tower, bf16 |
KV cache
8-bit on layers 51, 55, 59, 63; 4-bit on the other twelve (5.00 bits
average). Only full_attention layers appear: the 48 linear_attention
layers carry a fixed-size Gated DeltaNet state and have no KV cache to
quantize.
The allocation is measured, not assumed. Method: paired next-token NLL over 196k tokens in three domains (agentic transcripts with on-policy generated thinking and tool calls, German prose, WikiText), each of the 16 layers quantized individually against an all-8-bit baseline. Layer 63 carries the only per-layer damage that survives significance testing (tool-call spans); protecting three further layers adds a measured group benefit on thinking and agentic text. At this allocation, tool calls, thinking and English text are statistically indistinguishable from a full 8-bit cache; German prose retains ~+0.4% perplexity. A flip check over near-certain tokens found zero flips inside tool-call spans under any tested configuration — the 4-bit cache does not break tool-call syntax.
Sampling
From the base model card, unchanged:
| Parameter | Thinking | Instruct |
|---|---|---|
temperature |
1.0 | 0.7 |
top_p |
0.95 | 0.80 |
top_k |
20 | 20 |
min_p |
0.0 | 0.0 |
presence_penalty |
0.0 | 1.5 |
repetition_penalty |
1.0 | 1.0 |
Thinking mode is on by default and can be disabled per request. Context is 262,144 tokens natively, extensible to 1M with YaRN.
- Downloads last month
- 205
4-bit
Model tree for p4ik/Qwen3.8-27B-MLX-OptiQ-4bit
Base model
Qwen/Qwen3.8-27B