Monday, November 30, 2026
HomeData ScienceOnline Learning and Adaptive Algorithms – Regret Bounds, FTRL, Hedge and Streaming...

Online Learning and Adaptive Algorithms – Regret Bounds, FTRL, Hedge and Streaming ML

Table of Content

📋 KEY INSIGHTS

  • Online learning updates model parameters incrementally with each new data point rather than retraining from scratch — essential when data arrives as a continuous stream and batch retraining is too slow or expensive.
  • Regret is the central measure of online learning performance: the cumulative loss of the online algorithm minus the cumulative loss of the best fixed strategy in hindsight. Sublinear regret means the algorithm is competitive with the best single expert.
  • Follow-the-Regularised-Leader (FTRL) is the unifying framework for online convex optimisation — it recovers online gradient descent (L2 regularisation), online mirror descent (entropic regularisation), and AdaGrad (adaptive learning rate) as special cases.
  • The Hedge algorithm (Multiplicative Weights Update) maintains a distribution over experts, downweighting experts that make mistakes — achieving O(√(T log N)) regret after T rounds with N experts.
  • Online-to-batch conversion shows that the average of an online learner’s iterates has PAC-learning guarantees — connecting the streaming regret framework to classical statistical learning theory.
  • AdaGrad, Adam, and their variants are online learning algorithms applied to deep learning: each adapts the per-parameter learning rate based on the history of gradients seen so far.

Classical supervised learning assumes a fixed dataset: collect data, train a model, deploy. Online learning breaks this assumption — data arrives as a stream, the model must make predictions before seeing labels, and parameters are updated incrementally. This setting is ubiquitous in practice: ad click-through rate prediction (billions of impressions per day), financial market models (prices change continuously), recommendation systems (user preferences evolve), and spam filtering (adversarial distribution shift) all require online learning.

This guide covers online convex optimisation from first principles: the regret framework, Follow-the-Regularised-Leader and its special cases, the experts setting with Hedge, online-to-batch conversion, and connections to deep learning optimisers (AdaGrad, Adam) and streaming ML systems.

Regret, Online Gradient Descent and FTRL

The online learning protocol runs for T rounds: at each round t, the learner predicts w_t ∈ W, the adversary reveals a convex loss function ℓ_t: W → R, and the learner suffers loss ℓ_t(w_t). Regret is defined as R_T = Σ_{t=1}^{T} ℓ_t(w_t) − min_{w ∈ W} Σ_{t=1}^{T} ℓ_t(w). An algorithm is no-regret if R_T / T → 0 as T → ∞, meaning the algorithm eventually matches the best fixed strategy. No-regret algorithms exist for all convex loss functions — a remarkable fact given that the adversary may be adaptive. The regret lower bound for any algorithm is Ω(√T) for adversarial losses; optimal algorithms achieve O(√T) regret.

Online Gradient Descent (OGD) is the simplest no-regret algorithm: at each round, take a gradient step w_{t+1} = Π_W(w_t − η ∇ℓ_t(w_t)), where Π_W is the projection onto the feasible set W and η is the learning rate. With η = D/(G√T) (where D is the diameter of W and G bounds the gradient norm), OGD achieves R_T ≤ DG√T — an O(√T) regret bound that matches the lower bound. The connection to our calculus for ML guide is direct: OGD is gradient descent applied online — the same gradient computation and step-size analysis described there for batch gradient descent applies, with the key difference that the loss function ℓ_t changes at each step and regret (not convergence to a fixed minimum) is the performance measure.

Follow-the-Regularised-Leader (FTRL) selects w_t = argmin_{w ∈ W} Σ_{s=1}^{t-1} ℓ_s(w) + (1/η) R(w), where R(w) is a strongly convex regulariser. The intuition: predict using the best-in-hindsight strategy on all past losses, stabilised by the regulariser to prevent large steps. Setting R(w) = ||w||^2/2 recovers OGD; setting R(w) = Σ_i w_i log w_i (entropic regularisation) recovers online mirror descent / multiplicative weights; setting η proportional to the inverse square root of the sum of squared past gradients recovers AdaGrad. FTRL with adaptive learning rates (AdaGrad-style) is the production algorithm for large-scale ad click prediction systems at Google, Meta, and Alibaba — it handles sparse features (most features are 0 for any given ad impression) by using per-feature learning rates that adapt to feature frequency.

AlgorithmRegret BoundRegulariserKey Application
Online Gradient DescentO(√T)L2 (squared norm)General convex losses
Hedge / MWUO(√(T log N))Entropic (KL)Experts, boosting, game theory
AdaGradO(√Σ||g_t||^2)Adaptive L2Sparse features; NLP
FTRL-ProximalO(√T)L1 + L2Ad click prediction (sparse)
Online Newton StepO(d^2 log T)Second-order (Hessian)Exp-concave losses

Experts Setting, Online-to-Batch Conversion and Streaming ML

