Multidirection: Different heads have different areas of match
Multi-head structures map the same input into multiple query, key and value spaces, each group independently calculates the position, then collates and projectes the hidden dimensions.
Learning objectives and first steps2 objectives . 1 first fix
Try to do it after reading
- Explaining multi-purpose attention: Mechanisms and premises where different heads have different spaces for matching
- Positioning the mechanism ' s fault limits with fixed examples
Suggested first
- Attention and Matrix Projection
Issues and mechanisms
Multi-head structures map the same input into multiple query, key and value spaces, each group independently calculates the position, then collates and projectes the hidden dimensions. The difference between the head is derived from the process of projection and training learned, rather than from the procedure that pre-designated a syntax, a fact-finding approach. It is beyond the guarantees of the structure itself to treat the head count as a type of knowledge that does not duplicate each other, or to place a visual head in a semantic module.
When hiding a dimensions d fixed, header h, each header is usually d divided by h. The focus score zooms in with the matching dimensions of each head, not all hidden dimensions. The output projection allows for a mix of messages of different head after the combination of d. Even if multiple head weights were to be re-allocated separately, the projected output was no longer a single contour of all original value vectors, and the single head geometry conclusion could not be applied directly to the entire module.
A concrete example
Synthetic settings d = 8, h = 2, with four dimensions per query and a zoom factor of two. If a point is four, the score before entry is two; By erroneously dividing by root eight, about 1.414 will be obtained to change the concentration of weights. Combines each output by four dimensions to eight, multiplied by eight times eight output matrices. If the header is changed to four and the total dimensions remain unchanged, the four output groups are still eight-dimensional and the parameters and activation costs are calculated separately.
Borders and checks
Real models can use different key-value headcounts, different head dimensions or special position structures, depending on the configuration. The interpretation may first examine the distribution and output contribution of each head and then design controlled experiments for removal or replacement; A simple look at the difference in the heat map does not demonstrate that each head has the functions necessary to be independent. There may also be redundancy between head and head, and the level of redundancy needs to be measured.
A method of verification
(b) The two heads can be used in the same projection and in the same visible range to verify that they produce the same output on the same input; Only one key projection is changed to observe how weight and output change. The difference between the cross-reference header is derived from parameters and calculations rather than from the semantic character of the index number. An output projection is also considered when a head is removed: the direct deletion of a piece of pieces changes the shape, usually by defining zero or replacing intervention and comparing the final output of the same task.
Check understanding
Does doubling the number of headlines necessarily double the projection parameters?
When the total dimension is fixed, the common total projection shape may remain the same. (a) The reduction of each head, the change in the matrixing pattern; If the total dimension is increased by maintaining each header simultaneously, the other parameter book will be changed.
Why is the square root of each head scalded?
The head count is a summation of the head matching channel and the scale is related to the dimension. Use the full hidden dimension to introduce scalings that are not consistent with the setup, and a small example is required.
Sources and reconciliations
Definitions, methods and interfaces are available.
Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.