Qwen Long-Context Inference Fixed to Sub-Second

marzukia · reddit · 2026-07-13

While running Qwen3.5-122B for long-context agentic coding on an M3 Ultra Mac Studio 96GB, the author initially faced a major hurdle: follow-up messages took 3–5 minutes just to start generating, causing severe cold-start latency.

Investigation revealed the bottleneck wasn't the model itself, but three bugs in the serving stack:

After fixing these, prefill latency dropped from minutes to sub-seconds—for instance, with 53k tokens already cached, only 33 tokens needed re-prefilling. The author opted to fork the codebase rather than submit a PR upstream, arguing these hybrid attention optimizations are highly specific to the Qwen architecture and may not suit general-purpose stacks.

The fork and benchmarking scripts have been open-sourced, complete with a benchmark that distinguishes between prefill and decode phases.

Original post →

More from coding & agent

coding & agent channel →