arXiv: 2408.00118
Core Question
When Google builds lightweight open-source models, how do they achieve the best performance at 2B and 9B parameters? How should choices about positional encoding, attention, and training methods be combined?
Key Design Innovations
Gemma 2 makes several key design choices:
1. Interleaving local-global attentions: Based on Beltagy's SWA, but instead of using local attention in all layers, the layers *alternate*: odd layers use local sliding-window attention, even layers use global attention. This preserves both local detail and global aggregation.
2. GQA (Grouped-Query Attention): Adopted to reduce the KV cache.
3. Knowledge Distillation: The 2B and 9B models are trained via distillation - not just next-token prediction, but imitating a larger teacher model. This is more effective than standard pretraining for small models.
4. Soft-capping: Logits are soft-capped (via tanh) to prevent extreme values from destabilizing training.
Key Numbers
- Model sizes: 2B, 9B, 27B
- "Best performance for their size"
- "Competitive alternatives to models that are 2-3 times bigger"
- Fully open-sourced
Impact Assessment
Gemma 2 demonstrates that "small model + good architecture + distillation" can rival "large model + standard training." Its interleaved attention strategy has been referenced by subsequent work. As Google's response to the open-source community (competing with LLaMA), Gemma has advanced research into lightweight high-performance models.
Feynman-Style Commentary
> Gemma 2's mindset is "composition over singularity." It does not invent a new attention mechanism; it combines existing good ideas (SWA, GQA, distillation) in the right way. The interleaved local-global attention is especially clever - rather than making the model "perpetually nearsighted" or "perpetually farsighted," it lets one layer look at details and the next look at the big picture. Like a good photographer who shoots both close-ups and panoramas. Feynman would say: don't chase the "single most innovative technique"; chase the "most coherent combination of techniques." Gemma 2 is a victory of engineering taste.
---
Reference:
Gemma Team (2024). Gemma 2: Improving Open Language Models at a Practical Size. arXiv:2408.00118