Artificial Ignorance

How to Run Qwen4-35B-A3B on a Mac: Which Mac, Which File, Which App

Yes, Qwen4-35B-A3B runs well on an Apple Silicon Mac with 24GB of memory or more, and it can be squeezed onto 16GB. Use Unsloth’s 4-bit file (UD-Q4_K_XL, 24.7GB in memory) on 32GB and 36GB Macs, the 3-bit UD-Q3_K_XL on 24GB, and 2-bit files on 16GB and 18GB. The easiest route is brew install llama.cpp and one llama-server command. Two things make it fit: llama.cpp keeps Qwen4’s 11.5GB n-gram table on the SSD, and one Terminal command, sudo sysctl iogpu.wired_limit_mb=..., lets the GPU use more of your memory. Ollama’s default download is 36 to 37GB, so with Ollama plan on 48GB.

Below: which file fits each Mac from 16GB to 128GB, how to check and raise the GPU limit safely, step-by-step setup with llama.cpp, Unsloth Desktop, LM Studio, Ollama and MLX, GGUF vs MLX, the speed to expect on each chip, MTP, context sizes, thinking settings, images, disk space, heat and fixes for common errors.

How to run Qwen4-35B-A3B on a MacA MacBook running llama-server with Qwen4, memory sizes from 16GB to 64GB and more, and a bar showing one pool of unified memory shared by macOS, the model weights and the context cache, with the n-gram table read from the SSD.LOCAL AI GUIDEQwen4 35Bon a Mac.llama.cpp, MLX, Ollama, LM Studio16GB24GB32GB64GB+Which Mac, which file, which app,and the one setting that makes it fit.$ brew install llama.cpp$ llama-server -hf \unsloth/Qwen4-35B-A3B-GGUFMetal: using unified memoryserver listening on :8080one pool of unified memorymacOSQwen4 weightscache+ 20B n-gram table read from the SSDartificialignorance.net
01

Can your Mac run it? The short answer

Qwen4-35B-A3B is a mixture-of-experts model: 35 billion parameters in total, but only about 3 billion of them work on each token (Hugging Face counts 3.8 billion). That is why it is fast on a Mac. The catch is memory. All 35 billion parameters must sit in memory, because each token picks a different handful of experts. On a Mac that memory is the unified memory you chose when you bought it, and you cannot add more later.

Here is the whole guide in one table. The file names are Unsloth’s, and every size assumes the 20-billion-parameter n-gram table stays on your SSD (section 2 explains this).

Your Mac’s memoryDoes it run?What I would useContext I would start with
8GBNoA smaller model; see my 8GB laptop guide—
16GBOnly justUD-IQ2_XXS (11.9GB) with a raised GPU limit8K tokens
18GBYes, tightUD-IQ2_S (14.0GB) with a raised GPU limit16K
24GBYesUD-Q3_K_XL (19.4GB) with a raised GPU limit16K to 32K
32GBYes, wellUD-Q4_K_XL (24.7GB) with a raised GPU limit64K
36GBYes, wellUD-Q4_K_XL (24.7GB), no changes needed128K
48GBYes, very wellUD-Q6_K (29.2GB), or a 4-bit MLX file256K
64GB and moreYes, with room to spare8-bit (about 41GB), MLX or Ollama’s defaultUp to the full 1M

Two things in that table surprise most people. First, a 32GB Mac needs one Terminal command before the 4-bit file fits, because macOS does not let the graphics side of the chip use all of your memory. Second, the app you pick changes the minimum. Ollama’s default Qwen4 download is 36 to 37GB, so it wants a 48GB Mac, while llama.cpp and Unsloth Desktop can keep part of the model on the SSD and run it on 24GB.

Which Qwen4 file to start with for each amount of Mac memory8GB: not enough. 16GB: UD-IQ2_XXS, 11.9GB, experimental. 18GB: UD-IQ2_S, 14.0GB. 24GB: UD-Q3_K_XL, 19.4GB. 32GB: UD-Q4_K_XL, 24.7GB, with a raised limit. 36GB: UD-Q4_K_XL as is. 48GB: UD-Q6_K, 29.2GB, or MLX 4-bit. 64GB and more: 8-bit, about 41GB, or MLX and Ollama, with up to 1M tokens of context.MY STARTING FILE FOR EACH MACresident weights with the n-gram table on SSD8GBNot enough: even the 1-bit file needs about 11GB16GBUD-IQ2_XXS11.9GBExperimental: raise the limit, 8K context18GBUD-IQ2_S14.0GBRaise the limit, 16K context24GBUD-Q3_K_XL19.4GBRaise the limit, 16K–32K context32GBUD-Q4_K_XL24.7GBRaise the limit, 64K context36GBUD-Q4_K_XL24.7GBFits as is, 128K context48GBUD-Q6_K29.2GBOr MLX 4-bit, 256K context64GB+8-bit41GBOr MLX/Ollama, up to 1M contextSizes from Unsloth’s table (8-bit: its 41GB estimate). The picks and contexts are my own starting points.
My starting file for each amount of memory. The bars are the memory the weights need once the n-gram table is left on the SSD.
02

Why a Mac is different from a PC with a graphics card

