No history yet

Gradient Variance Dynamics

The Gradient Variance Problem

The core challenge for policy gradient methods in reinforcement learning is not just finding a direction of improvement, but finding one reliably. The Policy Gradient Theorem provides a theoretical foundation for updating policy parameters, but its practical application is fraught with high variance. This variance stems directly from the credit assignment problem inherent in Monte Carlo rollouts.

θJ(θ)=Eτπθ[(t=0T1θlogπθ(atst))(t=0T1R(st,at))]\nabla_\theta J(\theta) = \mathbb{E}_{\tau \sim \pi_\theta} \left[ \left( \sum_{t=0}^{T-1} \nabla_\theta \log \pi_\theta(a_t|s_t) \right) \left( \sum_{t=0}^{T-1} R(s_t, a_t) \right) \right]

Algorithms like REINFORCE directly implement this theorem. A single high-reward trajectory can drastically shift the gradient estimate, even if many of the actions within that trajectory were suboptimal. Conversely, a good action can be unfairly penalized if it happens to occur in an otherwise low-reward trajectory. This makes the gradient estimate incredibly noisy. Genetic Algorithms (GAs), being derivative-free, sidestep this issue entirely. GAs assess the fitness of a complete policy (an individual in the population) based on its total reward. It doesn't attempt to assign credit to individual actions or parameters, instead selecting for holistically successful policies. This population-based search is less susceptible to the noise of individual trajectory outcomes.

Actor-Critic and Bias

Actor-Critic methods attempt to mitigate the variance of REINFORCE by introducing a baseline. The critic, a value function approximator, estimates the expected return from a given state, V(st)V(s_t). Instead of using the full trajectory reward, the actor's update uses the advantage function, A(st,at)=Q(st,at)V(st)A(s_t, a_t) = Q(s_t, a_t) - V(s_t), or often the Temporal Difference (TD) error, δt=Rt+1+γV(st+1)V(st)\delta_t = R_{t+1} + \gamma V(s_{t+1}) - V(s_t), as a proxy. This reduces variance because it centers the reward signal, judging an action relative to the expected outcome rather than an absolute value.

Using a learned value function as a baseline introduces bias. If the critic's value estimate is inaccurate, the resulting policy gradient will be biased, potentially leading the actor toward a suboptimal policy.

This creates the classic bias-variance tradeoff. While the critic's baseline dramatically lowers the variance of the gradient estimate, it is itself a biased estimate of the true value function, especially early in training. The quality of the actor's update becomes dependent on the quality of the critic's estimates. In high-dimensional, non-convex reward landscapes, a biased, stochastically estimated gradient can easily lead the policy into a local optimum from which it cannot escape. The optimization process can become unstable, oscillating or converging prematurely because the gradient signal is misleading.

Natural Gradients and Search

The standard gradient tells us the direction of steepest ascent in the parameter space, but this doesn't necessarily correspond to the largest improvement in policy performance. Small changes in parameters can sometimes lead to large, destructive changes in the policy's action distribution. Natural policy gradients address this by scaling the gradient using the inverse of the Fisher Information Matrix (FIM).

~θJ(θ)=F(θ)1θJ(θ)\tilde{\nabla}_\theta J(\theta) = F(\theta)^{-1} \nabla_\theta J(\theta)

The FIM, F=E[θlogπθ(θlogπθ)T]F = \mathbb{E}[\nabla_\theta \log \pi_\theta \cdot (\nabla_\theta \log \pi_\theta)^T], essentially defines a metric on the manifold of probability distributions. This ensures that the policy update step size is measured in terms of the Kullback-Leibler (KL) divergence between the old and new policies. While powerful, computing and inverting the FIM is computationally expensive, often requiring approximations like in Trust Region Policy Optimization (TRPO) or Proximal Policy Optimization (PPO).

This is where the parallel search of a Genetic Algorithm offers a compelling alternative. Instead of following a single, noisy gradient, a GA maintains a population of policies. It performs exploration implicitly by combining and mutating existing high-performing solutions. In a noisy reward landscape where gradient estimates are unreliable, this population-based approach acts as a robust filter. Poor policies are discarded, and promising policies are recombined, allowing the search to progress on multiple fronts without depending on a single, potentially misleading, local gradient signal. This avoids the bottleneck of precise gradient estimation, making it particularly effective for problems where the reward landscape is rugged or deceptive.

Quiz Questions 1/5

What is the primary challenge associated with the direct application of the Policy Gradient Theorem, as seen in algorithms like REINFORCE?

Quiz Questions 2/5

How do Actor-Critic methods attempt to mitigate the high variance problem of simpler policy gradient methods?