Model works with Ollama (MLX, safetensors) on Apple Silicon

#1
by danilamaster18 - opened

✅ Model works with Ollama (MLX, safetensors) on Apple Silicon
Sharing that this model runs successfully in Ollama directly from safetensors — not via GGUF conversion, but through the experimental MLX import path Ollama added for Apple Silicon.
Hardware
MacBook Pro M3 Max, 128GB unified memory
macOS
Ollama 0.32.0
How I downloaded it
The unquantized version weighs ~40GB (this is the qat-q4_0-unquantized variant — i.e., the full-precision model left over after quantization-aware training, without the final quantization step applied).

hf download llmfan46/gemma-4-31B-it-qat-q4_0-unquantized-uncensored-heretic \
  --local-dir /Volumes/Lexar4TB/original

(hf is the current CLI from huggingface_hub, replacing the deprecated huggingface-cli)
How I imported it into Ollama

cd /Volumes/Lexar4TB/original
echo "FROM ." > Modelfile
ollama create --experimental gemma4-31b-unquant -f Modelfile

The --experimental flag is required — without it, the safetensors import won't run; the MLX path in Ollama is still marked experimental.
Running it

ollama run gemma4-31b-unquant

The model loaded and responds at 100% GPU (confirmed via ollama ps), with no errors during import or launch.
First impressions
Subjectively feels faster than the GGUF version of the same model — but this isn't a proper benchmark yet, just a first impression. I plan to run a real comparison (tokens/sec on identical prompts) and will update this post with numbers.
Important note for anyone trying to reproduce this
If the model responds very slowly after import and ollama ps shows mixed CPU/GPU usage — check the context window. Ollama sometimes defaults to the model's maximum context length (which can be very large for Gemma 4), and the KV cache at that context size may not fully fit in GPU memory for a model this size, pushing some layers to CPU and drastically slowing everything down. Explicitly limiting the context at launch fixes this.

Sign up or log in to comment