🤖 AI Hot

Swiftlet Runs 80B Qwen on Mac with 4.3GB RAM

A
Alex Chen

Running an 80-billion-parameter language model on a personal laptop used to sound like a joke. You’d need 160GB of VRAM in 4-bit, or multiple GPUs, or a cloud API key and a prayer that your data stays private. A new open-source project called Swiftlet just made it real — and it runs on an iPhone.

Swiftlet keeps only the dense core of a Qwen model in RAM and streams Mixture-of-Experts (MoE) weights from SSD on demand. The numbers are not theoretical: Qwen3-Next-80B-A3B peaks at 4.3GB of RAM on an M5 Mac and decodes at 4.5-5 tokens per second. Qwen3.6-35B-A3B runs on an iPhone 17 in about 2.5GB at roughly 1 tok/s. Both are firsts for models of this size on consumer Apple hardware — and both use the same codebase with zero platform-specific changes.

How Expert Streaming Works

The trick is in the architecture. These Qwen hybrid models activate roughly 3 billion parameters per token, not all 35 or 80 billion. Each layer routes every token to a subset of experts — 10 out of 512 for the 80B, 8 out of 256 for the 35B. The dense weights that get used every time — attention projections, DeltaNet recurrent states, routers, shared experts, embeddings — stay resident in RAM. That’s about 2.5GB for the 80B at 4-bit quantization and 1.3GB for the 35B.

The routed experts, which number in the thousands, get packed into a .qpack container at fixed stride. When the model needs expert 347, Swiftlet issues exactly one pread syscall to fetch that expert’s weights from SSD. No mmap, no page cache thrashing, no kernel guessing which pages you might want next. The I/O pattern is predictable because the model’s routing decisions are deterministic given the same input.

A bounded cache with LFU plus recency eviction keeps hot experts in RAM. Cache hit rates range from 43-70% depending on the workload, but the team found that cache size barely affects throughput because Apple SSDs are fast enough to absorb the misses at these token rates. The decode loop is dispatch-bound on the GPU, not I/O-bound.

The Metal Runtime

The entire forward pass runs on Metal with shaders compiled at runtime. This is a deliberate design choice: it means the same Swift code ships on macOS and iOS without a build-time Metal toolchain. No Xcode project with a .metallib compile step, no separate code paths per platform.

The Metal kernels handle a few things that commodity LLM runners typically don’t: MLX-compatible affine int4 and int8 group quantization, byte-addressed kernels with 64-bit offsets (important when your weight container exceeds 4GB), a cooperative simdgroup GEMV fast path for the attention projections, and explicit hazard management so the GPU doesn’t read weights that are being evicted.

Layer correctness is validated against mlx-lm reference implementations with per-layer fixtures in both float32 and int4. Incremental decoding output is verified against whole-sequence processing. Metal kernel outputs are tested against the exact CPU reference. Fast and scalar GPU kernel paths produce identical results. A streamed expert answers identically whether it came from cache or from a fresh disk read.

Why Gated DeltaNet Matters

Seventy-five percent of the layers in these Qwen hybrid models use Gated DeltaNet linear attention instead of standard multi-head attention. DeltaNet maintains a fixed-size recurrent state — think of it like an RNN hidden state, not a growing key-value cache. This means the memory cost for those layers stays constant regardless of context length. A 1-million-token context costs about 25GB of KV cache in a pure transformer. With Gated DeltaNet handling most of the layers, that number is roughly 4x smaller.

For local inference on a MacBook with shared memory, this is a big deal. Every gigabyte you don’t spend on KV cache is a gigabyte you can use for model weights or keep free for other applications. It’s also why Swiftlet can fit these models at all — without DeltaNet, the 80B would need significantly more RAM even with expert streaming.

Getting It Running

Clone and build on any Mac with Apple Silicon:

git clone https://github.com/leonickson1/Swiftlet.git && cd Swiftlet
swift build -c release

Download a pre-packed model from Hugging Face. The repack tool handles resumable downloads:

.build/release/swiftlet-repack \
  --from-hf Leonickson/Qwen3.6-35B-A3B-qpack \
  --output ~/models/qwen3.6-35b.qpack

Chat interactively:

.build/release/swiftlet chat ~/models/qwen3.6-35b.qpack \
  "Who wrote One Hundred Years of Solitude?" "What language did he write it in?"

Or spin up an OpenAI-compatible API server:

.build/release/swiftlet-server --model ~/models/qwen3.6-35b.qpack --port 8080

There are four ways to integrate it. The Swift package (SwiftletCore) drops into any macOS or iOS app with streaming chat, conversation caching, repetition control sampling, and memory pressure handling. The CLI covers chat, generation, and model repacking. The server speaks the OpenAI chat-completions protocol on localhost. And the iOS app, Priv AI, wraps SwiftletCore so end users can tap Download and chat on-device with no server involved.

Honest Performance Expectations