If you read my guide for 8GB to 16GB graphics cards, forget most of its tuning. On a PC the model is split between a small, fast graphics card and slower system RAM, and the art is deciding which part goes where. A Mac with Apple Silicon has one pool of unified memory that the CPU and the GPU share. There is nothing to split, which makes a Mac much simpler, but three things work differently.

  • The GPU only gets part of the pool. macOS reserves memory for itself and, by default, lets the GPU use only part of the total. The share most often reported is about two-thirds on Macs with 32GB or less and about three-quarters above that. Section 4 shows how to see your own figure and how to raise it.
  • Speed comes from memory bandwidth. To write each token, the chip reads the active weights from memory. A Max chip reads memory four to five times faster than a base chip, so the same file writes four to five times faster. The number of CPU cores hardly matters.
  • The n-gram table can stay on the SSD. Qwen4 adds a 20-billion-parameter lookup table that Unsloth calls the engram. Each token reads only a few rows of it, so llama.cpp can leave the whole table on disk and read rows on demand. macOS keeps recently read rows in free memory, and gives that memory back when an app needs it. Apple’s fast internal SSDs are good at this.

That last point is why the Unsloth download is bigger than the memory you need. The 4-bit UD-Q4_K_XL download is 36.2GB, but only 24.7GB has to be in memory; the other 11.5GB is the n-gram table. Apps that do not support this trick load everything, which is why Ollama’s and the standard MLX files need 32 to 37GB.

How a 32GB Mac shares its memory when running Qwen4 at 4-bitA bar for 32GB of unified memory: about 5GB for macOS and apps, 24.7GB of UD-Q4_K_XL weights, about 0.7GB of context cache for 64K tokens and about 1GB of buffers. A dashed line at about 21GB marks the default GPU limit, which is too low; a second line at 27GB shows the limit after raising it with sysctl. The 11.5GB n-gram table stays on the SSD.A 32GB MAC RUNNING THE 4-BIT FILEEverything shares one pool. The GPU may only use part of it.macOS + appsUD-Q4_K_XL weights 24.7GB64K cache + buffers ↓default GPU limit: about 21GBafter sudo sysctl iogpu.wired_limit_mb=27648On the SSD, not in this bar: the 11.5GB n-gram tablellama.cpp reads only the rows each token needs; macOS caches hot rows in free memory.Sizes from Unsloth. The default limit and the cache size are my estimates; check yours as shown in section 4.
A 32GB Mac with the 4-bit file. The default GPU limit (orange) is below what the model needs; one command raises it (green).
03

Which file to download for your memory

Unsloth publishes Qwen4 GGUF files from 1-bit to 8-bit. Fewer bits means a smaller file and slightly lower quality. Unsloth’s own tests put UD-Q4_K_XL at 95.0% on a set of maths, reasoning and knowledge tests, against 95.3% for the full model, with UD-IQ4_XS at 95.2% and UD-Q3_K_XL at 94.0%. Below 3-bit the quality drops faster, and the smallest files can get stuck repeating themselves.

FileDownloadIn memory (n-gram on SSD)Good for
UD-IQ1_M22.3GB10.8GBLast resort on 16GB
UD-IQ2_XXS23.4GB11.9GB16GB Macs
UD-IQ2_S25.5GB14.0GB18GB Macs
UD-IQ2_M26.6GB15.1GB18GB, if you close everything else
UD-IQ3_XXS28.7GB17.2GB24GB with longer context; 32GB without changing the GPU limit
UD-Q3_K_XL30.9GB19.4GB24GB Macs
UD-IQ4_XS32.0GB20.5GB24GB with nothing else open
UD-Q4_K_XL36.2GB24.7GB32GB and 36GB: the sweet spot
UD-Q5_K_XL43.2GB27.8GB36GB to 48GB
UD-Q6_K50.9GB29.2GB48GB
8-bit—about 41GB64GB and more

My picks are a little more careful than Unsloth’s own advice, and here is why. Unsloth suggests UD-IQ4_XS for 24GB devices and UD-IQ3_XXS for 18GB of total memory. Those figures are written for any machine, including PCs where a graphics card’s memory and system RAM add up. On a Mac, macOS, your browser and the model all share that one pool. A 17.2GB file on an 18GB Mac leaves under 1GB for everything else, which ends in heavy swapping. So I go one step down, and you can step up once you see how much room you really have.

Unsloth also recommends UD-Q4_K_XL for “32GB and Macs”. That is right for 32GB and up, but on a 32GB Mac it only fits after you raise the GPU limit in the next section. If you would rather not touch that setting, UD-IQ3_XXS (17.2GB) fits a 32GB Mac as it comes.

04

The one setting that makes it fit: the GPU memory limit

macOS decides how much unified memory the GPU may lock for its own use. Apple calls the figure the recommended maximum working set, and llama.cpp prints it when it starts. Look for a line like this near the top of the output (the number is different on every Mac):

recommendedMaxWorkingSetSize  = 21845.34 MB

That example is what a 32GB Mac often shows: about 21GB, not enough for the 24.7GB file plus its cache. If the model and cache are bigger than this figure, you get an out-of-memory error, a very slow model, or both.

On macOS Sonoma and later you can raise the limit with one command. The number is in megabytes:

sudo sysctl iogpu.wired_limit_mb=27648

