Learn by correcting
01 · Differentiate to reduce loss
Differentiate to reduce loss
The gradient tells you how error changes when parameters change.
Your turn
Take a small step
With step .1, move to .8w and loss decreases for this quadratic.
Understand the calculation, step by step
The gradient collects partial derivatives. The update w′=w−α∇f(w) decreases loss locally for a sufficiently small step. For f(w)=w², ∇f=2w and the error factor is 1−2α. Check the derivative with a centered finite difference; loss alone does not specify a direction.
Quadratic descent
f(w)=w² ; ∇f=2w ; α=0.1 ; w′=w−0.1×2wCheck my understanding
Keep a thought in my notebook
Read the source and go further
The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.
02 · Decompose error and choose a step
Decompose error and choose a step
A step that is too large oscillates; one that is too small progresses slowly.
Your turn
Choose a suitable step
Optimal constant step for this quadratic descent is 2/(L+1).
Understand the calculation, step by step
For a quadratic with symmetric positive Hessian, eigen directions separate: e′ᵢ=(1−αλᵢ)eᵢ. Convergence requires 0<α<2/L for largest eigenvalue L. With μ>0, optimal constant GD step is 2/(L+μ). Large condition number κ=L/μ explains a slow direction alongside oscillations in another.
Conditioning
μ=1 ; κ=L ; optimal GD step=2/(L+1)Check my understanding
Keep a thought in my notebook
Read the source and go further
The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.
03 · Polynomial regression and chain rule
Polynomial regression and chain rule
Fitting a curve means choosing coefficients that better follow observations.
Your turn
Read residuals
Short segments show what the line does not explain.
Understand the calculation, step by step
A polynomial model is linear in its coefficients: ŷ=Σwⱼxʲ. For f=‖Xw−y‖²/2, gradient is Xᵀ(Xw−y) and Hessian XᵀX. Differently scaled columns can slow descent. Centering inputs or changing bases may improve conditioning without a more complex optimizer.
Fit a line
x=(0,1,2), y=(0,2,c) ; OLS slope=c/2 ; intercept=(2+c)/3−c/2Check my understanding
Keep a thought in my notebook
Read the source and go further
The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.
04 · Momentum dynamics
Momentum dynamics
Momentum retains part of previous updates to sustain a useful direction.
Your turn
Update the weight
From w=2, movement is −.1v′. Negative velocity reverses movement.
Understand the calculation, step by step
Keep velocity v′=βv+∇f(w), then w′=w−αv′. Persistent gradients accumulate and sign changes can cancel. In one quadratic direction, eₖ₊₁=(1+β−αλ)eₖ−βeₖ₋₁. Initial velocity matters; overshooting alone does not imply divergence.
Accumulate velocity
previous v=1 ; β=0.9 ; v′=0.9+g ; w=2 ; α=0.1 ; w′=2−0.1v′Check my understanding
Keep a thought in my notebook
Read the source and go further
The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.
05 · Critical damping
Critical damping
Damping helps approach a target while limiting oscillation.
Your turn
Read critical β
The chosen branch is (1−√(αλ))²; it does not tune every problem direction simultaneously.
Understand the calculation, step by step
Roots of r²−(1+β−αλ)r+β determine oscillation and damping. A double root occurs at (1+β−αλ)²=4β; β=(1−√(αλ))² describes a critical branch per direction. One α,β pair generally cannot critically damp all curvatures. This is a quadratic calculation, not an arbitrary-network guarantee.
Critical damping
βcrit=(1−√(αλ))² (one quadratic direction)Check my understanding
Keep a thought in my notebook
Read the source and go further
The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.
06 · Optimal parameters and their assumptions
Optimal parameters and their assumptions
A good setting depends on problem shape and does not automatically work everywhere.
Your turn
Choose a suitable step
The heavy-ball setting assumes this strongly convex quadratic; β is shown alongside α.
Understand the calculation, step by step
For a strongly convex quadratic with curvature in [μ,L], heavy ball has α=4/(√L+√μ)² and β=((√L−√μ)/(√L+√μ))². These improve the asymptotic factor in that setting. Unknown curvature, nonconvex loss or noise removes that guarantee. Compare predictions with curves, then increase the step too far.
Optimal quadratic heavy ball
α=4/(√L+1)² ; β=((√L−1)/(√L+1))²Check my understanding
Keep a thought in my notebook
Read the source and go further
The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.
07 · Colourization and graph Laplacian
Colourization and graph Laplacian
Neighbouring values can become similar while respecting fixed values.
Your turn
Read the gradient
The minimum is at 2. Gradient 2c−4 indicates which way to move.
Understand the calculation, step by step
On a pixel graph, penalizing Σwᵢⱼ(cᵢ−cⱼ)² favours similar neighbouring colours. Fixed colours act as boundary conditions; remaining values solve a quadratic related to the Laplacian. Our three-vertex chain makes its central optimum hand-checkable. It illustrates the energy without reproducing the colourization interface.
Graph smoothing
fixed endpoints 0 and 4 ; E(c)=((c−0)²+(c−4)²)/2 ; ∂E/∂c=2c−4Check my understanding
Keep a thought in my notebook
Read the source and go further
The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.
08 · Polynomials, Krylov space and oracle
Polynomials, Krylov space and oracle
Some problem shapes remain difficult even with a well-tuned algorithm.
Your turn
Choose a suitable step
Optimal constant step for this quadratic descent is 2/(L+1).
Understand the calculation, step by step
After k linear steps on a quadratic, error is a polynomial in the Hessian applied to initial error. Gradient information explores a Krylov subspace. Oracle lower bounds construct a difficult problem for a class of methods; they do not claim every problem is equally difficult. Conditioning limits simultaneous reduction across directions.
Conditioning
μ=1 ; κ=L ; optimal GD step=2/(L+1)Check my understanding
Keep a thought in my notebook
Read the source and go further
The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.
09 · Noisy gradients and moving averages
Noisy gradients and moving averages
A gradient from little data fluctuates; accumulating it can smooth or sometimes amplify noise.
Your turn
Update the weight
From w=2, movement is −.1v′. Negative velocity reverses movement.
Understand the calculation, step by step
A minibatch gives a noisy gradient. Velocity also accumulates noise: smoothing does not remove variance and large β can amplify slow fluctuations. Including (1−β) changes convention and effective step. Evaluate losses across seeds while retaining divergent runs.
Accumulate velocity
previous v=1 ; β=0.9 ; v′=0.9+g ; w=2 ; α=0.1 ; w′=2−0.1v′Check my understanding
Keep a thought in my notebook
Read the source and go further
The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.
10 · Connection to differential equations
Connection to differential equations
A small-step update can mimic continuous evolution when its step remains appropriate.
Your turn
Take a small step
With step .1, move to .8w and loss decreases for this quadratic.
Understand the calculation, step by step
Small-step descent resembles gradient flow ẇ=−∇f(w); momentum resembles damped inertia ẅ+γẇ+∇f(w)=0 after scaling. Discretization adds its own stability limits. A stable continuous trajectory can be poorly simulated with a large step: distinguish the equation from its numerical scheme.
Quadratic descent
f(w)=w² ; ∇f=2w ; α=0.1 ; w′=w−0.1×2wCheck my understanding
Keep a thought in my notebook
Read the source and go further
The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.
Take this further
atomsh / lab