Running abliterated models on Apple Silicon with MLX
How MLX uses unified memory, which 4-bit and 6-bit models fit a 16, 24, 32 or 64 GB Mac, and how to run or serve an abliterated model with mlx-lm.
On this page
A Mac is a capable local-inference machine, but it does not work like a PC with a discrete GPU. The CPU and GPU share one pool of memory, and the framework you choose decides how well that memory is used. MLX is Apple's array framework, built for that arrangement. For many abliterated models it is the fastest way to run them on an M-series chip.
This guide covers what MLX changes, how to budget unified memory, which quant to pick for common Macs, and how to run or serve a model with mlx-lm. It assumes you already have a model in mind; if not, start with the catalog.
Why MLX instead of GGUF
GGUF through llama.cpp or Ollama also runs on Apple Silicon, using Metal. It is mature, portable and has the widest model coverage. MLX is different in three ways:
- Unified memory is the design center. MLX allocates arrays that the GPU can read directly, without copying them into a separate VRAM pool.
- Apple-specific kernels. Matrix multiplies and attention are tuned for M-series GPUs, which often helps prompt processing and long generations.
- Its own quantized format. MLX models are safetensors plus a config, quantized with MLX's scheme. They are not GGUF files and will not load in llama.cpp.
Use MLX when a good conversion exists and you are on Apple Silicon. Use GGUF when the model only ships GGUF, when you need Ollama, or when you want the broadest hardware compatibility.
What you need
- An Apple Silicon Mac (M1 or newer). Intel Macs are not supported by MLX.
- 16 GB minimum, and 32 GB or more for 27B-class models.
- A recent macOS and Python 3.10 or newer.
- Disk space for the model. A 4-bit 27B build is often 15–16 GB, and the Hugging Face cache keeps the download.
You do not need Xcode for the prebuilt mlx-lm wheels. If pip tries to compile something, install the command-line tools with xcode-select --install.
Unified memory is the real budget
On a Mac there is no separate VRAM number to check. The model, the KV cache, macOS and every open app compete for the same memory. Filling it completely makes the system swap, and swapping during inference is painfully slow.
Leave roughly 25–30% of total memory for the system and apps:
| Mac memory | Practical model budget | Typical fit |
|---|---|---|
| 16 GB | about 10–11 GB | 7–8B at 4-bit, or a 12B at 4-bit with a short context |
| 24 GB | about 16–17 GB | 12B at 4-bit comfortably, or a 27B at 4-bit with a short context |
| 32 GB | about 22–24 GB | 27B at 4-bit with an 8–16K context |
| 64 GB | about 48 GB | 27B at 6-bit or 8-bit, or a 70B at 4-bit (tight) |
| 128 GB | about 96 GB | 70B at 6-bit or 8-bit, or larger MoE models |
For a specific build on your specific Mac, the hardware fit page runs these numbers against every model in the catalog.
These are starting points, not guarantees. The KV cache grows with context, and a long prompt at 32K can cost several extra gigabytes. Watch Memory Pressure in Activity Monitor rather than the raw memory-used graph. If macOS starts compressing or swapping, reduce the context or the quant.
Choose the quant
MLX's default is 4-bit. It is the right starting point for most chat and coding work.
- 4-bit — roughly 4.5 bits per weight. A 27B model lands around 15–16 GB. Best default.
- 6-bit — about 35–45% larger than 4-bit, with a smaller quality gap. Use it when the model fits with room to spare.
- 8-bit — close to the original, but often too large for a 24 GB Mac at 27B. Useful for smaller models and evaluations.
- 3-bit — for tight memory. Expect visible degradation on reasoning and formatting.
MLX quants are not interchangeable with GGUF quants. A Q4_K_M GGUF and a 4-bit MLX build use different recipes, so their quality and size can differ. Check the model card for the exact size and evaluate on your own prompts.
A 4-bit 27B build like divinetribe's Qwen3.6-27B-abliterated conversion (opens in a new tab) is about 15.2 GB and is a realistic fit for a 32 GB Mac. A 12B build is the safer choice on 24 GB.
Install and run
Create an isolated environment so the MLX packages do not collide with other Python work:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -U mlx-lmGenerate from a Hugging Face MLX repo:
mlx_lm.generate \
--model divinetribe/Qwen3.6-27B-abliterated-4bit-mlx \
--prompt "Explain KV cache in two sentences." \
--max-tokens 256The first run downloads the weights. After that, the model is cached locally.
For an interactive chat:
mlx_lm.chat --model divinetribe/Qwen3.6-27B-abliterated-4bit-mlxTo serve an OpenAI-compatible endpoint on the local machine:
mlx_lm.server \
--model divinetribe/Qwen3.6-27B-abliterated-4bit-mlx \
--port 8080Then point a client at http://127.0.0.1:8080/v1:
curl http://127.0.0.1:8080/v1/chat/completions \
-H 'content-type: application/json' \
-d '{"model":"divinetribe/Qwen3.6-27B-abliterated-4bit-mlx","messages":[{"role":"user","content":"Hello"}]}'Keep the server bound to localhost unless you have a reason to expose it. It has no authentication layer of its own.
Long context and memory
MLX can use a rotating fixed-size KV cache, which caps memory at the cost of forgetting older tokens:
mlx_lm.generate \
--model divinetribe/Qwen3.6-27B-abliterated-4bit-mlx \
--prompt "..." \
--max-kv-size 4096Smaller values use less memory but degrade long-range recall. --prefill-step-size controls how much of a long prompt is processed at once; lowering it reduces peak memory during prompt processing at some cost in speed.
For a local chat, 4K–8K is usually enough. For codebases or long documents, expect to trade context for quant size.
Convert a model yourself
If an abliterated model only ships GGUF or full-precision weights, convert it:
mlx_lm.convert --model <hf-repo> -q-q defaults to 4-bit. For 6-bit:
mlx_lm.convert --model <hf-repo> -q --q-bits 6The output lands in a local directory, typically mlx_model. You can change it with --mlx-path. Conversion needs enough disk for the source weights plus the quantized copy, so check free space first.
LM Studio and Ollama
- LM Studio can use an MLX runtime on Apple Silicon. Search for the model, pick an MLX build, and choose 4-bit or 6-bit in the download list. GGUF models still run through its llama.cpp engine.
- Ollama uses GGUF and Metal, not MLX. It is the easiest path for official models and GGUF-only builds, but it will not load an MLX conversion.
If both formats exist, try MLX first on a Mac. If only GGUF exists, use Ollama or LM Studio's GGUF engine; the difference is smaller than the difference between a good and a bad quant.
Troubleshooting
The model does not load. Check that the repository contains MLX weights (config.json, model.safetensors.index.json, safetensors files), not just GGUF. mlx-lm cannot read a GGUF file.
The machine runs out of memory. Move down one quant, shorten the context, or close memory-heavy apps. A 27B at 4-bit is not a 24 GB certainty; it depends on context and the rest of your session.
Generation is slow. Token generation is limited by memory bandwidth, and prompt processing by compute. Base M1/M2 chips are much slower than Pro, Max and Ultra variants. Long prompts take time before the first token appears.
Quality dropped. Compare 4-bit against 6-bit on your own tasks. Quantization is not the only variable: the chat template and sampler settings can matter more.
The server is unreachable. Confirm the port, bind address and that the process is still running. mlx_lm.server prints the address it is serving on at startup.
Next steps
- Browse the model catalog and filter by size and method.
- Read the GGUF quantization guide if you also run models through Ollama or llama.cpp.
- See the Inkling 2 Mini builds for a recent 26B MoE with MLX conversions.