On the Generalization Gap in Reparameterizable Reinforcement Learning

Huan Wang, Stephan Zheng, Caiming Xiong, Richard Socher

TL;DR

This paper provides a novel theoretical framework for understanding generalization in reinforcement learning (RL) by focusing on "reparameterizable" RL problems. By decoupling environmental randomness from policy updates, the authors derive the first finite-sample generalization bounds using Rademacher complexity and PAC-Bayes theory, proving that the smoothness of both the policy and the environment transitions directly controls overfitting.

What Problem Does This Paper Address?

Reinforcement learning agents are notorious for overfitting to their training environments. An agent that achieves a perfect reward during training often fails spectacularly when deployed in a test environment with minor variations.

In traditional supervised learning, we assume data samples are drawn independent and identically distributed (i.i.d.) from a fixed distribution. In on-policy RL, this assumption breaks completely: as the agent learns and updates its policy, it changes the very distribution of the trajectories it experiences. This creates complex temporal dependencies that make deriving mathematical guarantees for generalization incredibly difficult. Furthermore, existing RL research often conflates two distinct types of errors: variance from pure environmental randomness and errors caused by actual shifts in the environment's underlying distribution.

This paper aims to bridge this gap by establishing rigorous, finite-sample generalization bounds that isolate these errors.

Methods

The authors restrict their focus to a specific class of problems: reparameterizable RL. By applying the "reparameterization trick" (commonly used in Variational Autoencoders), they decouple the stochasticity of the environment from the policy map. Under this formulation, any trajectory can be computed deterministically given a set of pre-sampled, peripheral random variables (such as Gumbel noise for discrete states or Gaussian noise for continuous control).

Once the problem is reparameterized, the expected reward becomes a function of the policy parameters over a fixed noise distribution, closely mirroring a supervised learning setup. This allows the authors to split the total generalization gap into two components via the triangle inequality:

  1. Intrinsic Error: Overfitting caused by the intrinsic randomness of the environment given a finite number of training episodes (analogous to standard overfitting in supervised learning).
  2. External Error: The performance drop caused by a shift in the environment's dynamics or initialization between training and testing (analogous to transfer learning).

Using this framework, they derive formal generalization bounds based on Rademacher complexity and PAC-Bayes bounds, analyzing how the Lipschitz "smoothness" of the transition dynamics, reward functions, and policy architectures affect the agent's ability to generalize.

Datasets

The paper does not utilize standard empirical deep RL benchmarks (such as Atari or MuJoCo). Instead, the authors validate their theoretical bounds using custom synthetic simulations. They construct a controlled environment featuring linear transitions parameterized by randomly generated matrices and a Multi-Layer Perceptron (MLP) policy. This synthetic setup allows them to precisely manipulate and measure the Lipschitz constants of the transitions and policies.

Key Insights and Ideas

  • Decoupling Restores Uniform Convergence: Reparameterization "lifts" the policy's dependency directly to the states. This mathematical pivot turns a moving-target distribution problem into a classic uniform convergence problem over a fixed noise distribution, making Rademacher complexity tools applicable.
  • The Exponential Danger of Non-Smoothness: The derived bounds show that the generalization gap is heavily dictated by a compounding factor, $\nu = Lt1 + Lt2L\pi1$ (where $L$ represents the Lipschitz constants of the transitions and policy). If the environment or policy is non-smooth ($\nu > 1$), the generalization gap can explode exponentially with the episode horizon $T$.
  • PAC-Bayes Justifies Policy Perturbation: The authors' PAC-Bayes bound mathematically demonstrates that maximizing a perturbed reward objective (adding noise to policy parameters during training) acts as a regularizer that directly shrinks the generalization gap.

Key Results

  • Theorem 1 (Generalization Bound): The authors prove that with a probability of at least $1-\delta$, the true expected reward in a modified test environment is bounded by the empirical training reward plus terms proportional to the Rademacher complexity, initialization shifts ($\epsilon$), transition shifts ($\zeta$), and an $O(\sqrt{\frac{\log(1/\delta)}{n}})$ sample-size penalty.
  • Smoothness Reduces the Gap: Empirical simulations verified that making the policy smoother—either by adjusting the softmax temperature $\tau$ or constraining the weight norms—directly reduces the intrinsic generalization gap.

As shown in the experimental data, varying the policy temperature directly influences the policy's smoothness metric ($\frac{1}{\tau}\Pi_l\|\hat{\theta}^l\|_F$) and correlates with changes in the generalization gap:

Intrinsic Gap versus Smoothness Table
  • Compounding Transition Shifts: The simulations confirmed that a shift in the transition function ($\Delta T$) hurts generalization significantly more than a shift in the initial state distribution ($\Delta I$), because transition errors accumulate and compound at every single time step of an episode.

Limitations and Future Work

  • Scope of Reparameterization: The primary limitation is that the framework requires the RL environment to be reparameterizable. While this holds true for continuous control tasks (like Linear Quadratic Regulators or physical systems modeled by smooth stochastic differential equations), it is not universally applicable to all RL problems.
  • Discrete MDPs are Inherently Non-Smooth: Discrete Markov Decision Processes rely on discontinuous argmax operations for state transitions. Theorem 1 cannot be directly applied to them without employing continuous relaxations (like the Gumbel-Softmax trick), which introduces approximation errors.
  • On-Policy Restriction: The current theoretical analysis is strictly limited to on-policy reinforcement learning. Extending these finite-sample guarantees to off-policy algorithms remains an open and vital direction for future research.

Summary updated

BibTeX
@inproceedings{wang2019generalization,
  author = {Huan Wang and Stephan Zheng and Caiming Xiong and Richard Socher},
  title = {{On the Generalization Gap in Reparameterizable Reinforcement Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2019},
  url = {https://openreview.net/forum?id=HyEiesbuZB},
}
Figure