Skip to content
NetProjects™
Menu

Insights

Google's Gemma 4 on a Mac: seven LayerFit™ MLX builds of the 31B, 26B-A4B and 12B models

NetProjects™

Gemma 4 is a family of open models from Google DeepMind under the Apache-2.0 licence, in five sizes: E2B, E4B, 12B, 26B A4B and 31B. The models take text and image input and write text, support more than 140 languages and context windows of up to 256K tokens on the medium sizes, and have a configurable thinking mode, native function calling and a system role. We build three of the instruction-tuned models: the 31B, a dense model with 30.7B parameters and 60 layers; the 26B A4B, a mixture-of-experts model with 25.2B parameters in total, of which 3.8B are active for each token, through 8 of 128 experts plus one shared expert across 30 layers; and the 12B Unified, a dense model with 11.95B parameters and 48 layers that has no separate vision or audio encoders.

Google reports these figures for the instruction-tuned models. They are Google's figures for its original weights; we have not reproduced them.

Google's figuresGemma 4 31BGemma 4 26B A4BGemma 4 12B
MMLU Pro85.2%82.6%77.2%
AIME 2026, no tools89.2%88.3%77.5%
LiveCodeBench v680.0%77.1%72.0%
GPQA Diamond84.3%82.3%78.8%
MMMU Pro76.9%73.8%69.1%

We publish seven LayerFit™ MLX builds: three of the 31B, three of the 26B A4B and one of the 12B, all with text and image input, from 6.8 GB for a 16 GB Mac to 18.4 GB for a 32 GB Mac.

Always up to date. We keep these builds current on Hugging Face. When Google releases a new version of the model, or LayerFit™ finds a better recipe, we rebuild, re-test and publish it there, so the links on this page always point to the latest version. The numbers in this article were measured on 29 November 2026; the model cards on Hugging Face carry the current figures.

What we released

LayerFit™ is NetProjects™' own method for building small MLX models for Macs with Apple Silicon. It measures how much each part of a model suffers when squeezed to few bits (such as the attention, MLP or expert blocks of every layer, the embeddings and the output head), then spends the bits where they matter. A standard build gives every layer the same bits; a LayerFit™ recipe is only published if it beats a standard build of the same size. The recipe ships in each repository as layerfit-recipe.json, so anyone can see which bits went where, and the result is a normal MLX build that stock mlx-lm, mlx-vlm and LM Studio load. How it works: https://netprojects.com/layerfit.

Hugging FaceSizeSuggested Mac memory
netprojects/gemma-4-31B-it-LayerFit-MLX-4bit18.4 GB24 GB (tight) or 32 GB
netprojects/gemma-4-31B-it-LayerFit-MLX-3bit14.6 GB24 GB
netprojects/gemma-4-31B-it-LayerFit-MLX-2.5bit14.1 GB24 GB
netprojects/gemma-4-26B-A4B-it-LayerFit-MLX-4bit15.4 GB24 GB
netprojects/gemma-4-26B-A4B-it-LayerFit-MLX-3bit12.2 GB24 GB
netprojects/gemma-4-26B-A4B-it-LayerFit-MLX-2.5bit10.5 GB16 GB
netprojects/gemma-4-12B-it-LayerFit-MLX-4bit6.8 GB16 GB

Same size, closer to the original

Each row compares a build with a standard build of the same size, which gives every layer the same bits. Our harness scores the language-model weights against our own bf16 MLX conversion on chat replies, with GSM8K (20 questions, thinking off); top-1 is how often the build picks the same next token as bf16, and error is the KL divergence from it. Text weights are the language-model weights alone; the download is larger because it also holds the bf16 vision tower and embeddings.

