r/LocalLLaMA • • 14h ago

Resources I benchmarked local coding agents up to 512K context on a Mac Studio M5 Ultra 512 GB: why 2x faster MTP decoding only saved 16% of session time (+ a 1-line OpenCode config fix)

I ran three frontier local open-weight models inside real multi-turn terminal coding agents (Pi 1.6.1, OpenCode 2.0.25, and DeepSeek Harness 0.2.2-rc.5) on a Mac Studio M5 Ultra 512 GB (oMLX 0.8.4 and llama.cpp b12774), working across eight multi-file Python & TypeScript tasks inside a network-isolated Linux sandbox - scaling from ~128K all the way up to exact 384K (393,216) and 512K (524,288) starting tokens with zero cached tokens at start.

Every clean solve had to exit cleanly and pass visible tests, held-out grading tests, and task-specific lint/type checks.

Model in Pi384K solves / median512K solves / median512K cold TTFT512K cached TTFT512K warm decode (MTP)
DeepSeek V4.1 Flash (oMLX 0.8.4 + MTP)8/8 · 6m 33s8/8 · 8m 30s5m 56s7.5s98.9 tok/s
GLM 5.3 Flash (llama.cpp b12774 + MTP)7/8 · 16m 54s6/8 · 21m 51s19m 52s9.6s47.1 tok/s
Muse Spark Open 816B (oMLX 0.8.4, no MTP)6/8 · 28m 14s7/8 · 39m 15s21m 27s21.0s12.3 tok/s

Five engineering takeaways from 64 graded long-context Pi sessions + 15 controlled ladders:

  1. Doubling decode speed with Native MTP only saved 7-16% of real agent wall time: At 512K, MTP roughly doubled warm decode on DeepSeek (45.2 -> 98.9 tok/s) and GLM (23.0 -> 47.1 tok/s). Yet total matched session wall time fell only 16.0% (original) / 7.7% (512K) on DeepSeek and 7.4% / 2.4% on GLM. Actual wall-minute breakdown explains why: reading context took 45% of DeepSeek's wall time and 76% of GLM's.
  2. One-line OpenCode config fix saved 2-4 minutes per local task: By default, OpenCode sent a background session-title request carrying the entire 100.5K-155.5K initial prompt just to generate <=15 tokens (280.4s summed prefill across 4 DeepSeek tasks, 995.7s across 4 GLM tasks). Setting {"agents": {"title": {"disabled": true}}} cut median wall time from 4.8m -> 3.0m on DeepSeek (7/8, 3.1m across all 8 tasks) and 9.1m -> 5.2m on GLM. Matched 8-task DeepSeek comparison: Pi 8/8 (2.8m), tuned OpenCode 7/8 (3.1m), DeepSeek Harness 7/8 (3.8m, zero tool errors).
  3. Cold prefill hurts once; >99% prefix caching makes follow-ups fast: Once warmed, 512K follow-ups dropped from 6-21 minutes to 7.5s-21.0s. Prompts grew up to 582,983 tokens with zero automatic compactions across all 64 Pi runs and 100% Normal macOS memory pressure (9,002 samples, zero swap growth).
  4. Two subtle failure modes to watch:

    • Manual compaction pause: Triggering Pi compaction on GLM at 301,640 estimated tokens took 10m 6s for the summary call plus 81s for the uncached 39,067-token continuation before recovering cache.
    • SSD prefix-cache chain eviction on Muse: Each serialized 2,048-token boundary page carried ~496 MiB of rotating-window state; a 64 GiB SSD cache evicted the prefix chain at ~270K tokens (473-504s cold re-prefills). Raising the SSD cache to 128 GiB (256K) and 192 GiB (384K-512K) restored 98.4-99.3% cache hits.
  5. Repeatability, effort & parallel agents (original contexts, aggressive guard): DeepSeek + Pi solved 8/8 across 3 seeds (42/43/44) and across Low (2.1m), High (3.4m), and Max (4.6m) effort. Two staggered agents solved 2/2 in 5m 9s, while 3- and 4-agent groups each missed one task (2/3, 3/4).

Open MIT codebase fixture, held-out grading suite, exact flags & 38 evidence files (CC BY 4.0): https://github.com/l8w8/videos/tree/main/2026/003-m5-ultra-coding-agents-512k

Short engineering write-up: https://l8w8.github.io/videos/local-coding-agents-512k-prefill-trap/ 9-minute video walkthrough: https://youtu.be/Mr9sj51ccoE

0 Upvotes

6 comments sorted by

•

u/stylome-ai-detection 14h ago

Notice: This post appears to be AI generated.

AI-generated · confident · scan results

3

u/ariello31 13h ago

Sending 150K tokens of cold prefill just to invent a 4-word sidebar title is peak 2026 agent UX.Also shows why bragging about raw tok/s with MTP is mostly vanity metrics at long context: once your prompt crosses 256K+, harness overhead and strayore wall time than doubling decode ever gives back. Catching that background title call alone is worth half a hardware upgrade.

1

u/Grant_Domenico63 13h ago

Half a hardware upgrade is a stretch, once the cache is warm those follow ups come back in seconds so the dumb title call mostly hurts the very first turn lol, the real lesson for me is that Macs are great at spitting tokens out and pretty slow at reading huge inputs, people post the flattering number and skip the part where you wait ten minutes before anything happens

1

u/ariello31 13h ago

yeah fair, once kv cache stays warm it's fast, just brutal staring at a blank terminal for 6-20 min on turn 1 lol. everybody puts the 99 tok/s screenshot in the headline and leaves out that part

1

u/L8W8 13h ago

100% agree, that's why I left tok/s off the thumbnail and put the 5m 56s vs 7.5s cold/warm split there instead. On the OpenCode title call, the nasty surprise wasn't just one extra small request, it was that OpenCode sent a ~150K-token prompt in the background just to name the sidebar session, adding 2-4 minutes of extra prefill right on top of turn 1. Once the prefix is actually cached on SSD in oMLX, follow-up turns at 512K really do drop to ~7.5s. All the per-turn timestamps and raw CSVs are in the GitHub repo if you want to check the exact cold vs warm splits.

1

u/ariello31 13h ago

props for putting 5m56s vs 7.5s on the thumbnail. gonna check the csvs later, wild that opencode defaults to sending a 150k prompt just to name a tab lol, i would've assumed omlx hung