Gemma 4 Open-Source Hands-On: 31B Cracks the Global Top Three, 2B Runs Agents Offline on a Phone

·Toolin Editorial Team

Google has released the Gemma 4 family — truly open source under Apache 2.0, covering everything from 2B to 31B, with multimodal agents running offline on phones. Includes a local deployment guide.

Gemma 4 Open-Source Hands-On: 31B Cracks the Global Top Three, 2B Runs Agents Offline on a Phone

In One Sentence

Gemma 4 is Google DeepMind's open-source model family built on technology shared with Gemini 3, in four sizes (E2B/E4B/26B MoE/31B Dense), all under the Apache 2.0 license — free to use commercially, modify, and embed in products.

Key Numbers

First, the numbers that matter most:

ModelEffective ParametersContext WindowArena AI RankTypical Deployment
E2B2B128K-Phone / IoT / Raspberry Pi
E4B4B128K-Mobile / Jetson Nano
26B MoE3.8B active256K6th in open sourceLow-latency agents / fast inference
31B Dense31B256K3rd in open sourceWorkstation / single H100

Gemma 4 model family overview

Why does this ranking matter? The 31B Dense scores 1452 Arena AI Elo, and the only models ahead of it are the 745B GLM-5 and the 1T Kimi K2.5. With a 31B footprint, Gemma 4 has forced its way onto the table of hundred-billion-parameter models — extraordinary parameter efficiency.

The Leap Over the Previous Generation

Compared with Gemma 3 27B, the gains for Gemma 4 31B across three core scenarios:

  • Math reasoning (AIME 2026): 20.8% -> 89.2%, a 4x improvement
  • Coding (LiveCodeBench v6): 29.1% -> 80.0%, a generational gap
  • Agent tool calling (tau2-bench): 6.6% -> 86.4%, from unusable to benchmark-setting

Gemma 4 benchmark results

On-Device Capability: Agents Running Offline on Phones

E2B and E4B are the most noteworthy part of this release.

Optimized in deep collaboration with the Google Pixel team, Qualcomm, and MediaTek, these two models run fully offline on Pixel phones, the Raspberry Pi, and the Jetson Orin Nano with near-zero latency. They are not cut-down versions — they deliver full multimodal agent capabilities:

  • Native image and video input
  • Native audio input (exclusive to E2B/E4B)
  • Native function calling, JSON structured output, and system instructions
  • Support for 140+ languages

E2B running on a Pixel phone

One telling comparison: E2B scores 43.4% on the GPQA Diamond science benchmark, while the previous-generation Gemma 3 27B scores 42.4%. A 2B model on a phone has caught up with the previous generation's 27B desktop model.

Google also shipped the Android app Google AI Edge Gallery (downloadable on Google Play), with a built-in Skills experience area where you can try Agent mode right on your phone.

Architecture Highlights

Gemma 4 doesn't pile on flashy concepts; it combines a handful of proven techniques into an optimal configuration:

Per-layer embeddings (PLE) -- exclusive to E2B/E4B. Every decoder layer gets its own low-dimensional embedding table, adding no layers while significantly improving parameter efficiency.

Shared KV cache -- the last N layers reuse KV tensors from earlier layers, cutting inference memory and compute; long-context generation benefits most.

Alternating attention -- local sliding windows and global attention used alternately, balancing speed with deep perception.

Local Deployment Guide

Option 1: Ollama (fastest to get started)

# Pull directly after installing Ollama
ollama run gemma4:31b

# 26B MoE version (faster)
ollama run gemma4:26b-moe

# Small on-device model
ollama run gemma4:e4b

Option 2: Hugging Face + Transformers

from transformers import AutoModelForCausalLM, AutoTokenizer

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

Model weights are already up on Hugging Face, Kaggle, and Ollama. Mainstream frameworks supported on launch day: Transformers, vLLM, llama.cpp, MLX, Unsloth, SGLang, Keras.

Hardware Requirements Reference

Modelbfloat16 VRAMVRAM after quantization (4bit)
31B Dense~62 GB (single H100 80GB)~18 GB (consumer GPU)
26B MoE~52 GB~15 GB
E4B~8 GB~3 GB
E2B~4 GB~1.5 GB

What Apache 2.0 Really Means

This time it is not “open weights” — it is true Apache 2.0 open source:

  • Completely free for commercial use, modification, and redistribution
  • Built-in patent protection
  • No custom clauses, no gray areas
  • Can be legally bundled into hardware products and industry equipment

Hugging Face CEO Clément Delangue called it “a major milestone.” Since the first generation launched in February 2024, the Gemma family has passed 400 million total downloads, with more than 100,000 community-derived variants.

Toolin's Take

Who it's for:

  • Enterprises that need on-premise deployment with data never leaving the device (healthcare, finance, industrial)
  • Mobile developers who want to run agents on edge devices
  • AI engineers who need a cost-effective open-source base model for fine-tuning

Who it's not for:

  • Users who need the strongest all-around capability (Claude Opus 4.6 and GPT-5 remain the ceiling)
  • Complex multimodal tasks (Simon Willison's hands-on: small models still fall short on complex visual generation)

Core strengths: Apache 2.0 + on-device multimodality + parameter efficiency. Nothing else on the market combines these three today.

Limitations: although the MoE model activates only 3.8B parameters, all 26B still have to be loaded into memory. And the real-world multimodal capability of on-device models is still maturing.


Related links: