Multi-head attention refines self-attention into a multidimensional form. In a transformer, self-attention learns dependencies between parts of the same input sequence; multi-head attention can improve performance. section 7.1
Reading an attention visualization
In a visualization of pretrained BERT, the token “cells” is associated with “it” and “boring.” Different columns show the shading for each head. section 7.1.2 section 7.1
Figure 7.3 (Duplicated) Self-attention visualization in the final encoding layer of the pretrained uncased BERT model for our example sentence. It reveals that “cells” is associated with “it” and “boring.” Note that this is a multihead view, with the shadings in each single column representing each head.
Inspect the multi-head view to compare attention shading across heads. section 7.1