Type your Mac password when asked. To see the current setting, run sysctl iogpu.wired_limit_mb; 0 means macOS is using its default. The change lasts until you restart, so a mistake is never permanent. To go back without restarting:

sudo sysctl iogpu.wired_limit_mb=0

How high is safe? Leave macOS at least 3GB on small Macs and 5 to 8GB on bigger ones, more if you keep a browser with many tabs open. These are the values I would use:

Mac memoryDefault GPU share (about)Value I would setLeaves for macOS
16GB10.7GB133123GB
18GB12GB153603GB
24GB16GB215043GB
32GB21.3GB276485GB
36GB27GBNot needed for 4-bit; 30720 for 5-bit5GB
48GB36GBNot needed; 40960 for 4-bit MLX7GB
64GB48GBNot needed—
128GB96GB118784 only for very long contexts12GB

The default shares in that table are typical values, not a promise; read the recommendedMaxWorkingSetSize line on your own Mac. Some people make the setting permanent by adding iogpu.wired_limit_mb=27648 to /etc/sysctl.conf. I prefer typing it after each restart, because if you ever set it too high, a restart fixes it.

If the Mac becomes sluggish, shows the spinning wheel, or Activity Monitor’s Memory Pressure turns red, the limit is too high for what else you have open. Lower it, close apps, or use a smaller file. Nothing is damaged; macOS is just short of memory.

05

Five ways to run it, and which to choose

Every app below runs Qwen4 on the Mac’s GPU through Apple’s Metal. They differ in how easy they are, which files they can use and, most importantly for small Macs, whether they can keep the n-gram table on the SSD.

Five ways to run Qwen4 on a Mac comparedllama.cpp: terminal and browser chat, all Unsloth GGUF files, images, MTP and the n-gram table on SSD. Unsloth Desktop: an app with GGUF and MLX, automatic n-gram placement. LM Studio: an app with one 21.5GB GGUF that needs 22GB or more. Ollama: a 36 to 37GB default download, so 48GB Macs and up. MLX through mlx-lm or oMLX: 4-bit files of 32 to 35GB, and oMLX can keep the n-gram table on SSD.FIVE WAYS TO RUN QWEN4 ON A MACHow you use itQwen4 filesImagesMTPn-gram on SSDllama.cppFull control, fastest in Unsloth’s testsTerminal + browser chatAll Unsloth GGUFsYesYesYesUnsloth DesktopEasiest way to get the n-gram table on SSDAppGGUF and MLXYesYesAutomaticLM StudioFriendly app, needs 22GB or moreAppOne GGUF (21.5GB)YesCheckCheckOllamaSimple, but the big download needs 48GB+App + terminal36–37GB defaultYesCheckNot confirmedMLXmlx-lm or oMLX, Apple’s own frameworkPython / oMLX app4-bit: 32–35GBoMLX: yesoMLX: yesoMLX: yes“Check” = not stated on the app’s Qwen4 page when I wrote this. Sizes are the download sizes listed by each source.
The five options. On 24GB and 32GB Macs, the n-gram column decides it.
If you…Use
have 16 to 32GB and want the most controlllama.cpp (section 6)
want an app and have 24GB or moreUnsloth Desktop (section 7)
already use LM Studio and have 24GB or moreLM Studio (section 8)
already use Ollama and have 48GB or moreOllama (section 9)
want Apple’s MLX framework, or write Pythonmlx-lm or oMLX (section 10)

If you are not sure, start with llama.cpp. It has Qwen4 support from the people who wrote it, it supports every Unsloth file and the built-in speed-up called MTP, and Unsloth’s own Mac speed test used it. It also gives you a chat page in your browser, so you do not have to live in the Terminal.

06

Way 1: llama.cpp with Homebrew

Qwen4 support arrived in llama.cpp with pull request 33626, merged on 3 December 2026. The Homebrew package at version 1.1.1 already includes it, and Homebrew has ready-made builds for Apple Silicon on macOS Sequoia and newer. If you do not have Homebrew, install it from brew.sh first. Then:

brew install llama.cpp

If you installed llama.cpp before, run brew upgrade llama.cpp instead; an older copy fails with an “unknown model architecture” error. Metal is on by default in the Mac build, so there is nothing else to set.

Start the model

This is the command for a 32GB Mac. Run the sysctl line first (once after each restart), then start the server. The first run downloads about 36GB, so give it time:

sudo sysctl iogpu.wired_limit_mb=27648

llama-server -hf unsloth/Qwen4-35B-A3B-GGUF:UD-Q4_K_XL \
  --load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU \
  --no-mmproj -c 65536 -np 1 -fa on -ctk q8_0 -ctv q8_0 \
  --temp 1.0 --top-p 0.95 --top-k 20 --min-p 0.0 \
  --port 8080

When you see that the server is listening, open http://127.0.0.1:8080 in Safari or Chrome and chat. What each part does:

