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 9BLlama 3.1 8BRatio
Parameters9.24B 9,241,705,9848.03B 8,030,261,2480.87×
Active per tokenall (dense)all (dense)0.87×
Layers42320.76×
Hidden size (d)3,5844,0961.14×
Attention16 heads, 8 KV heads × 25632 heads, 8 KV heads × 128
FFNGeGLU, 14,336SwiGLU, 14,336
Vocabulary256,000128,2560.50×
Tied embeddingsyesno
Max context8K128K16.00×
Weights, BF1618.5 GB16.1 GB0.87×
Weights, 4-bit4.6 GB4.0 GB0.87×
KV cache per token (BF16)344.1 KB131.1 KB0.38×
KV cache at 32K tokens– (max 8K)4.3 GB1.52×
FLOPs per token (4K context)21.3 GFLOPs18.2 GFLOPs0.85×

The full workings: Gemma 2 9B · Llama 3.1 8B · change the models