Models
Gemma Models: Gemma 4 Sizes, Licence, Hardware and Scores
Checked 2026-10-31
Loading poll...
Gemma 4 is Google DeepMind's open model family, released between March and May 2026, with five sizes from an effective 2B up to a 31B dense model. All are tagged Apache-2.0, all read images, the small ones and the 12B also hear audio, and contexts run from 128K to 256K tokens. A 4-bit 31B build is about 23 GB, which fits a single 24 GB GPU for short contexts. Checked 31 October 2026.
The family
Facts come from the Hugging Face model cards and API for each size, read on 31 October 2026.
E2B | E4B | 12B Unified | 26B A4B | 31B | |
|---|---|---|---|---|---|
Released | 2 Mar 2026 | 2 Mar 2026 | 23 May 2026 | 11 Mar 2026 | 11 Mar 2026 |
Parameters | 2.3B effective (5.1B with embeddings) | 4.5B effective (8B with embeddings) | 11.95B | 25.2B total, 3.8B active | 30.7B dense |
Layers | 35 | 42 | 48 | 30 | 60 |
Context | 128K | 128K | 256K | 256K | 256K |
Input | Text, image, audio | Text, image, audio | Text, image, audio | Text, image | Text, image |
Licence | Apache-2.0 | Apache-2.0 | Apache-2.0 | Apache-2.0 | Apache-2.0 |
Weight files | About 10 GB | About 16 GB | About 24 GB | About 52 GB | About 63 GB |
Notes on the table. "E" means effective parameters: the small models use per-layer embeddings so that on-device memory behaves like a smaller model. "Unified" on the 12B means an encoder-free design that projects raw image patches and audio straight into the language model, instead of using separate encoders. The 26B A4B is a mixture of experts with 8 of 128 experts active plus one shared expert. Pre-trained and instruction-tuned versions exist for each, and Google also publishes quantisation-aware-trained builds in 4-bit (w4a16) and mobile formats.
None of the Gemma 4 repositories is gated, unlike Meta's Llama and Muse downloads. You can pull the weights with a plain Hugging Face client.
What Google says about them
The cards describe Gemma 4 as multimodal and reasoning-capable, and list these capabilities:
- Thinking. A built-in reasoning mode, switched on by putting a
<|think|>token at the start of the system prompt and off by removing it. - Function calling. Native structured tool use for agent workflows.
- System prompt. Native support for the
systemrole, new compared with Gemma 3. - Coding. Generation, completion and correction, with improvements on coding benchmarks.
- Languages. Out-of-the-box support for 35 or more languages, pre-trained on over 140.
- Vision. Variable aspect ratio and resolution, OCR, document and PDF parsing, UI and chart understanding, handwriting, pointing and object detection.
- Video. Handled by processing sequences of frames.
- Audio. Speech recognition and speech-to-translated-text on E2B, E4B and 12B only.
The cards give a practical dial for vision: a visual token budget of 70, 140, 280, 560 or 1,120. Use lower budgets for classification, captioning or video, and higher ones for OCR, document parsing and small text.
One operational rule is worth copying into your agent framework. In multi-turn chats, history should hold only the final answer. Earlier thinking content must not be added back before the next user turn, with the exception of tool calls in the same turn. That is the opposite of Kimi K3 and Qwen3.8, which want reasoning passed back, so do not share one client library between them without checking.
Published scores
Everything below is vendor-reported on Google's cards. No one outside Google reproduced it for this page.
Benchmark | 31B | 26B A4B | 12B Unified | E4B | E2B | Gemma 3 27B |
|---|---|---|---|---|---|---|
MMLU Pro | 85.2% | 82.6% | 77.2% | 69.4% | 60.0% | 67.6% |
AIME 2026, no tools | 89.2% | 88.3% | 77.5% | 42.5% | 37.5% | 20.8% |
LiveCodeBench v6 | 80.0% | 77.1% | 72.0% | 52.0% | 44.0% | 29.1% |
Codeforces ELO | 2150 | 1718 | 1659 | 940 | 633 | 110 |
GPQA Diamond | 84.3% | 82.3% | 78.8% | 58.6% | 43.4% | 42.4% |
Tau2 (average of 3) | 76.9% | 68.2% | 69.0% | 42.2% | 24.5% | 16.2% |
HLE, no tools | 19.5% | 8.7% | 5.2% | not reported | not reported | not reported |
MMMU Pro (vision) | 76.9% | 73.8% | 69.1% | 52.6% | 44.2% | 49.7% |
MATH-Vision | 85.6% | 82.4% | 79.7% | 59.5% | 52.4% | 46.0% |
MRCR v2 8-needle at 128K | 66.4% | 44.1% | 43.4% | 25.4% | 19.1% | 13.5% |
How to read this. The jump from Gemma 3 27B to Gemma 4 31B is large on every row, which is Google's story: a new generation, not a refresh. The 26B A4B is close behind the 31B on most rows while using only 3.8B active parameters, so it is the speed pick if you have memory for 52 GB. And none of these rows is a repository-level agent test. LiveCodeBench and Codeforces measure competition-style problems. We found no SWE-bench or terminal-benchmark score on the cards, so do not compare Gemma with the models in our best open source LLM for coding table on that axis.
Hardware
Weight-file sizes from the Hugging Face API give the real download. Memory at run time is higher because of the key-value cache.
Model | Download | Realistic hardware |
|---|---|---|
E2B | About 10 GB | Phone or laptop; Google publishes mobile builds |
E4B | About 16 GB | Laptop or phone; mobile builds published |
12B Unified | About 24 GB; 10 GB at w4a16 QAT | A 16 GB GPU or Mac with the 4-bit build |
26B A4B | About 52 GB | One 80 GB GPU, or 24 to 48 GB quantised; all 25.2B parameters must be resident |
31B | About 63 GB; 23 GB at w4a16 QAT | One 80 GB GPU, or one 24 GB GPU with the 4-bit build and a short context |
The phrase "mobile" in the repository names (for example gemma-4-E4B-it-qat-mobile) marks builds prepared for on-device runtimes. Whether a specific phone can run them depends on its memory and the app; we did not test any device:.
For desktop tools, see Ollama vs LM Studio and llama.cpp vs Ollama. The card notes that Transformers and llama.cpp handle the chat template, which is good news for local use. The exact Ollama tags for Gemma 4 were not confirmed:.
Prices and where it is served
Gemma is meant to be self-hosted, so the main cost is hardware. If you want an API, third parties serve open Gemma weights. Google's own pricing for Gemma through its API platform was not on any page we read: . For third-party hosts, check the catalogues of Hugging Face Inference, Cloudflare Workers AI, Replicate and AWS Bedrock:.
Our Gemini API pricing page covers Google's closed models if you need the hosted frontier instead. For renting a GPU, use Runpod, Modal or Lambda.
Licence
Gemma 3 and earlier shipped under Google's own Gemma terms of use. For Gemma 4 the Hugging Face metadata says Apache-2.0 and links Google's Gemma 4 licence page. That is a substantive change: Apache-2.0 has no usage-policy clause that travels with derivatives and no attribution display rule. We did not read the linked Google page, so confirm there is no additional prohibited-use addendum before you commit: [VERIFY: Gemma 4 licence page terms at ai.google.dev/gemma/docs/gemma4license, including any prohibited-use policy].
Gemma 4 31B against Qwen3.8-27B
These two are the natural pair: dense, Apache-2.0, 27B to 31B parameters and image input. Each maker's card publishes its own scores, so the table compares two vendor claims, not a shared test.
Gemma 4 31B | Qwen3.8-27B | |
|---|---|---|
Parameters | 30.7B dense | 27B dense |
Context | 256K | 262,144 native, to 1M with YaRN |
Input | Text, image (video as frames) | Text, image, video |
Audio | No | Not listed |
LiveCodeBench v6 | 80.0% | 90.3% |
GPQA Diamond | 84.3% | 89.2% |
Weight files | About 63 GB | About 56 GB |
Hugging Face gating | None | None |
On Google's and Alibaba's own numbers, Qwen3.8-27B is ahead on the two overlapping rows, and Qwen also publishes repository-level scores that Gemma does not (see Qwen models). Gemma's case is breadth of sizes: we found no smaller sibling among the Qwen3.8 repositories we read, while Gemma gives you five choices with one chat format and one licence. If you need a family that scales from a phone to a workstation, that matters more than a few points on one benchmark. For the wider comparison, see Qwen vs Llama for how we frame open-model choices.
A first run with Transformers
The cards load every size with the latest Transformers. The pattern is the same across sizes, and only the model id changes.
from transformers import AutoProcessor, AutoModelForMultimodalLM
MODEL_ID = "google/gemma-4-31B-it"
processor = AutoProcessor.from_pretrained(MODEL_ID)
model = AutoModelForMultimodalLM.from_pretrained(MODEL_ID, dtype="auto", device_map="auto")After loading, you build a chat with a system role message, optionally include an image, and call generate. Pass enable_thinking=True when building the prompt if you want the reasoning mode, and use the card's parse_response helper to split thoughts from the answer. A test worth running before anything else: send the same hard prompt with thinking on and off and compare length and latency, so you know what the mode costs on your hardware.
On a machine with less than 63 GB of GPU memory, use the 4-bit QAT repository instead. Google publishes w4a16 builds in a format meant for vLLM-style serving, and those are the ones that bring the 31B down to about 23 GB of weights.
Working with images and audio
Two practical points from the cards. First, choose the visual token budget by task. Reading a receipt or a dense PDF needs 560 or 1,120 tokens per image, while sorting photos into categories works at 70 or 140. Because the budget multiplies by the number of images in a prompt, a high budget with many video frames fills the context window fast. Second, audio is limited to E2B, E4B and the 12B. If you need speech recognition and you want a bigger model for reasoning, run two models: a small Gemma for transcription, then the 31B on the transcript.
Interleaving is allowed: the cards say you can mix text and images in any order in one prompt. That makes screenshot-driven workflows simple, for example sending a UI screenshot with an error log and asking for a fix.
Choosing a size, step by step
- Write down the smallest device you must support. If it is a phone, the answer is E2B or E4B.
- If audio is needed, you are limited to E2B, E4B and 12B.
- Check memory for the whole model, not the active part. The 26B A4B needs about 52 GB of weights even though it computes with 3.8B.
- Test the two nearest sizes on 20 of your own prompts at the thinking setting you will run.
- Decide whether speed or accuracy is the constraint. The 26B A4B is faster per token than the 31B; the 31B scores higher on every row in the table above.
Which coding agents can use Gemma
Gemma supports native function calling, so an agent with a custom OpenAI-compatible endpoint can drive it when served by vLLM, Ollama or llama.cpp. For small-model agent work, the 12B and 26B A4B are the ones to try, since E2B and E4B score low on the Tau2 agent test (24.5% and 42.2%, against 76.9% for the 31B). See OpenCode, Cline and Aider for agent options. Which of those has first-class Gemma 4 support is not documented on the cards.
Google's own agent, Gemini CLI, targets Gemini models; whether it can use a local Gemma is a separate question:.
Who should pick Gemma
You are | Pick |
|---|---|
Building an on-device feature that hears and sees | E2B or E4B |
Running one laptop or modest GPU, wanting audio plus vision | 12B Unified |
Wanting fast answers with a big-model feel | 26B A4B |
Wanting the best Gemma accuracy | 31B |
Needing strong repository-level coding | |
Needing a permissive licence | Any Gemma 4, subject to the licence check above |
Gotchas
- E-model memory. The effective parameter count is not the file size. E4B is 8B parameters with embeddings.
- Thinking history. Do not feed earlier thoughts back, except tool calls in the same turn.
- Empty thought blocks. For all but E2B and E4B, disabling thinking still emits the tags with an empty block, so your parser must tolerate them.
- Audio coverage. The 26B and 31B do not hear audio.
- Long context is not equal across sizes. The 128K MRCR score is 66.4% for 31B and 43.4% for 12B on Google's own test.
Our take
Gemma 4 is the best-documented small-to-mid open family on this site: five sizes, one licence tag, no gating, and a card that tells you how to handle thinking, vision budgets and chat history. If you need one model for a workstation, take the 31B at 4-bit or the 26B A4B. If your product runs on phones, start with E4B. If your work is long agentic coding, look elsewhere first. See open source LLM, Qwen models and Llama models for the alternatives.
Product names are used descriptively. We are not affiliated with Google.
Questions
Is Gemma 4 open source?
Gemma 4 weights are tagged Apache-2.0 on Hugging Face, with a licence link to Google's Gemma 4 licence page. They are open weights, and Google does not publish the training data.
What sizes does Gemma 4 come in?
E2B and E4B (effective 2.3B and 4.5B parameters), 12B Unified (11.95B), 26B A4B mixture-of-experts (25.2B total, 3.8B active) and 31B dense (30.7B).
Does Gemma 4 handle images and audio?
All sizes take text and images, and E2B, E4B and 12B also take audio. Video is handled as sequences of frames. Output is text.
How much memory does Gemma 4 31B need?
The repository weights are about 63 GB. A 4-bit quantisation-aware-trained build from Google is about 23 GB.
Loading poll...