PartWhat it does
-hf unsloth/...:UD-Q4_K_XLDownloads that file from Hugging Face the first time, then reuses it.
--load-mode mmap --lazy-mode onMaps the file instead of copying it, and reads parts only when needed. This is what keeps the n-gram table on the SSD.
-ot per_layer_token_embd=CPUPuts the n-gram table on the CPU side, so it is read from disk instead of being locked into GPU memory. Unsloth’s command.
--no-mmprojSkips the vision part to save memory. Leave it out if you want to send images (section 16).
-c 65536Context length in tokens. Always set it: without it, llama.cpp may try to take the model’s full 1M.
-np 1One conversation at a time, so the whole context is yours.
-fa on -ctk q8_0 -ctv q8_0Flash attention and an 8-bit context cache, which halves the cache with little quality loss.
--temp ... --min-p 0.0Qwen’s recommended settings for thinking mode (section 15).

Commands for other Macs

Only the file, the context and the limit change. These are my starting points; raise the context later if the Mac stays responsive.

16GB (experimental: expect the Mac to feel slow while it runs; use non-thinking settings to save context):

sudo sysctl iogpu.wired_limit_mb=13312

llama-server -hf unsloth/Qwen4-35B-A3B-GGUF:UD-IQ2_XXS \
  --load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU \
  --no-mmproj -c 8192 -np 1 -fa on -ctk q8_0 -ctv q8_0 \
  --reasoning off --temp 0.7 --top-p 0.8 --top-k 20 \
  --min-p 0.01 --presence-penalty 1.5 --port 8080

18GB: the same, with iogpu.wired_limit_mb=15360, the file UD-IQ2_S and -c 16384.

24GB:

sudo sysctl iogpu.wired_limit_mb=21504

llama-server -hf unsloth/Qwen4-35B-A3B-GGUF:UD-Q3_K_XL \
  --load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU \
  --no-mmproj -c 16384 -np 1 -fa on -ctk q8_0 -ctv q8_0 \
  --temp 1.0 --top-p 0.95 --top-k 20 --min-p 0.0 --port 8080

36GB: the 32GB command without the sysctl line, with -c 131072. 48GB: UD-Q6_K with -c 262144. 64GB and more: an 8-bit file with any context you like, up to -c 1048576.

Prefer to download the files yourself, for example to an external drive? Install the Hugging Face command-line tool (pip install -U huggingface_hub gives you hf) and run:

hf download unsloth/Qwen4-35B-A3B-GGUF \
  --include "UD-Q4_K_XL/*" "mmproj-BF16.gguf" \
  --local-dir ~/models/qwen4

Then replace -hf ... with -m and the path to the first file in that folder, and add --mmproj ~/models/qwen4/mmproj-BF16.gguf if you want images.

07

Way 2: Unsloth Desktop

Unsloth, the team that made the GGUF files, also has a free desktop app for macOS, Windows and Linux. Its main advantage on a Mac is that it decides where to keep the n-gram table for you and sets Qwen’s sampling settings automatically, including the extra ones the smallest files need. It can run both GGUF and MLX files.

  1. Install. Download it from Unsloth’s site, or with Homebrew: brew install --cask unsloth.
  2. Find the model. Open the Model hub, search for unsloth/Qwen4-35B-A3B-GGUF and download the file for your memory from section 3.
  3. Chat. Select the file in Chat. Unsloth chooses where the n-gram table goes and turns on MTP with its recommended depth.
  4. Serve it to other apps (optional). unsloth run --model unsloth/Qwen4-35B-A3B-GGUF:UD-Q4_K_XL starts an API server from the Terminal.

Unsloth says its app lets the 4-bit MLX file run on a Mac with 24GB, because it moves the n-gram table to the SSD for MLX too. I have not been able to check that claim on a 24GB Mac, so treat it as Unsloth’s figure. The GPU limit from section 4 still applies to any app: if the model does not fit under it, raise it the same way.

08

Way 3: LM Studio

LM Studio lists Qwen4 as qwen/qwen4-35b-a3b, a 21.50GB GGUF download, and says you need at least 22GB of memory for it. Search for Qwen4 in the Discover tab, download it and load it. Update LM Studio first, and update its llama.cpp engine from the runtime settings if the model refuses to load; Qwen4 needs a llama.cpp build from December 2026 or later.

Before loading, open the load settings and check these:

  • Context length: set it yourself. 16K on a 24GB Mac, 64K on 32GB.
  • Flash attention: on.
  • K and V cache quantisation: Q8_0, to halve the cache.
  • GPU offload: all layers. On a Mac this just means the GPU does the work.

LM Studio’s page does not say whether its file keeps the n-gram table on the SSD, so I give no promise for 24GB. On a 24GB Mac, raise the GPU limit to 21504 first and keep the context short; on 32GB it is comfortable. If LM Studio refuses to load a model it thinks is too big, its model-loading guardrail setting decides that. Relax it only after you have raised the GPU limit, never instead.

LM Studio also has MLX models. Search for Qwen4 with the MLX filter if you want one; the MLX sizes in section 10 apply.

09

Way 4: Ollama

Ollama added Qwen4 in version 0.40.21. Update the app first, then:

ollama run qwen4

The default tag downloads 36 to 37GB, and the tag list also has qwen4:35b-a3b-q4_K_M (37GB), qwen4:35b-a3b-nvfp4 (36GB, an MLX build) and 114GB full-precision versions. Since version 0.40 Ollama uses Apple’s MLX on Macs for models it supports, which is why two of the tags are labelled MLX.

