# Why 2x faster decoding only saved 16% on 512K local coding agents (M5 Ultra)

> Source: <https://l8w8.github.io/videos/local-coding-agents-512k-prefill-trap/>
> Published: 2026-12-04 20:54:52+00:00

**Recommendation:** 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.
More in the playbook "Inference and self-hosting": <https://wpnews.pro/playbooks/inference-serving>

# Why 2x Faster Decoding Only Saved 16% on 512K Local Coding Agents

Single-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`.

Yet 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).

## 1. Past 128K Context, Cold Prefill and Cache Reuse Dominate

Real 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.

| Model in Pi | 384K solves / med | 512K solves / med | 512K cold TTFT | 512K cached TTFT | 512K warm tok/s | 
|---|---|---|---|---|---|
| **DeepSeek V4.1 Flash** (`oMLX 0.8.4` + MTP) | **8/8** · 6m 33s | **8/8** · 8m 30s | **5m 56s** | **7.5s** | **98.9** | 
| **GLM 5.3 Flash** (`llama.cpp b12774` + MTP) | 7/8 · 16m 54s | 6/8 · 21m 51s | 19m 52s | 9.6s | 47.1 | 
| **Muse Spark Open 816B** (`oMLX 0.8.4` ) | 6/8 · 28m 14s | 7/8 · 39m 15s | 21m 27s | 21.0s | 12.3 | 

Once 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).

## 2. The 1-Line OpenCode Setting That Saved 2 to 4 Minutes Per Task

Comparing 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.

That 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:

```
{
  "agents": {
    "title": {
      "disabled": true
    }
  }
}
```

## 3. Three Real Operational Limits I Hit Along the Way

1. **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.
2. **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.
3. **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` ).

**Reproduce Everything Yourself (MIT Fixture + CC BY 4.0 Data):**

• Full Episode 003 dataset, Waypoint MIT fixture, held-out grading suite & 38 evidence files:

[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)

• 9-minute visual walkthrough on YouTube:

[youtu.be/Mr9sj51ccoE](https://youtu.be/Mr9sj51ccoE)

• Earlier episodes:

[Part 1 (22 Setups)](https://youtu.be/vF-LUF6kPsE)·

[Part 2 (+63% Native MTP)](https://youtu.be/cEOhoBGDTeM)
