r/opencode • • 3d ago

My experiment building a hybrid OpenCode V2 orchestrator (Gemini 4 Hydrogen + local Qwen 3.8 27B MLX on M5 Pro 48GB) - real timings, runaway thinking loops, and how can I improve this?

I spent today wiring up a hybrid coding orchestrator in OpenCode V2 where a frontier cloud model handles planning and review in read-only mode, and a local 27B model writes all the code. Raw throughput on the M5 Pro looks great in Ollama's logs, but thinking tiers triggered massive 25-minute single-turn stalls on a basic 2048 build.

Wanted to share my actual numbers and see how others on 48GB Macs are avoiding these bottlenecks.

Setup

  • Hardware: MacBook Pro, Apple M5 Pro, 48 GB Unified Memory (37.4 GiB Metal GPU)
  • Runner: Ollama 0.40.19 (native MLX runner 0.32.4, 100% GPU, 22 GB VRAM, OLLAMA_CONTEXT_LENGTH=65536, speculative decoding enabled)
  • Local model: qwen3.8:27b-mlx (27.8B dense, nvfp4; valid thinking tiers: false, low, medium, xhigh; native defaults temp=1, top_p=0.95, top_k=20)

Architecture

Instead of the usual plan → manual Tab → build loop where the 27B model ends up owning the whole context, I flipped the hierarchy:

  • u/orchestrator: google/gemini-4-hydrogen (xhigh, temp: 0.1, edit: deny) — explores the repo, breaks tasks into tight 1–3 file specs, dispatches local workers sequentially, checks git diff + runs tests, and escalates failures.
  • u/coder: ollama/qwen3.8:27b-mlx (steps: 20, subagent: deny) — default implementer.
  • u/coder-deep: ollama/qwen3.8:27b-mlx (steps: 25, subagent: deny) — escalation tier for harder logic or retries (zero extra RAM since it reuses the loaded weights).
  • u/explore & small_model: qwen3.8:27b-mlx on low for repo search, and #none for session titles (224ms–1.3s while Hydrogen plans).

Raw Speed (server.log)

The hardware itself isn't the issue:

  • Cold prefill: ~450–490 tok/s (9,213 tokens in 19s)
  • Decode (MLX spec decoding): ~37–55 tok/s (47–96% draft acceptance, 2.4–6.7 avg tokens/step)
  • Prefix cache: Works well on normal multi-turn tool loops (8K → 38K cached with sub-second delta prefills)

Benchmark: Building 2048 Across Thinking Tiers

Run u/coder Thinking Scope Built Total Wall Time Longest Single Turn Quality & Notes
1 medium(had temp: 0.1 bug) game.js (569 LOC) + unit tests ~40 min 26m 43s (~59.5K tok) Best architecture: clean UMD, tile IDs, previousPosition, mergedFrom, isValidState, serialize/restore, undo.
2 low(fixed to native temp: 1) game.js (394 LOC) + game.test.js(308 LOC) ~50 min 25m 17s (~55.3K tok) + 17m 26s (~40K tok) Solid engine, minor contract drift (toJSON / module.exports) + 1 test bug (.filter() without .flat()).
2b medium(retry) Debug + fix failing test + node --test 1m 34s (10 turns) 21.4s 100% prefix cache hits, caught the .flat() bug immediately, 25/25 tests passed.
3 none (no thinking) Full 5-file app (logic.js, game.js, index.html, style.css, test.js) ~16 min (~20+ turns) 2m 41s (~7.8K tok) Zero runaway stalls; even caught a typo in its own spec. Simpler ES5 varstyle, no undo/animation tracking, keys stayed active behind overlays.

Questions for 48GB Mac users

  1. Inference engine: Would moving Qwen3.8-27B from Ollama to Inco Splash (DFlash 2) or oMLXprevent those ~50K-token runaway turns / cache misses and meaningfully cut wall-clock time?
  2. Worker model: When a cloud orchestrator is already handing over tight specs, are you getting better speed/quality using a fast MoE like Qwen3.6-35B-A3B or Gemma 4 26B-A4B for u/coder (keeping Qwen3.8-27B strictly for u/coder-deep)?
  3. Orchestrator patterns: Anything worth borrowing from oh-my-opencode-slim or opencode-orchestrator-kit (like persistent plan/ files) without adding prompt bloat to local 27B subagents?

My Honest Opinion

Waiting 40mins for 500 lines of code seams unreasonable. As for now the orchestration is not a Claude killer, but a time killer. Looking for better optimizations though not believing in it too much.

Update — Tested Inkling 2 Mini on LM Studio oMLX (Apple M5+):**

Spun up a parallel orchestrator-ink2 setup in OpenCode V2 (Gemini 4 Hydrogen xhigh → @coder-ink on medium) using thinkingmachines/inkling-2-mini (26.4B looped MoE, ~3.4B active) on LM Studio's oMLX 0.7.0 engine:

  • Footprint: 16.10 GiB at 64K context (loaded in 6.44s — ~6 GB lighter than qwen3.8:27b-mlx).
  • Wall time: ~8 minutes total (down from 40–50 min on Qwen 3.8 27B — roughly 5–6× faster).
  • Quality: Arguably the cleanest engine of all runs — 519 LOC with transactional deserialize() validating the full undoStack, defensive tile cloning, strict input validation, and overflow-safe isPowerOfTwo().

A couple of gotchas we hit:

  • On medium, Inkling 2 Mini hit our 16,384 output cap once while double-checking edge cases right before calling the write tool. Bumped it to 131K context / 65K output, which still fits easily in 48GB.
  • Moved small_model to gemini-3.5-flash-lite so background title generation wouldn't wake Ollama back up and collide with LM Studio in unified memory.
7 Upvotes

5 comments sorted by

2

u/WiseSir6962 3d ago

the prompt I've used is very blunt: create me a website for playing 2048

1

u/WiseSir6962 3d ago edited 3d ago

update is in the post

1

u/m_sandhu_142 1d ago

Changing model and runner together makes the 5-6x speedup hard to attribute. A same-model Ollama/oMLX comparison would isolate the runner.

1

u/WiseSir6962 1d ago

already have changed the server to omlx for its Lightning MTP. before qwen 4 35b the combination with google hydrogen and inkling gave me the best result. Currently downloading qwen and will test it. the best part about omlx that I've discovered, that users with similar specs share their settings to get the same number of tokens/s which is unique among ollama, lm studio etc.

1

u/for4f 3d ago

the stalls are the thinking tiers spiraling on a toy task lol. what worked for me is splitting it up, planner in read-only with a short leash, then the local model just executes with thinking off or capped low. letting a frontier model think unbounded on 2048 is where the 25 minutes go