This repository contains the official performance benchmarks and capability demonstrations for the Gemma 4 model family (E2B, E4B, 26B-A4B MoE, and 31B).
The tests were conducted on a DGX Spark system (NVIDIA GB10, 121GB VRAM) using the official optimized weights and transformers v5.5.0. These results demonstrate the resolution of early-access bottlenecks, particularly the "MoE Paradox," where the sparse 26B model now significantly outperforms the 31B dense model.
Source: A Visual Guide to Gemma 4
| Task | E2B-it (TPS) | E4B-it (TPS) | 26B-A4B MoE (TPS) | 31B Dense (TPS) |
|---|---|---|---|---|
| Text Generation | 28.00 | 15.69 | 12.52 | 3.40 |
| Thinking Mode (CoT) | 28.73 | 15.93 | 12.48 | 3.40 |
| Vision (Multimodal) | 27.69 | 15.67 | 12.24 | 3.22 |
| Function Calling | 28.76 | 16.10 | 11.55 | 3.44 |
gemma4_benchmark_master.py: The unified benchmark engine. It handles model loading (official HF paths), automated testing across 7 capability pillars, and auto-generates demonstration notebooks.install.sh: A shell script to set up the environment, install the correct version oftransformersand dependencies (usinguv).
master_benchmark_results.json: The complete raw data from the latest runs, including precise TPS metrics and the actual text/code generated by each model.gemma-4-*-core-capabilities.ipynb: Replicated Jupyter Notebooks for each model size, showing hand-on examples of vision, thinking mode, and tool use.
results_summary.md: A high-level overview of the performance metrics.moe_investigation.md: A technical deep-dive into how the official weights resolved previous MoE architectural bottlenecks.medium_article.md: A full-length article summarizing the market impact and technical takeaways of the Gemma 4 series.
- Ensure you have
uvinstalled (or the script will attempt to install it for you). - Run the installation script:
chmod +x install.sh ./install.sh
- Hugging Face Login: You will need access to the Gemma 4 models on Hugging Face.
huggingface-cli login
You can run the full suite or target specific models using the master script.
Run all models:
python gemma4_benchmark_master.pyRun a specific model (e.g., E4B):
python gemma4_benchmark_master.py E4B- Creative Text: Single-turn poem generation.
- Analytical Text: Multi-turn technical explanations.
- Thinking Mode: Native Chain-of-Thought reasoning using
<|think|>tokens. - Vision (Single): High-resolution image description.
- Vision (Multi): Comparative analysis across interleaved images.
- Visual Logic: Biological trait validation (Object counting/attributes).
- Function Calling: Zero-shot tool use for weather and agentic tasks.
- Precision: All tests are run in
bfloat16. - Framework: Requires
transformers >= 5.5.0for native Gemma 4 MoE support. - Thinking Mode: Enabled via
enable_thinking=Truein the processor's chat template.
