Over the past few years, there have been significant advancements in Machine Learning (ML), with numerous frameworks and libraries developed to simplify our tasks. Among these innovations, Apple recently launched a new framework, MLX, designed specifically for Apple silicon, that facilitates the training and deployment of machine learning ML models for Apple hardware. This framework is an array framework, similar to NumPy, that allows for efficient and flexible performance on Apple’s processors.
The design of the framework is inspired by existing frameworks like Jax, PyTorch, and ArrayFire, and has a Python API as well as a C++ API. This makes the framework user-friendly, and researchers can easily extend and improve MLX. It also has high-level packages like mlx.optimizers and mlx.nn with APIs, which simplifies complex model building. MLX has composable function transformations that enable automatic differentiation, automatic vectorization, and computation graph optimization.
The computations in MLX are lazy, which means that arrays are used only when needed. Moreover, computations in the framework are built dynamically, and modifying the function arguments does not lead to slower compilations. MLX supports multiple devices, and operations can be run on CPUs and GPUs. Lastly, unlike other frameworks, arrays in MLX live in shared memory, and operations can be performed on any supported device without moving the data.
The Apple researchers on GitHub said, “The framework is intended to be user-friendly, but still efficient to train and deploy models. The design of the framework itself is also conceptually simple. We intend to make it easy for researchers to extend and improve MLX with the goal of quickly exploring new ideas.”
Apple has listed some of the examples of how MLX could be utilized. Its use cases include training a transformer language model, large-scale text generation using LLaMA or Mistral, generating images with Stable Diffusion, parameter-efficient fine-tuning with LoRA, and speech recognition using OpenAI’s Whisper. The image generation capabilities of Stable Diffusion in MLX were tested, and the researchers observed that MLX achieved around 40% better throughput than PyTorch with a batch size of 16.
Through the release of MLX, the researchers at Apple have tried to democratize machine learning to facilitate more research. Although Apple is a bit late to join the AI war with its competitors like Meta, Google, and OpenAI releasing numerous state-of-the-art models/frameworks, we cannot completely rule them in the rather early stages of the competition. Nevertheless, the framework has the ability to simplify complex model building and potentially bring generative AI to Apple devices.
In conclusion, MLX is an effective framework that equips researchers with a powerful environment to build ML models. Apart from its unique design, what makes this more user-friendly is that it has been inspired by existing frameworks, which ensures a smooth transition for its users. Although Apple has not made significant announcements in the field of AI lately, with MLX, it hopes to make ML model building much simpler and facilitate the exploration of new ideas.
Asif Razzaq is the CEO of Marktechpost Media Inc.. As a visionary entrepreneur and engineer, Asif is committed to harnessing the potential of Artificial Intelligence for social good. His most recent endeavor is the launch of an Artificial Intelligence Media Platform, Marktechpost, which stands out for its in-depth coverage of machine learning and deep learning news that is both technically sound and easily understandable by a wide audience. The platform boasts of over 2 million monthly views, illustrating its popularity among audiences.