SCOPE-RL: A Python Library for Offline Reinforcement Learning and Off-Policy Evaluation

Haruka Kiyohara, Ren Kishimoto, Kosuke Kawakami, Ken Kobayashi, Kazuhide Nakata, Yuta SaitoarXiv 2023 · DOI

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 SCOPE-RL implementation aligns with the standard offline RL-to-OPE workflow, providing specialized modules for each stage.

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.

  1. 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.
  2. 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."
  3. 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.
SCOPE-RL extends existing OPE capabilities by introducing distributional estimates and risk-return tradeoff assessments for policy selection.

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

BibTeX
@misc{kiyohara2023scope,
  author = {Haruka Kiyohara and Ren Kishimoto and Kosuke Kawakami and Ken Kobayashi and Kazuhide Nakata and Yuta Saito},
  title = {{SCOPE-RL: A Python Library for Offline Reinforcement Learning and Off-Policy Evaluation}},
  year = {2023},
  eprint = {2311.18206},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.18206},
}
Figure