Grouped-query attention only works when the query heads divide evenly into groups. Checking that before building a model prevents a silent mismatch between head counts and cache shapes.
Implement groups_valid(n_heads, n_kv), returning whether the grouping is well defined.
Check the group count is between one and the head count and divides it exactly.
No results yet
Run your code to check it against the examples, or submit to run every test.