How does model width relate to head dimension in standard multi-head attention?
Reveal the answer and explore the explanation.
09MediumHow does model width relate to head dimension in standard multi-head attention?
Answer
Medium
How does model width relate to head dimension in standard multi-head attention?
Answer
With equal-sized heads and a standard partition, each head has dimension model width divided by head count.
Practical example
A 768-wide model with 12 heads uses 64 dimensions per head.
PythonRelated concept example
width, heads = 768, 12
assert width % heads == 0
print('Head size:', width // heads)This assumes the common equal-width head partition.
Reference: Further reading ↗