0
$\begingroup$

What makes differences in each head in the multiheaded attention in transformer?

As they are fed and trained in the exact same way, except the initialization of weights are different for each head to produce different sets of (Q,K,V) in each head. Such multi-headed design to me seems no difference than ensembling multiple models that are initialized differently.

Many sources claim that the multi-head attention 'can help capture meaning in different contextual subspace' without further substantiation or supporting proofs. Honestly I've been quite fed up with all those vague descriptions in the data science world that they make claim without mathematical rigor. I think I'm looking for more rigorous explanation as to why "multi-head attention 'can help capture meaning in different contextual subspace'" when they are simply an ensemble of identical models but weights randomly initialized?

$\endgroup$

1 Answer 1

1
$\begingroup$

You are right in that "they are simply an ensemble of identical models but weights randomly initialized". If you think about it, the different filters in convolutional layers are also just that. Having multiple heads increases the model's capacity.

The randomly initialized weights are certainly the key for each head to learn different things.

What the heads really learn has been an active area of research, normally studied by either pruning away heads to see the effect, by measuring the attention patterns to attribute effect, or by probing them in control tasks. These are some conclusions in that regard:

$\endgroup$
1
  • $\begingroup$ Excellent explanation with good references! Thank you @noe! =] $\endgroup$
    – Student
    Commented Mar 20, 2022 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.