Xylolabs

gemma-4-31B-it MLX 4-bit

google/gemma-4-31B-it converted to MLX for mlx-lm, text only: the vision tower is left out. Affine quantization, group size 64, scales and biases in bfloat16. 4-bit: every linear layer, except the token embedding (also the LM head) at 8-bit. Norms and the other unquantized tensors in bfloat16.

How to run

pip install mlx-lm==0.32.2

mlx_lm.generate --model Xylolabs/gemma-4-31B-it-MLX-4bit --prompt "Explain how a heat pump works."
mlx_lm.chat     --model Xylolabs/gemma-4-31B-it-MLX-4bit

Accuracy

KL and top-1 against MLX's own unquantized BF16 model on chat-template text (4 English and 4 Korean conversations, 8 x 1006 scored tokens); not against llama.cpp's BF16, which differs from MLX's by a KL of 0.16 to 0.27 on raw text. Raw text (WikiText-2, chat and held-out text, 40/20/20 chunks of 512; last chart) shows much larger KL for this model in every stack, llama.cpp's Q8_0 included.

Quant Size Chat-template KL top-1 7-question answer check
MLX 8-bit 32.62 GB 0.003032 98.36% 7/7 (BF16: 7/7)
MLX 4-bit 17.97 GB 0.090060 90.52% 7/7 (BF16: 7/7)
Mean KL divergence by size Top-1 agreement by size Mean KL divergence on raw text by size

Which file for your hardware

Hardware Memory File Context
Mac Studio M5 Max, 32-core GPU 36 GB unified Xylolabs/gemma-4-31B-it-MLX-4bit (4-bit, 17.97 GB) 73K
Mac Studio M5 Max, 40-core GPU 48 GB unified Xylolabs/gemma-4-31B-it-MLX-4bit (4-bit, 17.97 GB) 181K
Mac Studio M5 Max, 40-core GPU 64 GB unified Xylolabs/gemma-4-31B-it-MLX-8bit (8-bit, 32.62 GB) 149K
Mac Studio M5 Ultra 96 GB unified Xylolabs/gemma-4-31B-it-MLX-8bit (8-bit, 32.62 GB) 256K
Mac Studio M5 Max, 40-core GPU 128 GB unified Xylolabs/gemma-4-31B-it-MLX-8bit (8-bit, 32.62 GB) 256K
Mac Studio M5 Ultra 256 GB unified Xylolabs/gemma-4-31B-it-MLX-8bit (8-bit, 32.62 GB) 256K
Mac Studio M5 Ultra, 80-core GPU 512 GB unified Xylolabs/gemma-4-31B-it-MLX-8bit (8-bit, 32.62 GB) 256K

License and notices

Apache License 2.0, copied in LICENSE. We converted the weights to MLX and quantized them; see NOTICE.

Updates

  • 2026-11-27: First release.
Downloads last month
14
Safetensors
Model size
31B params
Tensor type
U32
Β·
BF16
Β·
MLX
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for Xylolabs/gemma-4-31B-it-MLX-4bit

Quantized
(380)
this model

Collections including Xylolabs/gemma-4-31B-it-MLX-4bit