NumPy allowed · plain Python earns 10 bonus points
Q · Kᵀ / √d scores normalized with softmax
Implement KV-cache size estimation specifically accounting for Grouped Query Attention's reduced KV head count, the real reason GQA models have a measurably smaller serving memory footprint.
Implement gqa_kv_cache_size_mb(num_layers, num_kv_heads, head_dim, seq_len, batch_size, bytes_per_value). Total elements: 2 (K and V) * num_layers * num_kv_heads * head_dim * seq_len * batch_size. Multiply by bytes_per_value, convert to MB (divide by 1024*1024).
gqa_kv_cache_size_mb(num_layers: int, num_kv_heads: int, head_dim: int, seq_len: int, batch_size: int, bytes_per_value: float) -> float