Optimization1951foundational8 min read

A Stochastic Approximation Method

أسلوب التقريب العشوائي

Robbins, H. · Monro, S. — The Annals of Mathematical Statistics

The problem

You have a function M(x) — the expected response of an experiment at level x — that you believe has a root at some unknown point θ: M(θ) = α. The catch: you cannot observe M(x) directly. Each experiment returns a noisy sample Y = M(x) + random error. Classical methods like require exact function values and derivatives. How do you find θ when all you have is noisy, one-shot observations?

The contribution

An iterative algorithm that finds θ using only noisy observations: at step n, observe Yₙ at level xₙ, then update xₙ₊₁ = xₙ − aₙ(Yₙ − α). The step sizes aₙ must satisfy two conditions: Σaₙ = ∞ (to reach any target) and Σaₙ² < ∞ (to suppress noise). Under mild monotonicity assumptions on M, the iterates xₙ converge to θ in probability. This was the first algorithm to provide a principled way to optimize under noise.

The impact

This seven-page paper is the seed from which all of modern stochastic grew. — the algorithm that trains every — is a direct descendant: set the to a and you recover the Robbins-Monro update. Adam, RMSProp, and every adaptive inherit its step-size logic. Without this paper, there is no practical way to train deep learning models on data too large to fit in memory.

Imagine you're blindfolded on a hilly field, trying to find the bottom of a valley. You can't see the slope, but you have a noisy compass — it points roughly downhill, but the needle wobbles randomly each time you check it.

A deterministic optimizer says: "read the compass and walk exactly where it points." But the wobble sends you zigzagging forever.

Robbins and Monro say: "read the compass, but take shorter steps as you go." Early on, you stride boldly to get close. Later, your steps shrink until the wobble can't throw you far. The random errors cancel out over time, and you settle into the valley floor — despite never seeing it clearly.

The problem: finding a root you cannot see

Suppose you run a medical experiment: at dose level xx, the patient's response has an expected value M(x)M(x). You want to find the dose θ\theta where M(θ)=αM(\theta) = \alpha — perhaps the dose at which 50% of patients respond. Two obstacles block your path:

You never see M(x)M(x). Each patient gives you one noisy outcome YY, not the true average. Two patients at the same dose may respond differently.

You get one shot per level. Classical methods like bisection assume exact function evaluations. With noise, a single observation at xx tells you very little about M(x)M(x).

Newton's method requires the derivative M′(x)M'(x), which is even harder to estimate from noisy data. Before 1951, there was no principled solution to this problem.

Open in Lab
The green line is the hidden M(x). You only see the red noisy dots. Watch the green iterate converge to θ despite the noise.
The demo wakes as you arrive…

The idea: shrink your steps, average out the noise

Robbins and Monro proposed a beautifully simple procedure. Start at some initial guess x1x_1. At each step nn:

  1. Run one experiment at level xnx_n and observe the noisy outcome YnY_n.
  2. Compute the "": how far is YnY_n from the target α\alpha?
  3. Step in the opposite direction by an amount proportional to the error, but scaled by a shrinking ana_n.

The in its entirety:

xn+1=xn−an(Yn−α)x_{n+1} = x_n - a_n \left( Y_n - \alpha \right)
The Robbins-Monro update — the ancestor of SGD — xₙ = current guess · Yₙ = noisy observation at xₙ · α = target value · aₙ = step size that shrinks with n · the update moves toward θ on average
Open in Lab
Click "Next" to step through one iteration of the algorithm.
The demo wakes as you arrive…

Think of the algorithm as a feedback loop — like adjusting the steering wheel of a car on a foggy road. You can't see the road clearly (the noise), but each small correction keeps you roughly on track. The key insight is that the corrections must shrink over time: big corrections early to get roughly right, tiny corrections later to settle precisely.

The step-size conditions: the engine of convergence

The entire theory rests on two conditions on the step sizes ana_n. These are the most famous conditions in stochastic optimization — every optimizer you've ever used inherits them. Before presenting the formulas, let's understand what each condition prevents:

The first condition prevents premature stopping. If the steps shrink too fast (say an=1/n2a_n = 1/n^2), their total sum ∑an\sum a_n converges — meaning the algorithm can only travel a finite distance from the starting point. If θ\theta is farther away, you'll never reach it. So we need the total distance budget to be infinite.

The second condition prevents eternal wandering. If the steps don't shrink at all (say an=ca_n = c), the noise keeps pushing the iterates around forever — they bounce but never settle. We need the cumulative noise power ∑an2\sum a_n^2 to be finite so the noise dies out.

