Brownian Motion and SDE Foundations

The probability and stochastic-calculus prerequisites for the batch-size and duration arguments in the Complete(d) Hyperparameter Transfer guide. Exact definitions and theorems are kept separate from the modeling assumptions needed to apply them to an optimizer.

← Return to the main guide's SDE section

1. Why an SDE Appears

An optimizer is a discrete random recurrence: one parameter update after another. An SDE is a possible small-step, many-update approximation to that recurrence. It is not a law of nature that we assume at the beginning.

One random update conditional mean conditional covariance many small steps Brownian limit mean becomes drift covariance becomes diffusion write the limit An SDE d theta = b dt + G dW an integral equation
The calculation that matters is local: find the conditional mean and covariance of one update, then check that dependence and higher-order errors are negligible in the scaling of interest.
Reading discipline. Brownian motion explains the form of a possible limiting noise process. It does not prove that a specific optimizer, schedule, data pipeline, or transformer run has that limit. Those are separate modeling claims.

2. The Probability Objects

Formally, all randomness lives on a probability space (Omega, F, P). Read Omega as every possible sequence of random minibatches, shuffles, augmentations, and other draws. A random variable maps an outcome omega in Omega to a number or vector.

NotationMeaning here
E[X]Expected value: the probability-weighted average of random quantity X.
Var(X)E[(X - E[X])^2], the squared size of scalar fluctuations.
Cov(X)For vectors, E[(X - E[X])(X - E[X])^T]: fluctuation sizes and directions.
N(m, V)A Gaussian with mean m and scalar variance or covariance matrix V.
F_tAll information available by time t: past parameters and past random draws.
adaptedMay depend on F_t, but not on future random draws.

A stochastic process is a random function of time. Thus W_t abbreviates W(t, omega). Fixing omega gives one sample path; probability statements range over all such paths.

3. Independent Noise and Variance

The elementary result beneath Brownian motion is that independent centered fluctuations add in variance, not in standard deviation. If Z_1, ..., Z_n are independent and centered, then

Var(sum_i a_i Z_i) = sum_i a_i^2 Var(Z_i)

Expand the square. Cross terms vanish because for i != j, E[Z_i Z_j] = E[Z_i] E[Z_j] = 0:

E[(sum_i a_i Z_i)^2] = sum_i a_i^2 E[Z_i^2] + sum_{i != j} a_i a_j E[Z_i Z_j] = sum_i a_i^2 Var(Z_i)

With unit-variance terms and unit coefficients, the sum has variance n and standard deviation sqrt(n). This is the precise sense in which centered independent noise accumulates like sqrt(n).

4. The Scaled Random Walk

Let xi_1, xi_2, ... be independent standardized random variables:

E[xi_k] = 0 Var(xi_k) = 1

For a small time mesh h > 0, define the step process

W^(h)(t) = sqrt(h) * sum_{k = 1}^{floor(t / h)} xi_k

The superscript (h) labels the approximation that takes one random kick every h units of time; it is not an exponent. The floor counts how many kicks have occurred by time t.

Why is a kick order sqrt(h)? There are about t / h kicks by time t. If each has standard deviation a(h), variance addition gives

Var(total fluctuation by time t) ~= (t / h) * a(h)^2

A finite nonzero limit proportional to t requires a(h)^2 / h to approach a constant, hence a(h) must be proportional to sqrt(h).

Size of one kickVariance by time tLimit as h -> 0
1t / hExplodes.
ht * hVanishes.
sqrt(h)tFinite nonzero diffusion.
Var(W^(h)(t)) = h * floor(t / h) -> t

The displayed process is a step function. Linearly interpolate between values at 0, h, 2h, ... to obtain continuous paths. Donsker's invariance principle says these interpolated paths converge in distribution, on each finite interval, to Brownian motion. This is convergence of probability laws on whole functions, not pointwise convergence of one chosen path.

5. Definition of Brownian Motion

Definition: standard Brownian motion. A real-valued process W_t is standard Brownian motion if W_0 = 0; for 0 <= s < t, W_t - W_s ~ N(0, t - s); increments on disjoint intervals are independent; and sample paths are continuous with probability one.

It follows that

E[W_s W_t] = min(s, t)

For s <= t, write W_t = W_s + (W_t - W_s). The later increment is independent of W_s, hence

E[W_s W_t] = E[W_s^2] + E[W_s (W_t - W_s)] = s + 0 = min(s, t)

