Off-Policy Evaluation

Off-policy evaluation (OPE) estimates the value of a target policy using data collected by a different behavior policy , without deploying . It is essential wherever running the new policy live is costly or risky: recommenders, healthcare, ads, autonomous systems, and any offline RL pipeline that must decide whether a learned policy is safe to ship.

The Problem

We want the expected return of the target policy,

but every logged trajectory was generated by . The data distribution is therefore wrong for the quantity we care about, and correcting for that mismatch is the whole task.

Importance Sampling

Inverse propensity scoring reweights logged rewards by how much more likely the target policy was to take the observed actions. For a single decision with logged reward , action , and context :

This is unbiased when has support everywhere does and the logged propensities are known. Its weakness is variance: when the two policies disagree, weights blow up. Weighted (self-normalized) IPS divides by the sum of weights, trading a little bias for much lower variance. In the sequential case, per-decision importance sampling multiplies the per-step ratios along the trajectory, and variance compounds with horizon.

Direct Method

The direct method fits a model of outcomes, such as a reward model or a fitted-Q evaluation (FQE) of the value function, then evaluates the target policy against the model:

It has low variance but is biased whenever the model is wrong, especially for actions the target policy favors but the data rarely contains.

Doubly Robust Estimation

The doubly robust estimator combines the two, using the model as a baseline and importance sampling to correct its residual:

It is unbiased if either the propensities or the outcome model is correct, and it typically has lower variance than plain IPS because the model absorbs most of the signal and importance weights only correct the residual.

Estimator Trade-offs

flowchart TD
  Logged[Logged data from the behavior policy] --> IPS[Importance sampling: reweight rewards by the policy ratio]
  Logged --> Direct[Direct method: fit an outcome or value model]
  IPS --> DR[Doubly robust: model baseline plus reweighted residual]
  Direct --> DR
  IPS --> Value[Estimated value of the target policy]
  Direct --> Value
  DR --> Value
EstimatorBiasVarianceKey requirement
IPSunbiased (with full support)highknown behavior propensities
Weighted IPSslightly biasedlowerknown propensities
Direct methodbiased if model wronglowaccurate outcome/value model
Doubly robustunbiased if model or propensity rightmediumone of the two components correct

Worked IPS Calculation

Suppose a logged action had behavior probability , target probability , and reward . Its importance weight is , so this sample contributes to the IPS average. An action the target policy avoids ( small) is down-weighted toward zero.

Caveats

OPE fails silently when the behavior policy is deterministic or unknown (no valid propensities), when support is missing (the target does things never logged), and when effective sample size collapses because a few trajectories carry almost all the weight. Report effective sample size and confidence intervals, and prefer staged online tests for final validation.

Connections

References