Skip to content
Glacius
CalculusConcept reference

Local derivatives

A local derivative is the rate of change of one operation’s output with respect to an immediate input, holding its other inputs fixed.

On this page 8 sections
  1. Overview
  2. A local derivative describes one operation’s response to one of its immediate inputs
  3. Use the derivative rule for the gate itself
  4. If u=3x and z=u^2, the gate’s local rate is ∂ z/∂ u=2u
  5. A local derivative is one factor in a longer chain
  6. Key takeaway
  7. Sources & further reading
  8. Concept connections

01A local derivative describes one operation’s response to one of its immediate inputs#

A local derivative describes one operation’s response to one of its immediate inputs. It temporarily ignores where that input came from. This lets a large model reuse small derivative rules for operations such as addition, multiplication, and squaring.

A local derivative measures one operation’s response to one of its input ports. Hold its other ports fixed. The notation z/u\partial z/\partial u asks how this gate’s output zz responds to input uu.

Schematic multiply gate. Inputs u=3 and v=5 feed z=uv=15. With v fixed, the local derivative of z with respect to u is 5. This local rate excludes any earlier operations that produced u.Schematic multiply gate. Inputs u=3 and v=5 feed z=uv=15. With v fixed, the local derivative of z with respect to u is 5. This local rate excludes any earlier operations that produced u.
Figure 1Schematic multiply gate. Inputs u=3 and v=5 feed z=uv=15. With v fixed, the local derivative of z with respect to u is 5. This local rate excludes any earlier operations that produced u.
Link to this figure ↗Download SVGDownload PNG

For z=uvz=uv, hold vv fixed. A change Δu\Delta u changes the output by vΔuv\Delta u, so the local rate is vv.

zu=v\frac{\partial z}{\partial u}=v

At u=3u=3, v=5v=5, the output is 1515 but the local rate on uu is 55.

For one multiplication node z=uvz=uv at u=3,v=2u=3,v=-2, changing uu slightly scales that change by vv, so z/u=2\partial z/\partial u=-2. Changing vv scales it by uu, giving z/v=3\partial z/\partial v=3. The forward value z=6z=-6 is neither of these derivatives.

Check your reasoning

Gate: z=uvz=uv. At u=4u=4, v=6v=6, find the local derivative z/u\partial z/\partial u.

Show answer and explanation
6

Hold v=6v=6 fixed. The local derivative of uvuv with respect to uu is v=6v=6.

02Use the derivative rule for the gate itself#

Use the derivative rule for the gate itself. For z=u2z=u^2, the local rate is 2u2u. For z=u+vz=u+v, with vv fixed, it is 11. For z=kuz=ku, with fixed kk, it is kk.

The rate may depend on the gate’s current input value, so use the value from the forward pass.

Check your reasoning

u=5u=5 and du/dx=3du/dx=3. Next gate: z=u2z=u^2. Find the gate’s local rate z/u\partial z/\partial u.

Show answer and explanation
10

The local derivative of u2u^2 is 2u=2(5)=102u=2(5)=10. Exclude the upstream rate.

03If u=3x and z=u^2, the gate’s local rate is ∂ z/∂ u=2u#

If u=3xu=3x and z=u2z=u^2, the gate’s local rate is z/u=2u\partial z/\partial u=2u. The rate with respect to the original xx also needs du/dx=3du/dx=3.

Those are different requested derivatives. Include the upstream factor only when the question asks for the response to that upstream input.

Check your reasoning

u=4u=-4 and du/dx=2du/dx=2. Next gate: z=u2z=u^2. An answer includes du/dxdu/dx. Repair z/u\partial z/\partial u.

Show answer and explanation
-8

The local derivative of u2u^2 is 2u=2(4)=82u=2(-4)=-8. Exclude the upstream rate.

04A local derivative is one factor in a longer chain#

A local derivative is one factor in a longer chain. If uu itself depends on a weight, you must still include that dependence when finding the loss’s response to the weight. Stopping at a local derivative answers a different question.

Key takeaway

Differentiate the requested gate with respect to the requested input port.

  • Compute one graph operation's local derivative with respect to an input.

Sources & further reading

  1. [1]
    Stanford CS231n: BackpropagationStanford CS231n · Article

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Local derivatives.” Math behind ML. /learn/c-local