The headline numbers are real, but they come with asterisks. Only about 3 billion parameters are active per token. These models chat and reason like large models — the prose quality and instruction-following are genuinely good — but they recall facts like small models. A 3B-parameter model simply cannot memorize as much world knowledge as a dense 80B model. If you ask it about a niche historical event, it might hallucinate.

The 4.5-5 tok/s on an M5 Mac is usable for reading-speed chat. The 1 tok/s on an iPhone is not. It works as a proof of concept — you can ask a question, wait, and get a correct answer — but nobody is going to have a flowing conversation at one word per second. The team acknowledges this and is working on kernel optimization since the decode loop is dispatch-bound rather than I/O-bound.

On the quality side, you are running a 4-bit quantized model. Expect some degradation on tasks that require precise numerical reasoning or long chains of logical deduction. For everyday use — summarization, drafting, Q&A, code explanation — the quality holds up well. I’ve been testing the 35B locally for a few days and it handles technical writing about as well as a cloud-hosted 7B model at full precision. The response latency is noticeable on longer generations but not deal-breaking.

Who Should Use This

If you’re building an app that needs on-device LLM inference and your users have M-series Macs or recent iPhones, Swiftlet is the most practical path to shipping an 80B-class model locally. The Apache 2.0 license means you can embed it in commercial products. The OpenAI-compatible server means you can swap it into any tool that talks to the chat-completions API.

If you’re a researcher working on efficient inference, the codebase is worth studying. The expert streaming pattern — fixed-stride packing, single-pread I/O, Metal runtime compilation — is clean and well-documented. The correctness validation suite is unusually thorough for an open-source inference project. Every layer is checked against reference implementations. That level of rigor is rare in inference engines and it shows in the reliability.

Who Should Skip It

If you need production throughput above 20 tok/s, this is not your tool. The current speeds are fine for personal use but not for serving concurrent users. If you need deterministic factual recall from the model’s training data, a dense 80B model at full precision will do better — the 3B active parameters per token is a real limitation for knowledge-intensive tasks. If you don’t have an Apple Silicon Mac with a fast SSD, the streaming pattern falls apart; this is Apple-hardware-only and likely will stay that way since the entire runtime is Metal.

The TurboFieldfare Lineage

Swiftlet didn’t come out of nowhere. It builds directly on TurboFieldfare, an earlier project that proved the expert-streaming thesis for Gemma models on Macs. Swiftlet carries forward the core patterns: stream experts with pread into a bounded slot pool, evict with LFU plus recency, pack at fixed stride for predictable I/O, install by routing downloaded bytes directly into final container positions, and compile shaders at runtime.

Everything else is built from scratch. The Qwen hybrid stack — Gated DeltaNet, gated grouped-query attention, high-sparsity MoE with shared experts — required a complete rewrite of the forward pass. The team added MLX-compatible affine quantization compute in Metal, byte-addressed kernels for containers larger than 4GB, and explicit hazard management so evictions never race with reads. The result is about 10,000 lines of Swift and Metal, supporting an architecture that most inference engines cannot handle.

What This Means for Local AI

Swiftlet is not the first project to run large models locally — llama.cpp has been doing that for years — but it’s the first to do it with an 80B MoE model in under 5GB of RAM on consumer hardware. The approach of keeping only the dense core resident and streaming experts on demand is probably the template for on-device LLM inference going forward, especially as MoE architectures become the default for large models.

The fact that the same code runs on macOS and iOS with zero platform-specific changes is a bigger deal than it looks. Most inference engines have separate code paths for each platform. Swiftlet’s runtime Metal compilation means you write the shader once and it works everywhere. For mobile developers who have been waiting for a credible on-device LLM story, this removes the biggest engineering barrier.

The 1 tok/s on iPhone is not the end state. It’s a lower bound. Dispatch-bound decode loops have clear optimization paths — better work scheduling, fused kernels, reduced synchronization — and the team is actively working on these. Combine that with Apple’s annual silicon improvements, and usable interactive speeds on iPhone are probably 1-2 hardware generations away.

I keep coming back to the 4.3GB number. An 80-billion-parameter model running in less RAM than a handful of Chrome tabs. That changes the calculus for anyone building privacy-sensitive AI features. You don’t need a data center. You don’t need a GPU cluster. You need a MacBook and an open-source Swift project. The rest is optimization. If the team can push decode speeds from 5 tok/s to 10-15 tok/s through kernel work — and they say the dispatch-bound bottleneck has clear headroom — this goes from impressive demo to genuinely useful tool.


Swiftlet is available on GitHub under Apache 2.0. Model weights are under Qwen’s Apache 2.0 license. The Priv AI iOS app is in App Store review; build from source for immediate access.

Disclosure: CarCare Guide is reader-supported. When you buy through links on our site, we may earn an affiliate commission at no extra cost to you. Learn more.
A
Alex Chen