Introduction
In Reinforcement Learning (RL), evaluating a policy's expected return typically relies on "on-policy" sampling—running the target policy, collecting trajectories, and averaging the results via Monte Carlo estimation. Standard RL assumes this is the most straightforward and effective way to evaluate a policy. However, this paper reveals that standard on-policy sampling is often surprisingly inefficient when dealing with finite samples. To address this, the authors propose Robust On-Policy Sampling (ROS), an adaptive approach that uses non-i.i.d., off-policy sampling to "correct" for random noise. This allows the collected data to match the target policy's true distribution much faster, leading to significantly more accurate policy evaluations.
The Problem with On-Policy Sampling
Policy evaluation is the task of estimating the expected return of a specific "target" policy. While on-policy sampling is the gold standard, there is a subtle but critical gap between on-policy data (the theoretical distribution of the policy) and on-policy sampling (the actual finite data collected).
Because of random chance, a finite set of samples will almost always deviate from the true policy distribution. For example, if a policy dictates taking Action A 20% of the time, a small sample of 5 trials might accidentally yield 0 or 2 occurrences of Action A. This "sampling error" is a major source of inaccuracy in policy evaluation, which becomes especially problematic when data is expensive or time-consuming to collect, such as in robotics.
Robust On-Policy Sampling (ROS)
To close this gap, the authors introduce ROS. Instead of blindly following the target policy, ROS acts as an adaptive "behavior policy" that keeps track of what has already been sampled and actively corrects for deviations.
- Tracking Empirical Distribution: ROS maintains a running count (or a gradient-based estimate) of how often state-action pairs have appeared relative to their theoretical probabilities under the target policy.
- Corrective Action Selection: If the agent realizes it has under-sampled a specific action in a certain state due to previous random noise, it temporarily increases the probability of taking that action in the future.
- Gradient-Based Updates: To handle large or continuous state spaces, ROS uses a single step of gradient descent on the log-likelihood of the observed data. It moves the behavior policy away from the target policy in a direction that actively reduces the current sampling error.
Crucially, while the sampling process is technically "off-policy" (because the behavior changes based on history), the resulting aggregate dataset converges to the expected "on-policy" distribution much faster than standard independent and identically distributed (i.i.d.) sampling.
Experimental Setup
The authors evaluated ROS across four environments designed to test different complexities:
- Multi-armed Bandit: A simple setting to isolate sampling error in action selection.
- GridWorld: A discrete state-action environment used to measure state visitation frequencies.
- CartPole: A classic control task with a discrete action space but continuous state space.
- Continuous CartPole: A version of CartPole with both continuous states and continuous actions.
ROS was compared against standard On-Policy Sampling (OS) and Behavior Policy Gradient (BPG), a method designed to find minimum-variance behavior policies.
Key Results and Insights
The most counter-intuitive insight from this research is that by intentionally deviating from a policy during collection, you can produce a dataset that matches that policy's true distribution more accurately than if you had followed it perfectly.
Faster Convergence and Robustness to Bias: Theoretically and empirically, ROS reduces the KL-divergence between the sampled data and the true policy distribution at a faster rate than standard sampling. Furthermore, ROS isn't just for starting from scratch. If you already have a "biased" dataset (e.g., data collected from an older version of a policy), ROS can be initialized with that data and will automatically prioritize actions that balance out the existing bias.
Lower Mean Squared Error (MSE): In all four tested domains, ROS achieved a lower Mean Squared Error in policy value estimates compared to standard Monte Carlo methods. This demonstrates that the reduction in sampling error directly translates to more accurate policy evaluations.
Finally, the computational overhead of ROS is linear relative to the number of policy parameters, making it highly practical for real-time data collection.
Limitations and Future Work
While promising, ROS does have limitations:
- Hyperparameter Sensitivity: ROS introduces a step-size parameter that controls how aggressively it tries to correct sampling errors. In continuous spaces, setting this too high can lead to divergence, suggesting a need for more automated tuning methods.
- Function Approximation: While the paper demonstrates that ROS works empirically with neural network policies, the theoretical convergence proofs are currently limited to tabular (discrete) settings.
Looking forward, the authors suggest that this "robust sampling" logic could be extended beyond evaluation to policy improvement (e.g., Policy Gradient methods), potentially making the entire RL training loop significantly more data-efficient.
Summary updated