Md. Asif Uddin
    I.14.X06

    Backpropagation through one graph convolution

    gradient▲▲△

    Derive the gradients of a loss L\mathcal L with respect to W\mat W and H\mat H for the linear layer Y=A^HW\mat Y=\hat{\mat A}\mat H\mat W, given G=∂L/∂Y\mat G=\partial\mathcal L/\partial\mat Y. Then evaluate them for the paw graph with scalar features x=(1,2,3,4)\vec x=(1,2,3,4), weight w=0.5w=0.5, target t=(0,0,1,1)\vec t=(0,0,1,1) and L=12∥y−t∥2\mathcal L=\tfrac12\|\vec y-\vec t\|^2.

    Hint

    Treat A^H\hat{\mat A}\mat H as one matrix and use the chain rule for matrix products (The chain rule for matrix products 0.MC.07). A^\hat{\mat A} is symmetric.

    Solution

    With Z=A^H\mat Z=\hat{\mat A}\mat H, Y=ZW\mat Y=\mat Z\mat W, so ∂L/∂W=ZTG=(A^H)TG\partial\mathcal L/\partial\mat W=\mat Z^{\mathsf T}\mat G=(\hat{\mat A}\mat H)^{\mathsf T}\mat G and ∂L/∂Z=GWT\partial\mathcal L/\partial\mat Z=\mat G\mat W^{\mathsf T}. Then ∂L/∂H=A^TGWT=A^GWT\partial\mathcal L/\partial\mat H=\hat{\mat A}^{\mathsf T}\mat G\mat W^{\mathsf T}=\hat{\mat A}\mat G\mat W^{\mathsf T}. The backward pass through a graph convolution is another graph convolution, applied to the gradients: each node receives a degree-weighted average of its neighbours’ errors.

    For the numbers, A^x=(1.866025, 1.866025,\hat{\mat A}\vec x=(1.866025,\,1.866025, 3.030239, 3.060660)3.030239,\,3.060660) from I.14.B01, so

    y=(0.933013,  0.933013,1.515119,  1.530330),\begin{aligned} \vec y&=(0.933013,\;0.933013,\\ &\qquad1.515119,\;1.530330), \end{aligned}

    the residual is y−t=(0.933013, 0.933013,\vec y-\vec t=(0.933013,\,0.933013, 0.515119, 0.530330)0.515119,\,0.530330), and L=1.143812\mathcal L=1.143812. The weight’s gradient is the dot product of A^x\hat{\mat A}\vec x with the residual, 6.6661466.666146. The input’s gradient is 0.5 A^(y−t)=(0.385355, 0.385355,0.5\,\hat{\mat A}(\vec y-\vec t)=(0.385355,\,0.385355, 0.427478, 0.223644)0.427478,\,0.223644).

    Nodes 11 and 22 receive the same gradient, as they produced the same output: one layer cannot tell them apart in either direction. The script confirms all five derivatives by central finite differences.

    Draws on