Data Dump Tutorial
Stochastic Approximation and Quasi-Stochastic Approximation
What Is Stochastic Approximation?
Stochastic approximation is a root-finding problem in disguise. The goal is to find a parameter θ∗ such that
where fˉ is an expectation — a function of θ and some random variable from nature or from exploration signals. In reinforcement learning, this expectation is too complex to compute directly.
The ODE method provides the conceptual foundation. If we could compute fˉ, we would design an ordinary differential equation (ODE) whose equilibrium is θ∗, and then approximate that ODE using Euler's method. Since we cannot compute fˉ, we replace it with noisy observations f(θ,ξ):
This is the fundamental stochastic approximation iteration. The convergence theory rests on the idea that Euler approximations are robust: the error from discretizing the ODE behaves like noise, and the same mathematical tools — particularly the Bellman-Gronwall lemma — prove convergence for both the ODE discretization and the stochastic approximation. The theory is not deep once properly set up; it is the setup that required the work of many brilliant researchers.
Key Point: ODE Design Before Algorithm
A pedagogical reversal is advocated: first design the ODE (the mean dynamics) to ensure stability and convergence to θ∗, then approximate it with a numerical method. This is a control problem — we are free to choose any dynamics we want for θ(t), unconstrained by physics. For example, one could set
which implies fˉ(θ(t))=fˉ(θ0)e−t, ensuring exponential convergence. Applying the chain rule yields a matrix gain algorithm (Newton–Raphson flow), which is the foundation of Zap Q-learning. This design freedom is invisible in the discrete-time world.
However, not all algorithms fit this ODE-first paradigm. Batch algorithms (e.g., linear programming approaches to Q-learning) are naturally discrete and must be analyzed via the ODE method in reverse. The ODE method is not universal, but it provides deep insight when applicable.
Rates of Convergence and Gain Selection
The step size (gain) sequence determines the convergence rate. For a gain αn=g/(n+1) with g>0, the mean-square error converges at the optimal O(1/n) rate if and only if the matrix I+gA∗ is Hurwitz — i.e., all eigenvalues lie in the open left half-plane. Here A∗ is the linearization of fˉ at θ∗, assuming smoothness. This condition is often restrictive (a "sad fact"). The ZAP algorithms were designed to overcome this by optimizing the constant.
Asymptotic statistics (e.g., the central limit theorem) are valuable for understanding rates. Remarkably, the optimal rate of convergence depends only on the linearization, not on the noise covariance. But the CLT can fail in some numerical examples.
Quasi-Stochastic Approximation: Replacing Noise with Sine Waves
In many applications — especially in reinforcement learning — we create the noise ourselves (e.g., exploration signals). Google's chess-playing system inserted noise during training; the chess game itself was not noisy. If we insert noise, we might as well make it "tame" to achieve faster convergence — potentially O(1/n2) instead of O(1/n).
Quasi-stochastic approximation replaces the random noise ξn with deterministic, smooth probing signals — for example, sinusoids or sums of sinusoids. The parameter estimate then evolves smoothly rather than erratically.
Probing Signals as Dynamical Systems
Let the probing signal Z(t) be generated by a deterministic dynamical system:
where Z takes values in a compact set (e.g., a torus). A simple example is a vector of complex exponentials:
This system is ergodic — sample-path averages converge to an invariant measure (e.g., uniform on the circle). This ergodicity is crucial for analysis.
Poisson's Equation
For a given forcing function G, Poisson's equation on this deterministic Markov process is
where Gˉ is the ergodic average of G. The solution G^ (if it exists) provides the rate of convergence of ergodic averages:
Hence the error decays as O(1/T). For sinusoidal signals, Poisson's equation is trivial; more generally, it is a central tool for analyzing convergence rates.
Applications to Gradient-Free Optimization
Kiefer–Wolfowitz (Finite Differences)
Suppose we want to minimize a loss function L(θ) but do not have access to gradients. The classical Kiefer–Wolfowitz procedure uses finite differences with random perturbations W:
where W is typically IID noise. The mean dynamics (ODE) for this algorithm approximates gradient descent:
The analysis is standard and relies on Taylor expansion: the even terms cancel, leaving the gradient plus a bias of order ε2.
Quasi-Kiefer–Wolfowitz (Quasi-Stochastic Gradient Descent)
Simply replace the IID noise W with a sinusoidal probing signal (e.g., a sum of sine waves). The algorithm becomes fully deterministic. The rate of convergence can be made extremely sharp — O(1/n) or even O(1/n2) under appropriate conditions — with precise constants determined by the probing signal's frequencies and amplitudes.
Extremum Seeking Control
A 100-year-old idea from control theory (dating back to 1922): perturb the parameter θ with a probing signal, pass the loss through a high-pass filter, multiply by the probing signal, and integrate to obtain an approximate gradient. This is essentially a lock-in amplifier technique. Extremum seeking has its own theory of averaging (analogous to Polyak–Ruppert averaging in stochastic approximation) but remains a niche area.
Theoretical Analysis: Rate Bounds
The analysis of quasi-stochastic approximation proceeds in two steps:
Coupling with the mean ODE: Compare the quasi-SA iterate θn with the ideal ODE trajectory θˉ(t) (both using the same step size). The difference Zn=θn−θˉ(tn) satisfies a linearized differential equation plus a noise term. If Zn is bounded, the rate of convergence is O(αn).
Change of variables: Define Yn that subtracts the integral of the "noise" (the error between the quasi-SA vector field and the mean field). The resulting Yn has zero-mean dynamics and converges to a constant. This yields a precise expression:
The bias from finite difference is O(ε2), manageable with small ε.
A key assumption for rate analysis: Poisson's equation has a solution for the probing signal. For sinusoids, this holds automatically. The rate bound is then O(αn) with explicit constants.
Failure of Polyak–Ruppert Averaging
In standard stochastic approximation, Polyak–Ruppert averaging obtains optimal O(1/n) rates by using a large step size and averaging the iterates. For quasi-SA, this fails because the residual bias term (the Y^ term) is non-local — it depends on the behavior of fˉ far from the equilibrium. The averaging works only if this term is zero, which is rare.
Tail averaging (weighting recent iterates more heavily) works much better in practice and is recommended.
Practical Considerations and Warnings
Lipschitz continuity of fˉ is critical. If the loss L is strongly convex (e.g., quadratic), it is not globally Lipschitz, so the theory may not apply globally. Local results may still hold.
In numerical experiments on the mountain car problem, quasi-Kiefer–Wolfowitz with sinusoids converged consistently to near-optimal parameters after only 5,000 samples, while the IID version exhibited high variance across runs.
The choice of step size remains an issue: the condition I+gA∗ Hurwitz is still needed for optimal rates. But by designing the ODE carefully (e.g., Newton–Raphson flow), one can circumvent this constraint.
Connections to Reinforcement Learning
Quasi-stochastic approximation is directly applicable to policy gradient and actor-critic methods, where the loss is the expected return and gradients are estimated via exploration noise. Replacing random exploration with deterministic sine waves can drastically reduce variance and improve convergence speed. Applications to constrained optimization (e.g., at NREL) and reinforcement learning are active areas of research.
Summary
Stochastic approximation is root-finding with noisy observations, justified by the robustness of Euler approximations of an underlying ODE.
Quasi-stochastic approximation replaces noise with deterministic probing signals (e.g., sine waves), enabling much faster convergence (O(1/n) or better with small constants).
Analysis relies on Poisson's equation for the probing signal dynamics and on Lyapunov theory for the mean ODE.
Gain selection and linearization at the optimum determine the asymptotic rate; Newton–Raphson flow can avoid restrictive conditions.
Polyak–Ruppert averaging fails for quasi-SA; tail averaging is recommended.
The approach is promising for reinforcement learning, where exploration noise is artificially injected and can be replaced by smooth, deterministic signals.

Ask anything
We've read this whole study set, so questions about it get the best answers.