Gemma 4 Runs Advanced Agents Offline on Phones
Gemma 4, under Apache 2.0, runs function-calling agents, structured outputs, and code execution fully offline on Android phones with 128k context, outperforming last year's cloud APIs while enabling cheaper self-hosting.
Offline Agent Capabilities Outpace Legacy Cloud APIs
Gemma 4 delivers high intelligence per parameter, enabling full agent workflows on Android phones in airplane mode without external servers. In a food tour demo, it identifies ramen as the dish, searches Seattle spots under $30/person via Google Maps MCP server (using Agent Development Kit), filters by high ratings, computes walkable routes (half km total, walking mode), and outputs structured plans with tips, budget breakdowns, and place details like Oink and Damboa in Capitol Hill. This showcases native function calling, structured JSON output, thinking traces, and multimodal understanding—all on-device with 128k context, a leap over most commercial models.
A coding demo further proves autonomy: Gemma 4 (31B instruction-tuned) reasons through physics and gravity to build a bouncing ball animation in a Pyodide-based Python sandbox. It selects NetworkX and Matplotlib, writes a physics engine, handles Matplotlib's WebAssembly failure by switching approaches, and generates a realistic animation—iterating like a self-correcting agent. With tools and 256k context (scalable via compression, memory), it unlocks code execution agents that solve complex tasks without cloud dependency.
Self-Hosting Beats API Costs with Scalable Infrastructure
Deploy Gemma 4 on Cloud Run using Nvidia RTX 6000 Pro GPUs for a few dollars/hour, scaling to zero when idle to avoid waste. This undercuts API-based models in cost and latency while ensuring data sovereignty. Use BentoRun for secure Python sandboxes in Cloud Run, isolating execution for production agents. Apache 2.0 license change maximizes permissiveness, sparking rapid innovation post-release.
Architectural Edges Enable Small-Model Power
Mixture of Experts (MoE) and per-layer embeddings shrink overhead while boosting agentic skills over Gemma 3. Multimodal handles variable aspect ratios for flexible inputs. Prefer Gemma 4 for local/privacy needs; use Gemini for broader scale. 256k context on devices changes agent design, supporting long reasoning chains without truncation.