Repository navigation
Learning notes: Qwen3.8-27B on an M1 Max 32 GB (llama.cpp Metal + MTP, 128K, ~15–17.6 tok/s) #4
Replies: 3 comments
Engine comparison: llama.cpp + MTP vs MLX-VLM + DFlash2 vs MLX-VLM plain (same Mac)Three setups for Qwen3.8-27B on this M1 Max 32 GB (32-core GPU). Only one server ran at a time, and every setup got the same requests. Setups
The fork was cloned at a pinned commit, read before use, and installed in its own venv. Every weight file matched its HF LFS sha256. Workload: one deterministic filler document per length with a hidden 5-digit code; the question asks for the code and then for a short Python function. Settings: temperature 0, thinking off, 512-token cap, a unique prefix on every request (so nothing comes from a cache), 3 runs at short / ~7.5K / ~22.7K tokens and 1 run at ~58K. Numbers are medians: prefill = prompt tokens ÷ TTFT; decode = (completion tokens − 1) ÷ decode time. MLX ignores
Findings
Recommendation: keep llama.cpp + MTP 3 (#470) on a 32 GB Mac. MLX + DFlash2 at block 3 is a good choice for short chats and code under ~30K tokens, at ~1.07× the decode speed at 22K. It cannot serve the 128K window that the registry recipe needs, so I opened no new PR. |
LookAtMyQuant on M1 Max 32 GB (32-core GPU)Runtime: ShinMegamiBoson/lookatmyquant pinned at
What happened
Verdict: not usable on M1 today. #470 (llama.cpp Q4 + MTP) stays the recommendation for Qwen3.8-27B on this Mac. No registry PR. Related: Inkling 2 Mini #3 · LFM2.5-24B-A2B #5 |
MTPLX 2.13.1 on M1 Max 32 GB (32-core GPU)Engine: youssofal/MTPLX v2.13.1 (tag commit
Same ctxbench prompts as the earlier engine comparison: temp 0, 512-token cap, medians of 3, one long run, thinking off. Launch: Decode tok/s
Prefill tok/s and time to first token
All context answers were correct in every leg. What I learned
Verdict: for Qwen3.8-27B chat up to about 25K on this Mac, MTPLX + MTP is the fastest setup I measured: 30 tok/s, against 24 for #470. For long context (over 36K), #470 stays the choice. No registry PR: the setup needs Related: Inkling 2 Mini #3 · LFM2.5-24B-A2B #5 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Learning notes from getting Alibaba's Qwen3.8-27B running on a 32 GB MacBook Pro (M1 Max), tuning it with the inference-optimisation skill, and publishing a lab-passed recipe to the Local AI registry: sybil-solutions/local-ai-registry#470. This is the companion to the Inkling 2 Mini notes: same Mac, same engine build, same benchmark settings, so the numbers compare directly.
TL;DR
How the model works
blk.64) that can draft extra tokens for speculative decoding. No separate drafter file is needed.Quant, engine, and why that build
UD-Q4_K_XL(Dynamic V3.1, 17.66 GB), fromunsloth/Qwen3.8-27B-GGUF@4af51b35. 16.45 GiB of weights leaves room for a 128K q8_0 KV cache inside the 25 GiB Metal budget; an 8-bit quant would not. I checked the LFS sha256 after download.b12588-mix-c0c3de8(macOS arm64 prebuilt, sha256229def18…fc496ceb8).draft-mtpspeculative type that uses the built-in head.How to run it on an M1 Max 32 GB
# from a directory holding llama-b12588-mix-c0c3de8/ and the GGUF llama-b12588-mix-c0c3de8/llama-server \ -m Qwen3.8-27B-UD-Q4_K_XL.gguf \ --spec-type draft-mtp --spec-draft-n-max 3 \ -c 131072 -np 1 -ngl 99 -fa on --fit off \ -ub 256 -ctk q8_0 -ctv q8_0 --cache-ram 0 \ --temp 1.0 --top-p 0.95 --top-k 20 --min-p 0.0 \ --jinja --alias qwen3.8-27b --host 127.0.0.1 --port 8080Sampling is the Unsloth guide's thinking-mode setting. No
sysctl iogpu.wired_limit_mbchange is needed.Why the defaults are a problem
macOS gives the GPU a 25.0 GiB working set (25,558 MiB) on a 32 GB Mac. Metal buffers at 128K:
-ub 256, q8_0 KVOnly the 16 full-attention layers keep KV, so the cache is half of Inkling's at the same window. The compute buffer is small (639 MiB vs Inkling's 4.7 GiB), so
-ubis not the problem here; f16 KV is. q8_0 KV is a small, labelled quality trade.Performance (M1 Max, 32-core GPU, macOS 26.6.2, AC power)
Each token reads ~16.5 GB of weights (4× Inkling's 4.1 GB), so decode is bandwidth-bound: without MTP it already runs at 57% of the bandwidth ceiling (Inkling: 25%). Prefill runs at ~71% of fp16 peak and falls only 6% from 2.8K to 21.6K tokens (Inkling: −25%), because 48 of 64 layers are linear-time.
What the optimisation skill tried
Every candidate ran between two controls, median of 6 samples.
-ub 512/-ub 1024Acceptance falls from 63% (1 draft) to ~40% (3 drafts) and 28% (5 drafts). Three drafts give ~2.2 tokens per step, and a 4-token verify step costs only ~1.6× a 1-token step.
Why MTP wins here but DSpark lost on Inkling: in a dense model every drafted token uses the same weights, so the verify step reads the weights once for all of them. In Inkling's MoE, each verified token routes to its own 8 of 128 experts in 48 looped passes, so a 2-token verify cost 1.98× a 1-token step and speculation could never pay.
Controls drifted down ~9% over 70 minutes (no thermal warning; swap grew 0.8 → 1.66 GiB with other apps open). Interleaved controls kept each comparison fair.
Lessons
buffer size =lines in the server log.Inkling 2 Mini vs Qwen3.8-27B on this Mac
Inkling is faster at every short-prompt number. Qwen has more Metal headroom and flatter prefill, and it fits a longer prompt in the context gate. Its thinking runs long on open prompts: the lab's 600-word story produced 15,182 tokens.
Evidence, logs and the full hill-climb log:
data/sources/qwen38-27b-m1-max-32gb-llamacpp/in sybil-solutions/local-ai-registry#470.Series: Inkling 2 Mini (#3) · Qwen3.8-27B (#4) · LFM2.5-24B-A2B (#5): same Mac, same benchmark settings.
All reactions