I could not confirm that Ollama keeps Qwen4’s n-gram table on the SSD. Plan as if the whole 36 to 37GB has to be in memory: a 48GB Mac with the GPU limit at 40960, or 64GB as it comes. On a 32GB Mac use llama.cpp, Unsloth Desktop or LM Studio instead; otherwise Ollama will either refuse to load the model or run it very slowly.

Ollama picks the context length from the memory the GPU can use. To choose it yourself, use the context slider in the app’s settings, or type /set parameter num_ctx 65536 in a chat. For an 8-bit cache, set the environment variable before starting the app; on a Mac that is done with launchctl, as Ollama’s FAQ explains:

launchctl setenv OLLAMA_KV_CACHE_TYPE q8_0
launchctl setenv OLLAMA_CONTEXT_LENGTH 65536

Quit Ollama from the menu bar and open it again for the change to take effect. My Ollama vs llama.cpp memory comparison explains every Ollama setting that changes memory.

10

Way 5: MLX, Apple’s own framework

MLX is Apple’s machine-learning framework for Apple Silicon, and mlx-lm is its tool for running language models. There are three ready-made 4-bit MLX versions of Qwen4, and they are not the same:

FileSizeImagesMTPNeeds
unsloth/Qwen4-35B-A3B-MLX-4bit34.0GB (peak 35–36GB)NoNomlx-lm plus Unsloth’s patch file
mlx-community/Qwen4-35B-A3B-4bit32.2GB (peak about 33GB)YesNomlx-lm from pull request 2141
mlx-community/Qwen4-35B-A3B-oQ4e-mtp35.2GB, or 22.4GB with the n-gram table on SSDYesYesThe oMLX app, Trust Remote Code on

Unsloth’s file is the most accurate of the plain 4-bit ones: Unsloth measured 87% lower error (mean KL divergence 0.0432 against 0.3356) than a standard mlx_lm.convert -q 4-bit conversion, on a par with its 4-bit GGUFs. The mlx-community and oMLX files are separate conversions that I have not compared.

Unsloth’s MLX file with mlx-lm

Make a Python environment, install mlx-lm, and put Unsloth’s mlx_qwen4_moe.py (in Unsloth’s GitHub repository under studio/backend/core/inference/) next to your script:

python3 -m venv ~/qwen4-mlx
source ~/qwen4-mlx/bin/activate
pip install -U mlx-lm
from mlx_qwen4_moe import patch_qwen4_moe
patch_qwen4_moe()
from mlx_lm import load, generate
from mlx_lm.sample_utils import make_sampler

model, tokenizer = load("unsloth/Qwen4-35B-A3B-MLX-4bit")
messages = [{"role": "user", "content": "Explain unified memory in two sentences."}]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, enable_thinking=True)
sampler = make_sampler(temp=1.0, top_p=0.95, top_k=20, min_p=0.0)
print(generate(model, tokenizer, prompt=prompt, max_tokens=4096, sampler=sampler, verbose=True))

The mlx-community file

Its model card says it needs mlx-lm from pull request 2141 until that is part of a release:

pip install -U git+https://github.com/ml-explore/mlx-lm.git@refs/pull/2141/head
mlx_lm.generate --model mlx-community/Qwen4-35B-A3B-4bit --prompt "hello"

For a server that other apps can use, run mlx_lm.server --model mlx-community/Qwen4-35B-A3B-4bit; it answers OpenAI-style requests on port 8080. A text-only version, mlx-community/Qwen4-35B-A3B-4bit-text, skips the vision part.

oMLX, if you have 32GB

oMLX is a Mac app and server built on MLX. Its oQ4e file includes the vision encoder and the MTP head, and with the app’s SSD N-gram Offload setting on, it needs 22.4GB instead of 35.2GB. That makes it the MLX option for a 32GB Mac (raise the GPU limit to 27648 as for llama.cpp). There are also oQ3e, oQ6e and oQ8e versions for smaller and larger Macs.

The plain 4-bit MLX files load the n-gram table into memory, so they peak at 33 to 36GB. On a 48GB Mac raise the GPU limit to 40960 first; 64GB runs them as they come.

11

GGUF or MLX: which is better on a Mac?

MLX is Apple’s own framework, so many people assume it must be faster. For Qwen4 right now, the only Mac numbers I could find point the other way, though the two tests were not run in the same way:

On a MacBook Pro M5 Max (128GB)Writing speedNotes
llama.cpp, UD-Q4_K_XL GGUF91.2 tokens/sThinking off, greedy, no MTP
llama.cpp, same file, MTP depth 1118.5 (code) / 111.1 (prose)Built-in speed-up, no extra file
mlx-lm, Unsloth MLX 4-bit75 tokens/s at a 512-token prompt, 69 at 4,096128 tokens written; MLX 0.32.5

All three rows are Unsloth’s measurements from its Qwen4 guide. Where MLX was very strong is reading the prompt: 2,711 tokens per second for a 512-token prompt and 3,977 for 4,096 tokens. That matters when you paste in long documents or code.

