FlashAttention 4 + tool calling

Byte for byte, the most capable open models

Gemma 4 is Google DeepMind's open-weight model family, built from the same research as Gemini 3 and released under Apache 2.0. Five sizes span a phone and a datacenter rack - with reasoning, native multimodality, function calling and up to 256K of context in every one.

Apache 2.0 · Commercial use permitted · Weights are free, you pay only for compute

Gemma 4 31B
Dense · 256K context
17.5 GB
Gemma 4 26B A4B
MoE · ~3.8B active
14.4 GB
Gemma 4 12B
Unified · encoder-free
6.7 GB
Gemma 4 E4B
Edge · laptops & GPUs
4.5 GB
Gemma 4 E2B
On-device · phones
2.9 GB

Sizes shown at Q4_0 quantisation · mobile builds are smaller still

5
Model sizes, E2B through 31B dense
256K
Context window on 12B, 26B and 31B
140+
Languages supported out of the box
900M+
Downloads across the Gemma family
Latest updates

Everything that shipped in 2026

Gemma 4 has moved fast since launch - a multi-token-prediction refresh two weeks in, a brand-new encoder-free 12B in June, and a mid-July weights update that quietly fixed the things agent builders were complaining about.

August 2026
Gemma family passes 900 million downloadsMilestone
Cumulative downloads across every Gemma generation crossed 900M, with Gemma 4 alone accounting for more than 150M since the spring launch. It remains the most-downloaded open model family on Hugging Face and Kaggle combined.
July 15, 2026
FlashAttention 4, tool-calling fixes and sharper vision
A weights-and-config refresh, not a new version number. FA4 landed for NVIDIA Hopper GPUs with prefill throughput up 25–70% and time-to-first-token down as much as 31%. Tool calling got substantially more reliable - 31B gained 10.1% on Tau2 Telecom, and E4B went from effectively zero to a working score on TB2 agent benchmarks. Vision defaults moved to a 280-token bucket with soft tokens raised to 1120, which sharpens OCR on roughly 2.5-megapixel documents and screenshots. Re-pull your weights to get the chat-template fixes.
June 3, 2026
Gemma 4 12B Unified - encoder-free multimodal
The architectural headline of the year. Instead of bolting vision and audio encoders onto a language backbone, 12B feeds image patches and raw audio directly into the model: vision through a lightweight embedding module, audio projected straight into the text token space with no encoder at all. It approaches 26B MoE quality on standard benchmarks at less than half the memory, and runs locally on a 16GB laptop.
July 2026
Amazon Bedrock in AWS GovCloud (US-West)
Following April's arrival in SageMaker JumpStart, Gemma 4 became available to regulated US public-sector workloads through Bedrock in GovCloud.
April 16, 2026
Multi-Token Prediction (MTP) checkpoints
MTP variants shipped for E2B, E4B, 26B A4B and 31B, enabling self-speculative decoding without a separate draft model - a meaningful throughput win on constrained hardware.
April 2026
On-device and cloud availability broadens
Gemma 4 arrived in the Android AICore Developer Preview for on-device inference, in Amazon SageMaker JumpStart, and across Vertex AI Model Garden, Cloud Run and GKE.
March 31 – April 2, 2026
Gemma 4 launches
E2B, E4B, 26B A4B and 31B released under Apache 2.0 with up to 256K context, native function calling, structured JSON output, configurable thinking mode and 140+ language support. The 31B took the #3 slot among open models on the Arena text leaderboard; 26B A4B took #6.
January 15, 2026
TranslateGemma - 4B, 12B and 27B
A dedicated translation family released ahead of the Gemma 4 core models.
January 13, 2026
MedGemma 1.5 (4B)
An updated healthcare-specialised model for medical imaging and clinical text.
The family

Five models, one architecture family

Pick by the hardware you actually have. Every model shares the same tokenizer, chat template, thinking mode and function-calling interface, so moving up or down a size is a config change, not a rewrite.

