Swift API for MLX, the array framework for machine learning on Apple silicon, letting Swift developers run ML research and experiments.
- Stars
- 28,887
- Forks
- 2,366
- Open issues
- 137
- Last commit
- 8 hours ago
What is it?
MLX is an array framework for machine learning on Apple silicon, released by Apple's machine learning research team. Its Python API closely follows NumPy, and higher-level packages such as mlx.nn and mlx.optimizers follow PyTorch-style APIs for building models. C++, C, and Swift APIs are also available.
MLX uses lazy computation, so arrays are only materialized when needed, and it builds computation graphs dynamically, so changing argument shapes does not trigger slow recompilation. It supports composable function transformations for automatic differentiation, vectorization, and graph optimization.
A key design point is unified memory: arrays live in shared memory, and operations can run on the CPU or GPU without copying data between devices. The project also provides examples for LLaMA text generation, LoRA finetuning, Stable Diffusion, and Whisper speech recognition.
Key features
- 01Python API closely following NumPy, with nn and optimizers modules modeled on PyTorch
- 02C++, C, and Swift APIs available alongside Python
- 03Lazy computation and dynamically constructed graphs
- 04Composable transformations for automatic differentiation and vectorization
- 05Unified memory model allowing operations on CPU or GPU without data transfer
Use cases
- Researching and prototyping new models on a Mac with Apple silicon
- Running LLM text generation or finetuning with LoRA on Apple hardware
- Running Stable Diffusion or Whisper speech recognition locally on macOS
- Building numerical or ML code in C++ or Swift with a NumPy-like interface
Quick start
- 1
Install MLX on macOS with pip
pip install mlx - 2
Read the quick start guide in the documentation
Things to know
- Targets Apple silicon; the README's main install path is macOS.
- Linux CUDA and CPU-only packages are also mentioned, so platform support varies by backend.
In collections
Topics
FAQ
- What is mlx?
- An array framework for machine learning on Apple silicon, with a NumPy-like Python API and C++, C, and Swift bindings. MLX is an array framework for machine learning on Apple silicon, released by Apple's machine learning research team. Its Python API closely follows NumPy, and higher-level packages such as mlx.nn and mlx.optimizers follow PyTorch-style APIs for building models. C++, C, and Swift APIs are also available.
- Is mlx free to use? What license does it have?
- mlx is open source under the MIT license. Check the license terms before using it in commercial products.
- Is mlx still maintained?
- Actively maintained. The last commit to mlx was on Oct 22, 2026.
- What can I use mlx for?
- Researching and prototyping new models on a Mac with Apple silicon Running LLM text generation or finetuning with LoRA on Apple hardware Running Stable Diffusion or Whisper speech recognition locally on macOS Building numerical or ML code in C++ or Swift with a NumPy-like interface
- How do I install mlx?
- Install MLX on macOS with pip: pip install mlx Read the quick start guide in the documentation
- Where can I get mlx?
- The source code and installation instructions are on GitHub: https://github.com/ml-explore/mlx
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A Python deep learning framework offering GPU-accelerated tensor computation and dynamic neural networks built on autograd.
A Python library that converts machine learning code between frameworks such as PyTorch, TensorFlow, JAX and NumPy via ivy.transpile.
An open machine learning compilation framework that lets developers customize compiler pipelines in Python and deploy models to many hardware targets.
A learn-by-building ML course: a from-scratch NumPy deep learning framework (CLI modules) plus 350+ browser-based coding questions graded in Pyodide.
A minimal deep learning framework with a PyTorch-like tensor API, autograd, a compiler, and support for many accelerator backends.