GGUF (llama.cpp, Unsloth, LM Studio)MLX (mlx-lm, oMLX, Ollama’s MLX tags)
Smallest Mac16GB (1-bit or 2-bit files)32GB with oMLX’s SSD offload; 48GB otherwise
File choice1-bit to 8-bitMostly 4-bit, plus oMLX’s 3, 6 and 8-bit
n-gram table on SSDYesOnly oMLX and Unsloth Desktop
MTP speed-upYes, every fileOnly the oMLX files
ImagesYes, with the mmproj fileDepends on the file
Best atWriting speed, small MacsReading long prompts

My advice: use GGUF unless you have a reason to prefer MLX, such as an app or Python project that already uses it. If you have 48GB or more and both are installed, try the same prompt in each and keep whichever feels faster on your Mac.

12

What speed to expect on your Mac

Only one Mac has published Qwen4 figures so far: Unsloth’s M5 Max, at 91 tokens per second with the 4-bit GGUF. Writing speed on a Mac is limited mostly by how fast the chip reads memory, so I scaled that one figure by each chip’s memory bandwidth to get a rough ceiling for other Macs. Apple gives 614GB/s for the M5 Max and 307GB/s for the M5 Pro; the other figures are Apple’s published bandwidths for those chips.

Rough writing speed of Qwen4 at 4-bit on Apple Silicon chipsUnsloth measured 91 tokens per second on an M5 Max with 614GB/s. Scaling by memory bandwidth, my rough ceilings are: M1 about 10; M2 / M3 about 15; M4 about 20; M3 Pro about 20; M5 about 25; M1 / M2 Pro about 30; M4 Pro about 40; M5 Pro about 45; M1 / M2 Max about 60; M4 Max about 80 tokens per second.ROUGH CEILING FOR WRITING SPEED (MY ESTIMATE)4-bit GGUF, thinking off, no MTP. Scaled by memory bandwidth from one measured point.M168 GB/sabout 10 tok/sM2 / M3100 GB/sabout 15 tok/sM4120 GB/sabout 20 tok/sM3 Pro150 GB/sabout 20 tok/sM5153 GB/sabout 25 tok/sM1 / M2 Pro200 GB/sabout 30 tok/sM4 Pro273 GB/sabout 40 tok/sM5 Pro307 GB/sabout 45 tok/sM1 / M2 Max400 GB/sabout 60 tok/sM4 Max546 GB/sabout 80 tok/sM5 Max614 GB/s91 tok/s, measuredOnly the M5 Max figure is measured. The rest are my rough ceilings; older and smaller GPUs often land 20–30% lower.
My rough ceilings, scaled by memory bandwidth from Unsloth’s one measured Mac. Treat everything except the M5 Max as an estimate.

How to read it:

  • About 10 tokens per second is slow reading pace. Usable for short questions, tiring for long answers. Turn thinking off.
  • 20 to 30 is faster than you read. Fine for chat and most coding help.
  • 40 and up feels instant for chat and is good for coding agents that write a lot.
  • Smaller files are a bit faster, because there is less to read per token. A 2-bit file on a 16GB M4 may beat the bar for its chip.
  • Older and smaller GPUs often land 20 to 30% below these ceilings, because they run out of GPU power before they run out of bandwidth.
  • Reading a long prompt depends on GPU power rather than bandwidth. A base chip has a quarter or less of a Max chip’s GPU cores, so a 10,000-token document can take tens of seconds before the answer starts.

If you measure your own Mac, llama-server prints the prompt and writing speed after every answer, and the browser chat page shows them too.

13

MTP: the free speed-up in every file

Every Unsloth Qwen4 GGUF includes a small multi-token prediction (MTP) head that guesses the next tokens ahead; the main model then checks them all at once. There is no extra file to download. On the M5 Max, Unsloth measured 1.30 times the speed for code and 1.22 times for prose with one token of lookahead, and recommends two tokens: on the Mac that gave 1.40 times for code. Add this to any llama.cpp command:

--spec-type draft-mtp --spec-draft-n-max 2

Depth 3 and 4 were slower than 2 in Unsloth’s tests, so stop there. MTP helps most with code and other predictable text, and least with creative writing. Unsloth Desktop turns it on by itself. On 16GB and 18GB Macs try it last, once the model runs: it needs a little extra memory for its own working buffers. My llama.cpp MTP guide explains how it works and how to tune it.

14

How much context your Mac can afford

Qwen4 can read 1,048,576 tokens at once, about 750,000 words. It does that cheaply, because only 10 of its 40 layers keep a growing cache. From the model’s configuration I calculate about 20KB per token with a 16-bit cache, and half that with the 8-bit cache the commands above use.

How much memory Qwen4's context cache needs at each lengthMy calculation from the model configuration: 32K tokens need about 0.67GB at 16-bit or 0.34GB at 8-bit; 64K 1.34 or 0.67GB; 128K 2.7 or 1.34GB; 256K 5.4 or 2.7GB; 512K 10.7 or 5.4GB; and the full 1M tokens 21.4 or 10.7GB.CONTEXT CACHE SIZE FOR QWEN4 (MY CALCULATION)16-bit cache8-bit cache (-ctk q8_0 -ctv q8_0)32K0.67GB0.34GB64K1.34GB0.67GB128K2.7GB1.34GB256K5.4GB2.7GB512K10.7GB5.4GB1M21.4GB10.7GBAbout 20KB per token at 16-bit: only 10 of Qwen4’s 40 layers keep a growing cache. Add it to the weights.
Cache size at each context length. Add this to the size of the weights from section 3.
Mac memory (4-bit or smaller file)Context I would start withRealistic maximum
16GB8K16K
18GB16K32K
24GB16K to 32K64K with UD-IQ3_XXS
32GB64K128K
36GB128K256K
48GB256K512K
64GB and more512KThe full 1M (10.7GB of cache at 8-bit)

