Skip to main content
← Lab

gqadict

confirmedshipPython · PyTorchModel behavior & reasoningJuly 22, 2026

the question

Does sharing one value matrix across a grouped-query head group lower the group's realized output rank relative to full multi-head attention?

what came out

Sharing V shrinks the group's value dictionary by exactly G (16=d_v vs 128=G*d_v at G=8), yet the concatenated output rank stays min(N, G*d_v)=128, equal to full MHA, because each head keeps an independent pattern and output projection. The cap bites only if the attention patterns are tied, collapsing rank to d_v=16.

method & receipts

  • Result: confirmed
  • Tested — a correctness/benchmark suite ships alongside the code.

→ read the code and re-run it

github.com/v-code01/gqadict