In multiple dimensions, W_t is a vector of independent scalar Brownian motions, so Cov(W_t - W_s) = (t - s) I.

No ordinary velocity. An increment over length h is order sqrt(h). Dividing by h is order 1 / sqrt(h), so there is no finite derivative in the limit. Brownian paths are almost surely continuous everywhere and differentiable nowhere.

6. Quadratic Variation and Ito Integration

Quadratic variation

On a partition 0 = t_0 < ... < t_n = T, let Delta W_i = W_{t_{i+1}} - W_{t_i}. Then

sum_i (Delta W_i)^2 -> T as max_i(Delta t_i) -> 0

This has a short mean-square proof. Since Delta W_i ~ N(0, Delta t_i),

E[(Delta W_i)^2] = Delta t_i Var((Delta W_i)^2) = 2 * (Delta t_i)^2

The increments are independent, so the sum has expectation T and variance

2 * sum_i (Delta t_i)^2 <= 2 * max_i(Delta t_i) * T -> 0

Therefore it converges to T in mean square, hence in probability. The mnemonic (dW)^2 = dt refers to this limit; it is not literal infinitesimal arithmetic.

The Ito integral

For an adapted process H_t, define the stochastic integral as the limit of left-endpoint sums:

integral_0^T H_t dW_t = limit over finer partitions of sum_i H_{t_i} * (W_{t_{i+1}} - W_{t_i})

The left endpoint prevents H_{t_i} from looking at the fresh increment Delta W_i. It is the mathematical form of not peeking at a future minibatch before taking an update. Its key lemma is the Ito isometry:

E[(integral_0^T H_t dW_t)^2] = E[integral_0^T H_t^2 dt]

For stepwise H, the proof is the same cross-term cancellation as the variance lemma. The isometry then defines the integral as an L^2 limit.

Why Ito's rule has an extra term

Taylor expansion has a quadratic term. For Brownian motion it survives after summing because squared increments accumulate to time:

d f(W_t) = f'(W_t) dW_t + (1/2) f''(W_t) dt

For f(x) = x^2, this gives d(W_t^2) = 2 W_t dW_t + dt. Ordinary calculus would incorrectly omit the final term.

7. What an SDE Means

Let parameters be a vector theta_t in R^p. The notation

d theta_t = b(theta_t, t) dt + G(theta_t, t) dW_t

describes a short random increment. It is not an ordinary equation involving a derivative dW_t / dt. Start with the earlier definition of Brownian motion and build the increment explicitly.

From W to dW

Standard scalar Brownian motion satisfies W_(t+h) - W_t ~ N(0, h). A q-dimensional Brownian motion contains q independent copies, hence

Delta W_t = W_(t+h) - W_t ~ N(0, h * I_q) equivalently in distribution: Delta W_t = sqrt(h) * z z ~ N(0, I_q)

This is the precise origin of the informal differential:

dW_t ~= sqrt(dt) * z E[dW_t | F_t] = 0 Cov(dW_t | F_t) = I_q * dt

The first line is shorthand for the Gaussian-increment law, not equality between ordinary infinitesimals. Brownian motion is a random path; it has no finite ordinary velocity.

Why W has q noise coordinates, not p parameter coordinates

theta has p coordinates because the model has p trainable scalar degrees of freedom. W has q coordinates because it is a standardized coordinate system for independent random sources. It is not a second parameter vector and does not need to have the same dimension.

G(theta, t) has shape p x q. Its j-th column is the parameter-space direction and size of the j-th independent unit noise source:

dW_t is in R^q G(theta_t, t) is in R^(p x q) G(theta_t, t) dW_t is in R^p

The actual intrinsic noise object is the parameter covariance rate

D(theta, t) = G(theta, t) G(theta, t)^T

D is positive semidefinite. Terminology varies: some texts call G the diffusion matrix, while others call D the diffusion matrix. Here G is the diffusion coefficient and D is the diffusion covariance.

The factorization is not unique. Rotating the Brownian coordinates and counter-rotating G leaves D unchanged. One can take q = p and a matrix square root of D, or q = rank(D) to omit redundant noise coordinates. Only D is a property of the parameter dynamics.

Derive the operational short-time meaning

Condition on F_t, the complete past. Then theta_t, and therefore b(theta_t, t) and G(theta_t, t), are known. The next Brownian increment is fresh:

