Running a large language model on a laptop usually means using general-purpose software that supports many models. Perplexity took the opposite approach. It built Lily, an inference engine designed for just one model on one kind of hardware: Qwen3.6-35B-A3B on Apple silicon. The Perplexity Lily inference engine is open source, and a standalone demo is available on GitHub under the Apache-2.0 license.
Lily exists for a product reason. Perplexity’s hybrid compute on Mac splits tasks between large models in the cloud and a local model that works with private files and apps on the computer. For that split to feel smooth, the local model has to keep up. That means reading prompts quickly and writing answers at a steady pace.
Why Build a Dedicated Engine
The usual way to run models on a Mac is MLX, Apple’s open-source machine learning framework, together with its companion library MLX-LM. It is a solid, general stack, and Perplexity treats it as the baseline to beat.
Qwen3.6-35B-A3B is an awkward model to run efficiently. It has 35 billion parameters but uses only about 3 billion for each token. A router picks 8 of 256 expert sub-networks for every token, plus one shared expert. The model also mixes two kinds of layers: 10 standard attention layers and 30 so-called Gated DeltaNet layers, which compress earlier text into a fixed-size memory. Perplexity’s point is that this uneven workload leaves room for an engine that knows the model’s exact shape.
Lily runs as a single program. A Rust runtime loads the model and manages the generation loop, custom Metal kernels do the math on Apple’s GPU, and a small OpenAI-compatible API accepts requests. Neither PyTorch nor MLX is involved while it runs.
The Speed Results
Perplexity measures two phases separately. Prefill is how fast the engine reads the prompt. Decode is how fast it writes new tokens.
The tests ran on a MacBook Pro with an M5 Max chip, a 40-core GPU and 128 GB of memory, across ten lengths from 256 tokens up to about 128,000. On average, Lily read prompts 1.23 times as fast as MLX-LM and wrote output 1.35 times as fast. It was faster at every length tested. At a 4,000-token prompt, Lily read 5,750 tokens per second and wrote 186.6 per second, against 4,738 and 140.9 for MLX-LM.
Perplexity also checked that speed did not change the answers. Compared on the same text, Lily picked the same most likely next token as MLX-LM at 96.35% of positions, and its perplexity, a standard measure of prediction quality, was only 0.04% higher.
Where the Speed Comes From
The detailed write-up describes many small changes. Three ideas stand out.
Use the right part of the chip for each phase. Reading a prompt processes many tokens at once, which suits the M5’s Neural Accelerators, built for matrix math. Writing output handles one token at a time, and speed there depends mostly on how fast the model’s weights can be read from memory. Lily uses different paths for the two.
Avoid moving data around. The model is stored in compressed 4-bit form, which shrinks it from about 70 GB to 19.4 GB. Lily unpacks small pieces of the weights only at the moment they are used, instead of writing a full unpacked copy to memory. On a 512-token prompt, that change alone sped up prompt reading by 77.4%. Keeping the expert routing on the GPU, instead of pausing for the CPU in every layer, added 89% in the same test.
Adapt to the length of the conversation. For very long contexts, Lily switches to a different way of reading its cache of earlier tokens. At 128,000 tokens, that switch alone made output 40.2% faster.
What Did Not Work
Perplexity also reports its failures, which is useful for anyone working on local AI. Speculative decoding, where a small model guesses tokens for the big model to check, made output 18% slower on the Mac. The checks came in awkward small batches, and the guessed tokens often needed different experts, so more weights had to be read. Perplexity notes that its batched cloud deployment of Qwen on NVIDIA Blackwell hardware does use the technique, under different conditions.
Its measurements also suggest little room is left. The main operations already reach 90 to 98% of the fastest possible memory read speed for their patterns.
Limits of the Demo
The public version is deliberately narrow. It needs an M5-generation chip or newer, macOS 26 or later, and one specific 4-bit version of the Qwen model. Other Qwen checkpoints and quantization formats are rejected. The API accepts only text, always gives the single most likely answer, does not stream output and does not support tools.
Questions for Teams Running Models Locally
- Is a gain of about a quarter to a third worth building and maintaining an engine for a single model?
- Do users have M5-class Macs with enough memory to hold a 19.4 GB model?
- Would a general tool like MLX-LM be easier to keep up to date as new models appear?
Perplexity’s broader argument is that Apple silicon is “not a smaller datacenter GPU” but a platform with its own strengths. Lily is a proof of that idea for one model, and Perplexity says future work will widen it to more models and chips.