AI Grounds

Open AI Grounds on a desktop

These interactive lessons need a larger screen. Please continue on a desktop or laptop computer.

Guided discovery

Autograd Graphs

Cache values. Multiply backward. Add shared paths.

Your dataset · two adjustable arguments

f(a, b) = a * b + b^2

b feeds multiply and square; add their outputs to get f.

Edit one argument. The other stays fixed; all current values and gradients are recomputed. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.

Edit one argument. The other stays fixed; all current values and gradients are recomputed. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.

Backward shows local output sensitivity with other arguments fixed. Switching views never updates parameters.

Follow the forward cache

Exact node values. Numeric display uses nine significant digits, with scientific notation for tiny nonzero values.
NodeOperationCached value
ainput2
binput3
mula * b6
squareb^29
addmul + square15
outf(a, b)15

Blue arrows carry current cached values. Each node follows from its inputs; the table supplies the same evidence in text. Focus a graph or table area and use arrow keys to scroll at narrow widths.

Output f

Value of the selected formula at the current arguments.

15

f(a, b) = a * b + b^2

Current a

Manually selected input; neither view changes it.

2

No optimizer applied

Current b

Manually selected input; neither view changes it.

3

No optimizer applied

Function and derivative slices

Holding a=2 fixed. Each function curve varies only b; the paired derivative curve is its local slope at each position. A zero slope at a stationary point does not make a curved function constant. Zero is explicitly marked; axes adapt to the selected slice.

Function sliceb=3; f=15
Derivative sliceb=3; gradient=8
One-step preview

This proposes simultaneous changes using the same original gradients, with fixed rate 0.1. It leaves the input editors and current graph unchanged. Proposals are not clipped to slider bounds. On Polynomial and Sigmoid, this is a mathematical descent preview for f; only Squared error defines a loss, and x,y there stay fixed. A finite step has no universal improvement guarantee.

Separate optimizer proposal: new = current − 0.1×gradient.
ArgumentCurrentGradientProposed
a231.7
b382.2

Current output 15; proposed output 8.58. No step is applied.

What this model includes

Three fixed scalar formulas illustrate reverse-mode autograd through analytically evaluated operations and derivatives. No framework graph capture, optimizer execution, or repeated-call gradient accumulator runs here. In real PyTorch, backward computes gradients; optimizer steps change parameters separately. Summing different paths within one backward pass differs from accumulating .grad across repeated backward calls.

Parameter slices hold the other argument fixed; the update preview moves both simultaneously. The toy domains use the displayed original ranges and 0.1 edits. Preview proposals can lie outside those editing ranges. Cached values, local derivatives, returning messages, accumulated input gradients and updated parameters are distinct quantities. Labels are rounded, with scientific notation retaining tiny nonzero values.

PyTorch autograd mechanics · Autograd tutorial