Flagship
Gemma 4 31B
Dense

The strongest model in the family and the leading dense open model on the Arena text leaderboard. All 31B parameters active on every token - the choice when quality matters more than throughput.

  • Context256K
  • ModalitiesText + Image
  • Memory (BF16)69.9 GB
  • Memory (Q4_0)17.5 GB
Efficient
Gemma 4 26B A4B
Mixture of Experts

26B total parameters, but only about 3.8B activate per token. Near-31B quality at a fraction of the inference cost, which makes it the default pick for high-volume serving.

  • Context256K
  • Active params~3.8B / token
  • Memory (BF16)57.7 GB
  • Memory (Q4_0)14.4 GB
New - June 2026
Gemma 4 12B
Unified · encoder-free

Text, vision and audio in a single backbone with no separate encoders. Native audio input in a mid-sized open model, approaching 26B benchmarks on under half the memory. Fits a 16GB laptop.

  • Context256K
  • ModalitiesText·Img·Aud·Vid
  • Memory (BF16)26.7 GB
  • Memory (Q4_0)6.7 GB
Edge
Gemma 4 E4B
Effective 4B

Built for laptops, single consumer GPUs and higher-end handsets. Full multimodal input including audio transcription and translation, at a size that fits comfortably in 8GB of VRAM when quantised.

  • Context128K
  • Raw params4.5B
  • Memory (Q4_0)4.5 GB
  • Mobile build2.5 GB
On-device
Gemma 4 E2B
Effective 2B

The phone-class model. Ships through LiteRT-LM, MediaPipe and the Android AICore preview, with a mobile build just over a gigabyte - offline, private, and fast enough for interactive use.

  • Context128K
  • Raw params2.3B
  • Memory (Q4_0)2.9 GB
  • Mobile build1.1 GB
Specialised
Gemma variants
Domain models

TranslateGemma (4B / 12B / 27B) for high-quality machine translation and MedGemma 1.5 (4B) for medical imaging and clinical text. Plus EmbeddingGemma, FunctionGemma, ShieldGemma and T5Gemma v2 across the wider ecosystem.

  • TranslateGemmaJan 15, 2026
  • MedGemma 1.5Jan 13, 2026
  • LicenseApache 2.0

Memory requirements by precision

ModelBF16SFP8Q4_0 MobileContext
Gemma 4 E2B11.4 GB5.7 GB2.9 GB1.1 GB128K
Gemma 4 E4B17.9 GB8.9 GB4.5 GB2.5 GB128K
Gemma 4 12B26.7 GB13.4 GB6.7 GB-256K
Gemma 4 26B A4B57.7 GB28.8 GB14.4 GB-256K
Gemma 4 31B69.9 GB34.9 GB17.5 GB-256K

Figures are for weights at inference. Add headroom for the KV cache - Gemma 4's pp-RoPE scheme cuts that footprint by up to 37.5% versus a standard configuration.

Capabilities

What you get in every size

The interface is identical across the family. Prototype on E4B on your laptop, deploy on 31B in production, and none of your prompting or tool schemas need to change.

🧠

Configurable thinking

A thinking mode that emits reasoning traces before responding, and can be dialled down or off when you need latency instead of depth.

🛠️

Native function calling

Tool schemas and strict structured JSON output are trained in, not prompted in - with July's patches fixing the JSON reliability issues agent builders hit at launch.

👁️

Multimodal input

Images at variable aspect ratio and resolution across the family; E2B, E4B and 12B add native video and audio understanding.

🌍

140+ languages

A 262K-entry SentencePiece vocabulary trained for genuine multilingual coverage, including audio transcription and translation on the edge models.

📜

256K context

Long-context retrieval and reasoning on 12B, 26B and 31B; 128K on the edge models - enough for whole codebases and long document sets.

Multi-token prediction

MTP checkpoints enable self-speculative decoding without a separate draft model, plus FlashAttention 4 support on Hopper GPUs.

💻

Code generation

