Free tool · browser-only calculation

Gradient descent, momentum and Adam simulator

Simulate SGD, momentum and Adam on convex and non-convex functions with adjustable trajectory, gradient and learning rate. With guided examples and shareable.

How the calculation works

xt+1=xt−η∇f(xt)x_{t+1}=x_t-\eta\nabla f(x_t)
Formula as plain textx_{t+1}=x_t-\eta\nabla f(x_t)

Gradient descent updates a point opposite to the local gradient. On a quadratic function, the learning rate directly reveals convergence, oscillation or divergence.

Momentum accumulates velocity and Adam adapts steps using first and second moment estimates. The simulator applies Adam bias correction and compares updates from the same starting point.

The non-convex function illustrates dependence on the basin of attraction. This is a one-dimensional educational model and does not predict the behaviour of a real neural network.