Chuyển đến nội dung chính

Gemma 4: Google's Most Powerful Open AI Model — Agentic Workflow, On-Device, and Apache 2.0

Duy Tran15 min
Gemma 4: Google's Most Powerful Open AI Model — Agentic Workflow, On-Device, and Apache 2.0

On April 2, 2026, Google DeepMind officially launched Gemma 4 — the most powerful family of open AI models they've ever released. With an Apache 2.0 license, support for agentic workflows, vision & audio, 140+ languages, and the ability to run directly on devices from Raspberry Pi to smartphones, Gemma 4 isn't just an upgrade — it's a complete game changer for open-source AI.

The results? The 31B model ranks #3 globally on the Arena AI leaderboard (open models), outperforming many models 20x larger in parameter count. The 26B MoE model claims #6. And the edge E2B variant runs smoothly on phones with under 1.5GB RAM.

This article provides a comprehensive analysis: architecture, capabilities, benchmarks, ecosystem, and how you can start using Gemma 4 today.


1. What Is Gemma 4?

Gemma 4 is a family of large language models (LLMs) from Google DeepMind, built on the same technology and research as Gemini 3 — but designed to run on your hardware.

Since its first generation, Gemma has been downloaded over 400 million times, creating the Gemmaverse ecosystem with more than 100,000 community-contributed variants. Gemma 4 is the biggest leap forward in this product line.

Design Philosophy

Gemma 4 doesn't chase models with hundreds of billions of parameters. Instead, Google focuses on intelligence-per-parameter — maximum intelligence per parameter. The goal: achieve frontier-level capability with significantly lower hardware requirements.


2. Four Sizes, Four Use Cases

Google releases Gemma 4 in 4 variants designed for different hardware segments:

ModelArchitectureContext WindowTarget HardwareKey Features
E2B (Effective 2B)Compact128KSmartphone, IoT, Raspberry PiAudio + Vision, <1.5GB RAM
E4B (Effective 4B)Compact128KSmartphone, tabletMultimodal, agentic on-device
26B MoEMixture of Experts256KConsumer GPU, workstationOnly activates 3.8B params → high speed
31B DenseDense256KGPU H100 80GB (bfloat16)Maximum quality, fine-tuning foundation

2.1. E2B and E4B — AI on Every Device

These two edge models are designed from the ground up for maximum computational efficiency and memory use. They only activate an effective footprint of 2B and 4B parameters during inference, saving RAM and battery.

Key features:

  • Native audio input: Voice recognition and audio understanding directly on device
  • Native vision: Processing video and images at multiple resolutions, OCR, chart understanding
  • Runs fully offline on Raspberry Pi 5, NVIDIA Jetson Orin Nano, Qualcomm, MediaTek
  • Integrates with Android AICore Developer Preview — forward-compatible with Gemini Nano 4

Impressive metrics on Raspberry Pi 5 with LiteRT-LM:

  • Prefill: 133 tokens/second
  • Decode: 7.6 tokens/second
  • Fast enough for smart home controllers, voice assistants, and offline robotics

2.2. 26B MoE — Frontier Speed on Consumer Hardware

A Mixture of Experts model with 26B total parameters but only activating 3.8B per inference. Result: astonishing tokens-per-second speed while still achieving frontier quality.

  • #6 on the Arena AI leaderboard (open models)
  • Quantized version runs on consumer GPUs
  • Ideal for IDEs, coding assistants, and agentic workflows requiring low latency

2.3. 31B Dense — Maximum Quality

A traditional dense model, optimized for raw quality and the strongest foundation for fine-tuning.

  • #3 globally on the Arena AI text leaderboard (open models)
  • Outperforms models 20x larger in parameter count
  • bfloat16 weights fit on a single NVIDIA H100 80GB GPU
  • Quantized version runs on consumer GPUs

3. Standout Capabilities

3.1. Agentic Workflow — Not Just a Chatbot

This is Gemma 4's biggest leap over the previous generation. The model supports natively:

  • Function calling: Directly calling tools and APIs
  • Structured JSON output: Structured, reliable output for production
  • Native system instructions: System guidance at the native level
  • Multi-step planning: Planning and executing multi-step workflows

