- Introduced by
- Xiao, L.; Shalev-Shwartz, S.; McMahan, H. B. et al.
- Year
- 2007–2013
- Type
- Online optimization framework with regularization
- Family
- Machine learning
What does it do?
Regularized online learning fits a model to data that arrive one example at a time, adding a regularization penalty to each update to control model complexity without storing the full dataset.
Follow-the-Regularized-Leader (FTRL) and Regularized Dual Averaging (RDA) are the best-known algorithms in this family. With an L1 penalty, they can produce sparse weight vectors on streaming data.
The intuition behind the method
Standard online learning updates model weights greedily after each example, which can lead to oscillating or overly complex solutions when the data stream is noisy. Adding a regularization term, such as an L1 or L2 penalty, keeps large or complex weights in check throughout training. The learner therefore balances fitting each new example against staying simple. With an L1 penalty, some coefficients can be exactly zero, and the model is maintained without storing the entire dataset in memory.
History
Lin Xiao introduced Regularized Dual Averaging (RDA) in a 2010 Journal of Machine Learning Research paper on dual averaging methods for regularized stochastic and online optimization. The online convex optimization framework within which these methods are analysed is surveyed by Shalev-Shwartz (2012), who is cited here for that framework rather than as the originator of these algorithms. Follow-the-Regularized-Leader (FTRL) is a closely related family of algorithms analysed in the same setting; its originators are not cited on this page.
When to use it
Use regularized online learning when data arrive as a continuous stream and the full dataset is unavailable, too large to store, or when the data distribution shifts over time and incremental adaptation is needed. It is especially well suited to high-dimensional sparse feature spaces — such as click-through-rate prediction or text classification — where L1 regularization produces compact, interpretable models. When the full dataset fits comfortably in memory, batch methods with cross-validated regularization are often more accurate, so compare on your own data before choosing online learning. Also avoid it when interpretability requires fixed coefficients, as online models continue to update and may shift.
Limitations and considerations
- Final accuracy often falls below carefully tuned batch methods when the full dataset is available and cross-validation of the regularization strength is feasible.
- The regret guarantees in the cited survey are stated for convex losses. For non-convex models such as deep networks, these guarantees do not apply directly.
- The regularization strength and learning-rate schedule are problem-dependent. In a stream there is no fixed hold-out set, so choosing them requires prequential evaluation or a warm-start batch.
- Order sensitivity: the sequence in which examples arrive changes the trajectory of the weights, so the same data in a different order can yield a different model.
- Regret bounds for these methods assume a convex loss in w and bounded subgradients. They compare the learner against the best fixed weight vector in hindsight over an arbitrary, possibly adversarial, ordering of examples. They describe worst-case behaviour and do not guarantee accuracy on a particular stream.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Memory scales with the number of features rather than the number of examples, because only accumulated gradient information or sufficient statistics are kept, so the method can run on streams with no fixed end.
- With an L1 penalty, the update can set coefficients exactly to zero, giving a sparse model with lower storage and inference cost. RDA was designed to produce this sparsity.
- The penalty acts on accumulated evidence rather than on the latest gradient alone, so a feature that has little support over the stream is shrunk toward zero.
- Continuous updating lets the weights track a distribution that shifts over time, without retraining from scratch.
- Only the regularization strength and the learning-rate schedule need tuning, but in a stream this requires prequential evaluation or a warm-start batch.
- The loss can be changed freely (for example squared or logistic loss), since the update requires only its gradient. The theoretical guarantees, however, rest on convexity (see limitations).
Applications
- Click-through-rate prediction on high-dimensional sparse ad features at internet scale.
- Real-time spam or fraud detection on a continuous stream of transactions.
- Text classification and sentiment analysis with streaming social-media data.
- Adaptive recommendation systems that update user-preference models with each interaction.
- Online regression for sensor data or time-series forecasting with concept drift.
- Feature selection in streaming settings via L1-induced sparsity.
How it works
How it works
The weights are initialized, typically to zero. Hyperparameters are set: the regularization type (L1 for sparsity, L2 for stability, or elastic net for both), the regularization strength, and the learning-rate schedule.
At each time step t, the algorithm receives one new labelled example from the stream. Past examples are not kept; the algorithm retains only accumulated gradient information or sufficient statistics.
The current weight vector is used to predict the label or value for the incoming instance. The prediction is made before the true label is revealed, as required by the online learning protocol.
Formula
\hat{y}_t = f(\mathbf{w}_t, \mathbf{x}_t)After the true label is revealed, the instantaneous loss is computed, and its gradient with respect to the weight vector is accumulated.
Formula
\ell_t(\mathbf{w}) = \text{loss}(f(\mathbf{w}, \mathbf{x}_t), y_t)Weights are chosen to minimize the sum of past losses plus the regularization penalty. The displayed formula is an idealized form. FTRL solves a subproblem of this kind at each step. RDA works with the running average of subgradients, which is what allows an L1 penalty to set coefficients exactly to zero. The penalty shrinks coefficients that are not supported by the accumulated evidence. For the exact update, see Xiao (2010).
Formula
\mathbf{w}_{t+1} = \arg\min_{\mathbf{w}} \left\{ \sum_{s=1}^{t} \ell_s(\mathbf{w}) + R(\mathbf{w}) \right\}Common pitfalls
- Keeping a fixed learning rate where a decaying or adaptive schedule is needed, which can prevent the weights from settling.
- Choosing the regularization strength without validation. A penalty that is too strong underfits the stream; one that is too weak lets noisy early examples dominate the accumulated sums.
- Leaving feature scales unnormalized in the stream. Gradient magnitudes then differ across coordinates, so the same L1 penalty shrinks features with large values differently from features with small values.
- Evaluating only the most recent examples rather than computing prequential (test-then-train) accuracy over the whole stream.
- Treating a model trained online as equivalent to a batch model fitted on the same examples. The order of arrival changes the solution.
Frequently asked questions
What is the difference between FTRL and standard stochastic gradient descent?
Standard online SGD takes a gradient step at each example. FTRL instead solves a subproblem at each step that minimizes the sum of all past losses plus the regularizer. With L1 penalties, dual-averaging and FTRL-type updates can yield exact zeros, which plain SGD with a per-example step typically does not produce; the degree of sparsity depends on the penalty strength and the data.
How do I choose the regularization strength in an online setting?
Use a held-out validation stream or prequential evaluation: evaluate the current model on each new example before updating, and track loss over time at different regularization levels. Grid search on a representative initial batch can provide a warm start.
Can regularized online learning handle non-stationary data?
Yes, this is one of its main advantages. Because weights are updated continuously, the model can track a slowly shifting distribution. For rapid drift, a smaller effective memory (faster learning rate, or forgetting factors) may be needed.
Is regularized online learning the same as mini-batch stochastic gradient descent?
Not exactly. Mini-batch SGD processes small random batches from a fixed dataset multiple times (epochs) and is a batch technique. Regularized online learning processes each example once as it arrives, with no epochs, making it truly incremental.
Which regularizer should I choose?
L2 (ridge) favors smooth, dense weights. L1 (lasso) promotes sparsity and is often preferred when most features are expected to be irrelevant. Elastic net combines both penalties and is a common compromise when both sparsity and stability matter. Compare the choices on your own validation stream.
Related methods
Sources
Xiao, L. (2010). Dual Averaging Methods for Regularized Stochastic and Online Optimization. Journal of Machine Learning Research, 11, 2543–2596.
Open publication referenceShalev-Shwartz, S. (2012). Online Learning and Online Convex Optimization. Foundations and Trends in Machine Learning, 4(2), 107–194.
Open DOI reference