Downloads · 30 days
73
6% of all-time downloads
avlp12/Qwen3.5-35B-A3B-Alis-MLX-Dynamic-2.6bpw-VLM
Qwen3.5-35B-A3B-Alis-MLX-Dynamic-2.6bpw-VLM is a image-text-to-text model from avlp12. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for mlx. The card lists the license as apache-2.0.
Part of the Qwen3.5-35B-A3B · Alis builds collection.
Downloads · 30 days
73
6% of all-time downloads
All-time downloads
1.1K
Public
Parameters
35.1B
12.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors12.1 GB · 100%
How the weights are stored.
U3234.6B · 99%
From the Hugging Face model README
Part of the Qwen3.5-35B-A3B · Alis builds collection.
✅ This is the VLM (Vision-Language) version with vision encoder included in bf16. For text-only with more KV headroom: avlp12/Qwen3.5-35B-A3B-Alis-MLX-Dynamic-2.6bpw
Extreme dynamic quantization to run a 35B multimodal MoE model on 16GB Apple Silicon. Expert 2-bit + Attention/GDN 3-bit + Router bf16 + Vision encoder bf16. Converted with
mlx_vlm, which includes the full vision encoder for image understanding.
VLM is even tighter on 16GB than the text-only version (12.5 GB peak vs 11.3 GB). Follow ALL steps or the model WILL crash:
python -m mlx_vlm generate \
--model avlp12/Qwen3.5-35B-A3B-Alis-MLX-Dynamic-2.6bpw-VLM \
--prompt 'Describe this image.' \
--image photo.jpg \
--max-tokens 200
Always set --max-tokens (default is unlimited → OOM crash).
16.0 GB total
- 3.5 GB macOS + background services
- 12.5 GB model (peak, with vision encoder)
= 0.0 GB ← ZERO headroom!
Close absolutely everything — Safari, Chrome, Slack, Discord, KakaoTalk. Even one tab can cause OOM.
| Parameter | Value | Why |
|---|---|---|
max_tokens | ≤ 500 | VLM has almost no KV headroom |
temperature | > 0 (use 0.7) | Greedy decoding causes loops |
VLM on 16GB is at the absolute limit. Headless mode frees ~0.5 GB from WindowServer.
| Step | Required | |
|---|---|---|
--max-tokens ≤ 500 | ✅ MANDATORY | VLM has near-zero KV headroom |
| Close all apps | ✅ MANDATORY | Even 0.3 GB matters |
temperature > 0 | ✅ MANDATORY | Prevents loops |
| Headless + SSH | ✅ STRONGLY recommended | Frees ~0.5 GB |
| Short prompts | ✅ STRONGLY recommended | Long prompts consume KV cache |
💡 24GB+ users: VLM runs comfortably with thinking ON and long prompts.
💡 16GB text-only users: Consider the text-only version which has 1.2 GB KV headroom instead of near-zero.
| Item | Value |
|---|---|
| Base Model | Qwen/Qwen3.5-35B-A3B |
| Total Parameters | 35B (Active: 3B per token) |
| Architecture | MoE 256 experts, top-8 routed + 1 shared |
| Quantization | Dynamic mixed-precision (2/3/4-bit) |
| Average BPW | 2.749 |
| Disk Size | 11 GB |
| Peak Memory | 12.5 GB |
| Target Hardware | M4 Mac Mini 16GB |
| Inference Speed | 97 tok/s (M3 Ultra) |
| Korean Quality | 100% (20/20, no QLoRA needed) |
| Vision | ✅ Image understanding (bf16 encoder) |
| Thinking Mode | ON/OFF switchable |
| Framework | MLX 0.31.1, mlx-vlm |
This model was built to run a 35B-class MoE language model on an Apple M4 Mac Mini with only 16GB unified memory.
Limitations of existing quantized models:
This model solves the problem through role-based dynamic quantization:
Result: 11GB multimodal model with vision + 100% Korean quality + English/coding/reasoning.
| Component | Bits | Rationale |
|---|---|---|
MoE Router (mlp.gate) | bf16 | Quantizing causes expert selection errors → hallucination. Never quantize. |
Shared Expert Gate (shared_expert_gate) | bf16 | Controls shared expert activation. Never quantize. |
| Norms (RMSNorm etc.) | bf16 | Small tensors, quantization unnecessary |
GDN Parameters (dt_bias, A_log, conv1d) | bf16 | Core GatedDeltaNet parameters |
Embedding (embed_tokens) | 3-bit | Token mapping |
LM Head (lm_head) | 3-bit | Output projection |
Full Attention (self_attn, 10 layers) | 3-bit | Active every token → quality-critical |
Linear Attention / GDN (linear_attn, 30 layers) | 3-bit | Active every token → verified: 2-bit causes repetition loops |
| Shared Expert (40 layers) | 3-bit | Always active |
Routed Experts (switch_mlp, 40 × 256) | 2-bit | Only 8 of 256 active → 2-bit impact is distributed |
Vision Encoder (visual) | bf16 | 0.83 GB, never quantized for image quality |
This exploits a key property of MoE architecture:
Per-layer relative error measured on 8-domain calibration data (Korean, English, code, reasoning):
| Component | 2-bit Error | Role in v3 | Verdict |
|---|---|---|---|
| Router | 0.5059 | bf16 | ✅ Most sensitive — bf16 justified |
| GDN in_proj | 0.4616-0.4770 | 3-bit | ✅ High sensitivity — 3-bit justified |
| Attention q/k/v/o | 0.4156-0.4369 | 3-bit | ✅ Medium sensitivity — 3-bit justified |
| Expert gate_up | 0.4015 | 2-bit | ✅ Most robust — 2-bit justified |
| Expert down | 0.3971 | 2-bit | ✅ Most robust — 2-bit justified |
Expert layers are 6.5% more robust than attention layers, confirming the MoQE paper (Kim et al., 2023). Edge layers (L0-2, L37-39) show no additional sensitivity (edge/mid ratio = 1.00x), so APEX-style edge protection is unnecessary for this model.
| Attempt | BPW | Size | Result | Lesson |
|---|---|---|---|---|
| Uniform 2-bit | 2.50 | 10.9GB | ❌ gibberish | No Router/Attn protection → total failure |
mixed_2_6 | 3.18 | 13GB | ⚠️ English switching, loops | Sensitive layers at 6-bit → too large |
mixed_3_4 | 3.67 | ~15GB | ❌ Too large | Doesn't fit 16GB |
| Tight (linear_attn 2-bit) | 2.64 | 11GB | ⚠️ Repetition loops | GatedDeltaNet requires 3-bit minimum |
| APEX v4 (edge protection) | 2.82 | 11GB | ✅ Quality OK | Peak 12.3GB → insufficient KV headroom |
| Dynamic v3 (this model) | 2.58 | 10GB | ✅ Perfect | Optimal balance |
pip install mlx-vlm
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
python -m mlx_vlm generate \
--model avlp12/Qwen3.5-35B-A3B-Alis-MLX-Dynamic-2.6bpw-VLM \
--prompt 'Describe this image in detail.' \
--image /path/to/image.jpg \
--max-tokens 200
python -m mlx_vlm generate \
--model avlp12/Qwen3.5-35B-A3B-Alis-MLX-Dynamic-2.6bpw-VLM \
--prompt 'What is the capital of South Korea?' \
--max-tokens 200
from mlx_vlm import load, generate
model, processor = load("avlp12/Qwen3.5-35B-A3B-Alis-MLX-Dynamic-2.6bpw-VLM")
# Image understanding
response = generate(
model, processor,
prompt="이 이미지를 설명해주세요.",
image="/path/to/image.jpg",
max_tokens=500,
)
print(response)
python -m mlx_vlm.server \
--model avlp12/Qwen3.5-35B-A3B-Alis-MLX-Dynamic-2.6bpw-VLM \
--port 8888
| Parameter | General Text | Reasoning Tasks |
|---|---|---|
temperature | 0.7 | 1.0 |
top_p | 0.8 | 0.95 |
top_k | 20 | 20 |
min_p | 0.0 | 0.0 |
presence_penalty | 1.5 | 2.0 |
repetition_penalty | 1.0 | 1.0 |
max_tokens | 16,384 | 32,768 |
enable_thinking | false | false |
| Parameter | General Reasoning | Precise Coding (WebDev etc.) |
|---|---|---|
temperature | 1.0 | 0.6 |
top_p | 0.95 | 0.95 |
top_k | 20 | 20 |
min_p | 0.0 | 0.0 |
presence_penalty | 1.5 | 0.0 |
repetition_penalty | 1.0 | 1.0 |
max_tokens | 32,768 | 32,768 |
enable_thinking | true | true |
⚠️ This model uses extreme 2.58 BPW quantization. Repetition loops are slightly more likely than the original. Follow these recommendations:
presence_penalty to 1.5 or higher. Setting it to 0 may cause repetition loops.temperature to 0. Greedy decoding causes quality degradation and repetitions in quantized models.max_tokens sufficiently high (default 200 is too short).python -m mlx_vlm.server \
--model avlp12/Qwen3.5-35B-A3B-Alis-MLX-Dynamic-2.6bpw-VLM \
--port 8888 \
--chat-template-args '{"enable_thinking": false}' \
--temp 0.7 --top-p 0.8 --top-k 20
# Thinking OFF (Agent/General Chat)
curl http://localhost:8888/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "avlp12/Qwen3.5-35B-A3B-Alis-MLX-Dynamic-2.6bpw-VLM",
"messages": [{"role": "user", "content": "Tell me about Korean traditional foods."}],
"max_tokens": 2048,
"temperature": 0.7,
"top_p": 0.8,
"presence_penalty": 1.5,
"extra_body": {"top_k": 20},
"chat_template_kwargs": {"enable_thinking": false}
}'
# Thinking ON (Math/Reasoning)
curl http://localhost:8888/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "avlp12/Qwen3.5-35B-A3B-Alis-MLX-Dynamic-2.6bpw-VLM",
"messages": [{"role": "user", "content": "Calculate 12345 × 6789."}],
"max_tokens": 32768,
"temperature": 1.0,
"top_p": 0.95,
"presence_penalty": 1.5,
"extra_body": {"top_k": 20},
"chat_template_kwargs": {"enable_thinking": true}
}'
Total Memory: 16.0 GB
- macOS Overhead: -3.5 GB
- Model (peak): -12.5 GB
= KV Cache Headroom: 0.5 GB (tight but functional)
Qwen3.5-35B-A3B's hybrid architecture makes KV cache extremely efficient:
| KV Bits | 32K | 64K | 100K |
|---|---|---|---|
| 4-bit | 0.16 GB ✅ | 0.31 GB ✅ | 0.49 GB ✅ |
| 2-bit | 0.08 GB ✅ | 0.16 GB ✅ | 0.25 GB ✅ |
Note: VLM version has tighter KV headroom (~0.5 GB) than the text-only version (~1.2 GB). For long-context tasks beyond 100K tokens, use the text-only version instead.
enable_thinking=False| Text-Only Version | VLM (This Model) | |
|---|---|---|
| Model ID | avlp12/Qwen3.5-35B-A3B-Alis-MLX-Dynamic-2.6bpw | avlp12/Qwen3.5-35B-A3B-Alis-MLX-Dynamic-2.6bpw-VLM |
| BPW | 2.579 | 2.749 |
| Disk Size | 10 GB | 11 GB (+0.83 GB vision) |
| Peak Memory | 11.3 GB | 12.5 GB |
| KV Headroom (16GB) | 1.2 GB (~245K ctx) | 0.5 GB (~100K ctx) |
| Generation Speed | 113 tok/s (M3 Ultra) | 97 tok/s (M3 Ultra) |
| Image Understanding | ❌ | ✅ (bf16 vision encoder) |
| Vision Encoder | Not included | 0.83 GB bf16 (not quantized) |
| Library | mlx_lm | mlx_vlm |
| Thinking Mode | ✅ ON/OFF | ✅ ON/OFF |
| Korean Quality | 100% (20/20) | 100% (20/20) |
| Recommended For | Agents, coding, long-context chat | Image analysis, multimodal tasks |
20 Korean prompts × Thinking OFF, max_tokens=200:
| Metric | Result |
|---|---|
| OK (correct Korean) | 20/20 (100%) |
| Foreign characters (JP/AR mixing) | 0/20 (0%) |
| Garbage output | 0/20 (0%) |
Test prompts covered: capital city, traditional foods, kimchi recipe, Korean history, Seoul tourism, Hangul origins, seasonal weather, bulgogi recipe, economic industries, traditional medicine, education system, Jeju Island, IT industry, traditional music, holidays, bibimbap, healthcare system, Korean grammar, traditional architecture, K-pop global success.
| Hardware | Prompt (tok/s) | Generation (tok/s) | Peak Memory |
|---|---|---|---|
| M4 Mac Mini 16GB (10 GPU cores) | 114 | 61 | 11.3 GB |
| M3 Ultra 512GB (80 GPU cores) | 158 | 113 | 11.3 GB |
| Profile | BPW | Size | Peak | Korean | Notes |
|---|---|---|---|---|---|
| Uniform 2-bit | 2.50 | 10.9GB | 11.0GB | ❌ gibberish | Unusable |
| Dynamic v3 (this model) | 2.58 | 10GB | 11.3GB | ✅ 100% | Optimal |
| Tight (GDN 2-bit) | 2.64 | 11GB | 11.6GB | ⚠️ Repetition loops | GDN needs 3-bit |
| Dynamic (L0-7 boost) | 2.81 | 11GB | 12.3GB | ✅ 100% | Insufficient KV headroom |
| Uniform 3-bit | 3.50 | 14GB | 15.3GB | ✅ Perfect | Exceeds 16GB |
| Benchmark | 3-bit (3.50bpw) | v3 (2.58bpw) | Loss |
|---|---|---|---|
| ARC-Challenge | 56.40% | 54.86% | -1.54pp |
| ARC-Easy | 83.33% | 82.58% | -0.75pp |
| HellaSwag | 58.54% | 54.19% | -4.35pp |
| TruthfulQA MC2 | 50.98% | 49.27% | -1.71pp |
| Winogrande | 71.98% | 65.82% | -6.16pp |
| Average | 64.25% | 61.34% | -2.90pp |
2.9pp average loss for 29% size reduction — and 3-bit doesn't fit in 16GB, so v3 is the only working option.
Uses mlx-vlm's custom quant_predicate API:
from mlx_vlm.convert import convert
import re
def qwen35_v3(layer_path, layer):
# Router: bf16 (never quantize)
if layer_path.endswith("mlp.gate"):
return False
if "shared_expert_gate" in layer_path:
return False
# Norms: bf16
if "norm" in layer_path and "proj" not in layer_path:
return False
# GDN parameters: bf16
if any(x in layer_path for x in ["dt_bias", "A_log", "conv1d"]):
return False
# Embed/lm_head: 3-bit
if "embed_tokens" in layer_path or "lm_head" in layer_path:
return {"bits": 3, "group_size": 64}
# Shared expert: 3-bit
if "shared_expert" in layer_path:
return {"bits": 3, "group_size": 64}
# Full attention: 3-bit
if "self_attn" in layer_path:
return {"bits": 3, "group_size": 64}
# Linear attention (GatedDeltaNet): 3-bit
if "linear_attn" in layer_path:
return {"bits": 3, "group_size": 64}
# Routed experts: 2-bit (primary compression target)
if "switch_mlp" in layer_path:
return {"bits": 2, "group_size": 64}
# Vision encoder: bf16 (never quantize)
if "visual" in layer_path or "vision" in layer_path:
return False
# Everything else: 2-bit
if hasattr(layer, "to_quantized"):
return {"bits": 2, "group_size": 64}
return False
convert(
hf_path="Qwen/Qwen3.5-35B-A3B",
mlx_path="./qwen35-dynamic-v3-vlm",
quantize=True,
quant_predicate=qwen35_v3,
)
# [INFO] Quantized model with 2.749 bits per weight.
This model is the successor to the Gemma 4 26B MoE extreme quantization project.
The Gemma4 project achieved 11GB at 92% Korean quality with OptiQ B++++ strategy, but failed to deploy on M4 Mac Mini due to an MLX bug where the 128-expert gather_mm Metal kernel malfunctions on M4 base (10 GPU cores).
Reasons for switching to Qwen3.5:
| Gemma4 26B OptiQ | Qwen3.5 35B Dynamic v3 | |
|---|---|---|
| M4 Mini 16GB | ❌ MLX bug | ✅ Working |
| Model Size | 11.0 GB | 10 GB |
| Parameters | 26B (3.8B active) | 35B (3B active) |
| Korean | 92% (after LoRA) | 100% (no LoRA) |
| Context | 74K (4-bit KV) | 245K (4-bit KV) |
| KV Efficiency | 122 KB/token | 5 KB/token (24x) |
| Vision | ✅ | ✅ (bf16 encoder) |
This model inherits the Apache License 2.0 from the original Qwen3.5-35B-A3B.
@misc{qwen35-dynamic-v3-2026,
title = {Qwen3.5-35B-A3B Dynamic v3: 2.58 BPW Mixed-Precision for 16GB Apple Silicon},
author = {avlp12},
year = {2026},
url = {https://huggingface.co/avlp12/Qwen3.5-35B-A3B-Alis-MLX-Dynamic-2.6bpw-VLM},
note = {Expert 2-bit + Attention/GDN 3-bit + Router bf16 dynamic quantization}
}
quant_predicate API