80.0 on LiveCodeBench v6 for the 31B, with strong performance across 50+ programming languages and agentic coding workflows.

🔓

Apache 2.0, genuinely

Open weights, commercial use, redistribution and fine-tuning permitted. No usage caps, no revenue thresholds, no acceptable-use rider.

Performance

Benchmarks from the technical report

Instruction-tuned checkpoints, thinking mode enabled. The 31B ranks #3 among open models on the Arena text leaderboard and #6 for the 26B A4B - while frequently matching models an order of magnitude larger.

AIME 2026

Competition mathematics
31B Dense89.2
26B A4B MoE88.3
12B Unified77.5

GPQA Diamond

Graduate-level science reasoning
31B Dense84.3
26B A4B MoE82.3
12B Unified78.8

MMLU Pro

Broad knowledge and reasoning
31B Dense85.2
26B A4B MoE82.6
12B Unified77.2

LiveCodeBench v6

Contamination-free code generation
31B Dense80.0
26B A4B MoE77.1
12B Unified72.0

Vision and full score table

BenchmarkWhat it measures31B26B A4B12B
MMLU ProBroad knowledge & reasoning85.282.677.2
AIME 2026Competition mathematics89.288.377.5
GPQA DiamondGraduate science reasoning84.382.378.8
LiveCodeBench v6Code generation80.077.172.0
MMMU ProMultimodal understanding76.973.869.1
MathVisionVisual mathematical reasoning85.682.479.7

Source: Gemma 4 Technical Report (arXiv:2607.02770). Training data cutoff January 2025.

Comparison

How Gemma 4 stacks up

The honest summary: frontier closed models still lead on absolute capability. Gemma 4's argument is that it is the most capable thing you can actually download, own, and run on a phone.

ModelWeightsLicenseMax contextMultimodalRuns on-device
Gemma 4 (Google) OpenApache 2.0256K Text·Image·Audio·VideoYes - down to 1.1 GB
Llama 4 (Meta) OpenCommunity licenseLongText·ImageLimited
Qwen 3.6 (Alibaba) OpenApache 2.0LongText·ImagePartial
DeepSeek OpenMIT / customLongMostly textRarely
Gemini 3 (Google) ClosedAPI termsVery longFullNo
GPT-5 (OpenAI) ClosedAPI termsLongFullNo
Claude Opus 4.x (Anthropic) ClosedAPI termsLongText·ImageNo

Choose Gemma 4 when…

Your data can't leave your infrastructure, you need offline or on-device inference, you want to fine-tune the weights, or per-token API pricing doesn't work at your volume.

Consider a frontier API when…

You need the absolute strongest reasoning available, don't want to manage serving infrastructure, or your volume is low enough that API pricing is cheaper than a GPU.

Or run both

A common pattern in 2026: E4B or 12B locally for routing, extraction and drafting, escalating only the hard cases to a larger hosted model. Most of the volume never leaves your machine.

Competitor rows are a positioning summary, not benchmarked head-to-head results - capabilities of hosted models change frequently. Verify current specs against each vendor's documentation.

Get started

Running in about two minutes

Pick your stack. If you pulled weights before mid-July 2026, re-pull them - the refresh included chat-template and tool-calling fixes that are worth having.

# Install Ollama, then pull a model that fits your machine
ollama pull gemma4:e4b        # ~4.5 GB - laptops, single consumer GPU
ollama pull gemma4:12b        # ~6.7 GB Q4 - 16 GB unified memory
ollama pull gemma4:26b-a4b    # ~14.4 GB Q4 - MoE, fast inference
ollama pull gemma4:31b        # ~17.5 GB Q4 - flagship quality

# Chat interactively
ollama run gemma4:12b

# Or call the OpenAI-compatible endpoint
curl http://localhost:11434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"gemma4:12b","messages":[{"role":"user","content":"Explain MoE routing"}]}'
from transformers import pipeline
import torch

