Compare
Gemma 2 9B vs Llama 3.1 8B
Gemma 2 9B has 9.24B parameters, 1.2 times the 8.03B of Llama 3.1 8B. In BF16 the weights take 18.5 GB and 16.1 GB. Gemma 2 9B needs 2.6 times as much KV cache per token (344.1 KB against 131.1 KB): GQA against GQA.
| Gemma 2 9B | Llama 3.1 8B | Ratio | |
|---|---|---|---|
| Parameters | 9.24B 9,241,705,984 | 8.03B 8,030,261,248 | 0.87× |
| Active per token | all (dense) | all (dense) | 0.87× |
| Layers | 42 | 32 | 0.76× |
| Hidden size (d) | 3,584 | 4,096 | 1.14× |
| Attention | 16 heads, 8 KV heads × 256 | 32 heads, 8 KV heads × 128 | |
| FFN | GeGLU, 14,336 | SwiGLU, 14,336 | |
| Vocabulary | 256,000 | 128,256 | 0.50× |
| Tied embeddings | yes | no | |
| Max context | 8K | 128K | 16.00× |
| Weights, BF16 | 18.5 GB | 16.1 GB | 0.87× |
| Weights, 4-bit | 4.6 GB | 4.0 GB | 0.87× |
| KV cache per token (BF16) | 344.1 KB | 131.1 KB | 0.38× |
| KV cache at 32K tokens | – (max 8K) | 4.3 GB | 1.52× |
| FLOPs per token (4K context) | 21.3 GFLOPs | 18.2 GFLOPs | 0.85× |
The full workings: Gemma 2 9B · Llama 3.1 8B · change the models