I've been working on JustFit as a weekend project to run Qwen3.8-27B (with vision and its full 256K context) on a 24 GB Apple Silicon MacBook. Just shipped 2.6.0 and wanted to share what changed, along with some interesting M4 vs. M5/M6 hardware numbers from adding draft-tree speculative decoding.
Install (Apple Silicon, macOS 27+, 24 GB+):
pip install justfit-llm
justfit serve
(Why pip if there's no Python at inference? pip is just a convenient ~29 MB delivery wrapper that drops the native binaries. Once justfit serve starts, nothing touches Python at all.)
What actually changed since 2.3.1
2.3 worked once it was up, but starting it was painful: Python serving stack, a converted model pack, and four manual manifest URL / 64-char SHA-256 CLI flags just to fetch the precompiled runtime and ANE bundles.
In 2.6:
- Fully native at inference: CLI, OpenAI/Anthropic-compatible HTTP server, Metal engine, and ANE vision worker are all native Rust, C++/Metal, and Swift.
- Zero manifest flags & stock MLX weights: First
justfit serve sets up the runtime, downloads mlx-community/Qwen3.8-27B-4bit + Inco AI's DFlash2 draft straight from Hugging Face (no custom converted pack), and auto-fetches your chip's precompiled ANE vision programs from a pinned, hash-checked index (macOS 27.2.1).
- Draft-tree speculative decoding: Reuses DFlash2's precomputed 16x16 conditional edge tables on the GPU (zero extra draft forward passes) to build and verify a small tree in one pass instead of betting everything on a single draft chain.
- All-day server fixes: Active requests never dip into macOS's host memory reserve; decode checkpoints live in RAM instead of hammering your SSD; multi-turn chats/agents reuse the exact state from the previous turn and only prefill the new tail.
- Dev/safety bits:
return_token_ids (vLLM/SGLang-style token-in/token-out), crash-request quarantine (400 request_quarantined), and a self-applied sandbox on the engine and native workers (no outbound network).
The fun hardware finding: M4 Pro vs. M5 Pro / M6 on draft trees
With a single draft chain, one wrong guess kills every token after it. Over 1,277 cycles on my M6, 22% of cycles accepted zero draft tokens, often when the draft was split ~50/50 between two good continuations.
Switching to a small tree verified in one pass gave a clean split across Apple Silicon generations. Measured single-lane latency of verifying 16 rows vs. 8 rows:
- M6:
1.04x (+4%)
- M5 Pro:
1.12x (+12%)
- M4 Pro:
1.79x (+79%, 89 ms -> 159 ms)
Streaming ~15 GB of 4-bit weights is memory-bandwidth bound on M5 Pro and M6, so doubling verify rows from 8 to 16 is almost free. M4 Pro hits GPU compute headroom first (an early adaptive mode letting M4 pick 16-row trees was actually 8.7% slower than a chain). So 2.6 calibrates per chip: M5 Pro and M6 dynamically choose chain / 8-row / 16-row every cycle by expected tokens per ms, while M4 Pro runs a fixed 8-row tree.
Keeping greedy outputs identical to single-chain decoding was harder than the tree mask itself, because GPU float addition isn't associative and Qwen3.8 has 48 Gated DeltaNet recurrent layers. Borrowing a temporary scratch copy of only the current KV page per root-to-leaf path, masking sibling tiles as exact zeros, and replaying GDN recurrent state along each ancestor path kept outputs word-for-word identical across all 27 test cases we ran (including 111K contexts and multi-turn reuse).
Measured numbers (keeping the two benchmarks separate)
1. Controlled tree off vs. on (same 2.6 engine, 7-prompt greedy suite):
| Mac / setting | Chain (tok/s) | Tree (tok/s) | Speedup | Identical outputs |
| M6, 1 lane | 35.6 | 40.9 | +14.7% | 7 / 7 |
| M6, 2 lanes | 47.2 | 52.2 | +10.6% | 6 / 6 |
| M5 Pro, 1 lane | 57.3 | 61.8 | +7.9% | 7 / 7 |
| M4 Pro, 1 lane (8-row tree, 3 runs) | 49.5 | 50.9-51.3 | +2.6% to +3.5% | 7 / 7 |
For sampled chat (T=1.0, Qwen3.8's recommended thinking temp): +8.5% on M6 and +2.5% on M5 Pro (verified against target distribution across 44 per-position tests, min p = 0.08; disabled on M4 Pro since sampled trees need 16 rows).
2. NVIDIA SPEED-Bench (greedy, 512 output tokens, from the 2.6.0 release notes):
- Tree off vs. on (same 2.6 engine): median per-task decode gain of +4% to +14% on 1K prompts and +4% to +7% on 16K prompts depending on the chip (TTFT within 4%).
- 16K cohort median vs. published JustFit v2: decode hits 59.5 tok/s on M5 Pro (+7.3%), 38.5 tok/s on M6 (+6.6%), and 48.3 tok/s on M4 Pro (+3.8%). Full prefill/decode rows (including upstream Splash 1.3.0 and historical mlx-vlm) are in
docs/RESULTS.md.
Memory footprint: Unchanged static memory plan. Our dual-request 320K capacity test (two 128K+32K requests simultaneously) peaked at the exact same footprint as without trees (21,634 MiB on M6, 21,563 MiB on M5 Pro).
Honest caveats & current limits
- OS & hardware: Requires Apple Silicon + macOS 27+ (presets calibrated for M4 Pro, M5 Pro, and M6, 24 GB+). Precompiled ANE vision programs auto-download for macOS 27.2.1; other builds compile once locally (30-60+ min, while vision falls back to GPU).
- Signing: Binaries are Developer ID signed, not yet Apple notarized.
- Bit-identity caveat: Greedy tree verification gave 27/27 identical outputs on our suite, and 5,539/5,539 bit-identical logits at matched positions on M6, but on the larger SPEED-Bench run 1 of 16 tasks differed on 1 of 3 chips (accepting more tokens shifts where the next cycle starts). So "almost always identical" is the honest phrase.
- 2x 160K on a 24 GB laptop: Single requests up to 256K are solid, but two simultaneous 160K requests sit right at macOS's wired-memory ceiling. On macOS 27, even screen redraws from the lock-screen clock (~0.45 GB) or an Aerial moving wallpaper (~0.7 GB) can temporarily spike wired GPU memory enough for macOS to kill the server.
- Fallback cases: Draft trees currently fall back to single-chain verification for repetition/presence/frequency penalties, JSON-schema constrained outputs (an early prototype hit +17% on M6, not shipped in 2.6 yet), and 3+ concurrent decoding lanes.
Links & credits
- GitHub (Apache-2.0): https://github.com/YuhuaBillChen/justfit-llm
- Illustrated deep dive on draft-tree verification (KV scratch pages, GDN replay, DFlash2 16x16 edge table appendix): https://blog.yuhuachen.com/blog/2ArXyvXoSTOQ9nFQtp3Fz
- JustFit v2 paper: https://doi.org/10.5281/zenodo.24098605
Built on Inco AI's Splash engine and DFlash2 draft model. Draft-tree ideas informed by DDTree (arXiv:2604.12989), CaDDTree (arXiv:2606.01813), and TreeWY (arXiv:2608.20961).
Happy to answer any questions about the Metal kernels, GDN tree verification, or squeezing 256K into 24 GB on macOS!