Variance-Optimal Counterfactual Policy Design for Sample-Efficient Online A/B Testing

Shashank Gupta, Subhadeep Maji

TL;DR

This paper introduces a method to jointly optimize both how data is collected (the logging policy) and how it is analyzed (the estimator) in online A/B tests for recommendation and ranking systems. By focusing traffic on actions where policies disagree and reward uncertainty is high, the authors achieve the same statistical precision as standard A/B tests with roughly 50% less traffic.

What Problem Does This Paper Address?

Standard online A/B testing is the gold standard for evaluating new policies (like a new recommendation algorithm), but it is often incredibly inefficient. When a new "treatment" policy is very similar to the existing "production" policy, they will often recommend the same items. In a traditional A/B test, showing these identical items adds noise to the data without providing any information about which policy is actually better.

This leads to high-variance estimates, requiring massive amounts of user traffic and long durations to detect small but meaningful improvements. While existing techniques like CUPED reduce variance by adjusting the estimator after data is collected, they don't change how the data is collected. Recent "overlap-aware" designs optimize the overall traffic split between policies but cannot independently choose how often to sample specific actions in a given context.

Methods

The authors propose a joint design of an action-level logging policy and a control-variate estimator based on pairwise off-policy evaluation ($\Delta$-IPS).

  1. Closed-Form Optimal Logger: The core theoretical contribution is a closed-form solution for the variance-optimal logging policy. For any fixed control variate, the optimal probability of sampling an action is proportional to the product of:
  2. The absolute difference between the two policies' probabilities for that action ($|d(x,a)|$).
  3. The square root of the residual reward uncertainty ($\sqrt{s_m(x,a)}$) after applying the control variate.
  4. Joint Optimization: Instead of fitting a reward model to minimize prediction error (the standard approach), they fit it to directly minimize the variance of the treatment effect estimator.
  5. Two Design Variants:
    • Scalar Joint: Uses a single constant baseline correction across all contexts and actions.
  6. Model-based CV (Model-CV): Uses an action-wise logistic regression model as a control variate, allowing the correction to vary based on the user context and the specific action.
  7. Safety Backoff: To ensure robustness against model misspecification, they mix the learned optimal logger with 5% uniform exploration.

Datasets

The authors evaluate their approach using a synthetic contextual-bandit environment. This allowed them to precisely calibrate the ground-truth Average Treatment Effect (ATE) and measure metrics that are impossible to calculate with real-world logged data alone (like MSE against the true effect).

  • Contexts: 25-dimensional Gaussian vectors.
  • Actions: Varied between $K=25, 50, \text{ and } 75$.
  • Rewards: Bernoulli (binary) rewards with means dependent on both context and action.
  • Data Splits: Historical logs of 10k or 30k interactions were used to design the test, which was then evaluated on fresh batches of up to 10k interactions.

Key Insights and Ideas

  • Disagreement is Informative: The most efficient way to compare two policies is to ignore the actions they agree on and focus entirely on the actions where they suggest different things.
  • Variance-Optimal Fitting: A "good" reward model for prediction isn't necessarily the best for variance reduction. By fitting the model to minimize estimator variance, the optimization naturally prioritizes getting the rewards right for the most "informative" actions.
  • Action-Level Control: Moving from a global traffic split (e.g., "50% treatment, 50% control") to action-level probabilities allows the system to "surgicaly" sample the most useful data points for the estimator.

Key Results

The proposed designs consistently outperformed standard A/B testing and existing overlap-aware baselines across all evaluated settings.

  • Sample Efficiency: The Model-CV design reached the same Mean Squared Error (MSE) as balanced A/B testing using only 39% to 51% of the evaluation traffic.
  • Statistical Power: With 10,000 observations, Model-CV increased the statistical power of balanced A/B testing by a factor of 1.5 to 2.1.
  • Decision Reliability: Model-CV reduced the "wrong-sign" selection rate (the probability of accidentally deploying the worse policy) by 42% to 63% compared to balanced A/B testing.
Figure 1: MSE of the ATE estimate versus the evaluation sample size 𝑛eval (logarithmic vertical axis; lower is better). Columns correspond to 𝐾= 25, 50, and 75 actions, and rows to historical logs of 𝑛hist = 10,000 (top) and 30,000 (bottom) interactions. Every point averages 500 independent replications with context dimension 𝐷= 25.
Figure 1 shows that the Model-CV (light blue) and Scalar Joint (red) consistently maintain lower MSE than all baselines as sample size increases.
Figure 2: Empirical power of the two-sided test at the 5% level (higher is better); the dotted line marks the 5% level. The panels are arranged as in Figure 1, and every point is the rejection frequency across 500 independent replications.
Figure 2 demonstrates the significant boost in statistical power, particularly at larger evaluation sample sizes.

Limitations and Future Work

  • Static Design: The current approach fits the design on historical logs and freezes it. An adaptive version that updates the logging policy online as new data arrives could potentially be even more efficient.
  • Single-Item Focus: The theory is derived for selecting a single action. Extending this to ranked lists (where an "action" is an entire ordered set of items) would require accounting for complex interactions between items in the reward model.
  • User Consistency: The paper does not explicitly address "user-level" randomization, which is common in industry to ensure a consistent experience for individual users over time.

Summary based on "Variance-Optimal Counterfactual Policy Design for Sample-Efficient Online A/B Testing" by Shashank Gupta and Subhadeep Maji.

Summary updated

BibTeX
@misc{gupta2026variance,
  author = {Shashank Gupta and Subhadeep Maji},
  title = {{Variance-Optimal Counterfactual Policy Design for Sample-Efficient Online A/B Testing}},
  year = {2026},
  eprint = {2611.24757},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.24757},
}

Loading related content...

Figure