ReLU is the keystone for exact backprop here. Its derivative is an exact gate, so the reverse pass stays rational and the negative branch is blocked.

highlighted = computed this step

ReLU's derivative is exact

ReLU'(z) is 1 when z is positive and 0 otherwise; at z=0 this surface uses the stated convention ReLU'(0)=0.

ReLU(z)={1z>00z0\operatorname{ReLU}'(z)=\begin{cases}1&z>0\\0&z\le0\end{cases}
ReLU derivative gateReLU derivatives are exact zero-or-one values.ReLU derivative gateReLU derivatives are exact zero-or-one values.one reverse-chain step (all exact)quantityrulevaluedL/dyhat2*(2-3)-2dL/dv1-2*2-4dL/dv2-2*00dL/dcdL/dyhat-2dL/dh1-2*1-2dL/dh2-2*1-2ReLU'(z1)z1=2>01ReLU'(z2)z2=-1<=00dL/dz1-2*1-2dL/dz2-2*00

Two derivative gates

Here z1=2 gives ReLU'(z1)=1, while z2=-1 gives ReLU'(z2)=0.

ReLU(z1)=1,ReLU(z2)=0\operatorname{ReLU}'(z_1)=1,\quad \operatorname{ReLU}'(z_2)=0
ReLU derivative gateReLU derivatives are exact zero-or-one values.ReLU derivative gateReLU derivatives are exact zero-or-one values.one reverse-chain step (all exact)quantityrulevaluedL/dyhat2*(2-3)-2dL/dv1-2*2-4dL/dv2-2*00dL/dcdL/dyhat-2dL/dh1-2*1-2dL/dh2-2*1-2ReLU'(z1)z1=2>01ReLU'(z2)z2=-1<=00dL/dz1-2*1-2dL/dz2-2*00

The dead branch

Multiplying by the second derivative gate blocks that branch exactly. The result is dL/dz1=-2 and dL/dz2=0.

dLdz1=21=2,dLdz2=20=0\frac{dL}{dz_1}=-2\cdot1=-2,\quad \frac{dL}{dz_2}=-2\cdot0=0
ReLU derivative gateReLU derivatives are exact zero-or-one values.ReLU derivative gateReLU derivatives are exact zero-or-one values.one reverse-chain step (all exact)quantityrulevaluedL/dyhat2*(2-3)-2dL/dv1-2*2-4dL/dv2-2*00dL/dcdL/dyhat-2dL/dh1-2*1-2dL/dh2-2*1-2ReLU'(z1)z1=2>01ReLU'(z2)z2=-1<=00dL/dz1-2*1-2dL/dz2-2*00