{"slug": "why-2x-faster-decoding-only-saved-16-on-512k-local-coding-agents-m5-ultra", "title": "Why 2x faster decoding only saved 16% on 512K local coding agents (M5 Ultra)", "summary": "Doubling warm decode speed with Native Multi-Token Prediction on a Mac Studio M5 Ultra 512 GB cut matched multi-turn coding-agent session wall time by only 16.0% on DeepSeek V4.1 Flash and 7.4% on GLM 5.3 Flash, the author's own benchmark of Pi 1.6.1, OpenCode 2.0.25 and DeepSeek Harness 0.2.2-rc.5 across eight multi-file Python and TypeScript tasks found. Decode rose from 45.2 to 98.9 tok/s for DeepSeek V4.1 Flash on oMLX 0.8.4 and from 23.0 to 47.1 tok/s for GLM 5.3 Flash on llama.cpp b12774 at 512K context, but cold prefill dominated: 512K time-to-first-token was 5m 56s on DeepSeek and 19m 52s on GLM, falling to 7.5s and 9.6s once the prefix cache warmed. Disabling OpenCode 2.0.25's background session-title request in opencode.json removed 280.4s of summed duplicate prefill across 4 DeepSeek tasks and 995.7s across 4 GLM tasks.", "body_md": "# Why 2x Faster Decoding Only Saved 16% on 512K Local Coding Agents\n\nSingle-prompt `tok/s` benchmarks make local coding-agent performance look deceptively simple. Turn on Native Multi-Token Prediction (MTP) on a Mac Studio M5 Ultra 512 GB and warm decode roughly doubles even at **512K context**: **DeepSeek V4.1 Flash** jumps from `45.2` to `98.9 tok/s` on `oMLX 0.8.4`, and **GLM 5.3 Flash** jumps from `23.0` to `47.1 tok/s` on `llama.cpp b12774`.\n\nYet when I ran real multi-turn terminal coding agents (**Pi 1.6.1**, **OpenCode 2.0.25**, and **DeepSeek Harness 0.2.2-rc.5**) on eight multi-file Python and TypeScript tasks inside a network-isolated Linux sandbox, doubling decode speed cut matched total session wall time by only **16.0%** on DeepSeek (`7.7%` at 512K) and **7.4%** on GLM (`2.4%` at 512K).\n\n## 1. Past 128K Context, Cold Prefill and Cache Reuse Dominate\n\nReal coding agents read repositories, run tests, inspect tracebacks, and edit multiple files over 8 to 16 turns. Every turn re-sends the growing conversation history. To measure the ceiling honestly, I ran 15 controlled six-turn ladders and 64 graded Pi coding sessions starting at exact native prompt sizes of **393,216 (384K)** and **524,288 (512K)** tokens with zero cached tokens at start.\n\n| Model in Pi | 384K solves / med | 512K solves / med | 512K cold TTFT | 512K cached TTFT | 512K warm tok/s | \n|---|---|---|---|---|---|\n| **DeepSeek V4.1 Flash** (`oMLX 0.8.4` + MTP) | **8/8** · 6m 33s | **8/8** · 8m 30s | **5m 56s** | **7.5s** | **98.9** | \n| **GLM 5.3 Flash** (`llama.cpp b12774` + MTP) | 7/8 · 16m 54s | 6/8 · 21m 51s | 19m 52s | 9.6s | 47.1 | \n| **Muse Spark Open 816B** (`oMLX 0.8.4` ) | 6/8 · 28m 14s | 7/8 · 39m 15s | 21m 27s | 21.0s | 12.3 | \n\nOnce the prefix cache warmed (>99% token reuse on follow-ups), a 512K follow-up dropped from **5m 56s** to **7.5s** on DeepSeek and from **19m 52s** to **9.6s** on GLM. Across all 64 Pi sessions, prompts grew as high as **582,983 tokens** with zero automatic compactions and **100% Normal macOS memory pressure** (9,002 samples, zero swap growth; median session-average package power `136 W` DeepSeek, `113 W` GLM, `156 W` Muse).\n\n## 2. The 1-Line OpenCode Setting That Saved 2 to 4 Minutes Per Task\n\nComparing three coding-agent harnesses on the exact same DeepSeek V4.1 Flash setup (~100K-165K starting prompts) turned up an immediate, fixable local-LLM trap. By default, **OpenCode 2.0.25** fires a background session-title request carrying the entire initial `100.5K-155.5K` prompt just to generate at most 15 tokens of title text.\n\nThat single duplicate prefill added `280.4s` of summed API prefill across 4 DeepSeek tasks and `995.7s` across 4 GLM tasks. Turning background titles off in `opencode.json` fixed it immediately:\n\n```\n{\n  \"agents\": {\n    \"title\": {\n      \"disabled\": true\n    }\n  }\n}\n```\n\n## 3. Three Real Operational Limits I Hit Along the Way\n\n1. **Manual compaction is expensive when it fires:** Triggering Pi compaction on GLM at`301,640` estimated tokens took**10m 6s** (`606.3s` ) for the summary call, followed by an uncached`39,067` -token continuation that took another**81s** to first token before recovering prefix caching and passing all checks.\n2. **SSD prefix-cache sizing breaks silently if too small:** On Muse Spark 816B, each serialized 2,048-token boundary page on disk carried`~496 MiB` of rotating-window state. A`64 GiB` SSD cache budget evicted the shared prefix chain around ~270K tokens and forced full`473-504s` cold re-prefills. Raising the SSD cache to`128 GiB` (256K) and`192 GiB` (384K-512K) restored`98.4-99.3%` hit rates cleanly.\n3. **Parallel agents and reasoning effort:** On original contexts (aggressive memory guard), DeepSeek + Pi solved`8/8` across three seeds (`42/43/44` ) and across Low (`2.1m` ), High (`3.4m` ), and Max (`4.6m` ) effort. Two staggered agents solved`2/2` cleanly in`5m 9s` (vs`5m 31s` sequential), while 3- and 4-agent groups each missed one task (`2/3` ,`3/4` ).\n\n**Reproduce Everything Yourself (MIT Fixture + CC BY 4.0 Data):**\n\n• Full Episode 003 dataset, Waypoint MIT fixture, held-out grading suite & 38 evidence files:\n\n[github.com/l8w8/videos/tree/main/2026/003-m5-ultra-coding-agents-512k](https://github.com/l8w8/videos/tree/main/2026/003-m5-ultra-coding-agents-512k)\n\n• 9-minute visual walkthrough on YouTube:\n\n[youtu.be/Mr9sj51ccoE](https://youtu.be/Mr9sj51ccoE)\n\n• Earlier episodes:\n\n[Part 1 (22 Setups)](https://youtu.be/vF-LUF6kPsE)·\n\n[Part 2 (+63% Native MTP)](https://youtu.be/cEOhoBGDTeM)", "url": "https://wpnews.pro/news/why-2x-faster-decoding-only-saved-16-on-512k-local-coding-agents-m5-ultra", "canonical_source": "https://l8w8.github.io/videos/local-coding-agents-512k-prefill-trap/", "published_at": "2026-12-04 20:54:52+00:00", "updated_at": "2026-12-04 21:16:39.126543+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "large-language-models", "ai-infrastructure", "mlops"], "entities": ["Mac Studio M5 Ultra", "DeepSeek V4.1 Flash", "GLM 5.3 Flash", "oMLX 0.8.4", "llama.cpp b12774", "Pi 1.6.1", "OpenCode 2.0.25", "Muse Spark Open 816B"], "also_reported_by": [], "takeaway": "On 512K-context local coding agents, doubling warm decode with MTP cut session wall time only 16.0% (DeepSeek V4.1 Flash) and 7.4% (GLM 5.3 Flash) because cold prefill dominates — 5m 56s versus 7.5s cached TTFT on DeepSeek — so budget SSD prefix cache at 128 GiB for 256K and 192 GiB for 384K-512K to", "recommendation": {"advice": "Size SSD prefix cache to 128 GiB for 256K contexts and 192 GiB for 384K-512K, and disable OpenCode's background title agent, which re-prefilled 100.5K-155.5K-token prompts and added 280.4s-995.7s per four tasks.", "playbook": "inference-serving", "playbook_url": "https://wpnews.pro/playbooks/inference-serving"}, "alternates": {"html": "https://wpnews.pro/news/why-2x-faster-decoding-only-saved-16-on-512k-local-coding-agents-m5-ultra", "markdown": "https://wpnews.pro/news/why-2x-faster-decoding-only-saved-16-on-512k-local-coding-agents-m5-ultra.md", "text": "https://wpnews.pro/news/why-2x-faster-decoding-only-saved-16-on-512k-local-coding-agents-m5-ultra.txt", "jsonld": "https://wpnews.pro/news/why-2x-faster-decoding-only-saved-16-on-512k-local-coding-agents-m5-ultra.jsonld"}}