MLX Swift LM
Run large language and vision-language models on device with MLX Swift.
View on GitHub ↗- Stars
- ★ 837
- Last commit
- 16 Oct 2026
- Maintenance
- Active
- Licence
- MIT
- Category
- On-device AI SDKs
- GitHub
- ml-explore/mlx-swift-lm
Overview
MLX Swift LM is a Swift package for building tools and apps with large language models and vision-language models using MLX on Apple silicon. It plugs into tokeniser and downloader packages through protocols, so you can choose how much convenience or control you want. It also includes a bridge to Apple's Foundation Models framework.
Features
- LLM and VLM implementations for MLX
- MLXHuggingFace macros give a default Hugging Face downloader and tokeniser
- ChatSession for simple multi-turn chat
- Supports custom downloaders, other tokeniser packages and local-only weights
- MLXFoundationModels bridges MLX models into Apple's FoundationModels API
Requirements
The source doesn't list any requirements, so check the project's own docs before you install.
Install
Add the core package to Package.swift, then choose an integration package for downloaders and tokenisers
.package(url: "https://github.com/ml-explore/mlx-swift-lm", .upToNextMinor(from: "3.32.3")),
Example
Load a Gemma 3 1B model with #huggingFaceLoadModelContainer, start a ChatSession and ask "What are two things to see in San Francisco?"
Works with
Listed in
Read the code before you install anything. SwiftAgents doesn't review or endorse the tools listed here. Active: a commit in the last 90 days. Slowing: last commit within the past year. Stale: older than a year, or archived.