Importance Sampling & Doubly Robust Estimators
Per-decision, weighted and doubly robust estimators, and their bias–variance trade-offs.
The doubly robust estimator is importance sampling with a model subtracted and added back. How much variance does that remove, and how much could any unbiased estimator remove? This lesson computes the variance exactly and shows that with the true value function it meets a Cramér–Rao bound. It then follows the estimators that give up a little bias for a lot of variance (weighted doubly robust, MAGIC, SWITCH), one that fits its model to minimize variance (MRDR), fitted Q-evaluation's error bound, and the efficiency bound that Markov structure makes polynomial in the horizon.
What you’ll learn
- Derive the variance of the sequential doubly robust estimator, and identify which terms a better model removes and which remain for any unbiased estimator.
- Explain weighted doubly robust, MAGIC's blending of partial importance-sampling estimates, and the SWITCH and MRDR alternatives by their bias–variance logic.
- State fitted Q-evaluation's finite-sample error bound with its assumptions, and the minimax-optimal result for linear function classes.
- State the semiparametric efficiency bounds for history-based and Markov models, and explain why the Markov bound grows only polynomially with the horizon.
The variance of doubly robust, exactly
Take a finite horizon , a discount , time-dependent values and with , and a time-dependent model with . The doubly robust estimate from one trajectory is defined backward,
and unrolls to the formula of Off-Policy Evaluation. Two quantities govern its variance: the model error , and the one-step noise
the randomness of a single reward and transition, measured with the true values.
By induction from the end, , so given the action the estimate's mean is off by the weighted model error, and averaging over removes it:
Condition on , then on . The variance splits into the spread of the conditional mean over actions, the one-step noise, and the variance of the future estimate, the last two multiplied by :
Unroll, and add the randomness of the start state. With cumulative weights and :
With trajectories, divide by . Jiang and Li (2016, Thm. 1) give the same decomposition in recursive form. Read the two sums separately.
- The model-error sum is the only place appears. With (per-decision importance sampling) it is , typically large; with it vanishes. A better model removes exactly this.
- The one-step-noise sum does not involve the model at all: it is a single step's randomness, inflated by the squared cumulative weight.
Jiang and Li prove that, in tree-structured problems where the state is the entire history and rewards are deterministic given it, the one-step-noise sum plus is a Cramér–Rao lower bound for unbiased estimators (Off-Policy Monte Carlo & Importance Sampling). Doubly robust with the true attains it, so it is optimal among unbiased estimators there; what no unbiased estimator escapes is the factor , whose mean grows exponentially with .
One decision () with deterministic rewards. The behavior takes two actions with probability each, the target with probabilities 0.9 and 0.1, and the rewards are 1 and 0, so and inverse propensity scoring has variance 0.81 per sample. With the imperfect model , what is the doubly robust estimate's variance per sample?
Show the answer
0.04
. Action 1 is logged half the time with : the estimate is . Action 2, with : . Both average to 0.9, with variance , which is the model-error term for . The rewards are deterministic, so the perfect model would give variance 0.
Trading a little bias for a lot of variance
Weighted doubly robust. Thomas and Brunskill (2016) put self-normalized weights , with , inside the doubly robust sum:
At each step the weights sum to one, so the estimate stays within the range of its terms however extreme one trajectory's weight; the price is a bias that vanishes as grows, as for weighted importance sampling.
MAGIC. Thomas and Brunskill also blend. For the off-policy -step return uses the weighted doubly robust correction for the first steps and the model's values afterward, just as an -step return in TD learning switches from samples to estimates. is the pure model estimate and is WDR. MAGIC (model and guided importance sampling combining) returns a convex combination over a set of these, with weights minimizing an estimate of the mean squared error,
where is the sample covariance of the and estimates their biases from their distances to a bootstrap confidence interval around WDR. In their experiments MAGIC often had orders of magnitude lower mean squared error than earlier estimators.
SWITCH. For one decision, Wang, Agarwal and Dudík (2017) proved a minimax lower bound on the mean squared error when no consistent reward model is available, matched up to constants by IPS and doubly robust. When a model is available, even a biased one, that bound is pessimistic. SWITCH weights the logged reward when the action's ratio is at most a threshold , and uses the model for the actions whose ratio exceeds it:
with chosen from the data to minimize an estimated error bound. The large weights, the source of variance, are exactly where the model is trusted instead.
MRDR. The model that minimizes doubly robust's variance is not the one that best fits rewards. Since , model errors count in proportion to : errors at actions the target likes and the behavior rarely takes matter most. Farajtabar, Chow and Ghavamzadeh (2018) fit by minimizing a sample estimate of this variance instead of the squared error under the data, and prove the resulting estimators strongly consistent and asymptotically optimal.
Fitted Q-evaluation: an error bound
If the class is closed under the policy's backup, and only the statistical term () and the truncation term (exponentially small in ) remain. Otherwise the error grows linearly with how far one backup can leave the class, amplified by concentrability and by the effective horizon. That coefficient is an all-policy worst case, often infinite for narrow data, which makes the bound a statement about well-covered problems.
For linear function classes, Duan, Jia and Wang (2020) gave a sharper, instance-dependent analysis. FQE's error is governed by a chi-squared divergence between the target policy's distribution and the data's, restricted to the function class: for linear features it measures the mismatch only in the directions the features can see. A nearly matching minimax lower bound shows that no estimator does better in that setting. Compare the unrestricted that drives importance sampling's variance: the function class is what lets the direct method ignore mismatch it cannot detect, and also what biases it when the class is wrong.
Efficiency when the state is Markov
The Cramér–Rao bound for trees is exponential in the horizon because, when every history is a distinct state, nothing learned along one trajectory transfers to another. In an MDP, histories that reach the same state share their futures. Kallus and Uehara (2020) computed the semiparametric efficiency bound, the smallest asymptotic variance of any regular estimator, in both models, for an undiscounted problem with steps. Write for the cumulative ratio (the above) and
for the marginal ratio of the two policies' state–action distributions at step .
Both bounds have the shape of doubly robust's variance with the true . The Markov bound replaces the cumulative weight by the marginal ratio , which need not grow with at all, so no estimator built from products of action ratios can attain it. Kallus and Uehara's double reinforcement learning (DRL) estimator does. It is doubly robust with estimated marginal ratios and action values , each fitted on folds of the data other than the one it is applied to (cross-fitting):
with and . It attains the Markov bound when the product of the two nuisances' errors shrinks faster than , for example when both converge at rate , and it remains consistent if either one is. Estimating the marginal ratios is the subject of Breaking the Curse of Horizon.
Key takeaways
- per trajectory. A better model removes only the first sum; the rest is a Cramér–Rao bound for history-based problems, attained by DR with .
- Weighted DR normalizes the weights; MAGIC blends partial importance-sampling estimates with the model by estimated MSE; SWITCH trusts the model where weights are large; MRDR fits the model to minimize DR's variance, which weights errors by .
- FQE's error is at most plus a term that vanishes with the number of iterations; for linear classes, a chi-squared divergence restricted to the features governs a minimax-optimal error.
- In an MDP the efficiency bound weights each step's noise by the squared marginal ratio instead of the cumulative product of action ratios, so it is polynomial in the horizon; cross-fitted doubly robust estimation with marginal ratios attains it.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
In the variance of the doubly robust estimator, which term can a better model reduce?
- The one-step-noise sum
- The model-error sum
- The start-state term
- All three
Show the answer
B. The model-error sum
Only the model-error sum contains , and it vanishes when . The other two terms are, in tree-structured problems, the Cramér–Rao bound for every unbiased estimator.
MRDR fits its model to minimize the variance of doubly robust instead of the squared error of the reward model on the data. Why do the two objectives differ?
- Doubly robust's variance weights model errors by squared importance ratios, so errors at actions the target likes and the behavior rarely takes count most
- Because doubly robust is biased, so its variance and its error differ
- Because squared error ignores the reward noise
- They do not differ; MRDR is a renaming
Show the answer
A. Doubly robust's variance weights model errors by squared importance ratios, so errors at actions the target likes and the behavior rarely takes count most
. A regression under the data distribution weights errors by how often takes each action; the variance weights them by under , which is .
SWITCH uses the model's prediction for actions whose ratio exceeds a threshold . What are its limits as and ?
- gives the direct method; gives inverse propensity scoring
- Both limits give doubly robust
- gives inverse propensity scoring; gives the direct method
- Neither limit is defined
Show the answer
C. gives inverse propensity scoring; gives the direct method
With an infinite threshold every logged reward is importance-weighted (IPS). With a threshold of zero, every action with positive target probability has ratio above it, so only the model's predictions remain (the direct method). The data-driven sits in between.
Why can the Markov efficiency bound of Kallus and Uehara grow only polynomially with the horizon, while the history-based bound can grow exponentially?
- Because Markov problems have fewer states
- Because the Markov bound assumes deterministic rewards
- Because the Markov bound holds only for discounted problems
- Because it weights each step's noise by the squared marginal ratio of state–action distributions, which need not grow with , instead of the squared product of action ratios
Show the answer
D. Because it weights each step's noise by the squared marginal ratio of state–action distributions, which need not grow with , instead of the squared product of action ratios
Histories that reach the same state share their futures, so what matters is how much more often visits at step , not the probability of the whole action sequence. With bounded marginal ratios and rewards the bound is .
Further reading
- N. Jiang & L. Li, "Doubly robust off-policy value evaluation for reinforcement learning," Proceedings of the 33rd International Conference on Machine Learning (ICML), 652–661 (2016).
- P. S. Thomas & E. Brunskill, "Data-efficient off-policy policy evaluation for reinforcement learning," Proceedings of the 33rd International Conference on Machine Learning (ICML), 2139–2148 (2016).
- M. Farajtabar, Y. Chow & M. Ghavamzadeh, "More robust doubly robust off-policy evaluation," Proceedings of the 35th International Conference on Machine Learning (ICML) (2018).
- H. M. Le, C. Voloshin & Y. Yue, "Batch policy learning under constraints," Proceedings of the 36th International Conference on Machine Learning (ICML) (2019).
- N. Kallus & M. Uehara, "Double reinforcement learning for efficient off-policy evaluation in Markov decision processes," Journal of Machine Learning Research 21(167), 1–63 (2020).