Section 25.5: Evaluating offline policies rigorously

A Careful Control Loop
Technical illustration for Section 25.5: Evaluating offline policies rigorously.
Figure 25.5A: Rigorous offline policy evaluation: a doubly-robust off-policy estimator compared against naive average-return and true on-policy performance, showing the variance reduction from using the behavior policy as a control variate.
Big Picture

Evaluating offline policies rigorously asks a hard robot-learning question: how can a policy improve from a fixed dataset without touching the robot during training? The answer is not "train harder." The answer is to respect the support of the data, make pessimism explicit, and evaluate with artifacts that expose when the learned policy leaves the behavior distribution.

Why Offline RL Is Different

For Evaluating offline policies rigorously, offline RL starts from a static dataset and must make the behavior policy, support envelope, reward labels, and candidate-policy update explicit before any robot rollout is trusted.

Offline evaluation is difficult because the learned policy may choose actions not present in the logged data. A reliable evaluation plan therefore combines behavior cloning baselines, off-policy estimates where assumptions hold, simulator or real rollouts on held-out task panels, and qualitative failure labels.

Support Before Ambition

For Evaluating offline policies rigorously, the policy is allowed to improve only inside measured dataset support; outside that support, the value estimate should be treated as a risk signal.

Formal Contract

For Evaluating offline policies rigorously, the baseline objective is useful only after the data distribution and robot action scale are fixed; otherwise expected return can reward unsupported commands.

$$J(\pi) = \mathbb{E}_{\tau \sim \pi}\left[\sum_{t=0}^{T} \gamma^t r(s_t,a_t)\right].$$

For Evaluating offline policies rigorously, the practical objective needs a pessimism or support term because training cannot ask the real robot whether a novel action is safe.

$$\widehat{V}_{\mathrm{IS}}(\pi)=\frac{1}{N}\sum_{i=1}^{N}\left(\prod_t \frac{\pi(a_t^i\mid s_t^i)}{\beta(a_t^i\mid s_t^i)}\right)R(\tau_i).$$

For Evaluating offline policies rigorously, the pessimism term should expose unsupported gripper poses, contact modes, saturation regions, missing viewpoints, or reset states rather than hiding them in one value estimate.

Offline robot learning pipeline from logged data through support checks to same-panel evaluation Robot dataset states, actions, rewards Behavior support what was tried Pessimistic critic what is believable Policy what will be done Same-panel eval
Figure 25.5.B: The evaluation pipeline keeps offline metrics, held-out rollouts, failure labels, and same-artifact reporting separate so a single optimistic number cannot hide weak evidence.

Worked Numeric Trace

Code Fragment 1 for Evaluating offline policies rigorously compares candidate actions with dataset support and applies pessimism only after the support metric and robot action scale are explicit.

# Show why importance sampling can become unstable offline.
# The product of action-probability ratios can make one trajectory dominate.
import numpy as np

returns = np.array([1.0, 0.0, 1.0])
ratios = np.array([
    [1.1, 0.9, 1.0],
    [0.8, 1.2, 0.7],
    [2.5, 2.0, 1.8],
])
trajectory_weights = ratios.prod(axis=1)
estimate = np.mean(trajectory_weights * returns)
for idx, weight in enumerate(trajectory_weights):
    print(f"trajectory={idx} weight={weight:.2f} return={returns[idx]:.1f}")
print(f"ordinary_is_estimate={estimate:.2f}")
trajectory=0 weight=0.99 return=1.0
trajectory=1 weight=0.67 return=0.0
trajectory=2 weight=9.00 return=1.0
ordinary_is_estimate=3.33
Code Fragment 1: The importance-sampling example shows why logged-policy evaluation can be fragile. One high-ratio trajectory dominates the estimate, which is a warning sign for robot-policy claims.
Algorithm: Offline Policy Update With Support Guard
  1. Fit a behavior model or nearest-neighbor support estimator on logged state-action pairs.
  2. Train a critic on Bellman targets from the fixed dataset.
  3. For each candidate action, subtract a penalty when the action is unlikely under the dataset.
  4. Update the policy toward high pessimistic value, not raw critic value.
  5. Evaluate behavior cloning, offline RL, and any fine-tuned policy on one saved task panel.

