MLX Swift
A Swift API for the MLX array framework, letting machine learning research and inference run natively on Apple silicon from Swift, with example apps for chat, text generation and Stable Diffusion image generation.
MLX Swift is a Swift-language API for MLX, an array framework for machine learning built for Apple silicon. It brings MLX's research and experimentation workflow to Swift developers building iOS and macOS applications, rather than only Python.
Example projects distributed alongside it include an MNIST digit classifier that trains a LeNet model on-device, a chat application supporting both language and vision-language models, a command-line and app-based tool that downloads a large language model and tokenizer from Hugging Face and generates text from a prompt, and an example that downloads a Stable Diffusion model from Hugging Face to generate images; language model implementations specifically live in a companion mlx-swift-lm package.
It installs through Xcode or Swift Package Manager, with a separate CMake-based build that supports native Linux builds. The core MLX framework is written in C++ and released under the MIT license.