Delta theta ~= b(theta_t, t) * h + G(theta_t, t) * Delta W_t ~= b(theta_t, t) * h + G(theta_t, t) * sqrt(h) * z where z ~ N(0, I_q) is independent of F_t

Take conditional expectation. The fresh noise has mean zero:

E[Delta theta | F_t] ~= b(theta_t, t) * h

Then compute covariance. Deterministic terms disappear, and a matrix transforms covariance on the left and right:

Cov(Delta theta | F_t) ~= Cov(G * sqrt(h) * z | F_t) = G * [h * I_q] * G^T = G G^T * h = D(theta_t, t) * h

Replacing h by dt gives the operational statement used in the guide:

E[Delta theta | F_t] ~= b(theta_t, t) * dt Cov(Delta theta | F_t) ~= G(theta_t, t) G(theta_t, t)^T * dt

This is where drift and diffusion come from in an optimizer application: compute the conditional first and second moments of one update. The SDE does not supply them; it summarizes the matched limiting process.

A complete two-parameter example

Let theta = (theta_1, theta_2), choose two independent Brownian sources, and set

G = [ [2, 0], [1, 1] ] dW = [dW_1, dW_2]^T

The noise part of the increment is then

G dW = [2 dW_1, dW_1 + dW_2]^T

The first parameter receives only source one. The second receives both sources. Thus the parameter noises are correlated even though dW_1 and dW_2 are independent:

Cov(G dW) / dt = G G^T = [ [4, 2], [2, 2] ]

The off-diagonal 2 comes from the shared source W_1. This is why a single scalar noise_scale is insufficient for a general optimizer: noise can have different sizes and correlations in different parameter directions.

Integral and Euler-Maruyama forms

The SDE notation means the integral equation

theta_t = theta_0 + integral_0^t b(theta_s, s) ds + integral_0^t G(theta_s, s) dW_s

Its standard small-step simulation is exactly the short-time construction above:

theta_(k+1) = theta_k + b(theta_k, t_k) * h + G(theta_k, t_k) * sqrt(h) * z_k z_k ~ N(0, I_q), independent from the past

The next section matches this form to minibatch SGD. It explains why the main guide asks which quantities make deterministic increments O(h) and random increments O(sqrt(h)).

8. Matching Minibatch SGD to an SDE

Let X_i(theta) be the gradient from one randomly selected training unit. At fixed parameters, define

mu(theta) = E[X_i(theta) | theta] Sigma(theta) = Cov(X_i(theta) | theta) = E[(X_i - mu)(X_i - mu)^T | theta]

Sigma(theta) is a p x p matrix: the covariance of one randomly drawn unit gradient around the population gradient. It is not the cross-covariance of two different units.

g_batch(theta) = (1 / B) * sum_{i = 1}^B X_i(theta) xi_batch(theta) = g_batch(theta) - mu(theta)

The old label xi_B meant “noise for a batch of size B,” not “the i-th summand.” This page now uses xi_batch to make that distinction explicit. Under conditionally iid sampling, Section 9 derives

E[xi_batch(theta) | F_t] = 0 Cov(xi_batch(theta) | F_t) = Sigma(theta) / B

Conditioning on F_t fixes the complete past and current parameters. The equality is exact for sampling with replacement under the stated definition of Sigma; the approximation used in practice recognizes that training units are often correlated.

Use the covariance in SGD

theta_(k+1) = theta_k - eta * g_batch(theta_k)

With gradient-flow time t_k = k * eta, one update has

E[Delta theta_k | F_k] = -grad_L(theta_k) * dt Cov(Delta theta_k | F_k) ~= eta^2 * Sigma(theta_k) / B = [eta / B * Sigma(theta_k)] * dt

Section 7 says that an SDE noise term G dW_t contributes covariance G G^T dt. We therefore need a matrix G whose product with its transpose is (eta / B) * Sigma. Take the positive-semidefinite matrix square root Sigma^(1/2), defined by Sigma^(1/2) Sigma^(1/2) = Sigma, and set

G(theta_t) = sqrt(eta / B) * Sigma(theta_t)^(1/2)

Then the SDE noise increment has exactly the required covariance:

Cov[G dW_t | F_t] = G * [I * dt] * G^T = [sqrt(eta / B) * Sigma^(1/2)] * [sqrt(eta / B) * Sigma^(1/2)]^T * dt = [eta / B * Sigma] * dt

