Instructions to use ObviousSalamander/Qwen3.8-27B-OptiQ-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use ObviousSalamander/Qwen3.8-27B-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("ObviousSalamander/Qwen3.8-27B-OptiQ-4bit") config = load_config("ObviousSalamander/Qwen3.8-27B-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 ObviousSalamander/Qwen3.8-27B-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 "ObviousSalamander/Qwen3.8-27B-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": "ObviousSalamander/Qwen3.8-27B-OptiQ-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use ObviousSalamander/Qwen3.8-27B-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 "ObviousSalamander/Qwen3.8-27B-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 ObviousSalamander/Qwen3.8-27B-OptiQ-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use ObviousSalamander/Qwen3.8-27B-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 "ObviousSalamander/Qwen3.8-27B-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 "ObviousSalamander/Qwen3.8-27B-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-OptiQ-4bit (MLX, mixed-precision)
A mixed-precision 4.93 bpw quantized MLX build of Qwen/Qwen3.8-27B, produced with
OptiQ (data-driven sensitivity-based quantization),
packaged in the standard MLX layout with the vision tower restored into the main shards.
What this is
- Trunk:
Qwen/Qwen3.8-27B(bf16, 55.6 GB) — a dense multimodal model (Qwen3_5ForConditionalGeneration, vision + language). - Method: OptiQ 0.4.22,
optiq convert --target-bpw 4.75 --candidate-bits 4,8. OptiQ ran a per-layer KL-sensitivity analysis and chose the bit width per layer. - Result: 4.93 bpw, 249× 8-bit + 247× 4-bit layers. ~18.3 GB of weights (this repo ≈ 19 GB on disk).
- Layout: standard MLX —
model-*.safetensors+model.safetensors.index.json. Vision tower is included asmodel.visual.*in the shards.
⚠️ This is NOT a uniform 4-bit model. The "4bit" in the name refers to the target budget (4.75 bpw); OptiQ protected ~half the layers at 8-bit. Effective size is between the community 4-bit and 8-bit packs. Do not compare it directly to a flat 4-bit pack.
Why this build
OptiQ preserves the layers whose quantization hurts quality the most (embeddings, early/mid attention q/k/v, parts of MLP) at 8-bit, keeping the rest at 4-bit. On a dense model this gives a better quality-per-byte ratio than uniform 4-bit, at the cost of a slightly larger file.
Why this was uploaded
This build took a long time to produce (download of the 55.6 GB bf16 original, the OptiQ conversion, and re-merging the vision tower into a standard MLX layout). It is published so that anyone can use the result directly instead of repeating that work.
Benchmarks (mlx-vlm, Apple Silicon)
Measured on a Mac mini M4 Pro (64 GB) with mlx-vlm 0.6.13 (MTP-4bit drafter),
sustained decode, max_tokens=256, across 3 task types × 3 context lengths (2026-08-17).
Thinking and non-thinking decode throughput are equivalent, so the table below shows
the non-thinking runs.
| type | ctx | mode | tok/s | prefill t/s |
|---|---|---|---|---|
| creative | 2k | non_think | 17.58 | ~116 |
| creative | 8k | non_think | 17.84 | ~125 |
| creative | 16k | non_think | 17.27 | ~106 |
| program | 2k | non_think | 20.83 | ~116 |
| program | 8k | non_think | 19.79 | ~125 |
| program | 16k | non_think | 18.57 | ~106 |
| decision | 2k | non_think | 20.13 | ~116 |
| decision | 8k | non_think | 18.86 | ~125 |
| decision | 16k | non_think | 13.54 | ~106 |
Summary: ~17–21 tok/s decode, throughput stays stable out to 16k context — this build matches the community 4-bit pack in speed while keeping higher fidelity (more 8-bit layers). Prefill ~106–127 t/s (reading a 16k context ≈ 130–150 s, true prefill, no cache).
Usage (text + vision)
Text
import mlx_lm
model, tokenizer = mlx_lm.load("ObviousSalamander/Qwen3.8-27B-OptiQ-4bit")
out = mlx_lm.generate(model, tokenizer, prompt="Hello")
Vision (image)
This is a multimodal model — image + text works. Use mlx_vlm and format the prompt with
apply_chat_template (the same path the official mlx_vlm.generate CLI uses):
python -m mlx_vlm.generate \
--model ObviousSalamander/Qwen3.8-27B-OptiQ-4bit \
--prompt "Describe this image in 2-3 short sentences." \
--image path/to/image.jpg
Python API:
from mlx_vlm import load, generate
from mlx_vlm.prompt_utils import apply_chat_template
from mlx_vlm.utils import load_config
model, processor = load("ObviousSalamander/Qwen3.8-27B-OptiQ-4bit")
config = load_config("ObviousSalamander/Qwen3.8-27B-OptiQ-4bit")
prompt = apply_chat_template(processor, config, "Describe this image.", num_images=1)
out = generate(model, processor, prompt, ["path/to/image.jpg"])
⚠️ Do not pass a hand-written
<|image_pad|>token intomlx_vlm.generatedirectly — it returns an empty output (immediate<|im_end|>). Always useapply_chat_templatewithnum_images=1, exactly as the official CLI does.
Usage with mtplx (native MTP speculative decoding)
Forge-probe/build this repo with mtplx forge, then serve it and use the OpenAI-compatible API
for text generation (see the mtplx docs). On the same M4 Pro hardware, OptiQ mtplx reaches
~13–27 tok/s engine decode at depth 3 (strongest on programming: 27 t/s at 2k/8k context).
How it was built (reproducibility)
# 1. download the original bf16
huggingface-cli download Qwen/Qwen3.8-27B --local-dir Qwen3.8-27B-bf16-orig
# 2. convert with OptiQ 0.4.22 (data-driven mixed precision)
optiq convert Qwen3.8-27B-bf16-orig \
--target-bpw 4.75 --candidate-bits 4,8 --reference auto \
-o Qwen3.8-27B-OptiQ-4bit
# 3. the output contains optiq_mixed/ (this model) + intermediate artifacts
# (static_mixed/ 3.97bpw and uniform_4bit/ 4.50bpw are NOT recommended for dense models;
# a forced flat 4-bit on this dense model degenerates into repetition loops)
Vision layout note
OptiQ stores the vision tower separately in optiq/optiq_vision.safetensors (prefix
vision_tower.*) and adds a custom optiq_vision field to config.json. This repo re-merges
those tensors into the main shards (renamed model.visual.*, matching the native Qwen prefix)
and updates model.safetensors.index.json, producing the standard MLX multimodal layout.
Vision is verified working on both the original sidecar layout and this unified layout
(mlx_vlm, mlx-vlm 0.6.13).
Notes for agents republishing this model
- All weights are real files in this repo (no symlinks) — safe to mirror/convert directly.
- This is multimodal: set
pipeline_tag: image-text-to-textand thevision/multimodaltags, as done in this card's frontmatter. - The vision tower is already inside the shards as
model.visual.*; do not strip it. config.jsonintentionally has nooptiq_visionfield — it was removed when the tower was merged in. Keep it that way.- If you re-quantize, prefer
--candidate-bits 4,8mixed precision. A flat 4-bit re-quant of this dense model degenerates into repetition loops.
Model card (original)
Qwen/Qwen3.8-27B — Apache-2.0. See the original model card
for intended use, license, and upstream Qwen3.8 details.
- Downloads last month
- 9
4-bit
Model tree for ObviousSalamander/Qwen3.8-27B-OptiQ-4bit
Base model
Qwen/Qwen3.8-27B