Online, Offline, and Continual Learning › Worked Example: Tracking a Drifting Coefficient
World Models HandbookAll chapters Online, Offline, and Continual Learning › Worked Example: Tracking a Drifting CoefficientOne section · Sections in this chapter6 / 11 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Let us make the tradeoffs quantitative with a scalar example we can solve on paper. Suppose the true relationship is
where:
- : the observed target at step
- : the true coefficient in the drifting-coefficient example
- : the scalar input at step
- : zero-mean observation noise at step
- : the variance of the observation noise
with and , and suppose changes at some point from one value to another. We want to know how fast SGD tracks the change and how precisely it can localize the new value.
From the derivation above, the bias decays geometrically:
where:
- : the expected deviation of the estimate from the true parameter after steps
- : the parameter estimate after steps
- : the initial parameter value
- : the true parameter
- : the fixed learning rate
- : the variance of the inputs
- : the number of steps elapsed, so is the per-step contraction factor
With and , the decay rate is per step. To reduce the initial error by a factor of takes about steps. Here is where that number comes from. We want the smallest with . Taking logarithms,
where:
- : the number of steps
- : the learning rate
- : the variance of the inputs
- : a small positive quantity, here
With this gives steps. That is the adaptation time.
The adaptation time is the first half of the tradeoff. It tells us how long the estimator takes to forget an old value after the world changes. The second half is the noise ball, which tells us how precisely the estimator can settle on the new value once it has arrived.
Now the noise. At stationarity, the variance satisfies
where:
- : the stationary variance of the estimate around the true parameter
- : the stationary parameter estimate around which the variance is measured
- : the learning rate
- : the variance of the inputs
- : the scalar input at step
- : the variance of the observation noise
- : the expected squared contraction factor, which appears in the denominator
Replacing the random contraction by its mean gives the moment-closure approximation . Under that approximation,
where:
- : the stationary variance of the estimate around the true parameter
- : the stationary parameter estimate around which the variance is measured
- : the learning rate
- : the variance of the inputs
- : the variance of the observation noise
This is the noise ball: the residual fluctuation of the estimate around the true value. Its radius is
where:
- : the standard deviation of the stationary estimate fluctuation, also called the noise ball radius
- : the stationary variance of the estimate around the true parameter
- : the stationary parameter estimate around which the variance is measured
- : the learning rate
- : the observation noise variance
With and , the approximate stationary standard deviation is about . That is the scale of an instantaneous stationary fluctuation, not a hard detection limit: averaging or sequential tests can detect smaller persistent shifts. A change of is much larger, and the roughly 50-step e-folding time means the estimate moves substantially toward it over tens of steps rather than settling immediately.
The tradeoff is now explicit. Increasing shortens the adaptation time and enlarges the noise ball. Decreasing does the reverse. There is no setting that makes both small; you are choosing where on the curve to sit. This is the same tradeoff that a replay buffer expresses in sample units, and the same tradeoff that a forgetting factor expresses as a discount rate. All three are parametrizations of a single decision about how much history to retain.
The figure below makes that frontier visible. Each point on the curve corresponds to one learning rate, with the adaptation time on the horizontal axis and the noise ball radius on the vertical axis.
import numpy as np
sigma_x_sq = 1.0
sigma_noise = 0.05
eta_grid = np.linspace(0.002, 0.2, 200)
adaptation_time = -1.0 / np.log1p(-eta_grid * sigma_x_sq)
noise_ball_radius = np.sqrt(eta_grid * sigma_noise**2 / 2.0)
marked_eta = np.array([0.005, 0.02, 0.05, 0.1])
marked_time = -1.0 / np.log1p(-marked_eta * sigma_x_sq)
marked_radius = np.sqrt(marked_eta * sigma_noise**2 / 2.0)
marked_labels = [rf"$\eta={e}$" for e in marked_eta]
One more observation from the variance formula. The noise ball shrinks only as , so halving the residual fluctuation requires quartering the learning rate, which quadruples the adaptation time. The returns to precision are poor. If you need a precise estimate, gradient descent with a fixed learning rate is the wrong tool; you want a method that reduces its effective step size as evidence accumulates, which is exactly what RLS does until it is given a forgetting factor.
The worked example also shows why the choice of learning rate depends on the scale of the change you expect. If the true coefficient changes by 0.3, a learning rate of 0.02 tracks it quickly. If the true coefficient changes by 0.003, that same learning rate cannot distinguish the change from noise. A practical system should therefore relate its learning rate to the smallest change it needs to detect and the fastest change it needs to track. Those two requirements pull in opposite directions, and the resolution is usually to use a larger learning rate for adaptation and a smaller one for fine-tuning, or to use a method that adapts the learning rate itself.