arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.18921cs.LGcs.AIcs.CL
收藏

基于MLX的Apple Silicon端侧机器学习基准测试

Benchmarking On-Device Machine Learning on Apple Silicon with MLX

Oluwaseun A. Ajayi, Ogundepo Odunayo

AI总结:

该研究构建MLX-transformers框架,在Apple Silicon设备上对BERT等Transformer模型开展推理延迟基准测试,对比PyTorch与CUDA GPU性能,验证了MLX赋能苹果生态高效端侧机器学习的潜力。

摘要:

近年来,大语言模型(LLM)及广义机器学习的广泛应用,激发了业界探索将此类模型部署在笔记本电脑、手机等小型设备上的研究兴趣,这也催生了对能够充分利用端侧硬件的框架与方法的需求。MLX框架正是为满足这一需求而开发,它是一款针对Apple Silicon设备上的机器学习(ML)计算优化的框架,可简化研究、实验与原型开发流程。\n本文对MLX开展性能评估,重点关注Transformer模型的推理延迟。我们将MLX中不同Transformer架构实现的性能,与对应的PyTorch实现进行对比。为此,本研究构建了名为MLX-transformers的框架,该框架包含MLX下的多种Transformer实现,还支持下载PyTorch格式的模型检查点并将其转换为MLX格式。依托Apple Silicon的先进架构与性能,MLX-Transformers可直接运行来自Hugging Face的Transformer模型,省去了跨框架迁移模型时通常需要的检查点转换步骤。\n本研究在两款Apple Silicon MacBook设备上,以NVIDIA CUDA GPU为对照,对不同Transformer模型开展基准测试,具体对比了参数规模与检查点完全相同的模型的推理延迟性能。本次评估覆盖BERT、RoBERTa与XLM-RoBERTa模型,后续工作将扩展至多模态模型,以更全面地评估MLX的性能。测试结果凸显了MLX在苹果生态内实现高效、更易获取的端侧ML应用方面的潜力。

英文摘要:

The recent widespread adoption of Large Language Models (LLMs) and machine learning in general has sparked research interest in exploring the possibilities of deploying these models on smaller devices such as laptops and mobile phones. This creates a need for frameworks and approaches that are capable of taking advantage of on-device hardware. The MLX framework was created to address this need. It is a framework optimized for machine learning (ML) computations on Apple silicon devices, facilitating easier research, experimentation, and prototyping. This paper presents a performance evaluation of MLX, focusing on inference latency of transformer models. We compare the performance of different transformer architecture implementations in MLX with their Pytorch counterparts. For this research we create a framework called MLX-transformers which includes different transformer implementations in MLX and downloads the model checkpoints in pytorch and converts it to the MLX format. By leveraging the advanced architecture and capabilities of Apple Silicon, MLX-Transformers enables seamless execution of transformer models directly sourced from Hugging Face, eliminating the need for checkpoint conversion often required when porting models between frameworks. Our study benchmarks different transformer models on two Apple Silicon macbook devices against an NVIDIA CUDA GPU. Specifically, we compare the inference latency performance of models with the same parameter sizes and checkpoints. We evaluate the performance of BERT, RoBERTa, and XLM-RoBERTa models, with the intention of extending future work to include models of different modalities, thus providing a more comprehensive assessment of MLX's capabilities. The results highlight MLX's potential in enabling efficient and more accessible on-device ML applications within Apple's ecosystem.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