We introduce mlx-snn, the first spiking neural network (SNN) library built natively on Apple's MLX framework. As SNN research grows rapidly, all major libraries -- snnTorch, Norse, SpikingJelly, Lava -- target PyTorch or custom backends, leaving Apple Silicon users without a native option. mlx-snn provides six neuron models (LIF, IF, Izhikevich, Adaptive LIF, Synaptic, Alpha), four surrogate gradient functions, four spike encoding methods (including an EEG-specific encoder), and a complete backpropagation-through-time training pipeline. The library leverages MLX's unified memory architecture, lazy evaluation, and composable function transforms (mx.grad, mx.compile) to enable efficient SNN research on Apple Silicon hardware. We validate mlx-snn on MNIST digit classification across five hyperparameter configurations and three backends, achieving up to 97.28% accuracy with 2.0--2.5 times faster training and 3--10 times lower GPU memory than snnTorch on the same M3 Max hardware. mlx-snn is open-source under the MIT license and available on PyPI. https://github.com/D-ST-Sword/mlx-snn
翻译:我们介绍了mlx-snn,这是首个基于苹果MLX框架原生构建的脉冲神经网络(SNN)库。随着SNN研究的快速发展,所有主流库——snnTorch、Norse、SpikingJelly、Lava——都以PyTorch或自定义后端为目标,使得Apple Silicon用户缺乏原生选择。mlx-snn提供了六种神经元模型(LIF、IF、Izhikevich、自适应LIF、突触模型、Alpha)、四种替代梯度函数、四种脉冲编码方法(包括一个专用于脑电图的编码器)以及一个完整的基于时间的反向传播训练流程。该库利用MLX的统一内存架构、惰性求值和可组合的函数变换(mx.grad、mx.compile),以在Apple Silicon硬件上实现高效的SNN研究。我们在五种超参数配置和三种后端上,通过MNIST数字分类任务验证了mlx-snn的性能,在相同的M3 Max硬件上,相比snnTorch实现了高达97.28%的准确率,训练速度提升了2.0–2.5倍,GPU内存使用降低了3–10倍。mlx-snn采用MIT许可证开源,并可在PyPI上获取。https://github.com/D-ST-Sword/mlx-snn