pipe = pipeline(
    "text-generation",
    model="google/gemma-4-12b-it",
    torch_dtype=torch.bfloat16,
    device_map="auto",
)

messages = [
    {"role": "system", "content": "You are a precise technical assistant."},
    {"role": "user", "content": "Summarise this paper in five bullets."},
]

out = pipe(messages, max_new_tokens=512)
print(out[0]["generated_text"][-1]["content"])

# Multimodal: pass image or audio content blocks in the same messages list.
# Thinking mode is controlled through the chat template kwargs.
# Production serving with an OpenAI-compatible API
pip install vllm

vllm serve google/gemma-4-26b-a4b-it \
  --max-model-len 262144 \
  --enable-auto-tool-choice \
  --tool-call-parser gemma \
  --tensor-parallel-size 2

# On Hopper GPUs, FlashAttention 4 (July 2026) gives
# +25-70% prefill throughput and up to -31% time-to-first-token.
# GGUF quantisations for CPU + GPU offload
git clone https://github.com/ggml-org/llama.cpp && cd llama.cpp
cmake -B build && cmake --build build --config Release -j

# Pull a GGUF straight from Hugging Face and serve it
./build/bin/llama-server \
  -hf google/gemma-4-12b-it-GGUF \
  --ctx-size 32768 \
  --n-gpu-layers 99 \
  --port 8080
# Apple silicon - fastest path on an M-series Mac
pip install mlx-lm

mlx_lm.generate \
  --model mlx-community/gemma-4-12b-it-4bit \
  --prompt "Transcribe and summarise the attached audio." \
  --max-tokens 1024

# 12B Q4 needs roughly 6.7 GB, so it fits a 16 GB Mac
# alongside everything else you have open.
# Prefer not to host it? Gemma 4 is served by several providers.
# Google AI Studio, Vertex AI, OpenRouter, Together, Fireworks.

curl https://openrouter.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemma-4-31b-it",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

# Hosted Gemma 4 typically prices well under $1 per million tokens.
# Check each provider for current rates.

Exact model tags vary by provider - check the Hugging Face collection or your runtime's registry for current identifiers before copying these verbatim.

Where to get the weights

Deploy

From a phone to a GPU cluster

The same weights run across the whole range. What changes is the runtime.

📱

On-device

E2B and E4B ship through LiteRT-LM, MediaPipe and the Android AICore Developer Preview. Fully offline, no data leaves the handset, mobile builds from 1.1 GB.

☁️

Google Cloud

Vertex AI Model Garden for managed endpoints, Cloud Run for serverless GPU serving, and GKE when you need full control over autoscaling and topology.

🅰️

AWS

Available in Amazon SageMaker JumpStart since April 2026, and on Amazon Bedrock in AWS GovCloud (US-West) since July for regulated US public-sector workloads.

🐳

Self-hosted

vLLM and SGLang for high-throughput serving, NVIDIA NIM and NeMo for enterprise GPU stacks, TGI and plain Docker for everything in between.

🎯

Fine-tuning

LoRA and QLoRA through TRL, PEFT and Unsloth; full fine-tuning with JAX or Keras. Apache 2.0 means you own and can redistribute the result.

🧪

Experimentation

Kaggle Notebooks give you free GPU time, Google AI Studio gives you a playground and an API key, and LM Studio gives you a desktop GUI with no terminal required.

Ecosystem support

Hugging Face TransformersOllamallama.cpp MLXvLLMSGLangUnsloth LM StudioNVIDIA NIMNVIDIA NeMo KerasJAXTRL / PEFT Vertex AICloud RunGKE SageMaker JumpStartAmazon Bedrock LiteRT-LMMediaPipeAndroid AICore KaggleOpenRouterTogetherFireworks
FAQ

Common questions

Is Gemma 4 really free, and can I use it commercially?

Yes. The weights are released under Apache 2.0, which permits commercial use, modification, redistribution and building proprietary products on top. There are no usage caps, revenue thresholds or acceptable-use riders attached to the license. You pay only for the compute you run it on - your own hardware, a cloud GPU, or a hosted provider's per-token fee.

