Bias, Variance, and Consistency of RL Estimators in LLM Post-Training

Preface

Easily my favorite class during the Fall 2024 semester during my MSML days at CMU was the Intermediate Statistics class by Prof. Larry Wasserman (coded 36-705). That course was about estimators, asymptotic theory, nonparametrics, causal inference, and concentration inequalities. But what I think it was actually about, in hindsight, was a habit of mind: whenever someone hands you a quantity computed from samples, you should immediately ask three questions. Is it unbiased? What is its variance? Is it consistent, and at what rate? (all our assignments were around these xD).

As I see it, the modern practice of post-training large language models with reinforcement learning turns out to be a spectacular playground for exactly these questions. Every algorithm in the alphabet soup of PPO, GRPO, and RLOO is, at its core, a Monte Carlo estimator of a policy gradient, and the differences between them are almost entirely differences in how they trade bias for variance. My goal with this blogpost is to make that statement precise. The blog assumes a background in Statistics and Linear Algebra, though some potentially unfamiliar concepts have been described, either in the next section or marked with a superscript and explained in the sidenotes.

1. Asymptotic Statistical preliminaries

While the best reference is obviously Prof. Larry's book, All of Statistics, this section collects the definitions and limit theorems that the rest of the blog uses, stated for a vector-valued estimator since gradients are vectors. Let $T_G \in \mathbb{R}^d$ be an estimator built from $G$ samples, targeting a fixed vector $g \in \mathbb{R}^d$.

Definition (bias, variance, MSE). The bias is $\mathrm{Bias}(T_G) = \mathbb{E}[T_G] - g$, the variance is $\mathrm{tr}\,\mathrm{Cov}(T_G) = \mathbb{E}\|T_G - \mathbb{E}[T_G]\|^2$, and the mean squared error is $\mathrm{MSE}(T_G) = \mathbb{E}\|T_G - g\|^2$.

Lemma 1 (MSE decomposition). $\mathrm{MSE}(T_G) = \|\mathrm{Bias}(T_G)\|^2 + \mathrm{tr}\,\mathrm{Cov}(T_G)$.

Proof expand the squared norm

Write $T_G - g = (T_G - \mathbb{E}[T_G]) + (\mathbb{E}[T_G] - g)$ and expand the squared norm. The cross term is $2 \, \mathbb{E}\langle T_G - \mathbb{E}[T_G], \, \mathbb{E}[T_G] - g \rangle$, and since the second argument is deterministic this equals $2 \langle \mathbb{E}[T_G] - \mathbb{E}[T_G], \, \mathbb{E}[T_G] - g \rangle = 0$. $\blacksquare$

The rest of this blog is about limits of random quantities, so we fix notation for the four standard modes of convergence, decorated as superscripts on the arrow in the style of the textbooks. Plain arrows $\to$ are reserved for deterministic sequences.

Definition (modes of convergence). Let $T_1, T_2, \dots$ and $T$ be random vectors on a common space.

The implications run $\xrightarrow{\text{a.s.}} \Rightarrow \xrightarrow{P}$, $\xrightarrow{qm} \Rightarrow \xrightarrow{P}$, and $\xrightarrow{P} \Rightarrow \xrightarrow{D}$, with none of the arrows reversible in general, and with almost sure and quadratic mean convergence incomparable to each other.

Definition (consistency). $T_G$ is consistent for $g$ if $T_G \xrightarrow{P} g$.

Lemma 2 (quadratic mean convergence implies consistency). If $\|\mathrm{Bias}(T_G)\| \to 0$ and $\mathrm{tr}\,\mathrm{Cov}(T_G) \to 0$, then $T_G \xrightarrow{qm} g$, and consequently $T_G$ is consistent.

Proof Lemma 1 + Markov

By Lemma 1, $\mathbb{E}\|T_G - g\|^2 = \|\mathrm{Bias}(T_G)\|^2 + \mathrm{tr}\,\mathrm{Cov}(T_G) \to 0$, which is the definition of $T_G \xrightarrow{qm} g$. Markov's inequality applied to $\|T_G - g\|^2$ then gives $\mathbb{P}(\|T_G - g\| > \varepsilon) \leq \varepsilon^{-2} \, \mathbb{E}\|T_G - g\|^2 \to 0$, which is $T_G \xrightarrow{P} g$. $\blacksquare$

Note the converse direction of the intuition fails in an instructive way: an estimator can be biased at every finite $G$ and still be consistent, and it can be consistent for something other than the quantity you wanted. Both phenomena occur below in the blog :D.

