Unbiased Policy Gradient with Random Horizon
- Deep Learning Theory
We use geometrically sampled trajectory horizons to construct unbiased policy-gradient estimators for infinite-horizon discounted reinforcement learning.
Paper EWRL 2024
- Stellantis, France
- Vehicle Software Development, Ukraine
Policy gradients for discounted reinforcement learning target rewards arbitrarily far into the future, while practical rollouts stop after finitely many steps. We address the resulting gradient bias by sampling the rollout horizon from a geometric distribution. The resulting unbiased policy gradient (UPG) estimators include new GPOMDP variants and existing random-horizon estimators. Their sampling complexity removes a logarithmic factor in accuracy from the corresponding vanilla policy-gradient bound. Longer expected rollouts reduce the second-moment bound, making trajectory length and estimator variance joint determinants of sampling cost.
The horizon enters the gradient
We consider a Markov decision process with bounded rewards , initial-state distribution , discount , and differentiable policy . For trajectories sampled under , write . The objective and its GPOMDP gradient representation are
The vector accumulates policy scores through time . A fixed truncation horizon drops the remaining reward-score terms and introduces bias. Increasing that horizon reduces the error while increasing sampling cost. We instead encode the discount in an independent stopping rule.
Geometric stopping yields unbiased GPOMDP
Sample on the nonnegative integers, then accumulate undiscounted rewards and scores:
Each time- term survives with exactly its original discount weight. Every rollout is finite almost surely, and arbitrarily late rewards remain represented across samples. At each step, we update the score accumulator and add the current reward times that accumulator to the gradient estimate. Independent trajectory estimates can then be averaged into a batch.
Splitting discounting between rewards and survival
The broader -UPG family allocates discounting between the stopping distribution and explicit reward weights. For , its GPOMDP estimator is
Multiplying the survival probability by recovers , preserving the same gradient expectation. At we recover UGPOMDP. Increasing lengthens the expected rollout; the theoretical second-moment bound decreases. We also derive an action-value branch, -QPGT, containing Q-PGT at and RPG at . These branches provide a common framework for comparing existing and new estimators.
Sampling cost depends on variance and horizon
For a smooth objective , unbiasedness permits a stochastic-gradient convergence analysis under an expected-smoothness bound on the estimator's second moment. Uniform bounds on the policy's expected squared score and expected log-policy Hessian norm yield an explicit second-moment bound . Choosing the batch size and constant step size according to these bounds gives
Here is a uniformly sampled iterate, is the initial policy parameter, and is the optimal objective value. The tolerance measures first-order stationarity, is the objective's smoothness constant, and counts expected environment samples. For fixed problem constants the accuracy dependence is , removing the truncation-related logarithmic factor in the vanilla comparison. Choosing therefore requires considering : the smallest second-moment bound occurs with longer rollouts. For UGPOMDP, the sampling bound scales as .
Discounted return in control benchmarks
We evaluate two-hidden-layer policies with 64 units and Tanh activations, using softmax outputs for discrete actions and Gaussian outputs for continuous actions. The main comparison averages 10 runs with 95% confidence intervals. Both UGPOMDP and -UGPOMDP outperform GPOMDP on CartPole, LunarLander, Acrobot, and Pendulum. We use for the first three and for Pendulum, with training batches of 64 trajectories. The preferred varies across environments; performs poorly on Acrobot and best among the tested settings on Pendulum.
We also compare the number of environment interactions and repeat the GPOMDP baseline with twice its truncation horizon to examine how discounted return depends on sampling cost. These experiments use Adam and nonlinear neural policies; the convergence bound applies to stochastic-gradient updates under the assumptions above. In terminating environments, the treatment of terminal states can change gradient estimates, particularly for Q-PGT and RPG, and must preserve the reward and stopping weights used in the unbiasedness calculation.