数组语言使神经网络更快
Array Languages Make Neural Networks Fast
摘要:
现代机器学习框架很复杂:它们通常组织在多个层中,每个层都用不同的语言编写,并且它们依赖于许多外部库,但在其核心,它们主要由张量操作组成。由于面向数组的语言提供了完美的抽象来实现张量操作,我们考虑了一个最小的机器学习框架,该框架被浅嵌入到面向数组的语言中,我们研究了它的生产力和性能。我们通过实现最先进的卷积神经网络(CNN)来实现这一点,并将其与TensorFlow和PyTorch中的实现进行比较-这两个最先进的工业强度框架。事实证明,我们的实现速度快了2倍和3倍,即使在我们的硬件(64核GPU加速机器)微调TensorFlow和PyTorch之后。所有三个CNN规范的大小都是相同的,大约有150行代码。我们的迷你框架是150行高度可重用的硬件无关代码,不依赖于外部库。主机数组语言的编译器自动为选定的体系结构生成并行代码。在性能和可移植性之间取得这种平衡的关键在于数组语言的设计;特别是,能够简洁地表达秩多态操作,但能够在它们之间进行优化。这种设计建立在非常少的假设上,并且它很容易转移到其他环境中,为高性能机器学习提供了一种干净的方法。
英文摘要:
Modern machine learning frameworks are complex: they are typically organised in multiple layers each of which is written in a different language and they depend on a number of external libraries, but at their core they mainly consist of tensor operations. As array-oriented languages provide perfect abstractions to implement tensor operations, we consider a minimalistic machine learning framework that is shallowly embedded in an array-oriented language and we study its productivity and performance. We do this by implementing a state of the art Convolutional Neural Network (CNN) and compare it against implementations in TensorFlow and PyTorch --- two state of the art industrial-strength frameworks. It turns out that our implementation is 2 and 3 times faster, even after fine-tuning the TensorFlow and PyTorch to our hardware --- a 64-core GPU-accelerated machine. The size of all three CNN specifications is the same, about 150 lines of code. Our mini framework is 150 lines of highly reusable hardware-agnostic code that does not depend on external libraries. The compiler for a host array language automatically generates parallel code for a chosen architecture. The key to such a balance between performance and portability lies in the design of the array language; in particular, the ability to express rank-polymorphic operations concisely, yet being able to do optimisations across them. This design builds on very few assumptions, and it is readily transferable to other contexts offering a clean approach to high-performance machine learning.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。