AI301 — Original on-site preparation
Independent written study. All essential explanations and optional model reasoning for this chapter are on this page. References are optional further study. No degree, professional approval or observed competence is conferred.
Training is a stateful numerical experiment
The retained chain-rule investigation already computes every path through active and inactive ReLUs. The published NumPy project additionally trains a tanh network and computes every parameter gradient before mutating weights. To interpret those updates, separate the objective, gradient estimator, optimizer state and evaluation policy. An epoch means a pass through the training examples under a declared sampling scheme; an update means one parameter change. They need not have the same count.
For a mean objective J(θ)=Σℓᵢ(θ)/n, the full gradient is the mean of individual gradients. Uniformly sampling one training row gives an unbiased gradient estimate at the fixed current parameters. A minibatch uses the mean over its sampled rows. This changes computation and sampling variability; it does not make every step lower full loss. Nonuniform sampling without appropriate weighting can target a different objective. If batches have different sizes, averaging their losses equally differs from weighting every example equally.
Use two fictional half-squared losses, ℓ₁(θ)=(θ−1)²/2 and ℓ₂(θ)=(θ−3)²/2. At θ=0 their gradients are −1 and −3, with full mean−2. A rate .1 full-gradient step reaches .2. Drawing one row uniformly reaches either .1 or .3, with expected new value .2. That equality concerns one update at a fixed starting state. Running the two rows sequentially gives θ=.1 after the first, then .39 after the second, because its gradient is now .1−3=−2.9. Reversing the order gives .37. These are two updates, not the original one-step minibatch calculation.
Momentum and adaptive state
One momentum convention is mₜ=βmₜ₋₁+(1−β)gₜ and θₜ=θₜ₋₁−ηmₜ. Other implementations omit the factor 1−β or use different lookahead updates; write the convention instead of comparing parameter values by optimizer name. With m₀=0, β=.5 and gradients 2 then−2, the states are 1 then−.5. The history smooths the changing direction, but does not certify that a finite step is safe.
A common Adam convention tracks mₜ=β₁mₜ₋₁+(1−β₁)gₜ and vₜ=β₂vₜ₋₁+(1−β₂)gₜ² coordinatewise. Starting from zero, use corrected states m̂ₜ=mₜ/(1−β₁ᵗ) and v̂ₜ=vₜ/(1−β₂ᵗ), then subtract ηm̂ₜ/(√v̂ₜ+ε). The squared-gradient average is a second-moment estimate, not by itself a centered variance. With g₁=2, β₁=.9 and β₂=.999, the raw states are .2 and .004; correction yields 2 and 4. For η=.1 the step is .2/(2+ε), approximately .1, rather than the plain-gradient step .2. Restoring weights without these state variables or the step count does not reproduce a resumed Adam run. Adaptive scaling supplies no universal convergence guarantee. Coupled L2 penalties and decoupled weight decay can implement different procedures under an adaptive optimizer.
Initialization, dropout and stopping
Identically initialized hidden units can receive identical updates and remain redundant. Random initialization breaks this symmetry; controlling its scale helps avoid tiny or exploding activations and gradients. Initialization schemes depend on fan-in, fan-out and activation assumptions, not a universal magic variance. Inspect activation and gradient magnitudes and retain the seed and actual parameter arrays needed to reproduce the run.
In inverted dropout, retain a hidden activation h with probability q>0 and use h/q when retained, zero otherwise. Its expectation is h. For h=4 and q=.5 the possible outputs are 0 and 8 with equal probabilities. Squaring gives expected value 32, whereas squaring the mean gives 16: preservation of an activation's expectation does not imply an unchanged nonlinear network output or loss. Conventional evaluation disables this training noise. A model accidentally left in training mode can produce stochastic predictions; an intentional uncertainty procedure needs its own specification and validation.
Validation-based early stopping selects a training duration, so validation is development evidence. Record the selected epoch, restore its weights and relevant state, and keep final test evaluation separate. Augmentation should represent justified task-preserving transformations; changing a label's meaning while retaining the label introduces incorrect training examples. Compare generalization, latency and failure behavior rather than treating a lower training loss as sufficient.
Optional changed batch and complete reasoning
Start the two-loss fixture at θ=2. Individual gradients are 1 and−1; the full mean is 0, so its full-gradient step stays 2. Sequential rate-.1 updates in order 1 then 2 give 1.9 then 2.01; reversing gives 2.1 then 1.99. A stationary full objective can therefore move under a particular sampled sequence. For dropout h=4,q=.25, retained output 16 occurs with probability.25: expected activation 4 and expected square 64. For Adam's first gradient−2, corrected states are−2 and 4, so the parameter moves upward by approximately .1. A zero first gradient instead yields zero numerator; ε prevents the denominator from being zero. These checks verify the stated conventions on synthetic records, not the quality of a trained model.
Optional criteria, one point each: distinguish batch weighting and update counts; trace optimizer state with the stated convention; calculate dropout expectations without commuting nonlinear functions; preserve validation/test and restart-state boundaries. Explain all four for four points.
Optional source references
These sources support the explanations; reading them is optional. Original Academy examples are fictional. Historical attributed readings remain preserved.