BuildText weightsStandard build of the same sizeLayerFit™ buildGSM8K, standard / LayerFit™
31B 4-bit17.3 GB93.3% top-1, error 0.080394.5% top-1, error 0.058820/20 and 20/20
31B 3-bit13.4 GB84.9% top-1, error 0.446588.8% top-1, error 0.264020/20 and 20/20
31B 2.5-bit12.9 GB77.5% top-1, error 0.904187.1% top-1, error 0.321920/20 and 20/20
26B A4B 4-bit14.2 GB89.3% top-1, error 0.156994.2% top-1, error 0.048620/20 and 20/20
26B A4B 3-bit11.1 GB75.4% top-1, error 0.843888.6% top-1, error 0.188511/20 and 20/20
26B A4B 2.5-bit9.3 GB64.7% top-1, error 1.504782.1% top-1, error 0.46776/20 and 20/20
12B 4-bit6.7 GB87.3% top-1, error 0.197690.2% top-1, error 0.124620/20 and 20/20

The widest gaps are on the 26B A4B at 3-bit and 2.5-bit, where a standard build of the same size answered 11 and 6 of 20 GSM8K questions and the LayerFit™ build answered all 20.

The numbers above come from the text the recipe was tuned on. We also checked each build on text it never saw: real chat replies from the ultrachat test_sft set, plus GSM8K questions 20 to 69, which is 50 questions.

Held-out buildText weightsSame next token as bf16Error (KL)GSM8K-50bf16 GSM8K-50
31B 4-bit17.3 GB94.3%0.031247/5047/50
31B 3-bit13.4 GB88.7%0.143347/5047/50
31B 2.5-bit12.9 GB87.8%0.172847/5047/50
26B A4B 4-bit14.2 GB94.6%0.026048/5048/50
26B A4B 3-bit11.1 GB88.8%0.113547/5048/50
26B A4B 2.5-bit9.3 GB84.1%0.250746/5048/50
12B 4-bit6.7 GB91.2%0.071048/5048/50

On the held-out text, the mlx-community 4-bit builds of the same size scored 93.6% (31B), 89.2% (26B A4B) and 86.7% (12B) on the same next token, against 94.3%, 94.6% and 91.2% for the LayerFit™ builds.

Try it

On a Mac with Apple Silicon, install mlx-vlm. For thinking mode and sampling settings, Google recommends temperature 1.0, top_p 0.95 and top_k 64.

pip install -U mlx-vlm
python -m mlx_vlm.generate --model netprojects/gemma-4-26B-A4B-it-LayerFit-MLX-4bit --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-26B-A4B-it-LayerFit-MLX-4bit --port 8080

For images, add the image option with a path to the file. Our cards were tested with mlx-vlm 0.7.11 on a MacBook Pro M5 Max.

Honest limits

  • Google's benchmark figures above are Google's, for the original models. We did not run them on our builds.
  • Our measure is closeness to our own bf16 MLX conversion, on text. We did not score image understanding.
  • Larger builds from others can sit closer to the original. In the tuning test, Unsloth's 4-bit build of the 31B, at 22.1 GB of text weights, scored 95.4% top-1 with error 0.0421, against 94.5% and 0.0588 for our 4-bit at 17.3 GB; on the 12B, mlx-community's QAT 4-bit, at 10.9 GB, scored 93.0% against 90.2% for our 6.7 GB build. The comparison we claim is at the same size.
  • GSM8K is 20 questions in the tuning test and 50 in the held-out test, so small differences are noise.
  • Google's card lists audio input for the 12B. Our 12B build's card lists text and image input, and we did not test audio.
  • There is one 12B build, at 4-bit. There is no 6-bit or 8-bit build of any of the three, because a standard build already stays close to the original at those sizes.
  • All figures come from one MacBook Pro M5 Max, measured on 29 November 2026. We give no speed figures.

Licence

Gemma 4 31B, 26B A4B and 12B and our builds are under the Apache-2.0 licence. Each of our repositories carries the licence text and and a notice that describes the conversion.

Links

Credits

Gemma 4 is by Google DeepMind, under the Apache-2.0 licence. The MLX builds are by NetProjects™ (Internet Projects Ltd), made with LayerFit™. Not affiliated with Google.

NetProjects™ and LayerFit™ are trade marks of Internet Projects Ltd.

This article was drafted with AI assistance, then edited and approved by people on our team. You can read more about how we use AI at https://netprojects.com/standards/ai.