MLX is an open source framework from Apple for machine learning on Apple Silicon, the chips in Macs since the M1. It works with arrays, through an API similar to NumPy's, and takes advantage of the CPU and GPU sharing memory. You use it to run, train and fine tune models from Python.
🔥PyTorch trains it→🤗Hugging Face shares it→💻Ollama runs it→🍎MLX on Apple chips
Put it to the test
A question from the app. Pick an answer.
A tutorial for Mac uses MLX. What is MLX?
The chips are Apple Silicon (M1, M2 and later). MLX is the software that makes use of them for machine learning.
Ollama already works on Mac. MLX is something else: a framework for programming, closer to PyTorch than to an app.
It is for training and running models on Apple Silicon, where CPU and GPU share memory. It is code, not a chat app.
MLX is code: a library you use from Python (it also has versions for C++, C and Swift). Apple's machine learning research team publishes it under the MIT license. It is closer to PyTorch than to an app: you use it to build, train and run neural networks.
It is not the chip: the chips are Apple Silicon (M1, M2 and later) and MLX is the software that makes use of them. It is not a chat app either, nor the Mac version of Ollama, which already works on Mac on its own.
Why unified memory matters
In a PC with a graphics card, the GPU has its own memory and data gets copied back and forth. On Apple Silicon, the CPU and GPU use the same memory. MLX is built for that: arrays live in that shared memory and each operation can run on the CPU or the GPU without copying them.
For a local model, what matters is still how much memory your Mac has: the model has to fit there, with room left for your other apps.
mlx-lm: language models on your Mac
mlx-lm is a separate package, built with MLX, for using LLMs on a Mac: generating text from the terminal or from Python, fine tuning a model on your data (including with LoRA, which trains small added matrices and keeps the original weights fixed) and quantizing it so it takes less space.
It gets the models from Hugging Face. There, the mlx-community group publishes many already converted to MLX and quantized, ready to download.
Does it only work on Mac?
It was made for Apple Silicon, and that is still its strength. According to its documentation, today it can also be installed on Linux, with support for NVIDIA cards (CUDA) or CPU only. Whether it beats another tool depends on the model, the task and your hardware: test it with your own work.