The explanation follows the equations in Section 3 of Shrikumar et al. (2017), who proposed the method. Let t be the output neuron of interest and x1,…,xn the neurons of a preceding layer.
- Choose a reference input. It is chosen to suit the problem; for MNIST, the paper uses an all-zero image (the background color).
- Run the input and the reference input through the forward pass, and compute for every neuron the difference between its value and its reference value, Δx=x−x0.
- Going from the output to the input, compute the multipliers mΔxΔt with per-layer rules and backpropagate them by connecting them with the chain rule (Eq. 3).
- For each input feature, multiply the multiplier by the difference to obtain the contribution CΔxiΔt=mΔxiΔtΔxi (Eq. 2).
The contributions are defined so that they sum to the difference in the output. The paper calls this property summation-to-delta.
i=1∑nCΔxiΔt=Δt,Δt=t−t0(1)
The multiplier is the contribution divided by the difference in the input. Whereas a partial derivative is "the ratio of infinitesimal changes", a multiplier is "the ratio of finite differences".
mΔxΔt=ΔxCΔxΔt(2)
With an input layer x, a hidden layer y, and an output t, multipliers can be connected in the same form as the chain rule for partial derivatives. This allows them to be computed in a single pass, just like ordinary backpropagation.
mΔxiΔt=j∑mΔxiΔyjmΔyjΔt(3)
There are three rules for determining the multipliers of each layer.
| Rule | Layers it applies to | Multiplier |
|---|
| Linear rule | Fully connected and convolutional layers (y=b+∑iwixi) | The weight wi (when separating positive and negative contributions, they are assigned by the sign of wiΔxi) |
| Rescale rule | Nonlinear functions with a single input (ReLU, tanh, sigmoid) | Δy/Δx; replaced by the gradient when Δx is close to 0 |
| RevealCancel rule | Same as above | Separates positive and negative differences, and averages the effect of each with and without the other |
The right side of the top figure is an example of the Rescale rule. With i1=i2=1 and a reference of 0,0, z=1−i1−i2 changes from 1 to −1 (Δz=−2), h from 1 to 0 (Δh=−1), and y from 0 to 1 (Δy=1). The ReLU multiplier is Δh/Δz=0.5, which is not 0 even though the gradient is 0. By the chain rule, m=(−1)×0.5×(−1)=0.5, so i1 and i2 each receive a contribution of 0.5, and the total matches Δy=1.