This means you can build autonomous agents running entirely on-device, without internet, without sending data to the cloud.

3.2. Vision & Audio

All Gemma 4 models natively process video and images:

  • Variable resolution support
  • High-quality OCR
  • Chart and graph understanding
  • E2B/E4B also supports native audio input for speech recognition

3.3. Code Generation

Gemma 4 supports high-quality offline code generation, turning your workstation into a local-first AI code assistant. Combined with 26B MoE (high speed) or 31B Dense (maximum quality), you get a coding assistant experience independent of the cloud.

3.4. 140+ Languages

Natively trained on more than 140 languages — including Vietnamese. This is a major advantage for developers building applications serving multilingual and global markets.

3.5. Extended Context Window

  • Edge models (E2B, E4B): 128K tokens
  • Larger models (26B, 31B): 256K tokens

Sufficient to pass an entire code repository or long document in a single prompt.


4. Agent Skills on Edge — The Future of On-Device AI

Google simultaneously launched Agent Skills in the Google AI Edge Gallery app — one of the first applications to run multi-step, autonomous, fully on-device agentic workflows.

What Can Gemma 4 on Edge Do?

1. Expand knowledge base: Agents can access information beyond their training data. Example: create a Wikipedia query skill to answer any encyclopedia question.

2. Create interactive content: Transform text or video into summaries, flashcards, and interactive charts. Example: automatically summarize and display daily sleep/mood trends from user voice input.

3. Extend core capabilities: Integrate with other models like text-to-speech, image generation, and music synthesis. Example: pair photos with mood-appropriate music.

4. End-to-end experiences: Instead of switching between multiple apps, users manage complex workflows entirely through conversation. Google demonstrated an app that describes and plays animal sounds — built entirely through conversation.

LiteRT-LM — Runtime for On-Device

LiteRT-LM is a new runtime enabling Gemma 4 deployment on any device:

  • Minimal memory: Gemma 4 E2B runs with <1.5GB memory thanks to 2-bit and 4-bit weight support
  • Constrained decoding: Structured output, ensuring reliable tool-calling in production
  • Dynamic context: Flexible processing on CPU and GPU with dynamic context length, maximizing the 128K context window
  • Performance: Processes 4,000 input tokens across 2 separate skills in under 3 seconds

Multi-platform support:

PlatformSupport
MobileAndroid (CPU/GPU), iOS, Android AICore
Desktop & WebWindows, Linux, macOS (Metal), WebGPU
IoT & RoboticsRaspberry Pi 5, Qualcomm IQ8 NPU

Google also launched a Python package and CLI tool litert-lm for Linux, macOS, and Raspberry Pi — allowing experimentation with Gemma 4 directly from the terminal without writing code:

# Install litert-lm CLI
pip install litert-lm

# Run Gemma 4 E2B directly from terminal
litert-lm run gemma-4-e2b

5. Apache 2.0 — A Licensing Milestone

This is the biggest strategic change. Previous Gemma versions used the Gemma Terms of Use — a custom license with certain restrictions. Gemma 4 switches entirely to Apache 2.0.

This means:

  • Commercial freedom: Unlimited use, modification, and distribution
  • Digital sovereignty: Full control over data, infrastructure, and models
  • No restrictions: Deploy freely, on-premises or cloud, without reporting or registration

Clément Delangue, CEO of Hugging Face, commented: "The release of Gemma 4 under the Apache 2.0 license is an important milestone."

License Comparison with Other Open Models

ModelLicenseCommercialDerivative Works
Gemma 4Apache 2.0✅ Free✅ Free
Llama 3.xLlama License✅ (conditional >700M MAU)✅ With restrictions
MistralApache 2.0✅ Free✅ Free
Qwen 2.5Apache 2.0 / Tongyi✅ Variant-dependent✅ Variant-dependent

Gemma 4 places Google on par with Mistral in terms of openness — and far ahead of Meta (Llama) in licensing freedom.


6. Ecosystem Support