∑n=1∞an=∞and∑n=1∞an2<∞\sum_{n=1}^{\infty} a_n = \infty \quad \text{and} \quad \sum_{n=1}^{\infty} a_n^2 < \infty
The Robbins-Monro step-size conditions — First condition: infinite reach — can travel any distance · Second condition: finite noise power — the noise eventually dies
Open in Lab
Compare three schedules. Only 1/n satisfies both conditions simultaneously.
The demo wakes as you arrive…

The convergence theorem

Robbins and Monro proved that under the following assumptions on the M(x)M(x), the iterates xnx_n converge to θ\theta in probability:

  • Monotonicity: M(x)M(x) is non-decreasing. This ensures the error signal Yn−αY_n - \alpha has the correct sign on average — pointing the algorithm toward θ\theta.
  • Existence of the root: there exists a unique θ\theta such that M(θ)=αM(\theta) = \alpha.
  • Bounded : the noise Y−M(x)Y - M(x) has bounded variance, Var(Y)≤C\text{Var}(Y) \leq C for all xx. This prevents individual observations from being catastrophically misleading.
  • Step-size conditions: ∑an=∞\sum a_n = \infty and ∑an2<∞\sum a_n^2 < \infty.

Under these conditions, for any ε>0\varepsilon > 0, P(∣xn−θ∣>ε)→0P(|x_n - \theta| > \varepsilon) \to 0 as n→∞n \to \infty. The iterates converge to the true root in probability — not with certainty on every run, but with vanishing probability of being far away.

Open in Lab
Five independent runs from different starting points — all paths converge to θ.
The demo wakes as you arrive…

The algorithm in code

Robbins-Monro stochastic approximation, completepython

Simplified to show the idea — not the real implementation.

import numpy as np

def robbins_monro(M_noisy, alpha, x0, n_steps=100):
    """
    Find θ where E[M(θ)] = α using only noisy observations.

    M_noisy(x) : callable — returns one noisy sample Y at level x
    alpha      : target value
    x0         : initial guess
    """
    x = x0
    history = [x]

    for n in range(1, n_steps + 1):
        a_n = 1.0 / n          # step size: Σ(1/n) = ∞, Σ(1/n²) < ∞
        Y_n = M_noisy(x)       # one noisy observation
        x = x - a_n * (Y_n - alpha)   # the update
        history.append(x)

    return x, history

# Example: M(x) = 2x − 6, root at θ = 3
def experiment(x):
    return 2*x - 6 + np.random.randn() * 1.5   # true M + noise

theta_hat, path = robbins_monro(experiment, alpha=0, x0=0.5)
print(f"Estimate: {theta_hat:.3f}")   # ≈ 3.0

From root-finding to training neural networks

The connection to modern is direct and profound. When a neural network, we want to minimize a function L(θ)=E[ℓ(θ;ξ)]\mathcal{L}(\theta) = \mathbb{E}[\ell(\theta; \xi)] over the model parameters θ\theta. The minimum occurs where the gradient is zero: ∇L(θ∗)=0\nabla \mathcal{L}(\theta^*) = 0. This is a root-finding problem.

We cannot compute the true gradient ∇L\nabla \mathcal{L} because it averages over the entire dataset — far too expensive. Instead, we estimate it from a random mini-batch, giving us a noisy gradient ∇ℓ(θ;ξt)\nabla \ell(\theta; \xi_t). This is exactly the noisy observation in Robbins-Monro.

Stochastic Gradient Descent is Robbins-Monro applied to gradient root-finding. The 1951 conditions ∑an=∞\sum a_n = \infty and ∑an2<∞\sum a_n^2 < \infty are the theoretical justification for learning rate schedules that every practitioner uses today — even when they may not know the names Robbins and Monro.

Open in Lab
Toggle between the two perspectives — the update rule is identical.
The demo wakes as you arrive…

Why it mattered

  1. 1951

    Robbins-Monro

    The stochastic approximation method — finding roots under noise with shrinking step sizes.

  2. 1952

    Kiefer-Wolfowitz

    Extended stochastic approximation to optimization (finding maxima) using finite differences, without needing analytical gradients.

  3. 1958

    Sacks' asymptotic normality

    Proved that √n(xₙ − θ) converges to a normal distribution, giving confidence intervals for the estimate.

  4. 1951

    SGD is born

    The Robbins-Monro update applied to gradient root-finding becomes Stochastic Gradient Descent, though the name came later.

  5. 2015

    Adam optimizer

    Adam adds adaptive per-parameter learning rates and momentum to the Robbins-Monro framework — the most popular optimizer in deep learning.

  6. 2024

    Scaling-law optimizers

    Modern training runs of trillion-parameter models rely on carefully tuned step-size schedules — all descendants of the 1951 conditions.

CitationRobbins, H. and Monro, S.. A Stochastic Approximation Method. The Annals of Mathematical Statistics, 1951.

Terms in this paper