The scalar square root appears because covariance is quadratic in the noise coefficient. The matrix square root chooses directions and correlations whose covariance is Sigma. Replacing the discrete state theta_k by its continuous approximation theta_t, the local-moment-matched SDE is therefore

d theta_t = -grad_L(theta_t) dt + sqrt(eta / B) * Sigma(theta_t)^(1/2) dW_t
Lower LR is only partly “smaller Brownian time.” For SGD, dt = eta refines deterministic drift, but the diffusion coefficient sqrt(eta / B) also shrinks at fixed batch.

A formal diffusion limit needs small updates, regular state dependence, and a martingale or weak-dependence central-limit argument. It is normally a local approximation, not an exact finite-LR identity.

9. What Batch Averaging Actually Establishes

High alignment does not contradict conditional independence

Write one example gradient as

X_i = mu + epsilon_i E[epsilon_i | F_t] = 0

Under conditional iid sampling, centered fluctuations from distinct draws have zero cross-covariance. But the raw gradients can still be highly aligned because they share a nonzero mean:

E[X_i X_j^T | F_t] = mu mu^T for i != j Cov(X_i, X_j | F_t) = E[epsilon_i epsilon_j^T | F_t] = 0

Thus high cosine similarity or a common descent direction is not evidence against the assumption. The 1 / B calculation concerns only fluctuations around the common mean.

The iid calculation

xi_batch = (1 / B) * sum_{i = 1}^B (X_i - mu) Cov(xi_batch | F_t) = (1 / B^2) * sum_i sum_j E[(X_i - mu)(X_j - mu)^T | F_t]

A “diagonal term” means i = j in this batch-index double sum, not a diagonal entry of Sigma. Each diagonal term is the full matrix

E[(X_i - mu)(X_i - mu)^T | F_t] = Sigma(theta)

Conditional independence zeros the i != j terms. There are B diagonal terms:

Cov(xi_batch | F_t) = (1 / B^2) * B * Sigma(theta) = Sigma(theta) / B

What fails in practice, and what is load-bearing

The iid condition is sufficient, not the actual load-bearing claim. The batch rule needs aggregate batch-noise covariance to be approximately proportional to 1 / B over the transferred range. In general, for i != j, let C_ij = Cov(X_i, X_j | F_t). Then

Cov(xi_batch | F_t) = (1 / B^2) * [sum_i Sigma_i + sum_{i != j} C_ij]

If all within-unit covariances equal Sigma and all cross-covariances are one matrix C, then

Cov(xi_batch | F_t) = Sigma / B + ((B - 1) / B) * C

Persistent positive cross-covariance prevents noise from falling as 1 / B. This arises, for example, when tokens from one document are treated as independent samples, packed or duplicated sequences are correlated, dropout/augmentation randomness is shared, or batches are deliberately non-iid. For a finite dataset of size N sampled uniformly without replacement,

Cov(xi_batch | theta) = [(N - B) / (B * (N - 1))] * Sigma_population(theta)

That is close to Sigma / B only when B is much smaller than N. In general correlation can differ by parameter direction, so there need not be one scalar effective batch size.

What is load-bearing for transfer. Complete(d)P requires an approximately inverse-batch covariance law, not literal iid per-token gradients. If covariance does not fall roughly as 1 / B, the square-root batch premise fails and should be checked with a small batch sweep or a gradient-noise measurement.

This covariance law alone still does not derive AdamW's square-root rule; the main guide additionally matches the adaptive-moment recurrences and their SDE coefficients.

10. Limits of the Approximation

StatementStatus
Independent centered increments have additive variance.Exact probability identity under its assumptions.
Scaled iid random walks converge to Brownian motion.Functional central-limit theorem under its conditions.
Batch-gradient covariance is approximately Sigma / B.Modeling approximation; correlated, repeated, or non-identically distributed data can break it.
A finite-LR optimizer is well approximated by an SDE.Asymptotic approximation; clipping, large steps, heavy tails, and sharp state changes can break it.
Transferred AdamW hyperparameters preserve behavior.Optimizer-specific derivation plus empirical claim, not a consequence of Brownian motion alone.

This is the bridge back to the main guide: use this page for definitions and lemmas; require the main page to show the optimizer-specific matching calculation before accepting a transfer rule.

← Return to the main guide's SDE section