Bigger is not always better. A long context makes every answer slower to start, and the model’s attention spreads thinner. For chat and most coding, 32K to 64K is plenty. My guide to the memory cost of 1M-token contexts goes deeper, and this one explains how coding tools compact a long conversation before it overflows.

15

Thinking levels and the right settings

Qwen4 thinks before it answers by default. Thinking makes it better at code, maths and multi-step tasks, but it writes many hidden tokens first, and on a slower Mac that is the difference between a 5-second and a 60-second answer. Qwen supports four effort levels: xhigh, high (the default), low and off. In llama-server, pass --reasoning-effort low, or --reasoning off to switch it off.

Qwen recommends different sampling settings for the two modes:

SettingThinking (default)Thinking off
temperature1.00.7
top_p0.950.80
top_k2020
min_p0.00.0
presence_penalty0.01.5

The non-thinking line for llama.cpp is:

--reasoning off --temp 0.7 --top-p 0.8 --top-k 20 --min-p 0.0 --presence-penalty 1.5

With the smallest files (UD-IQ1_S, UD-IQ1_M and UD-IQ2_XXS), Unsloth found the model sometimes loops, and recommends --min-p 0.01 and --presence-penalty 1.5 in both modes. My 16GB command already does that. On 16GB to 24GB Macs I would keep thinking off or low for everyday questions and switch it on for hard problems.

16

Showing it pictures

Qwen4 understands images and screenshots. In llama.cpp the vision part is a separate projector file (mmproj-BF16.gguf, with F16 and F32 versions too). The -hf option downloads and loads it automatically; my commands add --no-mmproj to save memory. Remove that flag and you can attach images in the browser chat page.

The projector adds roughly another gigabyte of memory (my estimate), so on a 32GB Mac raise the GPU limit by 1024 or shorten the context a little. Among the MLX files, Unsloth’s 4-bit is text only, while the mlx-community and oMLX files include vision; Ollama’s tags all list image input.

17

Disk space, external drives and SSD wear

Check your free space before you start. The download is bigger than the memory the model uses:

What you downloadDisk space
UD-IQ2_XXS GGUF (16GB Macs)23.4GB
UD-Q3_K_XL GGUF (24GB)30.9GB
UD-Q4_K_XL GGUF (32GB and 36GB)36.2GB
UD-Q6_K GGUF (48GB)50.9GB
MLX 4-bit (Unsloth / mlx-community / oMLX)34.0 / 32.2 / 35.2GB
Ollama default tag36 to 37GB
LM Studio’s Qwen421.5GB

Leave another 15 to 20GB free on the internal drive for macOS, which uses free space for swap. A full disk makes a memory-tight Mac much worse.

  • External SSD: fine for storing models. Set the LLAMA_CACHE environment variable, or use hf download --local-dir. The n-gram table is read during generation, so a slow USB drive can cost some speed; a Thunderbolt or USB4 SSD is close to internal speed.
  • SSD wear: reading does not wear an SSD; writing does. Reading the n-gram table costs nothing. What does write a lot is heavy swapping, another reason not to set the GPU limit so high that macOS runs short.
  • Deleting models: llama.cpp keeps downloads in its cache folder, Ollama with ollama rm qwen4, LM Studio in its My Models tab.
18

MacBook Air, heat and battery

Running a 35B model works the GPU as hard as a game. On a Mac with a fan (MacBook Pro, Mac mini, Mac Studio) you will hear it on long answers, and speed stays steady. A MacBook Air has no fan: it runs at full speed for a while, then slows down to stay cool. For short chats you will not notice; for a coding agent that writes for many minutes, you will.

  • Plug in. On battery, Low Power Mode and some energy settings lower GPU speed, and long generation drains the battery fast.
  • Keep the laptop on a hard surface, not a bed or a lap, so it can shed heat.
  • Close games, video editors and other GPU-heavy apps while the model runs.
  • If you plan to run Qwen4 all day, a Mac mini or Mac Studio with the same chip is quieter and does not slow down.
19

Using it from other apps and coding tools

Every option here can act as a local server that speaks the same API as OpenAI, so chat apps, editor plug-ins and coding agents can use Qwen4 instead of a cloud model. Point them at:

RunningAddressModel name
llama-serverhttp://127.0.0.1:8080/v1any name
mlx_lm.serverhttp://127.0.0.1:8080/v1the model’s Hugging Face name
LM Studio serverhttp://localhost:1234/v1qwen/qwen4-35b-a3b
Ollamahttp://localhost:11434/v1qwen4

Ollama also has a shortcut that sets up a coding tool for you, for example ollama launch opencode --model qwen4 or ollama launch claude --model qwen4. Coding agents send long prompts, so give the model at least 64K of context, which on a Mac means 32GB or more. On smaller Macs, a chat app is the better fit.

20

If something goes wrong

