Overview
Swiftlet is an inference runtime written in Swift with Metal GPU kernels, built for one specific trick: it keeps only the small dense core of a Mixture-of-Experts model resident in memory and streams the routed expert weights from storage on demand. Because a MoE model activates a fraction of its parameters per token, that turns a model far larger than the device's RAM into something an iPhone can hold open.
The runtime targets Qwen MoE models — Qwen3.6-35B and Qwen3-Next-80B in 4-bit and 8-bit variants — on Apple Silicon Macs running macOS 14 or later and iPhones running iOS 17 or later. Reported throughput spans roughly 1 token per second on an iPhone 17 up to about 19.5 tokens per second on an M4 Max, so the trade is explicit: the device stops being the limit on model size and starts being the limit on speed.
Under the hood it caches experts with an LFU eviction policy, compiles its Metal shaders at runtime, and validates its outputs against MLX reference implementations. Swiftlet is distributed as a Swift library, a set of command-line tools, an OpenAI-compatible server and an iOS app (Priv AI), all under the Apache-2.0 licence.
What it does
- Streams routed MoE expert weights from storage while the dense core stays in memory
- Runs Qwen3.6-35B and Qwen3-Next-80B in 4-bit and 8-bit variants on Apple Silicon and on iPhone
- LFU expert cache keeps the hot experts resident and evicts the rest
- Metal shaders compiled at runtime, with outputs validated against MLX reference implementations
- Ships as a Swift library, CLI tools, an OpenAI-compatible server and the Priv AI iOS app
- Runs on macOS 14+ and iOS 17+, with no cloud call in the loop
Getting started
Swiftlet builds with the Swift package manager and runs against a .qpack model file. Everything happens on-device.
Clone and build
A release build produces the swiftlet CLI under .build/release.
git clone https://github.com/leonickson1/Swiftlet.git && cd Swiftlet
swift build -c releaseChat with a model
Point the CLI at a downloaded model pack. The core stays in RAM and experts stream from disk as generation proceeds.
.build/release/swiftlet chat ~/models/qwen3.6-35b.qpack "your prompt"Pick the variant that fits the device
The 4-bit and 8-bit packs trade quality against how much of the model has to be paged in. On an iPhone 17 expect around 1 token per second; on an M4 Max the README reports about 19.5.
# 35B for phones and small Macs, 80B where storage bandwidth allowsCommands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Run a large open-weight MoE model on a Mac that does not have enough RAM to hold it
- Put a 35B-class assistant on an iPhone with no network round-trip
- Build an iOS or macOS app on a Swift-native inference library instead of bridging to a C runtime
- Serve a local OpenAI-compatible endpoint from an Apple machine for development
How Swiftlet compares
Swiftlet alongside other open-source local runtimes tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| Ollama | ★ 180k | A developer-friendly tool that downloads and runs local LLMs from the terminal with a built-in OpenAI-compatible API. |
| llama.cpp | ★ 127k | A C/C++ inference engine that runs LLMs in the GGUF format on CPUs, Apple Silicon, and GPUs with low memory use. |
| GPT4All | ★ 77.4k | GPT4All is a free desktop app and Python client that runs large language models locally on your own computer, with no API calls or GPU required. |
| LocalAI | ★ 49k | A self-hosted server that exposes an OpenAI-compatible API for running text, vision, voice, and image models on local hardware. |
| Jan | ★ 44.4k | An open-source desktop app that runs LLMs fully offline as a ChatGPT-style assistant on your own computer. |
| AirLLM | ★ 33.8k | A Python inference library that keeps only one transformer layer on the GPU at a time, so a 70B model runs on a single 4GB card and a 671B MoE model on about 12GB, without quantization. |
| llamafile | ★ 25.9k | A Mozilla project that packages a model and its runtime into one executable file you can copy and run on any OS. |
| Swiftlet | ★ 625 | A Swift and Metal runtime that streams Mixture-of-Experts weights from storage so 35B and 80B models run on a Mac or an iPhone |