How much memory does Gemma 4 31B need?

About 22 GB at Q4_K_M with an 8K context. It runs on a Mac with 32 GB of unified memory or more.

Try other settings in the calculator

Memory by quantization and context

Total memory: weights, KV cache in F16 and about 1 GB of buffers. Under each total, the smallest Mac that can run it with the default GPU memory limit.

Quantization8K context32K context128K context
Q3_K_M18 GB32 GB Mac22 GB32 GB Mac39 GB64 GB Mac
Q4_K_M22 GB32 GB Mac26 GB48 GB Mac42 GB64 GB Mac
Q5_K_M25 GB48 GB Mac29 GB48 GB Mac46 GB64 GB Mac
Q6_K29 GB48 GB Mac33 GB48 GB Mac49 GB96 GB Mac
Q8_036 GB64 GB Mac40 GB64 GB Mac57 GB96 GB Mac
F1666 GB96 GB Mac70 GB96 GB Mac86 GB128 GB Mac

About the model

Parameters
31.27B
Type
Dense
Attention
sliding window plus full attention
KV cache, F16
2.2 GB at 8K, 22 GB at 128K
On Hugging Face
google/gemma-4-31B-it

Some layers only look at the last 1,024 tokens, so their part of the cache stops growing. The full-attention layers still grow with context.

Questions

How much memory does Gemma 4 31B need?

About 22 GB at Q4_K_M with an 8K context: 19 GB of weights, 2.2 GB of KV cache and about 1 GB of buffers. At 32K context it needs about 26 GB.

Can Gemma 4 31B run on a Mac?

Yes. At Q4_K_M with an 8K context it fits on a Mac with 32 GB of unified memory or more, using the default GPU memory limit of about three quarters.

How big is the Gemma 4 31B KV cache?

About 2.2 GB at 8K tokens and 22 GB at 128K tokens with an F16 cache. Its attention design: sliding window plus full attention.

Other models

Data read from Hugging Face on 2026-11-09. These are estimates; benchmarks on this site report measured memory. How the estimate works. Compare all models in the model fit chart.

Get the next one

New benchmarks and agent runs by email, with the raw data. Or follow on RSS or X.

Free. You confirm by email, and every issue has a one-click unsubscribe. How I handle your email.

RSSX