Practical Recipe

  1. Start with behavior cloning and report it. If BC solves the task, offline RL must justify its extra complexity.
  2. Write the dataset manifest: robot body, sensors, action units, operator source, split rule, reset distribution, episode horizon, reward source, and license.
  3. Audit action support before training. Plot nearest-neighbor distances or behavior log probabilities for every proposed policy action.
  4. Train CQL, IQL, or behavior-regularized actor-critic only after the support audit exists.
  5. Report same-config evaluation: one task panel, one split, one seed policy, one artifact, and one failure taxonomy.
Library Shortcut

For Evaluating offline policies rigorously, use d3rlpy, robomimic, or LeRobot after the support audit is defined; the library may replace replay-buffer plumbing but must preserve dataset split, action scale, and evaluation artifact.

Practical Example

For Evaluating offline policies rigorously, a warehouse manipulation audit should align expert picks, recoveries, failures, behavior-cloning baseline, support distance, and offline-RL policy output in one table before reporting improvement.

When Behavior Cloning Wins

For Evaluating offline policies rigorously, compare behavior cloning and offline RL under the same split: BC is strongest with narrow expert demonstrations, while offline RL needs meaningful rewards, recoveries, and a visible support audit.

Research Frontier

For Evaluating offline policies rigorously, current robot-data work should be read through dataset quality, conservative objectives, diffusion or transformer policies, and offline-to-online safety gates.

Self Check

For Evaluating offline policies rigorously, trust requires naming the behavior policy, support estimator, pessimism mechanism, BC baseline, and exact evaluation artifact.

Key Takeaway

Evaluating offline policies rigorously is useful when it makes the perception-action loop more reliable, not when it merely adds a more impressive model name.

Exercise 25.5.1

Design a method-matched experiment for Evaluating offline policies rigorously. Specify the environment, observation schema, action interface, metric, and one perturbation that targets the section's core assumption.

What's Next

This section grounded evaluating offline policies rigorously in an explicit robot-data contract: observations, actions, demonstrations, evaluation splits, and failure labels. The next reading step is Chapter 26: Skills, Hierarchy, and Task Decomposition, where the same contract is carried into the next technique or chapter.

References & Further Reading
Foundational Papers

Kumar, A., Zhou, A., Tucker, G., and Levine, S. (2020). Conservative Q-Learning for Offline Reinforcement Learning. NeurIPS.

CQL addresses overestimation from distribution shift by learning conservative value estimates. It is essential for understanding why offline RL must avoid unsupported actions.

Paper

Kostrikov, I., Nair, A., and Levine, S. (2021). Offline Reinforcement Learning with Implicit Q-Learning.

IQL avoids direct evaluation of unseen actions and extracts policies through advantage-weighted behavioral cloning. It is a practical complement to CQL when teaching conservative improvement from static data.

Paper
Datasets and Benchmarks

D4RL: Datasets for Deep Data-Driven Reinforcement Learning.

D4RL popularized standardized offline RL datasets and benchmark tasks. Readers should use it as a cautionary baseline source, since robot deployment needs extra support checks beyond benchmark scores.

Dataset
Tools and Libraries

d3rlpy: Offline Deep Reinforcement Learning Library.

d3rlpy implements many offline RL algorithms behind a consistent Python API. It is useful for library-shortcut experiments after the reader understands support mismatch and conservative objectives.

Tool

robomimic Study: What Matters in Learning from Offline Human Demonstrations for Robot Manipulation.

The robomimic study compares offline learning algorithms across simulated and real manipulation tasks. It connects the chapter's offline RL theory to robot-specific data quality and evaluation concerns.

Paper