Skip to content
BIASED

Stochastic and adaptive optimizers

Block 1 of 7~3 min

A gradient from a sample

Gradient descent uses the full gradient at each step. For Q(w)=1n∑iℓi(w)Q(w)=\frac1n\sum_i\ell_i(w), a uniformly sampled example gives an unbiased gradient estimate at a fixed ww. Averaging BB independent draws with replacement gives

E[g]=∇Q(w),Cov⁡(g)=Σ(w)/B.E[g]=\nabla Q(w),\qquad \operatorname{Cov}(g)=\Sigma(w)/B.

Here Σ(w)\Sigma(w) is the covariance of one sampled example's gradient. The gradient RMSE is tr⁡Σ(w)/B\sqrt{\operatorname{tr}\Sigma(w)/B}, not proportional to 1/B1/B. Stochastic gradient descent uses w←w−ηgw\leftarrow w-\eta g at cost roughly O(Bd)O(Bd) instead of O(nd)O(nd).

For a uniform batch without replacement at fixed weights, multiply that covariance by (n−B)/(n−1)(n-B)/(n-1). During a shuffled epoch, the current weights and later batches depend on earlier choices; the independent-draw proof does not apply unchanged.

On the original 240-row sensor fixture, standardize the eight inputs and centre the target for a fixed training objective. At zero weights, 6000 independent batches give gradient RMSE 28.99,10.05,3.5428.99,10.05,3.54 for B=1,8,64B=1,8,64. Exact finite-dataset predictions are 28.47,10.07,3.5628.47,10.07,3.56. Seed 20261114 controls batch sampling; these are synthetic training calculations.

Answers are saved on the server and tied to this browser until you sign in.

Go deeper — optional

Code and labs do not count toward the main percentage or the certificate.

  • Optimizers: noise and a finite budgetoptional

    Compare batch noise and SGD, momentum and Adam training; separately compute the exact expectation of a noisy scalar recurrence.

    ~25 min · easier on a computer · The matching course topic has been read.

    Self-check in the notebook — not part of mastery or the certificate.