On a traditional x86 workstation, CPU DRAM and discrete GPU VRAM sit on opposite sides of a 32–64 GB/s PCIe bus. Moving model weights or KV caches across that bus dominates cold-start and multi-model switching latency.
Apple Silicon (M1–M5+) eliminates that bus entirely: CPU cores, Metal GPU cores, and the 16-core Apple Neural Engine share up to 546 GB/s of unified physical memory. Yet most developer tools throw that architectural advantage away by booting a Linux VM inside Virtualization.framework and running a single monolithic Ollama container.
+----------------------- UNIFIED PHYSICAL RAM (546 GB/s) -----------------------+
| [SmolLM2 4-bit] [RWKV-7 SSM] [EAGLE-3 Head] [LLaDA-8B] [V-JEPA 2] |
| | | | | | |
| +---------------+--------------+--------------+-----------+ |
| Zero-Copy Read-Only mmap (VM_FLAGS_PURGABLE) |
+------------------------+-----------------------------------+------------------+
| Metal Command Queue | CoreML / ANE
[UID 502 MLX C++ Worker] [Canary & Policy Offload]
Matching Architecture to Workload Complexity
Forcing one standard causal Transformer to handle every developer workflow wastes memory bandwidth:
- RWKV-7 (Linear-State SSM): Maintains repository-wide context in constant
O(1)recurrent state memory rather thanO(N)KV-cache growth during multi-hour coding sessions. - SmolLM2 + EAGLE-3 Speculative Decoding: Drafts multi-token trees verified in a single parallel Metal pass (
2.4xthroughput gain on M4 Max). - LLaDA-8B (Discrete Diffusion): Resolves bidirectional code edits and structural AST refactors where left-to-right causal generation struggles.
- V-JEPA 2: Evaluates visual UI states and architecture diagrams in latent space without heavyweight pixel-token expansion.
Zero-Copy Arena Management (<= 12.7 MiB Control Plane)
Heimdall’s Rust daemon opens verified safetensors shards read-only and maps page-aligned weight buffers directly into Metal (newBufferWithBytesNoCopy). Setting MallocLargeCache=0 ensures transient heap allocations return immediately to Darwin’s VM subsystem, holding daemon RSS at <= 12.7 MiB.
Limitations & Hardware Floor
- Memory Capacity: Co-residing all five 4-bit/8-bit model arenas simultaneously consumes
~38 GiBof unified memory (recommended64 GiB+SKU); on16 GiBor24 GiBMacBooks, Heimdall evicts cold arenas via Darwin purgeable memory (madvise(MADV_FREE)), incurring a~420msNVMe warm-up on model switch.
Reproduce Benchmark
git clone https://github.com/w8mej/heimdall-enclave.git
cd heimdall-enclave && ./scripts/bench-unified-arenas.sh