Apple releases MLX, an open-source machine-learning framework for Apple Silicon
Apple has unveiled MLX, a new machine-learning framework, along with MLX Data, a deep learning model library, both designed to run on Apple Silicon chips. The company is making these resources accessible through open-source repositories like GitHub and PyPI, allowing developers to build efficient machine-learning models. This move is seen as a sign of an impending wave of generative AI applications for MacBooks.
MLX, described by Apple on GitHub as a NumPy-like array framework, has been specifically crafted for efficient and flexible machine learning on Apple Silicon. It boasts a fully featured C++ API that closely mirrors the Python API, which in turn resembles NumPy with a few exceptions.
While MLX bears similarities with NumPy, Apple machine learning research on GitHub highlights key differences, such as composable function transformation for automatic differentiation, automatic vectorization, and computation graph optimization. Notably, computations in MLX are lazy, and arrays materialize only when necessary.
The design of MLX draws inspiration from frameworks like ArrayFire, Jax, and PyTorch but introduces a unified memory model. In MLX, arrays exist in shared memory, enabling operations to be performed on any supported devices—currently including CPU and GPU—without the need for data copying.
Recapping the capabilities of MLX, it offers familiar APIs, composable functional transformations, lazy computation, dynamic graph construction, multi-device support, and unified memory.
Awni Hannum from Apple’s machine learning research team shared a video showcasing the Llama v1 7B model implemented in MLX and running on an M2 Ultra chip. Hannum emphasized that MLX was purpose-built for Apple silicon, leveraging its efficiency. Additionally, the MLX Data deep learning model library focuses on efficient and flexible data loading.
Developers interested in exploring MLX can access the GitHub repository, which provides installation instructions and a quick start guide. Within the repository, examples of linear regression, multi-layer perceptron, and LLM inference are available. Apple’s machine learning research team also offers comprehensive developer documentation, along with Python and C++ API references.
With Apple’s release of MLX and MLX Data, a new era of machine learning on Apple Silicon is ushered in, promising breakthroughs in generative AI applications. The open-source nature of these resources empowers developers to leverage Apple’s powerful hardware for efficient and flexible machine learning tasks.
In summary, Apple has introduced MLX, an open-source machine-learning framework tailored for Apple Silicon, enabling developers to build models that efficiently run on MacBooks. This move paves the way for an influx of generative AI apps. To enhance accessibility, documentation, installation guides, and coding examples are provided on the GitHub repository. With MLX and MLX Data, Apple is fostering a new era of machine learning on its silicon chips, unlocking the potential for groundbreaking advancements in AI applications.