Welcome to The Nonlinear Library, where we use Text-to-Speech software to convert the best writing from the Rationalist and EA communities into audio. This is: Visualizing Neural networks, how to blame the bias, published by Donald Hobson on July 9, 2022 on The AI Alignment Forum.
Background
This post is strongly based on this paper, which it calls the LRP algorithm,
I later learned of the existence of this paper, which is even more similar to the ideas discussed here.
In it, I examine 2 of the methods for neural network visualization, and show that they have structural similarities. I show that these algorithms only differ by a difference in how they treat the biases, and (possibly a difference in getting started)
The second algorithm obeys conservation laws, it tries to parcel credit and blame for a decision up to the input neurons, even when credit and blame
Intro
The task we want is to assign importance to different inputs of a neural network in production of an output. So for example, in the case of a trained image classifier, the visualization method would take in a particular image, and highlight the parts of the image that the network thought were important.
A general method for visualizing neural networks is back-propagation. First evaluate the network forwards. Then work backwards through the network by using some rule about how to reverse each individual layer.
One example of this is differentiation. Finding the rate of change of the output, with respect to each input. But there are others.
Firstly, lets pretend biases in the network don't exist. We are allowed non-linearities, so long as they satisfy the equation f(0)=0 .
Lets look at various layer types and the different back-propagation rules.
Maximum
Most often found in the form of max pooling.
Gradient
The rule used in gradient descent, and I think the only rule used in the paper above for back propagating maximum. (Notation note. R here isn't exactly a function. Its more like ddx , its output is related to the context in which the input occurs. Think of every number in the forward net having an associated number )
Ignoring the case of an exact tie. Exact ties, and what to do on that kind of singular point will be ignored in general, because they are fiddly and unimportant.
Radial.
Treats 0 as a special point.
Where the plot above shows si and the si are non-negitive and sum to 1.
Case. ai<0, b>0⟹si=0 . Relative to 0, a negative value contributes nothing to a positive maximum.
Case, ai>0⟹si=ai∑ai>0ai (In particular si=1 if i is the only value with positive ai
Case all negative. si=1ai∑i1ai .
Matrix multiplication
A common operation in neural networks. Even convolutions can be expressed as a matrix multiplication. The matrix just happens to be sparse, and contain repetitions.
Gradient
Yet again a popular choice.
Normalized
What the LRP algorithm uses is
(This is deduced from equation 6 in )
Where blip is this function
A straight line of gradient 1, except for a little vertical jump to avoid 0.
Why are they using this blip? Because they want to divide by bj here to get an interesting theoretical property (conservation of total) but if they don't add this little jump, they get numerical instability caused by dividing by something too close to 0.
Nonlinearity
There are several mechanisms proposed to deal with an arbitrary potentially non-linear function b=f(a), applied elementwise. We will impose the condition f(0)=0 for now.
Ignore
Very simple R(a)=R(b)
Gradient
R(a)=f′(a)R(b) standard rule of calculus.
Slope
R(a)=baR(b)
Repeat
R(a)=f(R(b))
Downside: Is nonlinear in R(b), unlike every other method here.
Consistency rules
You can't just pick any option from each of these lists. Well you could. But there are some nice mathematical consistency properties it would be nice to have.
Scaling equivalence
Suppose you want to multiply all values in the network by a constant α, there are 2 ways you could do this. You could see the constant as a scaled identity matrix, and...