On-device neural network training and online system identification require an optimiser that accepts one externally computed gradient per call and maintains its own state between calls. Unlike batch optimisers that own the full objective, a step optimiser separates the gradient source from the update rule, enabling training loops where back-propagation runs elsewhere.
Two industry-standard rules are provided: Stochastic Gradient Descent (SGD) with optional momentum or Nesterov lookahead, and the Adam (Adaptive Moment Estimation) optimiser with bias correction.
Vanilla SGD applies the raw gradient:
where
Momentum accumulates a velocity
with
Nesterov momentum incorporates a lookahead correction, replacing the plain velocity step with:
This form evaluates the effective update at the anticipated next position, yielding faster convergence on smooth convex objectives.
Adam maintains exponential moving averages of the gradient (first moment
Both estimates are biased toward zero at initialisation. Bias correction removes this bias:
The parameter update normalises the corrected first moment by the square root of the corrected second moment, providing a per-parameter adaptive step size:
Typical hyper-parameters:
| Algorithm | Time per step | Extra state (floats) | Notes |
|---|---|---|---|
| SGD | One velocity vector (equals the gradient when momentum is 0) | ||
| Adam | Two moment vectors plus the running powers |
SGD with momentum on
| 1 | 1.000 | 1.000 | 0.900 |
| 2 | 0.900 | 1.800 | 0.720 |
| 3 | 0.720 | 2.340 | 0.486 |
Adam on the same objective,
| Quantity | Value |
|---|---|
Bias correction is the critical step: without it,
-
Learning rate too large. SGD without momentum diverges for
$\eta \geq 2/L$ on$L$ -smooth losses. Momentum reduces the effective stability bound further; reduce$\eta$ or$\beta$ if oscillation is observed. -
Adam with small
$\varepsilon$ . Setting$\varepsilon$ too small causes division by near-zero when a parameter has zero gradient history, producing numerical instability. The default$10^{-8}$ is sufficient forfloat. -
Momentum at reset. When
Reset()is called, the velocity (SGD) or moment estimates (Adam) return to zero. The first step after a reset behaves identically to starting from scratch, so the bias-correction denominator for Adam also restarts from$t=1$ . -
Nesterov with large
$\beta$ . The lookahead correction adds$\beta , v_{t+1}$ to the update, which can overshoot on sparse or noisy gradients. Prefer plain momentum when the gradient signal is noisy. -
Float precision. For Adam, the accumulated second moment
$v$ can underflow toward zero for very small gradients and single-precision arithmetic. Increasing$\varepsilon$ mitigates this at the cost of less adaptivity.
| Variant | Change from base |
|---|---|
| AdaGrad | Non-decaying sum of squared gradients (no |
| RMSProp | Adam without first-moment tracking; lacks bias correction |
| AdamW | Decoupled weight-decay applied directly to |
| AMSGrad | Replaces |
- On-device neural network training — Updating weights after each batch of sensor data.
- Online system identification — Fitting model parameters in real time as measurements arrive.
- Adaptive control — Adjusting gain schedules or feed-forward maps without offline re-training.
- Sensor calibration — Minimising residual error by incrementally fitting a polynomial or affine model.
| Component | Relationship |
|---|---|
| Gradient Descent | Batch counterpart; shares the learning-rate update rule but recomputes the objective each time |
| LMS Adaptive Filter | Equivalent to online SGD for a linear regression model under MSE loss |
| Regularization | Adds a penalty gradient to |
- Ruder, S., "An overview of gradient descent optimization algorithms", arXiv:1609.04747, 2016.
- Kingma, D.P. and Ba, J., "Adam: A Method for Stochastic Optimization", ICLR, 2015.
- Nesterov, Y., "A method for solving the convex programming problem with convergence rate
$O(1/k^2)$ ", Soviet Mathematics Doklady, 1983. - Goodfellow, I., Bengio, Y., and Courville, A., Deep Learning, Chapter 8, MIT Press, 2016.