Baselines and Variance Reduction

Imagine training a robot policy with REINFORCE: Monte Carlo Policy Gradient. Every episode's return is a huge positive number, say between 900 and 1100. REINFORCE pushes up the probability of every action taken, proportionally to the return. So it happily reinforces even mediocre actions just because the episode ended well overall. The gradient signal is technically correct in expectation. But its variance across episodes is enormous, and learning crawls or diverges. This is not a hypothetical nuisance. It is the central obstacle standing between the clean theory of policy gradients and their practical use in anything beyond toy problems. The fix that makes policy gradient methods usable in practice is deceptively simple: subtract a baseline from the return before using it to scale the gradient. If the baseline is chosen to depend only on the state (not on the action taken), this subtraction leaves the expected gradient completely unchanged. At the same time, it dramatically shrinks its variance. This single idea is the conceptual bridge from plain REINFORCE to modern actor-critic architectures. It underlies essentially every practical policy-gradient algorithm used today, from vanilla policy gradient to A2C, A3C, PPO, and TRPO. The big picture is a general statistical principle in disguise: control variates. Whenever we estimate an expectation via Monte Carlo sampling, we can subtract any zero-mean-correcting term. This reduces variance without touching the estimate's expected value. In reinforcement learning, the return GtG_t is our noisy sample. A well-chosen baseline b(st)b(s_t) absorbs the state-dependent part of that noise. What remains is only the part of the signal that actually distinguishes good actions from bad ones in that state. This article develops the baseline trick rigorously. It explains why subtracting a state-dependent function leaves the gradient unbiased, and why it reduces variance. It shows how to pick a good baseline in practice, typically an estimated state-value function. Finally, it shows how this naturally sets the stage for the advantage function and actor-critic methods, where the "critic" is precisely a learned baseline.

Key takeaways
  • REINFORCE's raw return-based gradient estimator is unbiased but has very high variance, which slows or destabilizes learning.
  • Subtracting any state-dependent baseline b(st)b(s_t) from the return leaves the policy gradient's expectation unchanged.
  • The unbiasedness holds because Eat∼π[∇θlog⁡πθ(at∣st)]=0\mathbb{E}_{a_t \sim \pi}[\nabla_\theta \log \pi_\theta(a_t|s_t)] = 0 for any function of state alone.
  • A near-optimal baseline is the state-value function Vπ(st)V^\pi(s_t), giving the term (Gt−Vπ(st))(G_t - V^\pi(s_t)), an early form of the advantage.
  • Variance reduction scales with how well b(s)b(s) correlates with GtG_t; a learned value-function baseline typically helps enormously.
  • This idea directly foreshadows actor-critic methods and the advantage function, where a learned critic replaces the raw return.
The core insight

Subtracting any state-dependent baseline from the return reduces the variance of the policy gradient estimator while leaving its expectation exactly unchanged.

The idea

Recall the REINFORCE gradient estimator for a trajectory-based objective J(θ)=Eπ[∑tγtrt]J(\theta) = \mathbb{E}_\pi[\sum_t \gamma^t r_t]. The policy gradient theorem gives

∇θJ(θ)=Eπ[∑t∇θlog⁡πθ(at∣st) Gt],\nabla_\theta J(\theta) = \mathbb{E}_\pi\left[\sum_t \nabla_\theta \log \pi_\theta(a_t \mid s_t)\, G_t\right],

where Gt=∑k≥tγk−trkG_t = \sum_{k \ge t} \gamma^{k-t} r_k is the return from time tt onward. This estimator is unbiased: its expectation equals the true gradient. But GtG_t is a Monte Carlo sample of a random variable that can have huge variance, especially in long-horizon or sparse-reward tasks, and this variance propagates directly into the gradient estimate. A baseline is any function b(st)b(s_t) that depends on the state but not on the action. The baselined gradient estimator replaces GtG_t with (Gt−b(st))(G_t - b(s_t)):

∇θJ(θ)=Eπ[∑t∇θlog⁡πθ(at∣st) (Gt−b(st))].\nabla_\theta J(\theta) = \mathbb{E}_\pi\left[\sum_t \nabla_\theta \log \pi_\theta(a_t \mid s_t)\, \big(G_t - b(s_t)\big)\right].