What you seeCauseFix
“unknown model architecture”llama.cpp, LM Studio’s engine or Ollama is older than Qwen4brew upgrade llama.cpp, update the app or its runtime
“Model type qwen4_moe not supported”mlx-lm without Qwen4 supportUse Unsloth’s patch file or mlx-lm from pull request 2141 (section 10)
An “Insufficient Memory” or out-of-memory error from MetalModel and cache are bigger than the GPU limitRaise the limit (section 4), shorten -c or use a smaller file
Ollama says the model requires more system memoryThe 36–37GB download does not fitUse llama.cpp or Unsloth Desktop, or a Mac with 48GB+
The whole Mac freezes or beach-ballsGPU limit set too high; macOS is out of memoryLower the limit or run sudo sysctl iogpu.wired_limit_mb=0; restart if needed
The first answer is very slow, later ones fasterThe n-gram table is being read from the SSD and cachedNormal. It speeds up as macOS caches the rows
Speed drops after a few minutesHeat (MacBook Air) or swappingPlug in, cool it, check Swap Used in Activity Monitor
Repeats itself or loopsVery small file, or thinking settings in non-thinking useUse --min-p 0.01 --presence-penalty 1.5 or a bigger file
Thinks for minutesDefault high effort on a slow Mac--reasoning-effort low or --reasoning off
Cannot attach imagesStarted with --no-mmproj, or a text-only MLX fileRemove the flag; use a file with vision

The best single tool is Activity Monitor’s Memory tab. Green memory pressure means all is well. Yellow means macOS is compressing memory, which is fine for a while. Red, or Swap Used climbing by gigabytes, means the setup is too big for your Mac.

21

Common questions

Can I run Qwen4-35B-A3B on an 8GB Mac?

No. Even the 1-bit file needs about 11GB of memory. On 8GB, use a model of 4 to 8 billion parameters; my 8GB laptop guide lists good ones.

Is 16GB really enough?

It starts and answers, with a 2-bit file and a short context, but the Mac has almost no room for anything else and quality is lower. Treat it as a way to try Qwen4, not a daily setup.

Does it work on Intel Macs?

Not usefully. This guide is for Apple Silicon (M1 and later). An Intel Mac would run it on the CPU alone, far too slowly for a model this size.

Is raising the GPU memory limit safe?

Yes. It changes nothing permanent and resets when you restart. The only risk is setting it so high that macOS runs short and the Mac freezes, which a restart fixes.

Which is easiest for a beginner?

Unsloth Desktop or LM Studio: both are normal Mac apps. llama.cpp needs a few Terminal commands but gives the most control and the most file choices.

Is MLX faster than llama.cpp for Qwen4?

Not in the only Mac test published so far: on an M5 Max, llama.cpp wrote 91 tokens per second and mlx-lm about 75, though the tests differed. MLX read long prompts very fast. Try both if you have the memory.

Which is better, a MacBook Pro or a Mac Studio?

With the same chip and memory, they run Qwen4 at the same speed. The Mac Studio stays cooler and quieter in long sessions; the MacBook Pro is portable.

How much memory should I buy for local AI?

For Qwen4 at 4-bit, 32GB is the practical minimum and 48GB is comfortable, leaving room for long contexts and other apps. Memory bandwidth (Pro or Max chip) matters more than CPU cores for speed.

Does it work without internet?

Yes. Once the files are downloaded, everything runs on your Mac. Nothing you type is sent anywhere, unless you connect a tool that does so itself.

Can I run it next to other apps?

On 32GB, a browser and an editor are fine; a video editor or a game is not. On 48GB and more there is room for normal work alongside it.

Can I use the full 1M-token context?

With an 8-bit cache it costs about 10.7GB on top of the model, so it needs 64GB or more. Reading that much text also takes a long time on any Mac.

Should I upgrade from Qwen 3.6?

If your Mac runs Qwen 3.6 35B-A3B today, compare its file with the Qwen4 sizes in section 3 before you switch. My Qwen4 vs Qwen 3.6 comparison covers what you gain.

22

Your next step

Find your memory in the table at the top, run the sysctl line if your size needs it, and start llama-server with the matching command from section 6. Ask it something you know the answer to, watch the speed it prints, and keep an eye on Activity Monitor’s memory pressure. If it stays green, raise the context or step up one file size; if it turns red, step down. Once it runs, add MTP from section 13 for a free speed-up. If you also have a Windows PC with a graphics card, my Qwen4 guide for 8GB to 16GB cards covers that side.

Sources: Unsloth Qwen4 guide (sizes, Mac speed, MLX tests), Unsloth Qwen4 GGUF files, Unsloth MLX 4-bit card, mlx-community 4-bit card, mlx-community oQ4e card, oMLX, mlx-lm, llama.cpp Qwen4 pull request, Homebrew llama.cpp, Ollama Qwen4 page, Ollama Qwen4 tags, Ollama FAQ, LM Studio Qwen4 page, Qwen4-35B-A3B model card, Apple Newsroom (M5 Pro and M5 Max bandwidth). File sizes, quality scores and the M5 Max speeds are Unsloth’s published figures; app sizes come from each app’s Qwen4 page. The speed estimates for other chips, the cache sizes, the default GPU shares and the file and limit picks for each Mac are my own calculations and judgement, and I have not measured them on each Mac.