arXiv:2607.19438cs.ARcs.AI2026-07

利用苹果M5芯片的神经加速单元,显著提升大模型推理速度。

BaseRT: Advancing Best-in-Class LLM Inference with Apple M5 Neural Accelerators

  • 直接调用M5芯片的矩阵计算单元,优化推理计算路径。
  • 在15种模型上实现最高6.4倍于llama.cpp的提示处理速度。
  • 适合追求设备端高效大模型推理的开发者和研究者。

苹果M5芯片采用重新设计的GPU架构,每个核心均配备专用神经加速器,通过Metal 4张量接口暴露在芯片内部。我们提出BaseRT,一个专为苹果自研芯片设计的原生金属推理运行时,充分利用这些加速单元,在苹果硬件上显著超越llama.cpp和MLX的推理吞吐量。基于框架无关的设计,我们开发了一组手写Metal 4张量核(包括密集层和专家混合GEMM、闪注意力预填充核),将推理中的计算密集型矩阵乘法路由至M5神经加速器,而保持内存密集型解码路径由现有专用核处理。在搭载M5 Pro的设备上,针对涵盖子10亿到350亿参数的Qwen3、Qwen3.5/3.6、Llama 3.2和Gemma 4系列共15种模型配置,BaseRT在提示处理上相比llama.cpp最高提升6.4倍,相比MLX提升3.9倍,尤其在专家混合模型中优势更明显;解码性能也领先达1.75倍(对比llama.cpp)和1.33倍(对比MLX)。结果确立了设备端大模型推理的新性能上限,证实了M5张量核心是苹果硅上提示处理的关键加速杠杆。BaseRT已开源:https://github.com/basecompute/baseRT。

原文摘要 · Abstract (English)

Apple's M5 generation introduces a redesigned GPU architecture in which every core carries a dedicated Neural Accelerator: on-die matrix units exposed through the Metal~4 tensor API. We show that BaseRT, our native Metal inference runtime for large language models on Apple Silicon, exploits these units to push inference throughput on Apple hardware substantially beyond both llama.cpp and MLX. Building on BaseRT's framework-free design, we add a family of hand-written Metal~4 tensor-core kernels (including dense and mixture-of-experts GEMM and flash-attention prefill kernels) that route the compute-bound matrix multiplications of inference through the M5 Neural Accelerators while leaving the memory-bound decode path on our existing specialised kernels. On an Apple M5 Pro, across fifteen model configurations spanning the Qwen3, Qwen3.5/3.6, Llama~3.2, and Gemma~4 families from sub-1B to 35B parameters, BaseRT delivers up to $6.4\times$ higher prompt-processing throughput than llama.cpp and $3.9\times$ higher than MLX, with the largest margins on the mixture-of-experts models where matrix multiplication dominates, while maintaining its lead on decode of up to $1.75\times$ over llama.cpp and $1.33\times$ over MLX. These results establish a new performance ceiling for on-device LLM inference and show that the M5's tensor cores are the decisive lever for prompt processing on Apple Silicon. BaseRT is publicly available at https://github.com/basecompute/baseRT.

大模型推理苹果M5神经加速器Metal 4

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。