Skip to content

test(mac): MLX batched multi-tenant run + honest finding (batched breaks recall on Mac) - #132

Merged
cursor[bot] merged 3 commits into
mainfrom
AgentMemory/mac-batched-multitenant-2815
Jun 14, 2026
Merged

test(mac): MLX batched multi-tenant run + honest finding (batched breaks recall on Mac)#132
cursor[bot] merged 3 commits into
mainfrom
AgentMemory/mac-batched-multitenant-2815

Conversation

@FluffyAIcode

Copy link
Copy Markdown
Owner

Why

The §3.7 BatchedDecodeScheduler ran only on the H200 (CUDA) — it's torch/CUDA, and the Mac served-restored path is blocked by the MLX-gemma load gap (ADR 0014 §6). This adds the Mac analog and runs it on the Mac mini, with an honest finding.

Result (Mac M4, 8 sessions, mlx_batched_multitenant_bench.py)

Mac (M4, 8 sessions) aggregate tok/s per-session recall
serialized 21.2 1.0
batched (MLX, batch>1) 57.1 (2.7× if recall held) 0.125

Finding: batched MLX decode over gemma-4 at batch > 1 breaks per-session recall (0.125 vs serialized 1.0). Since recall is the bottom line, the recall-safe Mac multi-tenant path is serialized; batched Mac throughput is not shippable until the MLX batch>1 forward/cache correctness is fixed (likely the gemma hybrid/sliding RotatingKVCache under batching). The Mac nominal speedup ceiling is also low (M4 saturates at small batch — 2.7× vs CUDA's 8.45×). The validated batched scheduler stays CUDA-only.

(Recall fix during the work: the first run had recall 0 even serialized — a plain chat template; matched the working NIAH harness's direct-answer prompt + content-channel marker, which fixed serialized to 1.0 and exposed the batched-only correctness gap.)

Files

  • scripts/research/mlx_batched_multitenant_bench.py + preset mlx-batched-multitenant
  • docs/adr/0014-…md §3.7 platform note; results/research/k3_mlx_batched_multitenant_mac.json

Testing

  • pytest tests/inference_engine/bridge/test_manifest.py (24 passed)
  • ✅ Ran on Mac M4 via bridge (conclusion=success): serialized recall 1.0; batched recall 0.125 → documented blocker, not a claimed win.
Open in Web Open in Cursor 

cursoragent and others added 3 commits June 14, 2026 10:20
… of §3.7 batched scheduler)

Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
…ll is elicited (was 0 with plain chat template)

Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
…X (batch>1) breaks recall (0.125 vs serialized 1.0)

§3.7 batched scheduler is CUDA-only (torch); Mac served-restored blocked by
MLX-gemma load gap. Mac analog bench run on M4: serialized recall 1.0; batched
MLX decode breaks per-session recall (0.125) -> NOT recall-safe (recall is the
bottom line). Recall-safe Mac multi-tenant = serialized; batched needs an MLX
batch>1 cache/forward fix. ADR 0014 §3.7 platform note + evidence.

Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
@cursor
cursor Bot merged commit 7a96615 into main Jun 14, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants