Skip to content

Gemma 4 Developer Guide: Google's Most Capable Open-Source LLM Explained

Updated:
GenAI

TL;DR

Released April 2026 under Apache 2.0, Gemma 4 comes in four sizes — E2B, E4B, 26B MoE, and 31B Dense. The 31B ranks 3 among all open models globally with 256K context and native agentic workflows. A complete breakdown for AI developers.

Gemma 4 Developer Guide: Google's Most Capable Open-Source LLM Explained

On April 2, 2026, Google DeepMind released Gemma 4. The original article highlights Apache 2.0 licensing, agent capabilities in edge models and a reported top-three position for the 31B model among open models.

This guide translates the article’s release-time specifications and deployment examples. Rankings, hardware estimates and framework support describe that snapshot; they are not a current compatibility certification.

Why Gemma 4 matters

Meta’s Llama family had dominated much of the open-model discussion. From Gemma 3 onward, Google pursued smaller models, stronger performance and broader tooling. Gemma 4 adds Apache 2.0 licensing, native function calling and structured output, with four sizes spanning mobile devices and servers.

Four model variants

E2B: a speed-focused edge model

  • Effective parameters: 2.3B
  • Context window: 128K tokens
  • Inputs: text, images and audio
  • Stated memory requirement: below 1.5GB RAM
  • Intended uses: mobile applications, Raspberry Pi, Jetson Nano and low-latency tasks

The article describes E2B as the fastest family member, three times faster than its predecessor. It identifies it as a core engine for Android AI Core and a technical foundation for Gemini Nano 4, anticipating reuse of applications on compatible devices.

E4B: balancing quality and speed

  • Effective parameters: 4.5B
  • Context window: 128K tokens
  • Inputs: text, images and audio
  • Intended use: edge deployments needing stronger reasoning

E4B retains audio understanding while improving reasoning and instruction following. The article reports 60% lower power consumption for both edge models than their predecessors, particularly on Android devices.

26B A4B: mixture-of-experts efficiency

  • Total parameters: 26B, with 3.8B active during inference
  • Context window: 256K tokens
  • Inputs: text and images
  • AIME 2026: 88.3%
  • Reported open-model ranking: sixth

The MoE architecture activates only 3.8 billion of its 26 billion parameters per inference. The article presents it as an economical route to near-31B output quality, reporting an Arena AI Elo of approximately 1,441.

31B Dense: the flagship

  • Parameters: 31B, fully dense
  • Context window: 256K tokens
  • Inputs: text, images and video up to 60 seconds
  • MMLU Pro: 85.2%
  • AIME 2026: 89.2%
  • GPQA Diamond: 85.7%
  • LiveCodeBench v6: 80.0%
  • Arena AI Elo: approximately 1,452; reported third among open models
  • Suggested hardware in the article: one NVIDIA H100 80GB

The article recommends the dense version as a fine-tuning base, arguing that uniform weight updates can make LoRA or QLoRA more stable than on the MoE variant.

Core capabilities

Agent foundations

The family supports function calling, structured JSON output and system prompts without additional fine-tuning. Developers can define tools and allow the model to select calls, constrain output to a schema and establish role and behavior instructions.

These are foundations for an agent backbone; a deployment still needs the surrounding application logic.

Long context

The 26B MoE and 31B Dense variants support 256K input tokens. The article compares that with roughly 200,000 Chinese characters, a medium-sized GitHub repository or hundreds of images. These are rough comparisons, not interchangeable capacity guarantees. E2B and E4B support 128K tokens.

Multimodal understanding

ModelTextImagesAudioVideo
E2BYesYesYesYes
E4BYesYesYesYes
26B MoEYesYes—Up to 60 seconds
31B DenseYesYes—Up to 60 seconds

Audio understanding is concentrated in the edge variants, supporting on-device voice applications with less cloud transmission. The larger models support video clips up to 60 seconds at one frame per second for analysis and information extraction.

Apache 2.0 licensing

Earlier Gemma releases used Google’s own license. The article describes Gemma 4 as the first family release fully under Apache 2.0, allowing model modification, redistribution and commercial integration without a separate permission request under that license.

Hardware estimates

ModelINT4 VRAMBF16 VRAMSuggested GPU
E2BAbout 5 GBAbout 15 GBRTX 3060 or above
E4BAbout 5 GBAbout 15 GBRTX 3060 or above
26B MoEAbout 18 GB—RTX 4090 / A100 40GB
31B DenseAbout 20 GBAbout 34 GBA100 80GB / H100

These are the original article’s estimates. It also suggests 4GB entry-level GPUs for the edge variants and below 1.5GB RAM for E2B elsewhere; those figures refer to different stated configurations and should not be treated as a consistent measured minimum. Verify the actual quantization, context and runtime before choosing hardware.

For local development, the article proposes an RTX 4090 with 24GB VRAM for the INT4 26B MoE model and its reported Elo of 1,441.

Deployment examples

These snippets are translated examples from the original guide. Model identifiers, available runtimes and cloud resources must be checked for the intended environment.

Ollama

# Run after installing Ollama
ollama run gemma4

# Model-size example from the original article
ollama run gemma4:27b

The original suggests this route for local development, testing and personal use. The 27b tag above is reproduced from its example, while the model overview describes 26B and 31B variants; confirm the actual registry tag before running it.

Hugging Face Transformers

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_id = "google/gemma-4-31B-it"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto"
)

messages = [
    {"role": "user", "content": "Explain the benefits and drawbacks of Mixture of Experts."}
]

input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
outputs = model.generate(input_ids, max_new_tokens=512)
print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))

Google Vertex AI

from google.cloud import aiplatform

# Illustrative Model Garden deployment
aiplatform.init(project="your-project-id", location="us-central1")

endpoint = aiplatform.Endpoint.create(display_name="gemma-4-endpoint")
model = aiplatform.Model("gemma-4-31b-it")
model.deploy(endpoint=endpoint, machine_type="n1-standard-8", accelerator_type="NVIDIA_L4")

GGUF and llama.cpp

./llama-cli -m gemma-4-31B-it.Q4_K_M.gguf \
  --ctx-size 65536 \
  --n-gpu-layers 35 \
  -i

The article proposes a quantized 31B model on a single 24GB RTX 4090. It lists release-day support across Ollama, Transformers, vLLM, llama.cpp, MLX for Apple Silicon, NVIDIA NIM/NeMo, AMD ROCm, LM Studio, Unsloth, SGLang, Keras, LiteRT-LM and NVIDIA Jetson Orin Nano.

Competitive position

The original calls Gemma 4 31B third among open models, while also naming Qwen 3.5, GLM-5 and Kimi K2.5 as models ahead of it. That wording is internally inconsistent; it does not establish an exact current rank.

Its comparative argument rests on Apache 2.0 licensing, integration with Vertex AI and Android AI Core, MoE efficiency and the increase in AIME performance from 20.8% for Gemma 3 to 89.2% for Gemma 4, described as roughly fourfold. Licensing terms for competing models must be evaluated individually.

The wider Gemma family

ModelPurposeCharacteristic
Gemma 4General conversation and agentsOpen-model flagship
Gemma 3nMobile and edge AIPLE technology; 2–4GB RAM
CodeGemmaCode generation and completionDevelopment tasks
PaliGemma 2Image understanding and fine-tuningVision-language model
ShieldGemma 2Content-safety classification4B image-safety classifier

For a narrow task, a specialist model may be more efficient than the general flagship.

Version timeline as presented in the original

2025/02  Gemma 1: 1B and 7B
2025/03  Gemma 3: 1B, 4B, 12B and 27B; multimodal; 128K context
2025/05  Gemma 3n: E2B and E4B; mobile-first PLE architecture
2025/07  Gemma 3 270M: lightweight fine-tuning model
2026/04  Gemma 4: E2B, E4B, 26B MoE and 31B; agents; Apache 2.0

This reproduces the source article’s chronology rather than independently rechecking each release date.

Choosing a variant

The article recommends E2B or E4B with Android AI Core SDK for mobile and edge applications; 26B MoE or 31B Dense for agent workflows using function calling and long context; and 31B Dense with Unsloth or Hugging Face PEFT for domain fine-tuning through QLoRA.

For teams considering a move from Llama, it emphasizes licensing and Google’s ecosystem. Those are evaluation criteria, not substitutes for testing the intended task, hardware and integration.

Further reading: The Claude Code harness leak and agent architecture.

More on this topic

Random article