Inference Speed Showdown: Llama, Mistral, Gemma Throughput with Memory Mapping

Mistral 7B, when optimized with TensorRT-LLM, achieved the highest performance at 93.63 tokens/second. Llama 2 7Bn followed closely at 92.18 tokens/second, while Gemma 7Bn exhibited the lowest token/second performance among the three, at approximately 65.86 tokens/second in one benchmark. On CPU, model size is the primary determinant of speed, with smaller quantized models generally being faster.

The top 3

  1. Quantization's Speed Impact: Best Throughput for Llama, Mistral, Gemma: Different quantization levels critically impact LLM inference speed; Q4_K_M often balances speed and quality best, enabling Llama 3 8B to achieve 61 tokens/second on M2 Ultra at 4.9 GB, significantly faster than Q8_0's 38 tokens/second at 8.5 GB.
  2. Architectural Edge: Mistral's GQA/SWA vs. Gemma's KV Cache Efficiency: Mistral 7B's Grouped-Query Attention (GQA) and Sliding Window Attention (SWA) deliver faster inference and longer context handling. Gemma 3/4 boasts superior KV-cache memory efficiency, processing over 23,000 tokens per GB, 3.1x more efficient than Llama 3.1.
  3. 7-8B Models: Llama 3.1, Mistral 7B, Gemma 2 Throughput Comparison: In the 7-8B class, Llama 3 8B demonstrated 41% faster code generation (55 completions/min) than Mistral 7B (39 completions/min) on an RTX 3090 with INT4 quantization, while Gemma 2 9B offers respectable general-purpose performance but generally trails in coding benchmarks.

Sources

Open the full topic