Conserving Relevance in Explaining Transformers with Layer-Wise Relevance Propagation
Ukyo Hayashi, Yoshimasa Tsuruoka
Layer-wise Relevance Propagation (LRP) is widely used in computer vision to explain the predictions of neural networks: the method propagates relevance layer by layer from the output back to the input pixels while conserving the total relevance. LRP has been extended to Transformers, but no existing extension simultaneously achieves numerical stability, distributes relevance to the query and key, and conserves relevance in Transformers. We build on Attention-Aware LRP (AttnLRP), which is numerically stable and distributes relevance to the query and key but does not conserve relevance in attention, owing to linearization error and the structural bias of softmax. To satisfy all three, we extend AttnLRP with two propagation rules, each of which eliminates one of these causes. (1) Softmax-IG is a softmax propagation rule based on Integrated Gradients that eliminates linearization error; its discretized version includes the softmax rule of AttnLRP as a special case, and its linearization error asymptotically converges to zero as the number of integration points grows. (2) Bias-to-V redirects the relevance that would otherwise flow into the structural bias to the value. In experiments…