Reducing Sampling Error in Batch Temporal Difference Learning

Brahma S. Pavse, Ishan Durugkar, Josiah Hanna, Peter Stone

TL;DR

Batch Temporal Difference (TD) learning often converges to an inaccurate value function because it implicitly weights updates by the empirical frequency of actions in a dataset, rather than their true probabilities under the target policy. This paper introduces PSEC-TD(0), an algorithm that corrects this "policy sampling error" by estimating the behavior policy from the data and applying importance sampling, resulting in a significantly more data-efficient and accurate value function estimator.

What Problem Does This Paper Address?

In reinforcement learning, estimating the value function—the expected return from a given state—is a foundational task. When learning from a fixed, finite dataset (batch value prediction), standard algorithms like TD(0) suffer from finite-sample inefficiencies.

Specifically, the authors identify policy sampling error. Imagine a policy that chooses between Action A and Action B with a 50/50 probability. In a small batch of data, Action A might randomly appear twice as often as Action B. Standard batch TD(0) blindly trusts these empirical counts, giving updates from Action A twice the weight. Because TD(0) ignores the known, true probabilities of the evaluation policy, it converges to a biased value function estimate. The paper seeks to mathematically define and algorithmically correct this specific source of error.

Methods

To fix policy sampling error, the authors propose Policy Sampling Error Corrected-TD(0) (PSEC-TD(0)). The approach relies on a clever use of importance sampling—a technique usually reserved for off-policy learning—applied here to the on-policy batch setting.

The algorithm works in three steps:

  1. Estimate the behavior policy: Use Maximum Likelihood Estimation (MLE) on the batch data to figure out the empirical distribution of actions taken in each state (denoted as $\hat{\pi}$). In tabular settings, this is a simple count; in continuous settings, it involves training a neural network or linear model.
  2. Compute an importance sampling weight: For every transition, calculate the ratio between the true evaluation policy and the estimated empirical policy: $\rho = \pi_e(a|s) / \hat{\pi}(a|s)$.
  3. Weight the TD update: Multiply the standard TD update by this ratio $\rho$.

The authors also provide theoretical proofs showing that standard TD(0) converges to a "Certainty-Equivalence Estimate" (CEE) based on the empirical policy, while PSEC-TD(0) converges to a more accurate fixed point based on the true evaluation policy. They also demonstrate that this weighting trick can be extended to other algorithms, like Least-Squares TD (LSTD).

Key Insights and Ideas

  • Separating finite-sample errors: The authors elegantly divide batch learning errors into transition sampling error (bad luck with environment dynamics) and policy sampling error (bad luck with action selection). While we can't easily fix transition errors without a perfect model of the environment, we can fix policy errors because we already know the target policy we want to evaluate.
  • On-policy importance sampling: Importance sampling is almost exclusively used to learn about a target policy from a different behavior policy. This paper highlights that even when the behavior and target policies are identical (on-policy), importance sampling is highly beneficial for correcting finite-sample deviations in the dataset.
  • Model expressivity unlocks PSEC's potential: In function approximation settings, the performance gap between PSEC and standard TD widens when using more expressive neural networks. Because PSEC targets a mathematically more accurate fixed point, a more capable neural network is required to actually capture that difference.

Key Results

The authors evaluated their method on three standard reinforcement learning environments: Gridworld (tabular), CartPole, and InvertedPendulum (function approximation).

Performance of PSEC-TD(0) and PSEC-LSTD(0) in Gridworld
  • Tabular Setting: In Gridworld, PSEC-TD(0) and PSEC-LSTD(0) drastically reduced Mean Squared Value Error (MSVE) compared to standard TD(0) and LSTD(0). Once a batch size reached 10 episodes (enough to see all valid transitions), PSEC fully corrected the policy sampling error, leading to a massive drop in MSVE.
  • Function Approximation: In CartPole and InvertedPendulum, PSEC-TD(0) yielded statistically significant improvements in data efficiency across almost all tested batch sizes.
  • Convergence: As batch sizes grow extremely large, the empirical policy naturally converges to the true policy, causing the PSEC weight to approach 1. Consequently, the performance of PSEC-TD(0) and standard TD(0) eventually align, proving PSEC is most valuable in data-constrained regimes.

Limitations and Future Work

Limitations: * Requires known evaluation policy: Unlike standard on-policy TD(0), PSEC-TD(0) requires exact knowledge of the evaluation policy's action probabilities. * Computational overhead: Estimating the behavior policy adds computation and memory costs (e.g., $O(|S||A|)$ parameters in tabular settings). * Overfitting risks: If the behavior policy estimator overfits to the batch data, it can degrade the performance of the value function estimate.

Future Work: The authors suggest extending PSEC to $n$-step TD and TD($\lambda$) algorithms. They also propose applying it to learn state-action values (Q-values) to see if it leads to better control policies (e.g., in actor-critic setups), and developing methods to automatically find optimal hyperparameter settings for the PSEC function approximators.

Summary updated

BibTeX
@inproceedings{pavse2020reducing,
  author = {Brahma S. Pavse and Ishan Durugkar and Josiah Hanna and Peter Stone},
  title = {{Reducing Sampling Error in Batch Temporal Difference Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2020},
  url = {https://openreview.net/forum?id=TV7hOTbJRC},
}
Figure