Gemma 4 is supported day-one across most popular frameworks and platforms:

Frameworks & Tools

  • Hugging Face: Transformers, TRL, Transformers.js, Candle
  • Inference: vLLM, llama.cpp, SGLang, Ollama, LM Studio
  • Apple: MLX (mlx-community)
  • NVIDIA: NIM, NeMo
  • Edge: LiteRT-LM, Google AI Edge Gallery
  • Fine-tuning: Unsloth, Google Colab, Vertex AI
  • Other: Cactus, Baseten

Download the Model

Quickest Way to Try It

# Via Ollama
ollama run gemma4

# Via Google AI Studio (31B, 26B MoE)
# https://aistudio.google.com/prompts/new_chat?model=gemma-4-31b-it

# Via Google AI Edge Gallery (E2B, E4B)
# https://github.com/google-ai-edge/gallery

7. Comparison: Gemma 4 vs Other Open Models

Based on Arena AI text leaderboard results (open models, as of April 2, 2026):

RankModelSizeLicense
#1DeepSeek-V3671B MoEDeepSeek License
#2Qwen3-235B235B MoEApache 2.0
#3Gemma 4 31B31B DenseApache 2.0
#4Llama 4 Maverick400B MoELlama License
#5DeepSeek-R1671B MoEMIT
#6Gemma 4 26B26B MoE (3.8B active)Apache 2.0

Notable: Gemma 4 31B (31 billion parameters) outperforms Llama 4 Maverick (400 billion parameters) — 13x smaller yet ranking higher. This is the clearest demonstration of Google's "intelligence-per-parameter" philosophy.


8. Practical Applications and Use Cases

8.1. For Individual Developers

  • Offline coding assistant: Run 26B MoE on a gaming GPU, no API fees needed
  • Code review agent: Use function calling + structured output to build an agent that automatically reviews PRs
  • Local RAG: Combine 256K context window with qdrant/chromadb running locally

8.2. For Enterprises

  • On-premises AI: Apache 2.0 + on-device operation = data never leaves your infrastructure
  • Sovereign AI: Meets requirements for in-country data storage (digital sovereignty)
  • Edge AI production: Smart home, kiosks, POS, camera AI with E2B/E4B

8.3. For Research

  • Fine-tuning foundation: 31B Dense is a powerful base model for domain-specific tuning
  • Multilingual research: 140+ languages opens NLP research for low-resource languages
  • Real-world example: Yale University uses Gemma to discover new pathways for cancer therapy (Cell2Sentence-Scale)

8.4. For IoT and Robotics

  • Offline voice assistant: E2B on Raspberry Pi 5 for robots and smart speakers
  • Edge analytics: Real-time image/video analysis on NVIDIA Jetson
  • Industrial automation: Autonomous agents on Qualcomm IQ8 NPU

9. Quick Start Guide

9.1. Run with Ollama (Easiest)

# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh

# Run Gemma 4 (auto-selects appropriate size)
ollama run gemma4

# Or specify a specific variant
ollama run gemma4:26b
ollama run gemma4:31b

9.2. Run on Edge with LiteRT-LM

# Install LiteRT-LM CLI
pip install litert-lm

# Download and run model
litert-lm download gemma-4-e2b
litert-lm run gemma-4-e2b

9.3. Use with Python (Hugging Face Transformers)

from transformers import AutoTokenizer, AutoModelForCausalLM

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"
)

messages = [
    {"role": "user", "content": "Explain the Mixture of Experts architecture in 3 sentences."}
]

input_ids = tokenizer.apply_chat_template(
    messages, return_tensors="pt"
).to(model.device)

outputs = model.generate(input_ids, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

9.4. Function Calling (Agentic)

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get current weather for a location",
            "parameters": {
                "type": "object",
                "properties": {
                    "location": {"type": "string", "description": "City name"}
                },
                "required": ["location"]
            }
        }
    }
]

messages = [
    {"role": "system", "content": "You are a helpful assistant with access to tools."},
    {"role": "user", "content": "What's the weather like in Hanoi today?"}
]