Thomas Piacentini
← Workshop
← All concepts

Learn by correcting

Concept 1 / 10

Change concept
01 · Differentiate to reduce loss

Differentiate to reduce loss

The gradient tells you how error changes when parameters change.

Your turn

2
f(w) = w²w′ = 1.6 · f(w′) = 2.56
InputTransformationResult

Take a small step1.6

With step .1, move to .8w and loss decreases for this quadratic.

Build
Final result · Parameter after correction1.6

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×2w

Check my understanding

For Position w = 3, what is the value of « new weight w′ » ?

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

4
f = ½(w₀² + Lw₁²)μ=1L=4α = 0.4 · κ = 4
InputTransformationResult

Choose a suitable step0.4

Optimal constant step for this quadratic descent is 2/(L+1).

Build
Final result · optimal GD step0.4

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

For Largest curvature L = 9, what is the value of « optimal GD step » ?

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

4
Slope = 2
InputTransformationResult

Read residuals2

Short segments show what the line does not explain.

Build
Final result · slope2

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/2

Check my understanding

For Last observation y₃ = 6, what is the value of « slope » ?

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

2
0.9 × v0.9Gradient2+= 1.71v′ = 2.9w′ = 2 − 0.1v′
InputTransformationResult

Update the weight1.71

From w=2, movement is −.1v′. Negative velocity reverses movement.

Build
Final result · new weight w′1.71

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

For Gradient g = 3, what is the value of « new weight w′ » ?

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

0.25
αλ = 0.25r₁ = r₂ = 0.5β critique = 0.25
InputTransformationResult

Read critical β0.25

The chosen branch is (1−√(αλ))²; it does not tune every problem direction simultaneously.

Build
Final result · critical β0.25

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

For Product αλ = 0.64, what is the value of « critical β » ?

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

4
f = ½(w₀² + Lw₁²)μ=1L=4α = 0.444 · β = 0.111
InputTransformationResult

Choose a suitable step0.444

The heavy-ball setting assumes this strongly convex quadratic; β is shown alongside α.

Build
Final result · optimal α0.444

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

For Curvature L (μ=1) = 9, what is the value of « optimal α » ?

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

2
024E = 4∂E/∂c = 0 · minimum at 2
InputTransformationResult

Read the gradient0

The minimum is at 2. Gradient 2c−4 indicates which way to move.

Build
Final result · energy derivative0

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−4

Check my understanding

For Central vertex value = 3, what is the value of « energy derivative » ?

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

4
f = ½(w₀² + Lw₁²)μ=1L=4α = 0.4 · κ = 4
InputTransformationResult

Choose a suitable step0.4

Optimal constant step for this quadratic descent is 2/(L+1).

Build
Final result · optimal GD step0.4

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

For Largest curvature L = 9, what is the value of « optimal GD step » ?

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

2
0.9 × v0.9Gradient2+= 1.71v′ = 2.9w′ = 2 − 0.1v′
InputTransformationResult

Update the weight1.71

From w=2, movement is −.1v′. Negative velocity reverses movement.

Build
Final result · new weight w′1.71

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

For Gradient g = 3, what is the value of « new weight w′ » ?

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

2
f(w) = w²w′ = 1.6 · f(w′) = 2.56
InputTransformationResult

Take a small step1.6

With step .1, move to .8w and loss decreases for this quadratic.

Build
Final result · Parameter after correction1.6

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×2w

Check my understanding

For Position w = 3, what is the value of « new weight w′ » ?

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