In grouped-query attention, each key-value head serves a group of query heads. Before the attention product, the key and value heads are repeated so that every query head finds its group's copy.
Implement expand_kv(kv, n_heads), repeating each key-value head across its group.
n_heads is a multiple of the number of key-value heads.Repeat along the head axis by the group size, keeping groups in order.
No results yet
Run your code to check it against the examples, or submit to run every test.