Anytime-valid off-policy inference for contextual bandits
Ian Waudby-Smith, Lili Wu, Aaditya Ramdas, Nikos Karampatziakis, Paul Mineiro
TL;DR
This work tackles off-policy evaluation in contextual bandits under adaptive, sequential data collection by developing anytime-valid confidence sequences (CSs) that require only nonparametric assumptions and accommodate unpredictable logging policies. It introduces doubly robust pseudo-outcomes to tighten CSs for fixed policy values, derives closed-form and fixed-time CIs, and extends to time-varying policy values with both empirical Bernstein and iterated-logarithm CSs. The paper also constructs time-uniform, quantile-uniform bands for the off-policy CDF and connects the OPE framework to causal inference in adaptive experiments, including sequential testing with anytime p-values. Collectively, these results enable robust, stop-time-valid, nonparametric inference for policy evaluation and distributional properties in dynamically evolving contextual-bandit settings, with extensions to FDR control and privacy-preserving OPE. The techniques rely on martingale-based constructions that remain valid without knowledge of the maximal importance weight and adapt to empirical variance, making them practical for real-time decision making and gated deployment scenarios.
Abstract
Contextual bandit algorithms are ubiquitous tools for active sequential experimentation in healthcare and the tech industry. They involve online learning algorithms that adaptively learn policies over time to map observed contexts $X_t$ to actions $A_t$ in an attempt to maximize stochastic rewards $R_t$. This adaptivity raises interesting but hard statistical inference questions, especially counterfactual ones: for example, it is often of interest to estimate the properties of a hypothetical policy that is different from the logging policy that was used to collect the data -- a problem known as ``off-policy evaluation'' (OPE). Using modern martingale techniques, we present a comprehensive framework for OPE inference that relax unnecessary conditions made in some past works, significantly improving on them both theoretically and empirically. Importantly, our methods can be employed while the original experiment is still running (that is, not necessarily post-hoc), when the logging policy may be itself changing (due to learning), and even if the context distributions are a highly dependent time-series (such as if they are drifting over time). More concretely, we derive confidence sequences for various functionals of interest in OPE. These include doubly robust ones for time-varying off-policy mean reward values, but also confidence bands for the entire cumulative distribution function of the off-policy reward distribution. All of our methods (a) are valid at arbitrary stopping times (b) only make nonparametric assumptions, (c) do not require importance weights to be uniformly bounded and if they are, we do not need to know these bounds, and (d) adapt to the empirical variance of our estimators. In summary, our methods enable anytime-valid off-policy inference using adaptively collected contextual bandit data.
