Nudge It Both Ways

BackpropagationMedium+20 XP+20

Nudge It Both Ways

You have just written the backward pass for a small regression network, and you want to check it before you trust it. The network takes two inputs, has two ReLU hidden neurons, and has one output neuron with no activation:

h1=ReLU(w11x1+w12x2+b1),h2=ReLU(w21x1+w22x2+b2)h_1 = \text{ReLU}(w_{11}x_1 + w_{12}x_2 + b_1), \qquad h_2 = \text{ReLU}(w_{21}x_1 + w_{22}x_2 + b_2)h1​=ReLU(w11​x1​+w12​x2​+b1​),h2​=ReLU(w21​x1​+w22​x2​+b2​)

y^=v1h1+v2h2+c,L=(y^−y)2\hat y = v_1 h_1 + v_2 h_2 + c, \qquad L = (\hat y - y)^2y^​=v1​h1​+v2​h2​+c,L=(y^​−y)2

Its current parameters are:

w11w_{11}w11​w12w_{12}w12​b1b_1b1​w21w_{21}w21​w22w_{22}w22​b2b_2b2​v1v_1v1​v2v_2v2​ccc
0.50.50.50.20.20.2−0.87-0.87−0.87−0.25-0.25−0.250.50.50.50.250.250.25222111−0.5-0.5−0.5

The training example is x1=1x_1 = 1x1​=1, x2=2x_2 = 2x2​=2, with target y=1.5y = 1.5y=1.5.

Your backward pass reports ∂L∂w11=−3.76\dfrac{\partial L}{\partial w_{11}} = -3.76∂w11​∂L​=−3.76.

To check it you use the lesson's nudge-and-compare, nudging in both directions. Run the forward pass once with w11w_{11}w11​ raised by hhh and once with it lowered by hhh, keeping every other parameter fixed, and compute the central-difference estimate

L(w11+h)−L(w11−h)2h\frac{L(w_{11} + h) - L(w_{11} - h)}{2h}2hL(w11​+h)−L(w11​−h)​

You pick h=0.05h = 0.05h=0.05 so the arithmetic can be done by hand.

What value does this check produce?

Round to 3 decimal places.

Hints

Solve it to unlock the solution

Once you get it right, the reasoning behind the answer shows up here.