Run Whittle 9B on Apple silicon
The Whittle engine runs Whittle 9B at full speed on Apple silicon, Macs (M1 to M5) and iPhones, with Metal kernels written for ternary weights. This quickstart builds it on a Mac, chats from the command line, and starts its OpenAI-compatible server and chat UI.
What you need
Section titled “What you need”- An Apple-silicon Mac on macOS 15 or later.
- The Xcode command-line tools (
xcode-select --install) and CMake (brew install cmake). whittle-9b-WTG2_0.whittlebinin~/models/whittle/, downloaded and checked against itsSHA256SUMS(see Get the model).
1. Build
Section titled “1. Build”Clone the engine and build its command-line tool, tg_cli, and its server, tg_server. The first build also fetches and builds the image decoders the server links (libjpeg-turbo and libpng); it takes under a minute on a recent Mac.
git clone https://github.com/literal-labs/whittle-engine.gitcd whittle-enginemakeIf the link step fails with unknown architecture arm64e.x1, your SDK is newer than the command-line tools’ linker: update the command-line tools.
2. Chat from the command line
Section titled “2. Chat from the command line”Ask one question on the GPU (--metal) with the model’s chat template (--chat):
./tg_cli ~/models/whittle/whittle-9b-WTG2_0.whittlebin --metal --chat --no-think -p "Explain why the sky is blue." -n 256It prints the answer, then its speed: time to first token, prefill and decode in tokens per second. Without --no-think the model thinks before it answers, using the sampling its model card recommends, and 256 tokens may show only the thinking. --mtp 2 drafts two tokens at a time with the MTP head, and ./tg_cli on its own lists every option.
3. Start the server and chat UI
Section titled “3. Start the server and chat UI”Start the server, which also serves the chat UI:
./tg_server ~/models/whittle/whittle-9b-WTG2_0.whittlebin --port 8080Then open localhost:8080 in a browser on the same Mac. (WHITTLE_MODEL=~/models/whittle/whittle-9b-WTG2_0.whittlebin make demo does both steps, and checks there is memory free for the model first.)
The chat UI’s tools are on by default, and their lookups leave your Mac. The model can search the web, read Wikipedia and pages, use a calculator and, if you turn it on, run Python in a sandbox. With tools on, what you ask can be sent to those sites; the model itself always runs locally. The tools button by the message box turns them all off.
4. Call it from your code
Section titled “4. Call it from your code”Any OpenAI-compatible client works with the base URL http://localhost:8080/v1: chat completions (streamed or not), completions and tool calls. From another terminal, with the server running:
curl -s http://localhost:8080/v1/chat/completions \ -H 'Content-Type: application/json' \ -d '{"model": "whittle-9b", "messages": [{"role": "user", "content": "Say hello in five words."}], "reasoning_effort": "off"}'reasoning_effort sets how much the model thinks (off, low, medium, high or max; medium is the default, and max thinks with no limit), and GET /v1/config lists every default. The server listens only on your Mac unless you give it --host, which then requires --api-key.
Stop the server with Control-C, or pkill -x tg_server if make demo started it.
The engine’s repository covers images (with whittle-9b-vision.whittlebin), the sampling settings, the iPhone bench app, and how to measure speed, memory and energy on your own Mac or iPhone.