position-wise feed-forward network on top of selfattention in a transformer block. It is possible to
analyse the role of each head in isolation of all other
heads using attention rollout and attention ﬂow. To
not make the assumption that there is no mixing
of information between heads, for computing the
“input attention”, we will treat all the layers below
the layer of interest as single head layers, i.e., we
sum the attentions of all heads in the layers below.
For example, we can compute attention rollout for
headkat layer ias~A(i; k) =A(i; k)A(i), where,
A(i)is attention rollout computed for layer iwith
the single head assumption.
In the Transformer model, "self-attention" combines information from attended
embeddings into the representation of the focal embedding in the next layer.
Thus, across layers of the Transformer, information originating from different
tokens gets increasingly mixed. This makes attention weights unreliable as
explanations probes. In this paper, we consider the problem of quantifying this
flow of information through self-attention. We propose two methods for
approximating the attention to input tokens given attention weights, attention
rollout and attention flow, as post hoc methods when we use attention weights
as the relative relevance of the input tokens. We show that these methods give
complementary views on the flow of information, and compared to raw attention,
both yield higher correlations with importance scores of input tokens obtained
using an ablation method and input gradients.
Samira Abnar Willem Zuidema