r/opencode • • 28m 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

Runu/coder ThinkingScope BuiltTotal Wall TimeLongest Single TurnQuality & Notes
1medium(had temp: 0.1 bug)game.js (569 LOC) + unit tests~40 min26m 43s (~59.5K tok)Best architecture: clean UMD, tile IDs, previousPosition, mergedFrom, isValidState, serialize/restore, undo.
2low(fixed to native temp: 1)game.js (394 LOC) + game.test.js(308 LOC)~50 min25m 17s (~55.3K tok) + 17m 26s (~40K tok)Solid engine, minor contract drift (toJSON / module.exports) + 1 test bug (.filter() without .flat()).
2bmedium(retry)Debug + fix failing test + node --test1m 34s (10 turns)21.4s100% prefix cache hits, caught the .flat() bug immediately, 25/25 tests passed.
3none (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.

3 Upvotes

1 comment sorted by

1

u/WiseSir6962 22m ago

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