Which model should I pick?

Start from your memory budget. Under 4 GB and you're on a phone: E2B. A laptop or single consumer GPU: E4B, or 12B if you have 16 GB. Serving at volume: 26B A4B, because only ~3.8B parameters activate per token. Maximum quality regardless of cost: 31B dense.

If you need audio input, use E2B, E4B or 12B - those are the models with native audio.

What changed in the July 2026 update? Is it "Gemma 4.1"?

No new version number - it's refreshed weights and configs under the existing Gemma 4 name. Three things matter: FlashAttention 4 support for NVIDIA Hopper GPUs (25–70% faster prefill, up to 31% lower time-to-first-token), substantially more reliable tool calling and JSON output, and a larger vision token budget that improves OCR on documents and screenshots.

The chat template also changed to reduce role-tag leakage. If you cached weights before mid-July, re-pull them.

What makes the 12B "encoder-free" and why does it matter?

Most multimodal models attach separate vision and audio encoders to a language backbone. Gemma 4 12B doesn't: image patches go through a lightweight embedding module - matrix multiplication, positional embedding, normalisation - and audio is projected directly into the same dimensional space as text tokens with no encoding stage at all.

Practically, that means fewer moving parts, lower memory, and quality approaching the 26B MoE at less than half the footprint. It's why 12B fits on a 16 GB laptop.

How long is the context window really?

256K tokens on 12B, 26B A4B and 31B; 128K on E2B and E4B. Gemma 4 uses a pp-RoPE positional scheme (p=0.25) that reduces KV cache footprint by up to 37.5%, which is what makes long context practical on modest hardware rather than just nominally supported.

Can I fine-tune it?

Yes, and the license lets you keep and redistribute the result. LoRA and QLoRA work through TRL, PEFT and Unsloth - QLoRA on E4B is comfortable on a single 24 GB card. Full fine-tuning is supported via JAX and Keras. Google also publishes fine-tuning notebooks you can run for free on Kaggle.

Does it run on a phone?

E2B is designed for it, with a mobile build around 1.1 GB, and E4B at roughly 2.5 GB works on higher-end devices. Distribution is through LiteRT-LM and MediaPipe, and Gemma 4 is in the Android AICore Developer Preview. Inference is fully offline - nothing leaves the device.

How does it compare to closed frontier models?

On raw capability, models like Gemini 3, GPT-5 and Claude Opus 4.x remain ahead. That's the honest answer.

Gemma 4's case is different: it's the strongest thing you can download and own. For workloads where data residency, offline operation, fine-tuning or per-token economics matter more than the last few benchmark points, that trade is usually the right one. Many teams run both - a small local model for the bulk of the volume, escalating only hard cases to a hosted frontier model.

What languages does it support?

140+ languages, backed by a 262K-entry SentencePiece vocabulary. The edge models additionally handle multilingual audio transcription and translation, with Japanese, German, French, Spanish, Italian, Russian and Chinese specifically evaluated in the technical report. If translation is your primary workload, look at TranslateGemma (4B / 12B / 27B) instead.

What's the knowledge cutoff?

Training data has a cutoff of January 2025. For anything more recent, use retrieval or tool calling rather than relying on the model's parametric knowledge - function calling is native and, since July, considerably more reliable.

What is "thinking mode"?

A configurable mode where the model emits reasoning traces before its final answer, which is what drives the strong AIME and GPQA numbers. It costs latency and tokens, so it's adjustable - turn it down for chat and classification, turn it up for maths, code and multi-step agentic work.

How popular is it?

The Gemma family passed 900 million cumulative downloads as of August 2026, with Gemma 4 accounting for more than 150 million of those since launch. It's among the most widely deployed open model families in production.

Download it. Own it. Ship it.

Open weights under Apache 2.0, five sizes, and a runtime for every piece of hardware you have. No API key required unless you want one.