The key structural requirement is that bb must not depend on the action ata_t (it may depend on the state, the time step, or even be a constant); if this is violated, the subtraction can introduce bias. Subject to that requirement, the identity above holds for any choice of bb, including the zero function, a running average of past returns, or — most usefully — an estimate of the state-value function Vπ(st)V^\pi(s_t). The terminology to fix: the quantity Gt−b(st)G_t - b(s_t), when b(st)≈Vπ(st)b(s_t) \approx V^\pi(s_t), is an estimator of the advantage function Aπ(st,at)=Qπ(st,at)−Vπ(st)A^\pi(s_t, a_t) = Q^\pi(s_t, a_t) - V^\pi(s_t), which measures how much better action ata_t is than the average action in state sts_t. This is the natural conceptual endpoint of the baseline idea and the direct precursor to Actor-Critic Methods and The Advantage Function, where a learned critic network provides b(st)b(s_t) online rather than via Monte Carlo averaging.

How it works

Step 1 — Why subtracting a baseline is unbiased. The crux fact is a single lemma: for any function b(s)b(s) that does not depend on aa,

Ea∼πθ(⋅∣s)[∇θlog⁡πθ(a∣s) b(s)]=0.\mathbb{E}_{a \sim \pi_\theta(\cdot \mid s)}\big[\nabla_\theta \log \pi_\theta(a \mid s)\, b(s)\big] = 0.

Proof: pull b(s)b(s) out of the expectation (it is constant with respect to aa), and use the "score function" identity Ea[∇θlog⁡πθ(a∣s)]=∑aπθ(a∣s)∇θπθ(a∣s)πθ(a∣s)=∇θ∑aπθ(a∣s)=∇θ(1)=0\mathbb{E}_a[\nabla_\theta \log \pi_\theta(a|s)] = \sum_a \pi_\theta(a|s) \frac{\nabla_\theta \pi_\theta(a|s)}{\pi_\theta(a|s)} = \nabla_\theta \sum_a \pi_\theta(a|s) = \nabla_\theta (1) = 0. Since b(s)b(s) is a constant multiplier, this whole expectation vanishes. This means adding or subtracting b(s)∇θlog⁡πθ(a∣s)b(s) \nabla_\theta \log \pi_\theta(a|s) to the REINFORCE gradient contributes exactly zero in expectation, so the estimator's mean is preserved for any choice of bb.

Step 2 — Why it reduces variance. Write X=∇θlog⁡πθ(a∣s) GX = \nabla_\theta \log \pi_\theta(a|s) \, G (the un-baselined per-step gradient contribution, treated as a vector-valued random variable; consider one coordinate for simplicity). The baselined version is X−YX - Y where Y=∇θlog⁡πθ(a∣s) b(s)Y = \nabla_\theta \log \pi_\theta(a|s)\, b(s). Since E[Y]=0\mathbb{E}[Y] = 0 (Step 1), we have E[X−Y]=E[X]\mathbb{E}[X - Y] = \mathbb{E}[X], and

Var(X−Y)=Var(X)−2 Cov(X,Y)+Var(Y).\mathrm{Var}(X - Y) = \mathrm{Var}(X) - 2\,\mathrm{Cov}(X, Y) + \mathrm{Var}(Y).

If b(s)b(s) is chosen close to E[G∣s]=Vπ(s)\mathbb{E}[G \mid s] = V^\pi(s), then YY tracks the state-dependent part of the noise in XX closely, making Cov(X,Y)\mathrm{Cov}(X,Y) large and positive, and the subtraction removes far more variance than it adds. In the ideal limit b(s)=Vπ(s)b(s) = V^\pi(s), the baselined target becomes Gt−Vπ(st)G_t - V^\pi(s_t), which has zero conditional mean given sts_t and thus the smallest possible variance attributable to the "which state did we land in" component of randomness — only the action-selection and future-trajectory noise conditioned on the state remains.