a close up of a street sign on a wall
Photo by Markus Spiske on Unsplash

The experts setting is the online learning framework where the learner chooses a distribution p_t over N expert predictions, then observes the loss of each expert. Hedge (the Multiplicative Weights Update algorithm) maintains expert weights w_t^i and updates them by w_{t+1}^i ∝ w_t^i × exp(−η ℓ_t^i) after each round — downweighting experts that made costly mistakes. With η = √(log N / T), Hedge achieves R_T ≤ √(T log N / 2), matching the lower bound. The experts framework is remarkably general: online boosting (Freund and Schapire’s original analysis of AdaBoost used it), game theory (Nash equilibria correspond to no-regret strategies in repeated games), and financial portfolio selection all reduce to the experts setting. The connection to our ensemble methods guide is direct: AdaBoost and stacking are batch analogues of Hedge — both maintain weights over base learners and update weights based on prediction errors, with Hedge doing so online round-by-round and AdaBoost doing so over training iterations.

Online-to-batch conversion formalises how online learning algorithms give generalisation guarantees in the statistical learning sense. If a no-regret algorithm is run on T i.i.d. samples (rather than adversarial losses), and the output policy is the uniform mixture over all iterates w_1, …, w_T, then E[ℓ(w_avg)] ≤ min_w E[ℓ(w)] + R_T/T. For OGD with R_T = O(√T), this gives generalisation error O(1/√T), matching the standard PAC learning sample complexity bound. This connects the streaming, game-theoretic world of online learning to the statistical world of batch learning: any online algorithm is implicitly a learning algorithm with PAC guarantees on i.i.d. data. The connection to our regularisation guide is direct: the FTRL regulariser R(w) plays the same role as the L1/L2 penalty in batch regularised empirical risk minimisation — it controls the complexity of the online learner and determines the bias-variance trade-off, with stronger regularisation reducing variance (regret from individual bad rounds) at the cost of bias (slower adaptation to the best strategy).

Streaming ML systems implement online learning at production scale. Apache Flink and Kafka Streams enable feature computation on live event streams with millisecond latency. River (the Python streaming ML library) implements online versions of logistic regression, decision trees, Naive Bayes, and k-NN — all with incremental update methods that process one sample at a time without storing the full dataset. The key production challenge is concept drift: the data distribution changes over time (user preferences evolve, adversaries adapt), making the fixed best-in-hindsight comparator irrelevant. Adaptive algorithms (Adapt-ML, DDM — Drift Detection Method) monitor prediction error rates and trigger model resets or learning rate increases when drift is detected. The connection to our streaming ML guide is direct: the production streaming ML systems described there implement online learning algorithms under the hood — the same FTRL and SGD updates that achieve regret bounds in theory are what powers real-time feature updates and model refreshes in Flink-based ML pipelines.

AdaGrad (Duchi et al., 2011) and Adam (Kingma and Ba, 2015) are online learning algorithms applied to deep neural networks. AdaGrad maintains per-parameter sum of squared gradients G_t^{ii} = Σ_{s=1}^{t} (g_s^i)^2 and sets the learning rate for parameter i to η/√G_t^{ii} — parameters with large historical gradients get smaller learning rates, sparse parameters with rare large gradients get larger ones. Adam adds exponential moving averages of both the gradient and squared gradient (momentum and RMSProp), making it robust to the initial choice of learning rate. The connection to our calculus for ML guide is direct: AdaGrad and Adam are SGD variants — the same gradient computation and chain rule described there for backpropagation produces the g_t gradient vectors that AdaGrad and Adam use to adapt their per-parameter learning rates. Understanding FTRL unifies all of these optimisers: Adam is FTRL with an adaptive regulariser derived from the second moment of the gradient history.

✦ SUMMARIZE THIS ARTICLE WITH AI

Calculus for ML (gradient computation and backpropagation used in OGD and AdaGrad) is in our Calculus guide. Regularisation (L1/L2 as FTRL regularisers; online vs. batch regularisation equivalence) is in our Regularisation guide. Ensemble methods (AdaBoost as batch Hedge; stacking as ensemble of experts) are in our Ensemble Methods guide. Streaming ML (production Flink/Kafka systems implementing online learning at scale) is in our Streaming ML guide. Hyperparameter optimisation (AdaGrad / Adam learning rate as hyperparameter) is in our HPO guide. Multi-armed bandits (online learning applied to explore-exploit; Hedge for adversarial bandits) are in our Bandits guide. ML monitoring (concept drift detection triggering online learner resets) is in our ML Monitoring guide.

Leave feedback about this

  • Rating

Durgesh Kekare
Durgesh Kekarehttps://www.dataexpertise.in
Durgesh Kekare is a data science educator and founder of DataExpertise.in. With expertise in Python, machine learning, and analytics, he helps 10,000+ learners break into data careers.

Latest Posts

List of Categories