开发者逆向工程Apple Neural Engine私有API,首次在ANE上实现神经网络训练

BlockBeats 消息,3 月 3 日,开发者 Manjeet Singh(GitHub: maderix)与 Claude Opus 协作,通过逆向工程 Apple 未公开的私有 API,首次在 M4 芯片的 Apple Neural Engine(ANE)上实现了包含反向传播的神经网络训练。ANE 是 Apple 专为推理设计的加速器,官方从未开放训练能力,开发者只能通过 CoreML 框架间接调用其推理功能。

该项目绕过 CoreML,直接映射了从 _ANEClient、_ANECompiler 等 40 余个私有类到 IOKit 内核驱动的完整软件栈,并发现了可在内存中直接编译模型的 _ANEInMemoryModelDescriptor 接口——这是实现训练的关键,因为每次权重更新都需要重新编译。当前实现了单个 transformer 层(dim=768, seq=512)的训练,M4 上每步耗时 9.3ms,ANE 利用率 11.2%(1.78 TFLOPS,理论峰值 15.8 TFLOPS),前向和反向传播的输入梯度在 ANE 上计算,权重梯度和 Adam 优化器在 CPU 上完成。

项目还发现 ANE 的核心计算原语是卷积而非矩阵乘法,用 1x1 卷积表达矩阵乘法可获得约 3 倍吞吐提升,绕过 CoreML 直接调用则有 2-4 倍额外增益,Apple 官方宣传的「38 TOPS」存在误导。目前项目仍处于早期阶段:仅支持单层训练、使用合成数据、存在约 119 次编译后的资源泄漏需重启进程规避,多层训练和真实数据支持尚在开发中。项目以 MIT 协议开源,发布 5 天获得约 2800 星。

Disclaimer: The information on this page may come from third parties and does not represent the views or opinions of Gate. The content displayed on this page is for reference only and does not constitute any financial, investment, or legal advice. Gate does not guarantee the accuracy or completeness of the information and shall not be liable for any losses arising from the use of this information. Virtual asset investments carry high risks and are subject to significant price volatility. You may lose all of your invested principal. Please fully understand the relevant risks and make prudent decisions based on your own financial situation and risk tolerance. For details, please refer to Disclaimer.
Commento
0/400
Nessun commento