Favicon of MLX

MLX

An open-source machine learning array framework with NumPy-style APIs, shared CPU and GPU memory on Apple silicon, and Linux CPU and CUDA backends.

Screenshot of MLX website

MLX is a machine learning array framework for researchers and developers building models on their own hardware. Its distinctive feature on Apple silicon is shared CPU and GPU memory: both processors can work on the same arrays without copying data between them. It's open source under the MIT license.

The Python API follows NumPy closely, so developers familiar with array-based numerical code have less new syntax to learn. MLX also has C++, C and Swift APIs. Its neural network and optimizer packages use conventions similar to PyTorch for building and training more complex models.

MLX supports automatic differentiation, vectorization and computation graph optimization, and these operations can be combined. It delays computation until results are needed. Computation graphs form dynamically, and changing the shapes of inputs doesn't trigger slow recompilation, which matters when experimenting with models and different data sizes.

For local AI work, the example projects cover transformer language model training, LLaMA text generation and LoRA fine-tuning. Other examples use Stable Diffusion for image generation and OpenAI's Whisper for speech recognition. These are model development examples rather than a ready-made chat interface.

MLX runs on macOS with Apple silicon CPU and GPU support. Linux packages provide a CUDA backend or CPU-only execution.

Similar to MLX