Reminder of the one rule everything rests on — the SGD update:
θt+1=θt−ηgBt(θt),gB(θ)=m1∑i∈B∇ℓi(θ).
Here θ is the parameter we tune, η (eta) is the learning rate = how big a step we take, gB is the mini-batch gradient = the average slope measured on m randomly chosen examples, and ∇ℓi is the slope contributed by example i.
(b) uses a single example → m=1 → pure (online) SGD.
(c) uses 32 of 1000, so 1<m<N → mini-batch SGD.
What it looks like: (a) is one smooth expensive step, (b) is a wildly jittery cheap step, (c) is the practical middle.
Recall Solution 1.2
One epoch = one full sweep = N/m updates.
mN=25050000=200 updates per epoch.
Over 8 epochs: 200×8=1600 updates.
Why: each update consumes one mini-batch of m examples, and N/m batches tile the whole dataset exactly once.
Recall Solution 1.3
(a) False. With uniform random sampling E[gB]=∇L — it is unbiased.
(b) True. Variance =σ2/m (with σ2 = per-example gradient variance from the definition above), so m→2m makes it σ2/(2m) = half.
(c) False. Noise never vanishes with fixed η; θ bounces in a ball of radius ∝η.
Draw x1=1: ∇=2.24−1=1.24; θ3=2.24−0.4(1.24)=2.24−0.496=1.744.
What the figure below shows: read it left-to-right along the number line. The two orange dots are the data points x1=1 and x2=5; the violet star at 3 is the true minimum. The magenta dots rising up the page are θ0,θ1,θ2,θ3 in order, and the magenta arrows are the actual jumps. Notice arrow 1 nudges right toward x1=1, arrow 2 leaps far right toward x2=5 (overshooting past 3), and arrow 3 pulls back left toward x1=1. The dotted vertical lines drop each θ onto the number line so you can read its value. Despite the zig-zag, every θ after the first sits inside the [1,5] range and the values hover around the true mean 3 — that is SGD's noisy-but-centered behaviour made visible.
Recall Solution 2.2
Full gradient: ∇L=21[(θ−1)+(θ−5)]=θ−3. At θ0=0: ∇L=−3.
θ1=0−0.4(−3)=1.2.Why this contrasts: full-batch aims straight at 3 in one clean move; SGD wobbles because each step only sees one point. Both are heading to 3.
Recall Solution 2.3
Variance =σ2/m, std-dev =σ2/m.
m=1: var =12, std =12≈3.464.
m=3: var =12/3=4, std =2.
m=12: var =12/12=1, std =1.
Why: multiplying m by 12 cut the std-dev only from 3.464 to 1 (about 3.46×, i.e. 12) — diminishing returns.
Bounce distance ∝ std-dev ∝σ/m.
std(m=8)std(m=32)=σ/8σ/32=328=41=21.
So the bounce shrinks by a factor of 2 — while costing 4× the compute per step. Why it matters:4× cost buys only 2× less jitter; this is the diminishing-returns story quantified.
Recall Solution 3.2
First, the role of k: it must satisfy k>0 so the denominator 1+kt actually grows with the step count t (if k=0 the rate never decays — that is just constant η; if k<0 the denominator eventually hits zero or flips sign and the rate blows up). Larger k = faster decay = the rate cools down sooner. Crucially, k only scales the sums by a constant — it changes how fast you converge, not whether the Robbins–Monro conditions hold.
Write ηt∼kη0⋅t1 for large t (the constant offset 1 doesn't change large-t behaviour).
∑tηt∼kη0∑tt1 — the harmonic series diverges ⇒∑ηt=∞. ✓ This buys: total travel distance is unbounded, so you can reach the minimum no matter how far.
∑tηt2∼k2η02∑tt21 — this is the p-series with p=2, which converges (to η02π2/6k2-ish) ⇒∑ηt2<∞. ✓ This buys: steps shrink fast enough that accumulated noise is finite and averages out, so you actually stop bouncing.
Why these two, not one? Diverging ∑ηt alone could bounce forever; converging ∑ηt2 alone could stall before reaching the min. Together: reach it and settle. The 1/t decay of this schedule is the slowest decay that still makes ∑ηt2 converge — a knife-edge sweet spot; k tunes the constant in front but cannot break either property. See Learning Rate Schedules.
Recall Solution 3.3
Near the minimum the true gradient ∇L≈0, so the update is dominated by the noise part of gB, whose typical size is ∝η⋅(σ/m). With fixedη this size never shrinks, so θ keeps taking noise-driven steps of constant scale — a permanent wiggle in a ball of radius ∝η. With a decayingηt→0, each noise kick gets smaller, and because ∑ηt2<∞ the total remaining wiggle is finite and vanishing — θ converges.
Scale factor c=512/64=8. New learning rate:
ηnew=c⋅η=8×0.1=0.8.Intuition: a larger batch gives a less noisy gradient, so each step is more trustworthy — you can afford a bigger step. The linear rule targets keeping the total parameter movement per epoch roughly constant: with c× larger batches you take c×fewer updates per epoch, so each update must move c× farther to cover the same ground.
Recall Solution 4.2
Updates per epoch =N/m; total over 10 epochs =10N/m.
m=100: 10⋅106/100=100000 updates.
m=1000: 10⋅106/1000=10000 updates.
So the big-batch run takes 10×fewer steps in the same epoch budget.
Linear scaling from base (100,0.05) with c=1000/100=10:
η=10×0.05=0.5.Why together: fewer, bigger, more-confident steps at a proportionally larger learning rate cover comparable distance — the synthesis of update-count, batch size and learning rate.
Recall Solution 4.3
Flat minima are favoured by more gradient noise, which the network cannot "sit still" inside a narrow sharp basin.
Decrease batch size m. Noise variance =σ2/m grows as m shrinks → more exploration → escapes sharp basins. (See Batch Size and Generalization.)
Increase the learning rate η (within stability). The effective noise injected per step scales with η, so a larger η widens the bouncing ball and pushes SGD out of narrow minima. (See Learning Rate Schedules.)
Both raise the temperature of SGD's random walk, biasing it toward wide, flat, generalizing basins — the implicit-regularization story linked to the Bias-Variance Tradeoff.
Exact gradient of the averaged loss is ∇L=θ−xˉ=θ−3. Update:
θt+1=θt−η(θt−3).
Subtract 3 from both sides — this reveals the erroret=θt−3:
θt+1−3=(θt−3)−η(θt−3)=(1−η)(θt−3).
So et+1=(1−η)et: the error shrinks (or grows) by a constant factor r=(1−η) each step — a geometric sequence, et=rte0. With η=0.4, r=0.6:
θ0=0⇒e0=−3.
θ1=3+0.6(−3)=3−1.8=1.2.
θ2=3+0.6(−1.8)=3−1.08=1.92.
θ3=3+0.6(−1.08)=3−0.648=2.352.
Since ∣r∣=0.6<1, et→0, so θt→3=θ∗. What it looks like: smooth exponential glide to the minimum — no wobble, because full-batch has zero gradient noise here.
All three regimes (governed by ∣1−η∣):
∣1−η∣<1 (i.e. 0<η<2): error shrinks each step → converges to 3. Within this, 0<η<1 gives r∈(0,1) = a monotone glide from one side; 1<η<2 gives r∈(−1,0) = convergence that alternates sides (overshoots then corrects), spiraling in. At exactly η=1, r=0 → one-step jump straight to 3.
∣1−η∣=1 (i.e. η=0 or η=2): error magnitude is constant. η=0 = no movement at all; η=2 = r=−1 = θoscillates forever between 0 and 6, never settling.
∣1−η∣>1 (i.e. η<0 or η>2): error grows each step → diverges, flying away from the minimum. This is the too-large-learning-rate blow-up.
Why this matters: the exact same contraction factor governs stability of the learning rate on any quadratic — η too large (>2 here) doesn't just slow you down, it explodes.
Recall Solution 5.2
In 5.1 the gradient is the exact averaged gradient θ−3, so the noise term is identically 0; the update is a pure contraction et+1=(1−η)et→0 and θ glides in. In SGD the estimate is gB=θ−xj, which equals the true gradient plus a mean-zero noise term whose typical size is σ/m (here caused by which point xj we happened to draw). That noise never disappears at fixed η: near θ=3 the true part ≈0 but the noise part ≈η⋅(σ/m) keeps kicking θ around a ball of radius ∝η. The responsible quantity is the gradient-estimate variance σ2/m (equivalently its square root, the noise std-dev σ/m); to kill the wobble you must send ηt→0 under Robbins–Monro, exactly as in Exercise 3.2. Full-batch has σ2/m effectively zero here, so no schedule is needed — it just contracts to the point.
Recall Solution 5.3
Need ∣et∣=3⋅(0.6)t<0.1⇒(0.6)t<1/30.
Take logs: t>ln0.6ln(1/30)=−0.5108−3.4012≈6.66.
Smallest integer: t=7. Check: 3⋅0.67=3⋅0.0279936=0.0839808<0.1. ✓ And t=6: 3⋅0.66=0.139968>0.1. So t=7.
Recall One-line recaps (self-test)
Updates in one epoch ::: N/m.
Meaning of σ2 ::: per-example gradient variance = spread of individual gradients around the true gradient.
Effect of m→2m on noise variance ::: halves it (σ2/m).
Robbins–Monro pair ::: ∑ηt=∞ and ∑ηt2<∞.
Role of k in ηt=η0/(1+kt) ::: decay constant, must be k>0; tunes speed, not whether R–M holds.
Linear scaling rule ::: multiply m by c⇒ multiply η by c.
Fixed-η SGD endpoint ::: a bouncing ball of radius ∝η, not a point.
Error law of exact-gradient step on quadratic ::: et+1=(1−η)et; converges iff ∣1−η∣<1.