Finally, four limit theorems, stated without proof since they are standard (again, can refer Prof. Larry's book). Let $Z_1, Z_2, \dots$ be iid with mean $m$.

2. The RL problem in LLM post-training

Post-training with a reward model or verifiable rewards is, in its simplest form, a contextual banditContextual bandit. An RL problem with a single decision step. The prompt is the context, the full completion is one action, and there is no further state transition. Treating the completion as one action (rather than each token as an action in an MDP) is what makes the sequence-level analysis in this post exact.. A prompt $x$ is drawn from a distribution $\mathcal{D}$, the policy $\pi_\theta$ (the LLM) samples a full completion $y \sim \pi_\theta(\cdot \mid x)$, and a scalar reward $r(x, y)$ is observed. The objective is

$$J(\theta) = \mathbb{E}_{x \sim \mathcal{D}} \, \mathbb{E}_{y \sim \pi_\theta(\cdot \mid x)} \left[ r(x, y) \right].$$

We want to ascend $J$ by stochastic gradient methods, so the fundamental statistical object of the whole enterprise is the gradient $\nabla_\theta J(\theta)$. Everything that follows concerns estimators of this vector.

Proposition 1 (Policy gradient / score function identity). If $\pi_\theta(y \mid x) > 0$ for all $y$ and differentiation under the sum is valid, then

$$\nabla_\theta J(\theta) = \mathbb{E}_{x, \, y \sim \pi_\theta} \left[ r(x, y) \, \nabla_\theta \log \pi_\theta(y \mid x) \right].$$
Proof the log-derivative trick

Fix $x$ and write the inner expectation as a sum over the countable completion space. Then

$$\nabla_\theta \sum_y \pi_\theta(y \mid x) \, r(x, y) = \sum_y r(x, y) \, \nabla_\theta \pi_\theta(y \mid x) = \sum_y \pi_\theta(y \mid x) \, r(x, y) \, \frac{\nabla_\theta \pi_\theta(y \mid x)}{\pi_\theta(y \mid x)},$$

and the last ratio is $\nabla_\theta \log \pi_\theta(y \mid x)$ by the chain rule. Taking the expectation over $x$ finishes the proof. $\blacksquare$

The vector $s_\theta(x, y) = \nabla_\theta \log \pi_\theta(y \mid x)$ is the scoreScore function. The gradient of the log-likelihood, $s_\theta = \nabla_\theta \log \pi_\theta$. Its defining property, $\mathbb{E}[s_\theta] = 0$ under the model, is the engine behind Proposition 2 and also the reason the Fisher information $\mathbb{E}[s_\theta s_\theta^\top]$ is a covariance matrix., and for an autoregressive model it decomposes as a sum of per-token log-probability gradients. This identity is the reason RL on LLMs is possible at all: the reward can be a black box, and only the policy needs to be differentiable.

3. The estimators

3.1 REINFORCE: the plug-in Monte Carlo estimator

Sample one prompt and $G$ completions $y_1, \dots, y_G \overset{\text{iid}}{\sim} \pi_\theta(\cdot \mid x)$, and form

$$\hat{g}_{\text{MC}} = \frac{1}{G} \sum_{i=1}^{G} r(x, y_i) \, s_\theta(x, y_i).$$

By Proposition 1 and linearity of expectation, $\mathbb{E}[\hat{g}_{\text{MC}}] = \nabla J(\theta)$, so this estimator is exactly unbiased. Its problem is variance. If rewards live in $[0, 1]$, every sampled completion pushes its own log-probability up, and the signal distinguishing good completions from bad ones is buried in the common positive offset. Formally, adding a constant $c$ to all rewards leaves $\nabla J$ unchanged (since $\mathbb{E}[c \, s_\theta] = 0$, as shown next) but inflates the second moment of the estimator by terms of order $c^2 \, \mathbb{E}\|s_\theta\|^2$. An estimator whose variance depends on the arbitrary origin of the reward scale is begging for a control variateControl variate. A variance reduction technique: to estimate $\mathbb{E}[X]$, use $X - c(W - \mathbb{E}[W])$ for a correlated $W$ with known mean. Here $W = b(x) s_\theta$ with known mean zero, so subtracting it is free of bias, and choosing $b$ well makes it strongly negatively correlated with the noise in $r \, s_\theta$..

3.2 Baselines are control variates

Proposition 2 (Baselines do not bias the gradient). For any function $b(x)$ that does not depend on $y$,

$$\mathbb{E}_{y \sim \pi_\theta} \left[ b(x) \, s_\theta(x, y) \right] = 0.$$
Proof the total probability is constant

$\mathbb{E}_y[b(x) s_\theta] = b(x) \sum_y \pi_\theta(y \mid x) \frac{\nabla \pi_\theta(y \mid x)}{\pi_\theta(y \mid x)} = b(x) \nabla_\theta \sum_y \pi_\theta(y \mid x) = b(x) \nabla_\theta 1 = 0$. $\blacksquare$

So replacing $r$ with the advantage $A = r - b(x)$ preserves unbiasedness while changing the variance. A short calculation identifies the best possible scalar baseline. Writing $s = s_\theta(x, y)$ and minimizing the trace of the covariance of $(r - b) s$ over constants $b$, the objective $\mathbb{E}\|(r - b) s\|^2$ is a quadratic in $b$, and setting its derivative to zero gives

$$b^\star = \frac{\mathbb{E}\left[ r \, \|s\|^2 \right]}{\mathbb{E}\left[ \|s\|^2 \right]},$$

a score-weighted mean reward. In practice everyone uses the unweighted approximation $b(x) \approx \mathbb{E}_{y}[r(x, y)]$, the expected reward of the current policy on that prompt. This quantity is unknown, and the different algorithms are distinguished mostly by how they estimate it.

3.3 RLOO: the leave-one-out baseline

RLOO estimates the baseline for sample $i$ using the other $G - 1$ samples in the group:

$$\hat{g}_{\text{RLOO}} = \frac{1}{G} \sum_{i=1}^{G} \left( r_i - \frac{1}{G-1} \sum_{j \neq i} r_j \right) s_\theta(x, y_i), \qquad r_i := r(x, y_i).$$

Proposition 3 (RLOO is unbiased). $\mathbb{E}[\hat{g}_{\text{RLOO}}] = \nabla J(\theta)$.

Proof the leave-one-out baseline is independent of its sample

The term $r_i \, s_i$ has expectation $\nabla J$ by Proposition 1. For the baseline term, independence of the samples means $\frac{1}{G-1}\sum_{j \neq i} r_j$ is independent of $y_i$, so

$$\mathbb{E}\left[ \left( \tfrac{1}{G-1} \textstyle\sum_{j \neq i} r_j \right) s_i \right] = \mathbb{E}\left[ \tfrac{1}{G-1} \textstyle\sum_{j \neq i} r_j \right] \cdot \mathbb{E}\left[ s_i \right] = \mu_r(x) \cdot 0 = 0,$$

using Proposition 2 with the constant $b(x) = 1$. Summing over $i$ and dividing by $G$ gives the claim. $\blacksquare$

The independence step is the entire trick. Had we included $r_i$ in its own baseline, the baseline would correlate with $s_i$ and the argument would fail, which is exactly the door through which GRPO's bias enters.

3.4 GRPO: group normalization

GRPO uses the full group mean and, crucially, divides by the group standard deviation:

$$\hat{A}_i = \frac{r_i - \bar{r}}{\hat{\sigma}}, \qquad \bar{r} = \frac{1}{G}\sum_{j} r_j, \quad \hat{\sigma}^2 = \frac{1}{G}\sum_j (r_j - \bar{r})^2,$$ $$\hat{g}_{\text{GRPO}} = \frac{1}{G} \sum_{i=1}^{G} \hat{A}_i \, s_\theta(x, y_i).$$

The mean subtraction alone is harmless. A one-line algebraic identity shows

$$r_i - \bar{r} = \frac{G-1}{G} \left( r_i - \frac{1}{G-1}\sum_{j \neq i} r_j \right),$$

so centering by the full-group mean is exactly the RLOO advantage shrunk by the deterministic factor $\frac{G-1}{G}$, and the resulting estimator is unbiased for $\frac{G-1}{G} \nabla J$, which is merely a learning-rate rescaling. The bias comes from $\hat{\sigma}$, for two separate reasons.

First, $\hat{\sigma}$ is a random quantity computed from the same samples, and it is correlated with $r_i$. Since $\mathbb{E}[X / Y] \neq \mathbb{E}[X] / \mathbb{E}[Y]$ in general, the expectation of the ratio does not factor, and for finite $G$ we have $\mathbb{E}[\hat{g}_{\text{GRPO}}] \neq c \, \nabla J(\theta)$ for any constant $c$.

Second, and more interesting, the bias does not vanish into the true gradient even asymptotically. This is the subject of the next section.

3.5 PPO: importance sampling and deliberate bias

PPO reuses samples drawn from a stale policy $\pi_{\text{old}}$. The exact off-policy correction is importance samplingImportance sampling. Unbiased when $q$ covers the support of $p$, but the variance involves $\mathbb{E}_q[(p/q)^2 f^2]$, which is finite only when $p^2 / q$ is integrable. For autoregressive policies the ratio is a product over tokens, so small per-token disagreements compound geometrically.: for $\rho(y) = \pi_\theta(y \mid x) / \pi_{\text{old}}(y \mid x)$,

$$\mathbb{E}_{y \sim \pi_{\text{old}}} \left[ \rho(y) \, f(y) \right] = \sum_y \pi_{\text{old}}(y \mid x) \frac{\pi_\theta(y \mid x)}{\pi_{\text{old}}(y \mid x)} f(y) = \mathbb{E}_{y \sim \pi_\theta}[f(y)],$$

valid whenever $\pi_{\text{old}}$ has support wherever $\pi_\theta$ does. This estimator is unbiased but its variance is governed by the second moment $\mathbb{E}_{\pi_{\text{old}}}[\rho^2 f^2]$, which involves the chi-square divergence between the two policies and can be astronomically large for sequence-level ratios, since $\rho$ is a product over hundreds of per-token ratios and its distribution is heavy-tailed. PPO responds by optimizing the clipped surrogate

$$L(\theta) = \mathbb{E}_{y \sim \pi_{\text{old}}} \left[ \min\!\left( \rho \hat{A}, \; \text{clip}(\rho, 1 - \epsilon, 1 + \epsilon) \, \hat{A} \right) \right],$$

whose gradient is a truncated importance sampling estimator. Truncation caps the variance at the price of bias, since the clipped ratio no longer integrates the tails correctly. This is not an accident of implementation but the entire design philosophy: PPO is the algorithm that chooses a bounded, biased estimator over an unbiased one with potentially infinite variance. Anyone who has seen truncated importance weights or trimmed estimators in a statistics course will recognize the move.

4. Analysis!!

4.1 The bias and the variance

Throughout this section fix the prompt $x$, write $\nabla J_x = \mathbb{E}[r s]$ for the per-prompt gradient, $\mu = \mathbb{E}[r]$, $\sigma^2 = \mathrm{Var}(r)$, and abbreviate $s_i = s_\theta(x, y_i)$. Two lemmas make the informal variance claims of Section 3 exact.

Lemma 3 (variance depends on the reward origin). Shifting all rewards by a constant $c$ leaves the mean of the single-sample estimator $r s$ unchanged but changes its variance by

$$\mathrm{tr}\,\mathrm{Cov}\big((r + c)s\big) - \mathrm{tr}\,\mathrm{Cov}(r s) = 2c \, \mathbb{E}\big[ r \|s\|^2 \big] + c^2 \, \mathbb{E}\|s\|^2.$$
Proof expand the shifted second moment

The mean is unchanged by Proposition 2, since $\mathbb{E}[c s] = 0$. The second moment expands as $\mathbb{E}\|(r + c)s\|^2 = \mathbb{E}\|r s\|^2 + 2c \, \mathbb{E}[r \|s\|^2] + c^2 \mathbb{E}\|s\|^2$, and subtracting the common squared mean gives the claim. $\blacksquare$

The variance is therefore a quadratic in the reward origin, minimized exactly at the optimal baseline $b^\star$ of Section 3.2, and unboundedly bad for large offsets. This is the precise version of the statement that raw REINFORCE is at the mercy of the reward scale.

Proposition 4 (exact cost of estimating the baseline). Let $(r, s)$ be one sample and let $B$ be a baseline estimate independent of $(r, s)$ with $\mathbb{E}[B] = \mu$ and $\mathrm{Var}(B) = \sigma^2 / m$, for instance the mean of $m$ independent rewards. Then $(r - B)s$ is unbiased for $\nabla J_x$ and

$$\mathrm{tr}\,\mathrm{Cov}\big( (r - B) s \big) = \mathrm{tr}\,\mathrm{Cov}\big( (r - \mu) s \big) + \frac{\sigma^2}{m} \, \mathbb{E}\|s\|^2.$$
Proof decompose r − B and use independence

For unbiasedness, independence gives $\mathbb{E}[B s] = \mathbb{E}[B]\,\mathbb{E}[s] = \mu \cdot 0 = 0$, so $\mathbb{E}[(r - B)s] = \mathbb{E}[r s] = \nabla J_x$. The same argument applied to the constant baseline $\mu$ shows both estimators have the same mean, so it suffices to compare second moments. Decompose $r - B = (r - \mu) + (\mu - B)$ and expand:

$$\mathbb{E}\|(r - B)s\|^2 = \mathbb{E}\big[(r - \mu)^2 \|s\|^2\big] + 2\,\mathbb{E}\big[(r - \mu)(\mu - B)\|s\|^2\big] + \mathbb{E}\big[(\mu - B)^2 \|s\|^2\big].$$

By independence of $B$ from $(r, s)$, the cross term factors as $2\,\mathbb{E}\big[(r - \mu)\|s\|^2\big] \, \mathbb{E}[\mu - B] = 0$, and the last term factors as $\mathbb{E}[(\mu - B)^2] \, \mathbb{E}\|s\|^2 = \frac{\sigma^2}{m}\mathbb{E}\|s\|^2$. $\blacksquare$

Applied to RLOO, where the baseline for sample $i$ is the mean of the $m = G - 1$ other rewards, the price of not knowing $\mu$ is exactly $\frac{\sigma^2}{G - 1}\mathbb{E}\|s\|^2$ per term, which vanishes as the group grows. The ledger, then. REINFORCE is unbiased with variance hostage to the reward origin (Lemma 3). RLOO is unbiased with the origin term removed and an $O\!\left(\frac{1}{G-1}\right)$ surcharge for estimating the baseline (Proposition 4). GRPO is biased at every finite $G$ through the random denominator, quantified below. The clipped PPO gradient is biased even as $G \to \infty$, by construction, in exchange for bounded variance under off-policy reuse.

4.2 Consistency and asymptotics

ConsistencyGRPO at fixed $G$ is a biased estimator that is consistent for a different (reweighted) target, which is a useful reminder that consistency is a statement about the limit, and one must always ask what the limit actually is. asks what the estimators converge to as $G \to \infty$ with the prompt fixed. Define the centered numerator that both RLOO and GRPO share,

$$N_G = \frac{1}{G} \sum_{i=1}^{G} (r_i - \bar{r}) \, s_i,$$

and recall from the identity in Section 3.4 that $\hat{g}_{\text{RLOO}} = \frac{G}{G - 1} N_G$ and $\hat{g}_{\text{GRPO}} = N_G / \hat{\sigma}$.

Proposition 5 (consistency and rate for REINFORCE and RLOO). Assume $\mathbb{E}\|r s\|^2 < \infty$ and $\mathbb{E}\|s\|^2 < \infty$. Then $\hat{g}_{\text{MC}} \xrightarrow{\text{a.s.}} \nabla J_x$ and $\hat{g}_{\text{RLOO}} \xrightarrow{\text{a.s.}} \nabla J_x$, and $\sqrt{G}\left( \hat{g}_{\text{MC}} - \nabla J_x \right) \xrightarrow{D} N(0, \mathrm{Cov}(r s))$.

Proof SLLN/CLT on iid terms, then Slutsky

The terms $r_i s_i$ are iid with mean $\nabla J_x$, so the SLLN and CLT of Section 1 apply directly to $\hat{g}_{\text{MC}}$. For RLOO, expand the numerator:

$$N_G = \frac{1}{G} \sum_i r_i s_i - \bar{r} \cdot \frac{1}{G} \sum_i s_i.$$

By the SLLN, $\frac{1}{G}\sum_i r_i s_i \xrightarrow{\text{a.s.}} \mathbb{E}[r s] = \nabla J_x$, $\bar{r} \xrightarrow{\text{a.s.}} \mu$, and $\frac{1}{G}\sum_i s_i \xrightarrow{\text{a.s.}} \mathbb{E}[s] = 0$. Products and sums of almost surely convergent sequences converge, so $N_G \xrightarrow{\text{a.s.}} \nabla J_x - \mu \cdot 0 = \nabla J_x$, and since the deterministic factor satisfies $\frac{G}{G-1} \to 1$, the RLOO estimator has the same almost sure limit. $\blacksquare$

If in addition $|r| \leq R$ and the score coordinates are bounded by $S$, Hoeffding's inequality applied per coordinate of $\hat{g}_{\text{MC}}$ gives the non-asymptotic tail bound $\mathbb{P}\left( |\hat{g}_j - (\nabla J_x)_j| \geq t \right) \leq 2 \exp\!\left( - \frac{G t^2}{2 R^2 S^2} \right)$, so the root-$G$ rate holds at every finite sample size and not merely in the limit.

GRPO is where the asymptotics become genuinely interesting, and where the continuous mapping theoremSlutsky's theorem and the continuous mapping theorem together are the tools that let us replace the random $\hat{\sigma}$ with its limit $\sigma(x)$ when computing what GRPO converges to, as in the proof of Proposition 6. earns its keep.

Proposition 6 (GRPO is consistent for a reweighted gradient). Assume $\mathbb{E}\|r s\| < \infty$, $\mathbb{E}[r^2] < \infty$, and $\sigma > 0$. Then

$$\hat{g}_{\text{GRPO}} \xrightarrow{\text{a.s.}} \frac{1}{\sigma} \, \mathbb{E}\left[ (r - \mu) \, s \right] = \frac{1}{\sigma} \nabla J_x(\theta).$$
Proof numerator SLLN, denominator SLLN, continuous mapping

The proof of Proposition 5 already gives $N_G \xrightarrow{\text{a.s.}} \nabla J_x$. For the denominator, $\hat{\sigma}^2 = \frac{1}{G}\sum_j r_j^2 - \bar{r}^2 \xrightarrow{\text{a.s.}} \mathbb{E}[r^2] - \mu^2 = \sigma^2$ by the SLLN. The map $(u, v) \mapsto u / \sqrt{v}$ is continuous at $(\nabla J_x, \sigma^2)$ since $\sigma^2 > 0$, so the continuous mapping theorem yields $\hat{g}_{\text{GRPO}} = N_G / \hat{\sigma} \xrightarrow{\text{a.s.}} \nabla J_x / \sigma$. $\blacksquare$

So GRPO is consistent, but not for $\nabla J_x$. It is consistent for the gradient of each prompt's objective reweighted by $1 / \sigma(x)$, and averaged over prompts it ascends $\tilde{J}(\theta) = \mathbb{E}_x \left[ J_x(\theta) / \sigma_x \right]$ in a first-order sense. This upweights prompts where the policy's rewards are nearly deterministic and downweights high-variance prompts. Whether this implicit reweighting is a feature or a bug is a modeling question rather than a statistical one, but the statistics forces us to notice that it exists.

Proposition 7 (GRPO's finite-sample bias is $O(1/G)$). Assume rewards are bounded, scores are bounded, and $\hat{\sigma}$ is bounded below by some $\epsilon > 0$, as it is in implementations that add $\epsilon$ to the denominator. Then

$$\mathbb{E}\left[ \hat{g}_{\text{GRPO}} \right] = \frac{1}{\sigma} \nabla J_x(\theta) + O\!\left( \frac{1}{G} \right).$$

The $O(1/G)$ scaling comes from a second-order expansion of the reciprocal standard deviation.A second-order expansion of the map $v \mapsto v^{-1/2}$ (the delta method) is what produces the $O(1/G)$ bias estimate for GRPO's normalized advantage, since the first-order term has mean zero and the curvature of $(u, v) \mapsto u / v$ contributes at order $1/G$.

Proof sketch — ratio expectation via delta method

Decompose the expectation of the ratio into a product of expectations plus a covariance:

$$\mathbb{E}\left[ \frac{N_G}{\hat{\sigma}} \right] = \mathbb{E}[N_G] \cdot \mathbb{E}\left[ \frac{1}{\hat{\sigma}} \right] + \mathrm{Cov}\left( N_G, \frac{1}{\hat{\sigma}} \right),$$

where the covariance is taken coordinatewise. Three estimates finish the argument. First, $\mathbb{E}[N_G] = \frac{G-1}{G} \nabla J_x = \nabla J_x + O(1/G)$ by Proposition 3 and the centering identity. Second, the delta method applied to the map $v \mapsto v^{-1/2}$ at $v = \sigma^2$ gives $\mathbb{E}[1 / \hat{\sigma}] = 1/\sigma + O(1/G)$, since the first-order term has mean $O(1/G)$ (the plug-in variance $\hat\sigma^2$ has bias $-\sigma^2/G$) and the second-order term is driven by $\mathrm{Var}(\hat{\sigma}^2) = O(1/G)$; boundedness below by $\epsilon$ supplies the integrability the expansion needs. Third, both $N_G - \mathbb{E}[N_G]$ and $1/\hat{\sigma} - \mathbb{E}[1/\hat{\sigma}]$ have $L^2$ norms of order $G^{-1/2}$, being averages of bounded variables and smooth functions thereof, so by Cauchy-Schwarz the covariance is $O(1/G)$. Multiplying out the first two estimates and absorbing all $O(1/G)$ terms gives the claim. $\blacksquare$

This is why published ablations find GRPO and its debiased variants nearly indistinguishable at common group sizes like $G = 16$ or $64$, and why variants such as Dr. GRPO simply delete the $\hat{\sigma}$ to restore an unbiased target. The bias is real but it is a $1/G$ effect stacked on top of a $1/\sqrt{G}$ noise floor, so at moderate group sizes the noise dominates the bias by an order of magnitude.

For clipped PPO no amount of sampling helps. The estimator converges by the law of large numbers to the gradient of the clipped surrogate, which differs from $\nabla J$ whenever the clip is active with positive probability. The bias is a fixed feature of the estimand, not a finite-sample artifact, and the algorithm is best understood as consistently estimating the gradient of a deliberately different, trust-region-flavored objective.

4.3 Why any of this matters for training

Stochastic gradient ascent with step sizes $\eta_t$ satisfying the Robbins-Monro conditions $\sum_t \eta_t = \infty$ and $\sum_t \eta_t^2 < \infty$ converges to a stationary point when the gradient estimator is unbiased with bounded variance. With a persistent bias, the guarantee degrades to a neighborhood whose radius scales with the bias, and this can be proved in a few lines with the standard smoothness toolkit.

Proposition 8 (biased SGD reaches a bias-sized neighborhood). Suppose $J$ is $L$-smooth and bounded above by $J^\star$, and run $\theta_{t+1} = \theta_t + \eta \, \hat{g}_t$ with a constant step $\eta \leq \frac{1}{4L}$, where $\hat{g}_t = \nabla J(\theta_t) + b_t + \xi_t$ with $\mathbb{E}[\xi_t \mid \theta_t] = 0$, $\mathbb{E}[\|\xi_t\|^2 \mid \theta_t] \leq v$, and $\|b_t\| \leq \beta$. Then

$$\frac{1}{T} \sum_{t=0}^{T-1} \mathbb{E}\left\| \nabla J(\theta_t) \right\|^2 \; \leq \; \frac{4 \left( J^\star - J(\theta_0) \right)}{\eta T} + 3\beta^2 + 2 L \eta v.$$
Proof descent lemma with Young's inequality

By $L$-smoothness, $J(\theta_{t+1}) \geq J(\theta_t) + \langle \nabla J(\theta_t), \eta \hat{g}_t \rangle - \frac{L \eta^2}{2} \|\hat{g}_t\|^2$. Take the conditional expectation given $\theta_t$, writing $\nabla_t = \nabla J(\theta_t)$. The inner product term becomes $\eta \|\nabla_t\|^2 + \eta \langle \nabla_t, b_t \rangle$, and the quadratic term becomes $\frac{L\eta^2}{2}\left( \|\nabla_t + b_t\|^2 + \mathbb{E}\|\xi_t\|^2 \right)$ since the noise is conditionally mean zero and uncorrelated with the deterministic part. Now bound $\langle \nabla_t, b_t \rangle \geq -\frac{1}{2}\|\nabla_t\|^2 - \frac{1}{2}\beta^2$ by Young's inequality and $\|\nabla_t + b_t\|^2 \leq 2\|\nabla_t\|^2 + 2\beta^2$, obtaining

$$\mathbb{E}\left[ J(\theta_{t+1}) \mid \theta_t \right] \geq J(\theta_t) + \eta\left( \tfrac{1}{2} - L\eta \right) \|\nabla_t\|^2 - \eta\left( \tfrac{1}{2} + L\eta \right)\beta^2 - \frac{L\eta^2}{2} v.$$

With $\eta \leq \frac{1}{4L}$ the coefficient on $\|\nabla_t\|^2$ is at least $\frac{\eta}{4}$ and the coefficient on $\beta^2$ is at most $\frac{3\eta}{4}$. Take total expectations, sum over $t = 0, \dots, T-1$, telescope the left side against $J^\star \geq \mathbb{E}[J(\theta_T)]$, and divide by $\frac{\eta T}{4}$. $\blacksquare$

The first term vanishes as $T \to \infty$, the last is controlled by shrinking the step, but $3\beta^2$ is a floor that no amount of training removes. This is the precise sense in which the taxonomy above has teeth. RLOO's unbiasedness buys clean convergence guarantees. GRPO's $O(1/G)$ bias buys a neighborhood that shrinks with group size, which is cheap. PPO's non-vanishing bias means the fixed points themselves move, which is tolerated because the surrogate's fixed points are close to the original ones when updates stay inside the trust region. Variance, meanwhile, controls the constants and the usable learning rate everywhere. The whole field is a walking bias-variance tradeoff, and the vocabulary from a first estimation theory course is exactly the right one for reading it.

5. ....umm all that's fine, but what happens in practice?

Everything so far assumed we can sample from $\pi_\theta$ and evaluate $\nabla \log \pi_\theta$ exactly. In a production post-training system neither assumption is quite true, and the failure modes are best understood in the vocabulary of the previous sections.

5.1 The sampler is not the trainer

Real pipelines split into two engines. Rollouts are generated by an inference engineInference engine. A serving system such as vLLM or SGLang that generates tokens at high throughput using techniques like paged KV caching, continuous batching, prefix caching, and fused or quantized kernels. RL pipelines pair one of these with a separate training framework because generation is memory-bandwidth bound while gradient computation is compute bound, and the two workloads want different kernels. The statistical price of this efficiency is that the generating distribution and the differentiated distribution are computed by different code paths. built for throughput, with paged KV caches, fused kernels, continuous batching, and often reduced precision, while log-probabilities and gradients are computed by a training engine with different kernels, different reduction orders, and different precision policies. Even with bit-identical weights, the two engines realize two different conditional distributions, $\pi_{\text{sample}} \neq \pi_{\text{train}}$, because floating point arithmetic is not associativeFloating point non-associativity. In finite precision, $(a + b) + c$ need not equal $a + (b + c)$, so the value of a large reduction like a matrix multiply or a softmax normalizer depends on the order in which terms are accumulated. Different kernels, different batch sizes, and different parallelism layouts induce different orders, which is why two mathematically identical implementations of the same network produce slightly different probabilities, and why bitwise reproducibility requires deliberately batch-invariant kernels. and per-token probabilities disagree at the level of $10^{-3}$ or so in BF16. The statistical consequence is that supposedly on-policy training is silently off-policy: samples come from $q = \pi_{\text{sample}}$ but the score is evaluated under $p = \pi_{\text{train}}$, so the plug-in estimator targets $\mathbb{E}_q[r \, \nabla \log p]$ rather than $\nabla J$. A per-token discrepancy of $10^{-3}$ sounds ignorable until you recall that the sequence-level ratio is a product over hundreds or thousands of tokens, so log discrepancies add and the ratio drifts exponentially in length. The remedies are exactly the menu from Section 3.5. One can correct with full sequence-level importance weights, which restores unbiasedness at the price of heavy-tailed variance. One can correct with truncated or per-token importance weights, accepting a small bias for bounded variance, which is the choice most open frameworks have converged on. Or one can attack the bias at its source by aligning numerics, for instance computing sampler log-probabilities in FP32 and using batch-invariant deterministic kernels, which costs throughput but shrinks $\chi^2(p \, \| \, q)$ toward zero so that no correction is needed. Which point on this frontier is optimal is a systems question, but the frontier itself is the bias-variance tradeoff of Section 4.

5.2 Precision, determinism, and what is bias versus what is variance

Numerical effects sort cleanly into the two columns of the ledger. Systematic differences are bias: a sampler that always computes softmax in BF16 while the trainer uses FP32 shifts the sampling distribution in a fixed direction, quantized KV caches in serving perturb every rollout the same way, and gradient clipping truncates the same tail on every step. Nondeterministic differences are variance: atomics and reduction-order nondeterminism inject approximately mean-zero noise into log-probabilities and gradients, and continuous batching makes a sequence's logits depend on which requests it happened to be batched with, which acts like extra sampling noise when batch composition is random. The distinction matters operationally because Proposition 8 says variance can be averaged away with larger batches and smaller steps while bias cannot. This also explains a phenomenon that surprises people at scale: as $G$ and the batch size grow, the $1/\sqrt{G}$ noise floor drops until the residual systematic terms, sampler mismatch, clipping bias, and reward model artifacts, become the binding constraint. Small-scale ablations live in the variance-dominated regime and large-scale runs live in the bias-dominated regime, so conclusions do not transfer for a reason you can state as an inequality between $\beta^2$ and $2 L \eta v$.

5.3 Serving economics shape the estimator

The estimator choices also interact with inference costs in ways that are easy to miss. Group-based methods like GRPO and RLOO are popular partly because $G$ completions of the same prompt share a prefill, so prefix caching makes within-prompt samples far cheaper than samples of fresh prompts, which is a variance-reduction subsidy paid by the serving stack. Asynchronous actor-learner designs raise throughput by letting rollouts lag the learner by a few versions, but staleness widens the gap between behavior and target policies, inflates the chi-square divergence that controls importance weight variance, activates the PPO clip more often, and therefore converts throughput into bias. Length is a lurking variable throughout: sequence-level ratios and sequence-level rewards both scale badly with completion length, and normalization choices that look innocuous, such as dividing token losses by the completion length, reweight the objective across lengths in the same way GRPO's $\hat{\sigma}$ reweights it across prompts.

5.4 Some open questions.....and discussion :)

I was recently interviewing for a couple of frontier labs, and during my prep (and during the interviews), I came across so many nuances when theory is actually applied to practice. While inspired from the interviews, the following questions' discussion is strictly my own POV and could be wrong (please do reach out with any concerns, such discussions are always welcome).

Question. Your RL run generates rollouts with an inference engine and trains in BF16. Training is stable for a thousand steps and then collapses. A colleague suggests the run is secretly off-policy. What diagnostic would you look at, and what are the possible fixes with their tradeoffs?

Discussion. The diagnostic is the per-token log-ratio $\log \pi_{\text{train}} - \log \pi_{\text{sample}}$ on the same completions, tracked in distribution over training. On-policy training should concentrate this near zero; a drifting mean is systematic mismatch and a widening spread is compounding disagreement, and the sequence-level ratio is the exponential of the sum, so both are amplified by length. The collapse mechanism is that an uncorrected estimator ascends $\mathbb{E}_q[r \nabla \log p]$, whose fixed points differ from those of $J$, and the gap grows as the policy sharpens into regions where the engines disagree most. Fixes, in increasing order of principle: clip harder, which caps the damage but adds bias; apply truncated importance weights $\min(\rho, c)$, which bounds variance and reduces but does not remove bias; apply exact sequence-level importance weights, which is unbiased by the identity in Section 3.5 but requires monitoring the effective sample size $\left( \sum_i \rho_i \right)^2 / \sum_i \rho_i^2$ since heavy tails can make the correction worse than the disease; or align the numerics so $q \approx p$ and the correction becomes unnecessary. A strong answer notes that these are points on one bias-variance frontier, not competing folk remedies.

Question. You double the GRPO group size from $G = 32$ to $G = 64$. What improves, by how much, and when does this stop being worth it?

Discussion. Three quantities improve at known rates: estimator variance falls like $1/G$, the baseline estimation surcharge of Proposition 4 falls like $1/(G-1)$, and the normalization bias of Proposition 7 falls like $1/G$. The marginal serving cost is sublinear because the prompt prefill is shared across the group. The gains stop mattering when the reduced terms fall below the systematic floor, meaning clipping bias, sampler mismatch, and reward model error, at which point Proposition 8 says more samples buy nothing. There is also a subtler failure specific to outcome rewards: as the policy improves, more groups become all-correct or all-incorrect, the centered advantages vanish, and those groups contribute zero gradient, so the effective $G$ is the count of mixed groups, not the nominal one. Doubling $G$ partly compensates by making mixed groups more likely, which is a legitimate but different argument from variance reduction, and it interacts with the $\hat{\sigma} \to 0$ degeneracy that the $\epsilon$ floor papers over.

Question. The unbiased off-policy correction is the sequence-level importance ratio, yet essentially every framework applies ratios and clipping per token. Defend the practice, then attack it.

Discussion. The defense is variance. The log of the sequence ratio is a sum of per-token log-ratios, so the ratio itself is log-normal-like with variance growing in length, and a single long completion can carry an importance weight of $e^{10}$ that annihilates the batch. Per-token ratios with clipping keep every multiplicative factor in $[1 - \epsilon, 1 + \epsilon]$, bounding the estimator uniformly in length. The attack is that per-token correction answers a different question: the product structure means the correct weight for token $t$ depends on the whole prefix ratio, and truncating each factor independently biases long completions relative to short ones, so the method quietly reweights the objective by length. This is the same move as GRPO's $\hat{\sigma}$: a normalization introduced for stability that changes the estimand, invisible until you ask, as in Proposition 6, what the estimator is actually consistent for. A complete answer mentions that the bias is second order when the policies are close, which is why the practice works when staleness and numerical mismatch are controlled, and fails when they are not.

Question. You must estimate and penalize the KL divergence to a reference policy. Compare the estimators $k_1 = -\log \rho$ and $k_3 = (\rho - 1) - \log \rho$ with $\rho = \pi_{\text{ref}} / \pi_\theta$ on samples from $\pi_\theta$, and explain what changes when the penalty enters the reward versus the loss.

Discussion. Both estimators are unbiased for the value of $\mathrm{KL}(\pi_\theta \| \pi_{\text{ref}})$, since $\mathbb{E}_{\pi_\theta}[\rho - 1] = 0$ makes the added term in $k_3$ a control variate in exactly the sense of Section 3.2. But $k_1$ takes both signs and has high variance while $k_3$ is nonnegative, since $u - 1 \geq \log u$, and typically far lower variance, so $k_3$ is the right reporting estimator. The trap is the gradient. Unbiasedness for the value does not give unbiasedness for the gradient, because the sampling distribution itself depends on $\theta$: differentiating $\mathbb{E}_{\pi_\theta}[k]$ produces a pathwise term plus a score-function term $\mathbb{E}[k \, \nabla \log \pi_\theta]$, and backpropagating through the $k_3$ formula alone drops the latter. Folding the KL penalty into the reward as $r - \beta \log(\pi_\theta / \pi_{\text{ref}})$ and running it through the policy gradient estimator handles the score term automatically and is unbiased for the gradient of the penalized objective, while adding $k_3$ directly to the loss estimates the value well and its gradient with a bias. Whether that bias matters is an empirical question, but a candidate should know the two constructions are not the same estimator.

Question. Two runs with identical seeds, data order, and hyperparameters diverge after ten thousand steps. Is nondeterminism a bias problem or a variance problem, and does it threaten the consistency arguments of Section 4?

Discussion. Decompose the perturbation as in Proposition 8. Reduction-order nondeterminism with random batch composition is approximately conditionally mean-zero, so it lands in the noise term $\xi_t$ and is a variance problem, handled by averaging and step size. Batch-size-dependent or shape-dependent kernel selection is systematic, lands in $b_t$, and is a bias problem that no averaging removes; batch-invariant kernels exist precisely to move this term back into the zero column. The divergence of trajectories is nevertheless expected under pure variance, because SGD on a nonconvex landscape is chaotic in the dynamical sense and infinitesimal perturbations grow exponentially until trajectories decorrelate, so run-level divergence is not by itself evidence of bias. The honest caveat to the consistency story is distributional: the CLT and Hoeffding arguments of Proposition 5 assumed light tails, while reward times score for rare, long, high-reward completions can be heavy-tailed enough that the effective sample size is much smaller than $G$, in which case median-of-means or Bernstein-style thinking, rather than the raw mean, describes what practitioners implicitly do when they clip gradients. Gradient clipping is, after all, one more truncated mean: a biased, low-variance estimator chosen over an unbiased one, which is the thesis of this post applied to itself.

Notes & Feedback

Thoughts, a correction, or a slicker proof? Leave a note below — sign in with GitHub to post. Comments support Markdown, fenced ```code``` blocks, and $LaTeX$ math, all rendered by GitHub.