Step 3 — Choosing a practical baseline. Three common choices, in increasing order of effectiveness: 1. Constant baseline: subtract the running average return Gˉ\bar{G} over recent episodes. Trivial to implement, removes only the overall scale/offset of returns. 2. State-dependent average: bucket states (or use a simple regression) to estimate average return per state. Better, but crude for large or continuous state spaces. 3. Learned value function baseline: train a separate function approximator v^(s;w)\hat{v}(s; w) (via regression toward observed returns) and use b(st)=v^(st;w)b(s_t) = \hat{v}(s_t; w). This is the standard choice and is exactly the "critic" of actor-critic methods.

Step 4 — Putting it together in an algorithm. The following is REINFORCE with a learned baseline (sometimes called "REINFORCE with a value-function baseline," a stepping stone to full actor-critic): ``` Initialize policy parameters θ (actor) Initialize value-function parameters w (baseline), e.g. via a neural network v̂(s; w) Set learning rates α_θ (policy) and α_w (baseline) for each episode: generate trajectory s_0, a_0, r_1, s_1, a_1, r_2, ..., s_{T-1}, a_{T-1}, r_T using policy π_θ for t = 0 to T-1: G_t ← sum_{k=t}^{T-1} γ^{k-t} r_{k+1} # Monte Carlo return from step t for t = 0 to T-1: δ_t ← G_t - v̂(s_t; w) # baselined advantage estimate w ← w + α_w · δ_t · ∇_w v̂(s_t; w) # regress baseline toward G_t θ ← θ + α_θ · γ^t · δ_t · ∇_θ log π_θ(a_t | s_t) # policy gradient step end for end for ``` Notes on the pseudocode:

  • The return GtG_t is computed exactly as in plain REINFORCE (no change to the target being estimated).
  • δt=Gt−v^(st;w)\delta_t = G_t - \hat v(s_t; w) plays a dual role: it is the baselined return used to scale the policy gradient, and it is also the regression error used to update the baseline itself toward GtG_t (this is why ww's update uses the same δt\delta_t, scaled by ∇wv^\nabla_w \hat v, i.e., gradient descent on squared error 12(Gt−v^(st;w))2\tfrac{1}{2}(G_t - \hat v(s_t;w))^2).
  • The γt\gamma^t factor in the policy update accounts for discounting from the start of the episode, consistent with the discounted objective; it is sometimes dropped in practice as a design choice that slightly changes what's being optimized.
  • Because ww and θ\theta are updated using data from the same trajectory, updating ww first, before using δt\delta_t for the θ\theta update in the same step, is a matter of convention — both orders are used in practice and remain unbiased since we use the same δt\delta_t computed before either update. The version shown updates ww then uses the same δt\delta_t for θ\theta, which is standard.
Figure
REINFORCE gradient before and after subtracting a state-value baseline
Raw return G_t (high variance) episodes → all values large & positive → every action reinforced gradient scale varies wildly episode to episode subtract b(s)=V(s) Baselined signal G_t − V(s_t) episodes → centered around zero → sign shows better/worse than average; much smaller spread Same expected gradient direction — much lower variance in the estimate

Complexity & correctness

Time complexity. The baseline adds only a constant-factor overhead to REINFORCE. Per episode of length TT:

  • Computing all returns GtG_t: O(T)O(T) (one backward pass accumulating the discounted sum).
  • Evaluating v^(st;w)\hat v(s_t; w) at each of the TT states: O(T⋅Cv)O(T \cdot C_v) where CvC_v is the cost of one forward pass of the value network (e.g., O(d)O(d) for a linear model in feature dimension dd, or the cost of a neural network forward pass).
  • Updating ww via gradient descent on the squared error: O(T⋅Cv)O(T \cdot C_v) for the backward pass, same order as forward.
  • The policy gradient update itself: O(T⋅Cπ)O(T \cdot C_\pi), unchanged from plain REINFORCE.

So overall the algorithm remains O(T⋅(Cπ+Cv))O(T \cdot (C_\pi + C_v)) per episode — the same asymptotic order as plain REINFORCE, since a baseline is just one more function approximator evaluated alongside the policy. Space complexity is O(T)O(T) to store the trajectory (states, actions, rewards, returns) plus O(∣θ∣+∣w∣)O(|\theta| + |w|) for the two parameter vectors — again, only an additive constant beyond REINFORCE's O(T+∣θ∣)O(T + |\theta|).

Correctness (unbiasedness). This is the central theoretical claim, and it deserves a full derivation, not just an assertion. Start from the exact policy gradient (single time step, to keep notation light; summing over tt recovers the full trajectory case):

∇θEa∼πθ(⋅∣s)[G(s,a)]=Ea∼πθ(⋅∣s)[∇θlog⁡πθ(a∣s) G(s,a)].\nabla_\theta \mathbb{E}_{a \sim \pi_\theta(\cdot|s)}\big[G(s,a)\big] = \mathbb{E}_{a \sim \pi_\theta(\cdot|s)}\big[\nabla_\theta \log \pi_\theta(a|s)\, G(s,a)\big].

Now consider the baselined estimator's expectation:

Ea[∇θlog⁡πθ(a∣s) (G(s,a)−b(s))]=Ea[∇θlog⁡πθ(a∣s) G(s,a)]−b(s) Ea[∇θlog⁡πθ(a∣s)].\mathbb{E}_{a}\big[\nabla_\theta \log \pi_\theta(a|s)\,(G(s,a) - b(s))\big] = \mathbb{E}_a\big[\nabla_\theta \log \pi_\theta(a|s)\, G(s,a)\big] - b(s)\, \mathbb{E}_a\big[\nabla_\theta \log \pi_\theta(a|s)\big].

The second term vanishes because, as shown above, Ea[∇θlog⁡πθ(a∣s)]=∇θ∑aπθ(a∣s)=∇θ1=0\mathbb{E}_a[\nabla_\theta \log \pi_\theta(a|s)] = \nabla_\theta \sum_a \pi_\theta(a|s) = \nabla_\theta 1 = 0, using the fact that πθ(⋅∣s)\pi_\theta(\cdot|s) is a probability distribution summing to 11 for every θ\theta (this differentiate-under-the-sum step is valid under standard regularity conditions on πθ\pi_\theta, e.g., smoothness and dominated convergence, which hold for the softmax and Gaussian policies used in practice). Hence the baselined expectation equals the unbaselined one exactly — no approximation, no asymptotic argument, an exact algebraic cancellation for any function b(s)b(s) that does not depend on aa. This is why the "must not depend on the action" restriction is not a minor technicality: it is precisely the condition that makes the cancellation term equal to b(s)⋅0b(s) \cdot 0 rather than something nonzero.

Correctness (variance reduction, and why it isn't automatic). Variance reduction is not guaranteed for every baseline — it is guaranteed only that the estimator stays unbiased. To see when variance actually goes down, expand:

Var[∇θlog⁡πθ(a∣s)(G−b(s))]=Var[∇θlog⁡πθ(a∣s) G]−2 Cov[∇θlog⁡πθ(a∣s) G, ∇θlog⁡πθ(a∣s) b(s)]+Var[∇θlog⁡πθ(a∣s) b(s)].\mathrm{Var}\big[\nabla_\theta \log \pi_\theta(a|s)(G - b(s))\big] = \mathrm{Var}\big[\nabla_\theta \log \pi_\theta(a|s)\, G\big] - 2\,\mathrm{Cov}\big[\nabla_\theta \log \pi_\theta(a|s)\, G,\ \nabla_\theta \log \pi_\theta(a|s)\, b(s)\big] + \mathrm{Var}\big[\nabla_\theta \log \pi_\theta(a|s)\, b(s)\big].

Variance decreases exactly when 2 Cov[⋅,⋅]>Var[∇θlog⁡πθ(a∣s) b(s)]2\,\mathrm{Cov}[\cdot,\cdot] > \mathrm{Var}[\nabla_\theta \log \pi_\theta(a|s)\,b(s)] — i.e., when b(s)b(s) is correlated enough with GG (through the shared randomness in ss) relative to the extra noise b(s)b(s) itself injects via ∇θlog⁡πθ\nabla_\theta \log \pi_\theta. Since b(s)b(s) is constant given ss, choosing b(s)b(s) close to E[G∣s]=Vπ(s)\mathbb{E}[G \mid s] = V^\pi(s) makes the covariance term large, because it directly cancels the state-dependent mean shift in GG that has nothing to do with which action was chosen. A provably optimal (minimum-variance) baseline, per state, can even be derived as a weighted average of returns weighted by squared score-function norm, but in practice Vπ(s)V^\pi(s) is used because it is simple to estimate and empirically works extremely well.

Tradeoffs. The baseline is free of bias but not free of cost: a second function approximator v^(s;w)\hat v(s;w) must be trained, adding hyperparameters (its own learning rate, architecture, regularization) and a second source of approximation error. If v^\hat v is badly miscalibrated (e.g., early in training), the baseline can be a poor variance reducer — it never introduces bias into the gradient, but a bad baseline may fail to reduce variance much, or even (in finite samples, due to using the same returns to fit ww and to compute δt\delta_t) introduce subtle correlations that complicate finite-sample analysis, though the population-level unbiasedness of the gradient is unaffected.

Worked example

Consider a tiny two-state MDP: state sAs_A (start) and state sBs_B (leads to episode end), with two actions "up" and "down" available in sAs_A. Suppose across a batch of 4 episodes we observe:

EpisodeState sts_tActionReturn GtG_tv^(st)\hat v(s_t) (baseline)Gt−v^(st)G_t - \hat v(s_t)
1sAs_Aup105100+5
2sAs_Adown96100−4
3sBs_Bup1210+2
4sBs_Bdown710−3

Without a baseline, REINFORCE would scale the gradient for the "up" action in sAs_A by +105+105 and for "down" in sAs_A by +96+96 — both positive, so both actions get reinforced, even though "down" was clearly the worse choice in that state. Worse, the raw returns in sAs_A (around 100) and in sBs_B (around 10) live on completely different scales, purely because sAs_A happens to be a state with high value regardless of action. This scale difference is the "nuisance variance" the baseline exists to remove. With the learned baseline v^(sA)=100\hat v(s_A) = 100 and v^(sB)=10\hat v(s_B) = 10 (estimates of each state's average return), the baselined signal Gt−v^(st)G_t - \hat v(s_t) becomes +5+5 for "up" and −4-4 for "down" in sAs_A — now correctly signed to increase the probability of "up" and decrease the probability of "down," at a much smaller, more comparable magnitude to the signal in sBs_B (+2+2 and −3-3). The direction of the policy update is unchanged in expectation (both the raw and baselined estimators point the same way on average, by the unbiasedness proof above), but the per-sample gradient magnitudes are now centered near zero rather than swinging between roughly 7 and 105 — a reduction in scale of over an order of magnitude in this toy case, illustrating concretely why gradient noise (and hence required learning-rate tuning and number of samples) shrinks dramatically with a good baseline. To make the variance argument numeric: the sample variance of {105,96,12,7}\{105, 96, 12, 7\} (crudely as "the scale multiplying the score function") is large — spanning nearly 100 in range — while the variance of {5,−4,2,−3}\{5, -4, 2, -3\} spans only 9. Even in this four-point toy batch, the reduction in spread mirrors the general phenomenon: a state-appropriate baseline removes the part of the return's variance attributable to "which state am I in," leaving only the part attributable to "was this action better or worse than the state's average" — precisely the informative signal for policy improvement.

Common pitfalls & traps

PitfallWhy it happensFix
Letting the baseline depend on the actionBreaks the exact cancellation Ea[∇θlog⁡πθ(a∣s)]=0\mathbb{E}_a[\nabla_\theta \log \pi_\theta(a|s)] = 0; introduces bias into the gradientRestrict bb to be a function of state (and/or time), never of the sampled action
Using a single global constant baseline onlyRemoves overall reward scale but leaves large state-dependent variance untouchedPrefer a learned v^(s;w)\hat v(s;w) that adapts per state
Training the baseline with too high a learning rateOverfits noisy per-episode returns, making v^\hat v itself high-variance and destabilizing δt\delta_tUse a smaller/separate learning rate for ww; consider more averaging (larger batches) for the value fit
Confusing "reduces variance" with "removes bias entirely"The estimator can still have nonzero variance from action-conditional randomness and bootstrapping error later onUnderstand that baselines control variance, not bias; bias enters separately if bootstrapped value estimates are later substituted for full returns
Forgetting the γt\gamma^t discount factor in the policy updateLeads to an estimator of a subtly different (undiscounted-style) objective, changing what is being optimizedInclude γt\gamma^t consistently, or explicitly note the deliberate simplification if omitting it
Using the exact same minibatch of returns to both fit v^\hat v and compute δt\delta_t for many epochsCan cause the baseline to "chase" the specific noise in that batch, reintroducing correlated finite-sample bias in practiceUse fresh data or limit the number of gradient steps on ww per batch; in on-policy settings, this is a known practical subtlety even though population-level unbiasedness of J(θ)J(\theta)'s gradient is unaffected

Pioneers & history

The baseline trick sits at the intersection of statistics (control variates, a decades-old variance-reduction technique in Monte Carlo estimation) and the specific machinery of policy gradient reinforcement learning developed in the late 20th century.

Origins · 1 minRonald J. Williams and how this was discovered
RJ
Ronald J. Williams
1953– · Northeastern University; originator of the REINFORCE family of algorithms

Ronald Williams introduced the REINFORCE algorithm and, in the same body of work, the observation that subtracting a "reinforcement baseline" from the reward signal leaves the expected weight update unchanged while typically reducing its variance. This insight — stated originally for connectionist reinforcement learning units — is the direct ancestor of the state-value baselines used throughout modern deep policy-gradient methods.

History
1987–1992
Williams develops and formalizes REINFORCE-style algorithms and explicitly analyzes reward baselines for variance reduction in connectionist networks.
1999–2000
The policy gradient theorem is formalized rigorously (Sutton, McAllister, Singh, Mansour), clarifying exactly which baseline choices preserve unbiasedness.
2000
s: Actor-critic architectures mature, using a learned value function explicitly as the baseline/critic, formalizing the advantage function A(s,a)=Q(s,a)−V(s)A(s,a) = Q(s,a) - V(s).
2015–2016
Deep actor-critic methods (A3C and successors) popularize learned neural-network baselines at scale, combining bootstrapped critics with baseline subtraction for stability.
2017
onward: Trust-region and clipped-objective methods (TRPO, PPO) build on advantage estimates derived directly from the baseline-subtraction principle, often combined with techniques like generalized advantage estimation.

Where this matters

Baseline subtraction is not a niche trick; it is load-bearing infrastructure in nearly every deployed policy-gradient system. Robotics control policies trained with policy gradients rely on learned value-function baselines to make training tractable within realistic sample budgets, since raw REINFORCE variance would otherwise require infeasibly many rollouts on physical or simulated hardware. Large-scale reinforcement learning from human feedback (RLHF) pipelines used to align language models employ a value-function baseline (often called the "critic" or "value head") precisely to stabilize policy updates over noisy, high-variance reward signals coming from a learned reward model. Game-playing agents, from classic Atari-playing deep RL agents to more recent large-scale game AI systems, use actor-critic architectures whose critic is functionally a baseline in the sense developed here — this article's advantage estimate Gt−v^(st)G_t - \hat v(s_t) is the direct ancestor of the advantage estimates used inside PPO and A3C. Simulation-based scientific and engineering optimization (e.g., chip placement, molecule design, resource scheduling formulated as sequential decision problems) similarly leans on baseline-subtracted policy gradients to make Monte Carlo policy optimization practical at all. Understanding this idea is therefore a prerequisite for understanding Actor-Critic Methods and The Advantage Function, both of which are simply more sophisticated, more tightly integrated versions of "learn a good baseline and subtract it."

Ask the tutor: Can you show why the minimum-variance baseline is weighted by the squared score-function norm, and how far that is from just using Vπ(s)V^\pi(s)?

Does subtracting a baseline change what policy the algorithm converges to?

No. Because the baseline subtraction leaves the expected gradient exactly unchanged (as shown by the cancellation Ea[∇θlog⁡πθ(a∣s)]=0\mathbb{E}_a[\nabla_\theta \log \pi_\theta(a|s)]=0), the direction the parameters move in, on average, is identical with or without a baseline. What changes is the variance of each individual stochastic gradient step. Lower variance means the empirical average of many samples converges faster to the true expected gradient, and updates are less erratic, but the fixed point of gradient ascent — the local optimum the policy converges toward — is unaffected by the choice of baseline, as long as the baseline genuinely does not depend on the action.

Is the state-value function V(s) the "best possible" baseline?

It is an excellent and very commonly used baseline, but not provably variance-optimal in a strict sense. The theoretically minimum-variance baseline, per state, is a return-weighted average using weights proportional to the squared norm of the score function ∥∇θlog⁡πθ(a∣s)∥2\|\nabla_\theta \log \pi_\theta(a|s)\|^2, which is impractical to compute exactly. Vπ(s)V^\pi(s) is preferred in practice because it is simple to interpret, easy to estimate via regression toward observed returns, reuses the same feature representations as the policy, and empirically captures the large majority of the achievable variance reduction.

How is this different from bootstrapping, as in temporal-difference methods?

Baseline subtraction, by itself, does not require bootstrapping — you can subtract v^(st)\hat v(s_t) from a full Monte Carlo return GtG_t and remain fully unbiased with respect to the true policy gradient, since only GtG_t (not bb) determines the expectation. Bootstrapping, by contrast, replaces GtG_t itself with an estimate like rt+1+γv^(st+1)r_{t+1} + \gamma \hat v(s_{t+1}), which introduces bias if v^\hat v is imperfect, in exchange for lower variance and the ability to update online without waiting for episode completion. Actor-critic methods typically combine both ideas: a learned baseline plus bootstrapped targets, trading a controlled amount of bias for large variance and efficiency gains.

Can the baseline depend on time step t, in addition to state?

Yes. Nothing in the unbiasedness proof requires bb to depend on state alone; it can depend on any information available at the time of the update that is independent of the specific action sampled, including the time index tt, the episode number, or even be a deterministic function of the entire trajectory prefix up to (but not including) the action choice. In practice, letting bt(st)b_t(s_t) vary with tt can help further reduce variance in finite-horizon tasks, since the scale of expected returns often changes systematically as an episode progresses.

Why doesn't a bad baseline hurt correctness, only efficiency?

Because the proof of unbiasedness (the score-function identity Ea[∇θlog⁡πθ(a∣s)]=0\mathbb{E}_a[\nabla_\theta \log \pi_\theta(a|s)] = 0) holds for literally any function of state alone, regardless of how well or poorly it approximates Vπ(s)V^\pi(s). A badly miscalibrated v^(s)\hat v(s) (say, wildly overestimating returns) simply fails to correlate well with the true returns, so the variance-reduction benefit shrinks or, in pathological cases, the baseline's own noise could add variance rather than remove it — but the expected value of the gradient estimator is untouched either way, so learning direction on average remains correct, only the sample efficiency and stability suffer.

How does this connect to the advantage function used in later actor-critic algorithms?

The quantity Gt−v^(st)G_t - \hat v(s_t) is precisely a Monte Carlo estimate of the advantage function Aπ(st,at)=Qπ(st,at)−Vπ(st)A^\pi(s_t,a_t) = Q^\pi(s_t,a_t) - V^\pi(s_t), since E[Gt∣st,at]=Qπ(st,at)\mathbb{E}[G_t \mid s_t, a_t] = Q^\pi(s_t,a_t) and the baseline approximates Vπ(st)V^\pi(s_t). Once you accept that a good baseline should approximate VπV^\pi, the entire actor-critic framework follows naturally: train a "critic" network to estimate VπV^\pi online (often with bootstrapped TD targets rather than full-episode returns), and use the resulting advantage estimate to scale the policy ("actor") gradient, exactly as the baseline-subtraction algorithm here does, but with faster, incremental updates.

Do baselines apply outside of policy gradient methods?

Yes — subtracting a control variate to reduce Monte Carlo variance without changing the expectation is a general statistical technique used throughout computational statistics, not unique to reinforcement learning. Within RL specifically, similar variance-reduction reasoning appears in other estimators too, such as certain formulations of importance-sampling-based off-policy evaluation, where carefully constructed correction terms play an analogous role. The REINFORCE baseline is simply the RL-specific instantiation of this broader idea, tailored to the score-function identity that makes state-dependent terms cancel in expectation.

Before this

Where this leads