Google's Gemma 7B Beats Llama 2 13B With Open Weights Anyone Can Run
Google's open 7B model is built on Gemini research, ships with commercial-use weights, and outperforms Llama 2 13B on major reasoning benchmarks.
ProTakeaways
- Google released Gemma 7B and 2B open-weight LLMs derived from Gemini research, with commercial-use license.
- Gemma 7B scores 64.3 on MMLU, 81.2 on HellaSwag, and 32.3 on HumanEval pass@1.
- Beats Llama 2 7B, Mistral 7B, and reportedly Llama 2 13B on reasoning and coding benchmarks.
- Trained on 6 trillion tokens of web, code, and math on TPUv5e using JAX and Pathways.
- Ships with QLoRA and FSDP fine-tuning scripts, plus GGUF, bitsandbytes, and Flash Attention 2 support.
- Available on Hugging Face, Google, Kaggle, and Vertex AI Model Garden.
Google has entered the open weights arena with Gemma 7B, a decoder-only language model that pulls directly from the research pipeline behind Gemini. It arrives alongside a 2B sibling and instruction-tuned variants of both, giving anyone with a single GPU a credible alternative to Llama 2 and Mistral without an API key or a rate limit.
The family is text-to-text and English-only, with open weights, pre-trained checkpoints, and instruction-tuned variants suited for question answering, summarization, and reasoning. The pitch: a slice of Gemini engineering in a size that fits on a laptop or a modest cloud instance.
What's in the box
Google is releasing weights in two sizes, each with a pre-trained and instruction-tuned checkpoint. The 7B has roughly 8.5 billion parameters (the naming is approximate), and the 2B has around 2.5 billion, intended for CPUs and edge devices.
A few concrete specs matter for anyone planning to actually run it:
- Context window: 8,192 tokens
- Language: English only
- Precision on Hugging Face: BF16, with float16, int8, and 4-bit quantized paths
- Attention: Multi-Query Attention with RoPE embeddings and RMSNorm
- License: Gemma's terms permit commercial use but prohibit a wide range of uses Google deems harmful, including copyright infringement, illegal activity, generating misinformation, or producing sexually explicit content
How it was trained
The training recipe leans heavily on Google's in-house stack. Gemma-2B and Gemma-7B were trained on 2 trillion and 6 trillion tokens, respectively, of English-language web documents, mathematics, and code. That mix explains why the larger model shows respectable code and math scores despite its size.
Hardware was TPUv5e, with toolchains for inference and supervised fine-tuning across JAX, PyTorch, and TensorFlow through native Keras 3.0. Google also applied CSAM filtering, PII scrubbing, and quality filters before training, and ran red-team evaluations across content safety, representational harms, and CBRN risk categories before shipping the weights.
Benchmark story
The 7B punches above the weight class you would expect. It ranks higher than comparably sized open models including Meta's Llama 2 7B and Mistral-7B on HuggingFace's Open LLM Leaderboard, and by Google's assessment it outperforms the nearly double-sized Llama 2 13B on major question answering, reasoning, math, and coding benchmarks.
The headline numbers from Google's own evaluation:
| Benchmark | Metric | Gemma 7B | Gemma 2B |
|---|---|---|---|
| MMLU | 5-shot | 64.3 | 42.3 |
| HellaSwag | 0-shot | 81.2 | 71.4 |
| HumanEval | pass@1 | 32.3 | 22.0 |
| MBPP | 3-shot | 44.4 | 29.2 |
| GSM8K | maj@1 | 46.4 | 17.7 |
| MATH | 4-shot | 24.3 | 11.8 |
| BIG-Bench | - | 55.1 | 35.2 |
The weak spots are worth calling out. GSM8K at 46.4 is decent for the size but well short of frontier models, MATH at 24.3 confirms that harder arithmetic is still a stretch, and the smaller checkpoint is honestly overmatched: Gemma-2B falls short of the most capable models of its size, such as the 2.7-billion-parameter Phi-2.
Actually running it
The Hugging Face repo ships with the standard transformers path. A minimal example:
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
tokenizer = AutoTokenizer.from_pretrained("google/gemma-7b")
model = AutoModelForCausalLM.from_pretrained(
"google/gemma-7b",
device_map="auto",
torch_dtype=torch.bfloat16,
)
input_ids = tokenizer("Write me a poem about Machine Learning.", return_tensors="pt").to("cuda")
outputs = model.generate(**input_ids)
print(tokenizer.decode(outputs[0]))For lower-memory setups, the model card documents bitsandbytes 4-bit and 8-bit configs, plus a Flash Attention 2 flag. There is also a GGUF build for llama.cpp, ready-to-use Colab and Kaggle notebooks, and integrations with MaxText, NVIDIA NeMo, and TensorRT-LLM.
Fine-tuning is a first-class citizen. The repo includes a QLoRA script for supervised fine-tuning on UltraChat, an FSDP-on-TPU script, and a free-tier Colab notebook for adapter tuning on the English quotes dataset. That last one is the fastest path to a domain-specific 7B without renting an H100.
Why it matters
Two things are new here, and neither is captured by the benchmark table alone.
- Gemini lineage in open weights. Until now, the strongest small open models came from Meta and Mistral. Google shipping a checkpoint derived from the same research stack as its flagship closed model changes the competitive geometry, and fine-tuners now have a third architectural family to build on.
- A commercially usable license attached to a Google model. The Gemma terms are not Apache 2.0, but they allow commercial deployment, which was not previously possible with any Google-branded LLM at this quality level.
For practical use, the 7B instruct variant is the target for chat, retrieval-augmented generation, and summarization workloads where you want on-prem inference or predictable per-token cost. The base 7B is the target if you plan to fine-tune. The 2B is mostly interesting for edge and CPU-only scenarios, and you should benchmark it against Phi-2 for your specific task before committing.
Updating your mental model
A few assumptions worth revisiting. Small models are catching up faster than the frontier narrative suggests: a 7B that beats Llama 2 13B on MMLU and reasoning was not on most roadmaps a year ago. Google is now a serious participant in the open weights ecosystem rather than a spectator, which changes how derivative work (adapters, quantizations, distillations) will flow. And the effective floor for a usable local assistant just moved. If your product was gated by "we cannot ship an OpenAI dependency," the calculus for running Gemma-based inference on your own infrastructure is meaningfully better today than it was last week.