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

google/gemma-4-31B-it, Google's 31B dense model with image input, for Apple Silicon, built with LayerFitβ„’: a per-layer search that spends the bits where the model needs them most. 14.1 GB on disk, text and image input.

Build Size Suggested Mac memory
netprojects/gemma-4-31B-it-LayerFit-MLX-4bit 18.4 GB 24 GB (tight) or 32 GB
netprojects/gemma-4-31B-it-LayerFit-MLX-3bit 14.6 GB 24 GB
netprojects/gemma-4-31B-it-LayerFit-MLX-2.5bit (this build) 14.1 GB 16 GB (tight) or 24 GB

LayerFit: same size, closer to the original

A standard quant gives every layer the same bits. LayerFit measures how much each part of the model suffers at low bits (attention, the experts and MLP of every layer, the embeddings), then fills the same size budget where it helps most. After the search, the scales were polished by distillation from bf16 (DWQ, same bits and format).

Build (same test: chat replies, our harness) Text weights* Top-1 vs bf16 Error (KL) GSM8K
LayerFit 2.5-bit (this build) 12.9 GB 87.1% 0.3219 20/20
Standard 2.5-bit (same bits everywhere, same size) 12.9 GB 77.5% 0.9041 20/20
unsloth/gemma-4-31b-it-UD-MLX-3bit 19.5 GB 90.6% 0.1851 20/20

*Text weights = language-model weights, the same measure for every row. The download is larger because it also holds the bf16 vision tower and embeddings.

Held-out check on text the search and tuning never saw (real chat replies from ultrachat test_sft, GSM8K items 20-69):

Held-out test (new chats + GSM8K 50) Text weights* Top-1 vs bf16 Error (KL) GSM8K
LayerFit 2.5-bit (this build) 12.9 GB 87.8% 0.1728 47/50
unsloth/gemma-4-31b-it-UD-MLX-3bit 19.5 GB 91.5% 0.0801 47/50
bf16 original (reference) 100% 0 47/50

*Text weights = language-model weights, the same measure for every row. The download is larger because it also holds the bf16 vision tower and embeddings.

Our harness: language-model weights against our bf16 MLX conversion, chat-template text, top-1 agreement and KL on the reply tokens, GSM8K with thinking off. Public builds were scored on the same tokens. The exact recipe is in layerfit-recipe.json. Measured on a MacBook Pro M5 Max, 29 November 2026.

Use

pip install -U mlx-vlm
python -m mlx_vlm.generate --model netprojects/gemma-4-31B-it-LayerFit-MLX-2.5bit --max-tokens 2048 \
  --prompt "Write a Python function that checks if a string is a palindrome."

OpenAI-compatible server:

python -m mlx_vlm.server --model netprojects/gemma-4-31B-it-LayerFit-MLX-2.5bit --port 8080
  • Images: add --image path/to/file.png to mlx_vlm.generate.
  • See the original card for thinking mode, sampling settings and the published benchmark scores.

Tested with mlx-vlm 0.7.11 on a MacBook Pro M5 Max.

Licence

Apache-2.0, as google/gemma-4-31B-it. LICENSE is the licence text; NOTICE describes the conversion.

All LayerFit builds, one pick per model: [LayerFit MLX builds](https://huggingface.co/collections/netprojects/layerfit-mlx-builds-6b0ad24ace6f450872d036e5).

Built by Paris Michalas, NetProjects. LayerFitβ„’ is a NetProjects trademark. Not affiliated with Google.

Downloads last month
6
Safetensors
Model size
31B params
Tensor type
BF16
Β·
U32
Β·
MLX
Hardware compatibility
Log In to add your hardware

Quantized

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

Model tree for netprojects/gemma-4-31B-it-LayerFit-MLX-2.5bit

Quantized
(384)
this model

Collection including netprojects/gemma-4-31B-it-LayerFit-MLX-2.5bit