r/LocalLLaMA · · 1 min read

Running Qwen3.5-122B on Mac Studio 96GB: Fixed 3 bugs that made long-context inference usable

Mirrored from r/LocalLLaMA for archival readability. Support the source by reading on the original site.

Hey everyone,

I recently switched from DS4 Flash to Qwen3.5-122B on my M3 Ultra Mac Studio for long-context agentic coding. While the model fit better, I hit a wall where follow-up messages took 3-5 minutes to start generating (cold fills) despite having a "warm" context.

Turns out the issue wasn't the model, but three specific bugs in my serving stack (qMLX fork of rapid-mlx):

  • Prompt Instability: A unique message ID in the system prompt broke byte-exact KV cache matching, forcing a full re-compute on every turn.
  • Interrupt Path: Streaming replies weren't persisted when generation was interrupted, causing history divergence.
  • Checkpoint Poison: A background writer created unmatchable checkpoints that crowded out valid ones, triggering aggressive eviction.

After fixing these, prefill time dropped from minutes to sub-seconds (e.g., 53k tokens cached, only 33 prefilled).

I decided to fork rather than PR these changes because the hybrid attention optimizations are very specific to Qwen and likely unpalatable for a general upstream stack. Expect qMLX to continue diverging as we optimize specifically for this architecture.

I've open-sourced the fork and a benchmark script (bench_qmlx.py) that separates prefill/decode metrics. Would love to hear if anyone else is seeing similar issues with hybrid attention caching or has ideas for further optimization.

submitted by /u/marzukia
[link] [comments]

Discussion (0)

Sign in to join the discussion. Free account, 30 seconds — email code or GitHub.

Sign in →

No comments yet. Sign in and be the first to say something.

More from r/LocalLLaMA