Introduction
In real-world applications such as autonomous driving or medical treatment planning, training reinforcement learning (RL) agents through online trial-and-error is often impractical due to safety, ethical, or cost constraints. Offline RL addresses this by learning from historical logged data. However, a critical bottleneck remains: Off-Policy Evaluation (OPE). Practitioners need to reliably estimate the performance of a newly trained policy before deployment. Existing tools often focus solely on learning or provide limited evaluation metrics, such as expected mean reward, which can mask significant tail risks.
SCOPE-RL is an open-source Python library designed to bridge this gap. It provides a unified, end-to-end pipeline—from data collection to risk-aware policy selection—enabling researchers to estimate entire reward distributions and evaluate the "risk-return" tradeoff of their models.
The SCOPE-RL Framework
SCOPE-RL introduces a modular architecture that streamlines the offline RL-to-OPE workflow. The library is organized into four primary components: the Dataset module, the Offline Policy Learning (ORL) module, the OPE module, and the Off-Policy Selection (OPS) module.
The library is designed for high compatibility, supporting standard Gym/Gymnasium environments and integrating seamlessly with d3rlpy. It also includes BasicGym, a synthetic environment for rapid prototyping.
Advanced Evaluation Capabilities
The core innovation of SCOPE-RL lies in its focus on robust evaluation beyond simple point estimates.
- Cumulative Distribution OPE (CD-OPE): Unlike traditional methods that only estimate mean performance, SCOPE-RL estimates the entire Cumulative Distribution Function (CDF) of a policy's rewards. This allows for the calculation of critical risk metrics like Conditional Value at Risk (CVaR) and variance, which are essential for safety-critical deployments.
- Comprehensive Estimator Suite: The library implements a wide variety of OPE estimators, including Direct Method, Doubly Robust, and marginalized importance sampling to mitigate the "curse of horizon."
- Risk-Return Assessment for OPS: SCOPE-RL treats the selection of top-$k$ policies as a portfolio management problem. It evaluates estimators based on the performance of the selected "portfolio," using metrics like the Sharpe Ratio to balance expected returns against deployment risks.
Key Insights and Results
A central philosophy of SCOPE-RL is that average performance is insufficient for high-stakes applications. By framing OPE as a screening tool, the library helps practitioners shortlist the most promising policies for expensive online A/B testing.
Benchmarking against other major RL packages (such as d3rlpy, OBP, and RLlib) reveals that SCOPE-RL is uniquely positioned to support the full lifecycle of offline RL, particularly in advanced OPE and evaluation-of-OPE protocols. Furthermore, the library's built-in visualization tools generate publication-quality analytics for reward distributions and estimator accuracy, significantly reducing the engineering overhead for rigorous evaluation.
Future Directions
While SCOPE-RL provides a robust foundation, future development will focus on expanding support for Partially Observable Markov Decision Processes (POMDPs) and integrating more advanced CD-OPE estimators based on generative modeling. The team also plans to expand educational resources to help the community navigate the theoretical complexities of off-policy evaluation.
Documentation and source code: https://scope-rl.readthedocs.io/en/latest/
Summary updated