GQA, decode the acronym and describe its KV sharing pattern
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
GQA = Grouped-Query Attention. Query heads partition into G groups; each group shares one K and one V head. Llama-2 70B uses 64 query heads on 8 KV heads.
Imagine 64 people on a quiz team, each holding a different question. In regular multi-head attention, every person gets a personal librarian and a personal bookshelf. That is expensive: 64 librarians, 64 shelves. Grouped-query attention says: split the 64 people into 8 groups of 8, and each group shares one librarian and one shelf. The 8 people in a group ask different questions, but they all consult the same librarian for answers. You go from 64 shelves down to 8, an 8x storage saving, and the team's quiz scores barely drop because the librarians were duplicating each other's work anyway.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
60s: expand the acronym, describe the group partitioning, name the MHA-MQA slider with GQA in between, give Llama-2 70B's specific config (64 Q, 8 KV), state the KV cache reduction (8x), mention the quality cost is small per Meta's ablations.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Thinking GQA is just MQA with extra heads. Both share KV across queries, but GQA picks a group size between 1 (MHA) and num_heads (MQA) to balance memory savings against quality.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.