Grouped-query attention (Ainslie et al., 2023) sits between multi-head and multi-query attention. Query heads are split into groups, and each group shares one key-value head. The grouping is a simple integer division.
Implement group_index(head, n_heads, n_kv), returning the key-value head used by a query head.
Each group has n_heads / n_kv query heads, so divide the head index by that group size.
No results yet
Run your code to check it against the examples, or submit to run every test.