Everything scattered across Google's docs, HuggingFace, and community threads — compiled in one place.
Google DeepMind released Gemma 4 on April 3rd, 2026. The headline benchmark numbers are impressive. But the more important story is the license change.
Previous Gemma releases used a custom Google license with usage restrictions that made enterprise legal teams nervous. Gemma 4 ships under Apache 2.0 — the same permissive terms used by Qwen, Mistral, and most of the open-weight ecosystem. No custom clauses, no redistribution restrictions, no legal gray areas. For teams that had been waiting to build commercial products on Gemma, the wait is over.
This guide covers the full model family, what the architecture decisions actually mean in practice, and deployment paths across mobile, local, and cloud.
Gemma 4 ships in four sizes, but the differences go beyond parameter count.
E2B — Dense + PLE architecture, ~2.3B active params, ~2GB VRAM (4-bit), target: Mobile/edge
E4B — Dense + PLE architecture, ~4.5B active params, ~3.6GB VRAM (4-bit), target: Laptop/tablet
26B A4B — MoE architecture, 3.8B active params, ~16GB VRAM (4-bit), target: Consumer GPU
31B — Dense architecture, 30.7B active params, ~18GB VRAM (4-bit), target: Workstation
The E2B result deserves attention. Community benchmarks confirm it outperforms Gemma 3 27B on several tasks despite having 12x fewer effective parameters. Google's efficiency improvements at the architecture level — specifically Per-Layer Embeddings — are doing real work.
The 26B A4B naming needs unpacking. "A4B" means "active 4B" — this is a Mixture-of-Experts model with 25.2B total parameters, but only 3.8B activate per token during inference. Running it locally feels closer to a 4B model in terms of speed and memory, while output quality approaches the 31B dense model.
Standard transformers give each token a single embedding vector at input. Every layer then builds on that same initial representation.
PLE adds a parallel lower-dimensional conditioning pathway alongside the main residual stream. For each token, it produces a small dedicated vector for every decoder layer — combining a token-identity component and a context-aware component from the main embeddings. Each layer then uses its corresponding vector to modulate hidden states via a lightweight residual block.
The practical result: each layer gets token-specific information only when it becomes relevant, rather than requiring everything to be frontloaded into a single embedding. This is what enables E2B to run under 1.5GB RAM on mobile devices via LiteRT-LM.
Gemma's MoE implementation differs from DeepSeek and Qwen. Instead of replacing MLP blocks with sparse experts, Gemma adds MoE blocks as separate layers alongside standard MLP blocks and sums their outputs.
This means self-hosting the 26B A4B requires memory for active parameters during inference (~4B equivalent), but you still need to load the full 25.2B parameter set into memory. The inference cost advantage is real; the memory loading advantage is more modest.
All Gemma 4 models alternate between local sliding-window attention and global full-context attention layers. Smaller models use 512-token sliding windows; larger ones use 1024. The final layer is always global.
Global layers use Shared KV Cache — reusing key-value states from earlier layers to eliminate redundant KV projections.
Known issue: KV cache footprint at long context is substantial. Community reports indicate the 31B at 262K context requires approximately 22GB just for KV cache, on top of model weights. This makes the advertised 256K context window practically inaccessible on most consumer hardware.
Workaround:
--ctx-size 8192 --cache-type-k q4_0 --parallel 1
The fastest path to running Gemma 4 locally. Requires Ollama 0.20 or newer.
# E4B — recommended starting point for most laptops
ollama pull gemma4:e4b
ollama run gemma4:e4b
# 26B A4B — needs 16GB+ VRAM
ollama pull gemma4:26b-a4b
ollama run gemma4:26b-a4b
# 31B — needs 20GB+ VRAM
ollama pull gemma4:31b
ollama run gemma4:31b
Community benchmarks on MacBook M4 Pro 24GB:
A tokenizer fix was merged into the main branch shortly after launch. Pull the latest and recompile before running Gemma 4 GGUF files — earlier builds produce incorrect outputs.
Recommended quantization starting points:
Unsloth MLX builds use approximately 40% less memory than Ollama at the cost of 15-20% lower token throughput. Worth considering for memory-constrained setups.
pip install mlx-lm
mlx_lm.generate \
--model unsloth/gemma-4-e4b-it-mlx \
--prompt "Explain the difference between MoE and Dense architecture"
Search "gemma4" in the model browser. E4B and 26B A4B are available as pre-quantized GGUF files. Recommended for non-technical users who want a GUI.
This is where Android and iOS diverge significantly. The official paths are not equivalent.
Android has the most complete official on-device story, built around Google's AI Edge tooling stack.
Google AI Edge Gallery
Install from the Play Store. Select Gemma 4 E2B or E4B. Runs fully on-device with no internet connection required. The fastest way to evaluate Gemma 4 on Android hardware.
LiteRT-LM
Google's production framework for on-device inference. Supports 2-bit and 4-bit quantization. Gets E2B running under 1.5GB RAM on supported devices. Use this if you're building your own app.
ML Kit GenAI Prompt API
Production-ready API for integrating Gemma 4 into Android applications. Forward-compatible with Gemini Nano 4.
Android AICore
System-wide access to the optimized on-device Gemma 4 model. AICore Developer Preview available now for prototyping on supported Android 10+ devices.
iOS is currently a developer integration story. There is no consumer-facing App Store app for Gemma 4 on iPhone.
The official path is the MediaPipe LLM Inference SDK. It works, but the setup is significantly more involved than the Android side.
A practical side-by-side reference for both platforms is available at gemma4.app/mobile.
Vertex AI
Fully managed deployment with autoscaling. Best for production workloads where you need SLA guarantees and don't want to manage infrastructure.
Cloud Run
Serverless container deployment. Lower operational overhead than GKE. Good fit for moderate traffic workloads.
Google Kubernetes Engine (GKE) + vLLM
High-throughput serving for teams already running Kubernetes infrastructure. Most flexible option for custom serving configurations.
For API access without self-hosting, the 26B A4B is available on OpenRouter at $0.13/M input tokens and $0.40/M output tokens.
QLoRA fine-tuning tooling was not production-ready at launch. Three issues surfaced within the first 24 hours:
HuggingFace Transformers architecture recognition
The gemma4 architecture wasn't recognized, requiring installation from source. This has since been resolved in recent releases.
PEFT and Gemma4ClippableLinear
PEFT couldn't handle a new layer type in the vision encoder. A monkey-patch workaround exists but isn't ideal for production fine-tuning pipelines.
mm_token_type_ids requirement
A new field is required during training even for text-only data, requiring a custom data collator.
Issues have been filed on both huggingface/peft and huggingface/transformers. Verify your toolchain versions before attempting fine-tuning.
AIME 2026: E2B 37.5% / E4B 42.5% / 26B A4B 88.3% / 31B 89.2%
GPQA Diamond: 26B A4B 82.3% / 31B 84.3%
LiveCodeBench v6: E2B 44.0% / E4B 52.0% / 26B A4B 77.1% / 31B 80.0%
MMMU Pro: 26B A4B 73.8% / 31B 76.9%
Codeforces ELO: 31B 2150
The 31B currently ranks #3 among open models on Arena AI. The E2B numbers are the real story — a model that runs on a phone scoring 37.5% on AIME 2026, while Gemma 3 27B scored 20.8% on the same benchmark.
Privacy-first mobile apps: E2B via LiteRT-LM on Android. Fully offline, under 1.5GB RAM.
Local assistant on a laptop: E4B via Ollama. Runs well on most modern laptops.
Best open model on consumer GPU: 26B A4B. MoE efficiency means inference cost of a 4B model with quality approaching 31B.
Maximum quality, workstation: 31B Dense. Needs 20GB+ VRAM for comfortable operation.
Production cloud: Vertex AI for managed deployment, GKE + vLLM for high throughput.
The Apache 2.0 license removes previous friction for commercial use. For teams evaluating open models for production, Gemma 4 is now a first-class option.
A live playground, hardware planning tool, and complete deployment guides for all four models are available at gemma4.app.