1 Introduction
Many modern data sets consist of data that is gathered adaptively: the choice of whether to collect more data points of a given type depends on the data already collected. For example, it is common in industry to conduct “A/B” tests to make decisions about many things, including ad targeting, user interface design, and algorithmic modifications, and this A/B testing is often conducted using “bandit learning algorithms” Bubeck et al. (2012), which adaptively select treatments to show to users in an effort to find the best treatment as quickly as possible. Similarly, sequential clinical trials may halt or reallocate certain treatment groups due to preliminary results, and empirical scientists may initially try and test multiple hypotheses and multiple treatments, but then decide to gather more data in support of certain hypotheses and not others, based on the results of preliminary statistical tests.
Unfortunately, as demonstrated by Nie et al. (2017), the data that results from adaptive data gathering procedures will often exhibit substantial bias. As a result, subsequent analyses that are conducted on the data gathered by adaptive procedures will be prone to error, unless the bias is explicitly taken into account. This can be difficult. Nie et al. (2017)
give a selective inference approach: in simple stochastic bandit settings, if the data was gathered by a specific stochastic algorithm that they design, they give an MCMC based procedure to perform maximum likelihood estimation to recover debiased estimates of the underlying distribution means. In this paper, we give a related, but orthogonal approach whose simplicity allows for a substantial generalization beyond the simple stochastic bandits setting. We show that in very general settings, if the data is gathered by a differentially private procedure, then we can place strong bounds on the bias of the data gathered, without needing any additional debiasing procedure. Via elementary techniques, this connection implies the existence of simple stochastic bandit algorithms with nearly optimal worstcase regret bounds, with very strong bias guarantees. The connection also allows us to derive algorithms for linear contextual bandits with nearly optimal regret guarantees, and strong bias guarantees. Since our connection to differential privacy only requires that the
rewards and not the contexts be kept private, we are able to obtain improved accuracy compared to past approaches to private contextual bandit problems. By leveraging existing connections between differential privacy and adaptive data analysis Dwork et al. (2015c); Bassily et al. (2016); Rogers et al. (2016), we can extend the generality of our approach to bound not just bias, but to correct for effects of adaptivity on arbitrary statistics of the gathered data. For example, we can obtain valid value corrections for hypothesis tests (like tests) run on the adaptively collected data. Since the data being gathered will generally be useful for some as yet unspecified scientific analysis, rather than just for the narrow problem of mean estimation, our technique allows for substantially broader possibilities compared to past approaches. Experiments explore the bias incurred by conventional bandit algorithms, confirm the reduction in bias obtained by leveraging privacy, and show why correction for adaptivity is crucial to performing valid posthoc hypothesis tests. In particular we show that for the fundamental primitive of conducting tests for regression coefficients, naively conducting tests on adaptively gathered data leads to incorrect inference.1.1 Our Results
This paper has four main contributions:

Using elementary techniques, we provide explicit bounds on the bias of empirical arm means maintained by bandit algorithms in the simple stochastic setting that make their selection decisions as a differentially private function of their observations. Together with existing differentially private algorithms for stochastic bandit problems, this yields an algorithm that obtains an essentially optimal worstcase regret bound, and guarantees minimal bias (on the order of ) for the empirical mean maintained for every arm.

We then extend our results to the linear contextual bandit problem. We show that algorithms that make their decisions in a way that is differentially private in the observed reward of each arm (but which need not be differentially private in the context) have bounded bias (as measured by the difference between the predicted reward of each arm at each time step, compared to its true reward). We also derive a differentially private algorithm for the contextual bandit problem, and prove new bounds for it. Together with our bound on bias, this algorithm also obtains strong sublinear regret bounds, while having robust guarantees on bias.

We then make a general observation, relating adaptive data gathering to an adaptive analysis of a fixed dataset (in which the choice of which query to pose to the dataset is adaptive). This lets us apply the large existing literature connecting differential privacy to adaptive data analysis Dwork et al. (2015a, c); Bassily et al. (2016). In particular, it lets us apply the maxinformation bounds of Dwork et al. (2015b); Rogers et al. (2016) to our adaptive data gathering setting. This allows us to give much more general guarantees about the data collected by differentially private collection procedures, that extend well beyond bias. For example, it lets us correct the values for arbitrary hypothesis tests run on the gathered data.

Finally, we run a set of experiments that measure the bias incurred by the standard UCB algorithm in the stochastic bandit setting, contrast it with the low bias obtained by a private UCB algorithm, and show that there are settings of the privacy parameter that simultaneously can make bias statistically insignificant, while having competitive empirical regret with the nonprivate UCB algorithm. We also demonstrate in the linear contextual bandit setting how failing to correct for adaptivity can lead to false discovery when applying tests for nonzero regression coefficients on an adaptively gathered dataset.
1.2 Related Work
This paper bridges two recent lines of work. Our starting point is two recent papers: Villar et al. (2015) empirically demonstrate in the context of clinical trials that a variety of simple stochastic bandit algorithms produce biased sample mean estimates (Similar results have been empirically observed in the context of contextual bandits Dimakopoulou et al. (2017)). Nie et al. (2017)
prove that simple stochastic bandit algorithms that exhibit two natural properties (satisfied by most commonly used algorithms, including UCB and Thompson Sampling) result in empirical means that exhibit negative bias. They then propose a heuristic algorithm which computes a maximum likelihood estimator for the sample means from the empirical means gathered by a modified UCB algorithm which adds Gumbel noise to the decision statistics.
Deshpande et al. (2017)propose a debiasing procedure for ordinary leastsquares estimates computed from adaptively gathered data that trades off bias for variance, and prove a central limit theorem for their method. In contrast, the methods we propose in this paper are quite different. Rather than giving an expost debiasing procedure, we show that if the data were gathered in a differentially private manner, no debiasing is necessary. The strength of our method is both in its simplicity and generality: rather than proving theorems specific to particular estimators, we give methods to correct the
values for arbitrary hypothesis tests that might be run on the adaptively gathered data.The second line of work is the recent literature on adaptive data analysis Dwork et al. (2015c, b); Hardt and Ullman (2014); Steinke and Ullman (2015); Russo and Zou (2016); Wang et al. (2016); Bassily et al. (2016); Hardt and Blum (2015); Cummings et al. (2016); Feldman and Steinke (2017a, b) which draws a connection between differential privacy Dwork et al. (2006) and generalization guarantees for adaptively chosen statistics. The adaptivity in this setting is dual to the setting we study in the present paper: In the adaptive data analysis literature, the dataset itself is fixed, and the goal is to find techniques that can mitigate bias due to the adaptive selection of analyses. In contrast, here, we study a setting in which the data gathering procedure is itself adaptive, and can lead to bias even for a fixed set of statistics of interest. However, we show that adaptive data gathering can be recast as an adaptive data analysis procedure, and so the results from the adaptive data analysis literature can be ported over.
2 Preliminaries
2.1 Simple Stochastic Bandit Problems
In a simple stochastic bandit problem, there are unknown distributions over the unit interval [0,1], each with (unknown) mean . Over a series of rounds , an algorithm chooses an arm , and observes a reward . Given a sequence of choices , the pseudoregret of an algorithm is defined to be:
We say that regret is bounded if we can put a bound on the quantity in the worst case over the choice of distributions
, and with high probability or in expectation over the randomness of the algorithm and of the reward sampling.
As an algorithm interacts with a bandit problem, it generates a history , which records the sequence of actions taken and rewards observed thus far: . We denote the space of histories of length by .
The definition of an algorithm induces a sequence of (possibly randomized) selection functions , which map histories onto decisions of which arm to pull at each round.
2.2 Contextual Bandit Problems
In the contextual bandit problem, decisions are endowed with observable features. Our algorithmic results in this paper focus on the linear contextual bandit problem, but our general connection between adaptive data gathering and differential privacy extends beyond the linear case. For simplicity of exposition, we specialize to the linear case here.
There are arms , each of which is associated with an unknown
dimensional linear function represented by a vector of coefficients
with . In rounds , the algorithm is presented with a context for each arm with , which may be selected by an adaptive adversary as a function of the past history of play. We write to denote the set of all contexts present at round . As a function of these contexts, the algorithm then selects an arm , and observes a reward . The rewards satisfy and are bounded to lie in . Regret is now measured with respect to the optimal policy. Given a sequence of contexts , a set of linear functions , and a set of choices , the pseudoregret of an algorithm is defined to be:We say that regret is bounded if we can put a bound on the quantity in the worst case over the choice of linear functions and contexts , and with high probability or in expectation over the randomness of the algorithm and of the rewards.
In the contextual setting, histories incorporate observed context information as well: .
Again, the definition of an algorithm induces a sequence of (possibly randomized) selection functions , which now maps both a history and a set of contexts at round to a choice of arm at round .
2.3 Data Gathering in the Query Model
Above we’ve characterized a bandit algorithm as gathering data adaptively using a sequence of selection functions , which map the observed history to the index of the next arm pulled. In this model only after the arm is chosen is a reward drawn from the appropriate distribution. Then the history is updated, and the process repeats.
In this section, we observe that whether the reward is drawn after the arm is “pulled,” or in advance, is a distinction without a difference. We cast this same interaction into the setting where an analyst asks an adaptively chosen sequence of queries to a fixed dataset, representing the arm rewards. The process of running a bandit algorithm up to time can be formalized as the adaptive selection of queries against a single database of size  fixed in advance. The formalization consists of two steps:

By the principle of deferred randomness, we view any simple stochastic bandit algorithm as operating in a setting in which i.i.d. samples from (vectors of length representing the rewards for each of arms on each time step ) are drawn before the interaction begins. This is the Interact algorithm below.
In the contextual setting, the contexts are also available, and the draws are not drawn from identical distributions. Instead, the draw is from , where each distribution is determined by the context .

The choice of arm pulled at time by the bandit algorithm can be viewed as the answer to an adaptively selected query against this fixed dataset. This is the InteractQuery algorithm below.
Adaptive data analysis is formalized as an interaction in which a data analyst performs computations on a dataset , observes the results, and then may choose the identity of the next computation to run as a function of previously computed results Dwork et al. (2015c, a). A sequence of recent results shows that if the queries are differentially private in the dataset , then they will not in general overfit , in the sense that the distribution over results induced by computing will be “similar” to the distribution over results induced if were run on a new dataset, freshly sampled from the same underlying distribution Dwork et al. (2015c, a); Bassily et al. (2016); Dwork et al. (2015b); Rogers et al. (2016). We will be more precise about what these results say in Section 5.
Recall that histories record the choices of the algorithm, in addition to its observations. It will be helpful to introduce notation that separates out the choices of the algorithm from its observations. In the simple stochastic setting and the contextual setting, given a history , an action history denotes the portion of the history recording the actions of the algorithm.
In the simple stochastic setting, a bandit tableau is a matrix . Each row of is a vector of real numbers, intuitively representing the rewards that would be available to a bandit algorithm at round for each of the arms. In the contextual setting, a bandit tableau is represented by a pair of matrices: and . Intuitively, represents the contexts presented to a bandit algorithm at each round: each row corresponds to a set of contexts, one for each arm. again represents the rewards that would be available to the bandit algorithm at round for each of the arms.
We write to denote a bandit tableau when the setting has not been specified: implicitly, in the simple stochastic case, , and in the contextual case, .
Given a bandit tableau and a bandit algorithm , we have the following interaction:
We denote the subset of the reward tableau corresponding to rewards that would have been revealed to a bandit algorithm given action history , by . Concretely if then . Given a selection function and an action history , define the query as .
We now define Algorithms Bandit and InteractQuery. Bandit is a standard contextual bandit algorithm defined by selection functions , and InteractQuery is the Interact routine that draws the rewards in advance, and at time selects action as the result of query
. With the above definitions in hand, it is straightforward to show that the two Algorithms are equivalent, in that they induce the same joint distribution on their outputs. In both algorithms for convenience we assume we are in the linear contextual setting, and we write
to denote the i.i.d. error distributions of the rewards, conditional on the contexts.Claim 1.
Let be the joint distribution induced by Algorithm Bandit on at time , and let be the joint distribution induced by Algorithm InteractQuery on . Then .
The upshot of this equivalence is that we can import existing results that hold in the setting in which the dataset is fixed, and queries are adaptively chosen. There are a large collection of results of this form that apply when the queries are differentially private Dwork et al. (2015c); Bassily et al. (2016); Rogers et al. (2016) which apply directly to our setting. In the next section we formally define differential privacy in the simple stochastic and contextual bandit setting, and leave the description of the more general transfer theorems to Section 5.
2.4 Differential Privacy
We will be interested in algorithms that are differentially private. In the simple stochastic bandit setting, we will require differential privacy with respect to the rewards. In the contextual bandit setting, we will also require differential privacy with respect to the rewards, but not necessarily with respect to the contexts.
We now define the neighboring relation we need to define bandit differential privacy:
Definition 1.
In the simple stochastic setting, two bandit tableau’s are reward neighbors if they differ in at most a single row: i.e. if there exists an index such that for all , .
In the contextual setting, two bandit tableau’s are reward neighbors if and and differ in at most a single row: i.e. if there exists an index such that for all , .
Note that changing a context does not result in a neighboring tableau: this neighboring relation will correspond to privacy for the rewards, but not for the contexts.
Remark 1.
Note that we could have equivalently defined reward neighbors to be tableaus that differ in only a single entry, rather than in an entire row. The distinction is unimportant in a bandit setting, because a bandit algorithm will be able to observe only a single entry in any particular row.
Definition 2.
A bandit algorithm is reward differentially private if for every time horizon and every pair of bandit tableau that are reward neighbors, and every subset :
If , we say that is differentially private.
2.5 The Binary Mechanism
For many interesting stochastic bandit algorithms (UCB, Thompsonsampling, greedy) the selection functions are randomized functions of the history of sample means at each time step for each arm. It will therefore be useful to have notation to refer to these means. We write to represent the number of times arm is pulled through round :
. Note that before the history has been fixed, this is a random variable. In the simple stochastic setting, We write
to denote the sample mean at arm at time , where is the time that arm is pulled for the time. Then we can write the current set of sample means sequences for all arms at time as . Since differential privacy is preserved under postprocessing and composition, we observe that to obtain a private version of any of these standard algorithms, an obvious method would be to estimate privately at each round, and then to plug these private estimates into the selection functions .The Binary mechanism Chan et al. (2011); Dwork et al. (2010) is an online algorithm that continually releases an estimate of a running sum as each arrives one at a time, while preserving differential privacy of the entire sequence , and guaranteeing worst case error that scales only with . It does this by using a treebased aggregation scheme that computes partial sums online using the Laplace mechanism, which are then combined to produce estimates for each sample mean . Since the scheme operates via the Laplace mechanism, it extends immediately to the setting when each is a vector with bounded norm. In our private algorithms we actually use a modified version of the binary mechanism due to Chan et al. (2011) called the hybrid mechanism, which operates without a fixed time horizon . For the rest of the paper we denote the noise added to the partial sum by the hybrid mechanism, either in vector or scalar form, as .
Theorem 1 (Corollary 4.5 in Chan et al. (2011)).
Let . The hybrid mechanism produces sample means where , such that the following hold:

The sequence is differentially private in .

With probability :
(1) where denotes the binary iterated logarithm, and Ln is the function defined as in Chan et al. (2011).
For the rest of the paper, we denote the RHS of (1) as , hiding the messier sublogarithmic terms.
3 Privacy Reduces Bias in Stochastic Bandit Problems
We begin by showing that differentially private algorithms that operate in the stochastic bandit setting compute empirical means for their arms that are nearly unbiased. Together with known differentially private algorithms for stochastic bandit problems, the result is an algorithm that obtains a nearly optimal (worstcase) regret guarantee while also guaranteeing that the collected data is nearly unbiased. We could (and do) obtain these results by combining the reduction to answering adaptively selected queries given by Theorem 1 with the standard generalization theorems in adaptive data analysis (e.g. Corollary 3 in its most general form), but we first prove these debiasing results from first principles to build intuition.
Theorem 2.
Let be an differentially private algorithm in the stochastic bandit setting. Then, for all , and all , we have:
Remark 2.
Note that since , and for , , this theorem bounds the bias by roughly . Often, we will have and so the bias will be bounded by roughly .
Proof.
First we fix some notation. Fix any time horizon , and let be the sequence of selection functions induced by algorithm . Let be the indicator for the event that arm is pulled at time . We can write the random variable representing the sample mean of arm at time as
where we recall that is the random variable representing the reward for arm at time . Note that the numerator () is by definition independent of , but the denominator () is not, because for depends on . It is this dependence that leads to bias in adaptive data gathering procedures, and that we must argue is mitigated by differential privacy.
We recall that the random variable represents the number of times arm is pulled through round : . Using this notation, we write the sample mean of arm at time , as:
We can then calculate:
where the first equality follows by the linearity of expectation, and the second follows by the law of iterated expectation.
Our goal is to show that the conditioning in the inner expectation does not substantially change the value of the expectation. Specifically, we want to show that all , and any value , we have
If we can show this, then we will have
which is what we want (The reverse inequality is symmetric).
This is what we now show to complete the proof. Observe that for all , the quantity can be derived as a postprocessing of the sequence of choices , and is therefore differentially private in the observed reward sequence. Observe also that the quantity is bounded in . Hence by Lemma 2 for any pair of values , we have All that remains is to observe that there must exist some value such that . (Otherwise, this would contradict ). Fixing any such implies that for all
as desired. The upper bound on the bias follows symmetrically from Lemma 2. ∎
3.1 A Private UCB Algorithm
There are existing differentially private variants of the classic UCB algorithm (Auer et al. (2002); Agrawal (1995); Lai and Robbins (1985)), which give a nearly optimal tradeoff between privacy and regret Mishra and Thakurta (2014); Tossou and Dimitrakakis (2017, 2016). For completeness, we give a simple version of a private UCB algorithm in the Appendix which we use in our experiments. Here, we simply quote the relevant theorem, which is a consequence of a theorem in Tossou and Dimitrakakis (2016):
Theorem 3.
Tossou and Dimitrakakis (2016) Let be the means of the arms. Let , and for each arm let . Then there is an differentially private algorithm that obtains expected regret bounded by:
(2) 
where . Taking the worst case over instances (values ) and recalling that , this implies expected regret bounded by:
Thus, we can take to be as small as while still having a regret bound of , which is nearly optimal in the worst case (over instances) Audibert and Bubeck (2009).
Combining the above bound with Theorem 2, and letting , we have:
Corollary 1.
There exists a simple stochastic bandit algorithm that simultaneously guarantees that the bias of the empirical average for each arm is bounded by and guarantees expected regret bounded by .
Of course, other tradeoffs are possible using different values of . For example, the algorithm of Tossou and Dimitrakakis (2016) obtains sublinear regret so long as . Thus, it is possible to obtain nontrivial regret while guaranteeing that the bias of the empirical means remains as low as .
4 Privacy Reduces Bias in Linear Contextual Bandit Problems
In this section, we extend Theorem 2 to directly show that differential privacy controls a natural measure of “bias” in linear contextual bandit problems as well. We then design and analyze a new differentially private algorithm for the linear contextual bandit problem, based on the LinUCB algorithm Li et al. (2010). This will allow us to give an algorithm which simultaneously offers bias and regret bounds.
In the linear contextual bandit setting, we first need to define what we mean by bias. Recall that rather than simply maintaining an empirical mean for each arm, in the linear contextual bandit case, the algorithm is maintaining an estimate a linear parameter vector for each arm. One tempting measure of bias in this case is: , but even in the nonadaptive setting if the design matrix at arm is not of full rank, the OLS estimator will not be unique. In this case, the attempted measure of bias is not even well defined. Instead, we note that even when the design matrix is not of full rank, the predicted values on the training set are unique. As a result we define bias in the linear contextual bandit setting to be the bias of the predictions that the least squares estimator, trained on the gathered data, makes on the gathered data. We note that if the data were not gathered adaptively, then this quantity would be 0. We choose this one for illustration; other natural measures of bias can be defined, and they can be bounded using the tools in section 5.
We write to denote the sequence of context/reward pairs for arm that a contextual bandit algorithm has observed through time step . Note that . It will sometimes be convenient to separate out contexts and rewards: we will write to refer to just the sequence of contexts observed through time , and to refer to just the corresponding sequence of rewards observed through time . Note that once we fix , and are determined, but fixing leaves a random variable. The randomness in is over which contexts from arm has selected by round , not over the actual contexts  these are fixed. Thus the following results will hold over a worstcase set of contexts, including when the contexts are drawn from an arbitrary distribution. We will denote the sequence of arms pulled by up to time by . We note that fixes independently of the observed rewards , and so if is differentially private in the observed rewards, the postprocessing is as well. First, we define the least squares estimator:
Definition 3.
Given a sequence of observations , a least squares estimator is any vector that satisfies:
Definition 4 (Bias).
Fix a time horizon , a tableau of contexts, an arm , and a contextual bandit algorithm . Let be the least squares estimator trained on the set of observations . Then the bias of arm is defined to be the maximum bias of the predictions made by on the contexts in , over any worst case realization of . The inner expectation is over since depends on the rewards at arm .
It then follows from an elementary application of differential privacy similar to that in the proof of Theorem 2, that if the algorithm makes its arm selection decisions in a way that is differentially private in the observed sequences of rewards, the least squares estimators computed based on the observations of have bounded bias as defined above. The proof is deferred to the Appendix.
Theorem 4.
Let be any linear contextual bandit algorithm whose selections are differentially private in the rewards. Fix a time horizon , and let be a least squares estimator computed on the set of observations . Then for every arm and any round :
Below we outline a rewardprivate variant of the LinUCB algorithm Chu et al. (2011), and state a corresponding regret bound. In combination with Theorem 4 this will give an algorithm that yields a smooth tradeoff between regret and bias. This algorithm is similar to the private linear UCB algorithm presented in Mishra and Thakurta (2014). The main difference compared to the algorithm in Mishra and Thakurta (2014) is that Theorem 4 requires only reward privacy, whereas the algorithm from Mishra and Thakurta (2014) is designed to guarantee privacy of the contexts as well. The result is that we can add less noise, which also makes the regret analysis more tractable — none is given in Mishra and Thakurta (2014)
— and the regret bound better. Estimates of the linear function at each arm are based on the ridge regression estimator, which gives a lower bound on the singular values of the design matrix and hence an upper bound on the effect of the noise. As part of the regret analysis we use the selfnormalized martingale inequality developed in
AbbasiYadkori et al. (2011); for details see the proof in the Appendix.Theorem 5.
The following corollary follows by setting and setting to be as small as possible, without it becoming an asymptotically dominant term in the regret bound. We then apply Theorem 4 to convert the privacy guarantee into a bias guarantee.
Corollary 2.
Remark 3.
Readers familiar with the linear contextual bandit literature will remark that the optimal nonprivate regret bound in the realizable setting scales like Chu et al. (2011), as opposed to above. This is an artifact of the fact that for ease of presentation we have analyzed a simpler LinUCB variant using techniques from AbbasiYadkori et al. (2011), rather than the more complicated SupLinUCB algorithm of Chu et al. (2011). It is not a consequence of using the binary mechanism to guarantee privacy – it is likely the same technique would give a private variant of SupLinUCB with a tighter regret bound than the one given above.
5 Max Information & Arbitrary Hypothesis Tests
Up through this point, we have focused our attention on showing how the private collection of data mitigates the effect that adaptivity has on bias, in both the stochastic and contextual bandit problems. In this section, we draw upon more powerful results from the adaptive data analysis literature to go substantially beyond bias: to correct the values of hypothesis tests applied to adaptively gathered data. These value corrections follow from the connection between differential privacy and a quantity called max information, which controls the extent to which the dependence of selected test on the dataset can distort the statistical validity of the test (Dwork et al., 2015b; Rogers et al., 2016). We briefly define max information, state the connection to differential privacy, and illustrate how max information bounds can be used to perform adaptive analyses in the private data gathering framework.
Definition 5 (MaxInformation Dwork et al. (2015b).).
Let be jointly distributed random variables over domain . Let denote the random variable that draws independent copies of according to their marginal distributions. The maxinformation between , denoted , is defined:
Similarly, we define the approximate max information
Following Rogers et al. (2016)
, define a test statistic
, where is the space of all datasets. For , given an output , the value associated with the test on dataset is , whereis the null hypothesis distribution. Consider an algorithm
, mapping a dataset to a test statistic.Definition 6 (Valid value Correction Function Rogers et al. (2016).).
A function is a valid value correction function for if the procedure:

Select a test statistic

Reject the null hypothesis if
has probability at most of rejection, when .
Then the following theorem gives a valid value correction function when have bounded approximate max information.
Theorem 6 (Rogers et al. (2016).).
Let be a datadependent algorithm for selecting a test statistics such that . Then the following function is a valid value correction function for :
Finally, we can connect max information to differential privacy, which allows us to leverage private algorithms to perform arbitrary valid statistical tests.
Theorem 7 (Theorem 20 from Dwork et al. (2015b).).
Let be an differentially private algorithm, let be an arbitrary product distribution over datasets of size , and let . Then for every :
Rogers et al. (2016) extend this theorem to algorithm satisfying differential privacy.
Remark 4.
We note that a hypothesis of this theorem is that the data is drawn from a product distribution. In the contextual bandit setting, this corresponds to rows in the bandit tableau being drawn from a product distribution. This will be the case if contexts are drawn from a distribution at each round, and then rewards are generated as some fixed stochastic function of the contexts. Note that contexts (and even rewards) can be correlated with one another within a round, so long as they are selected independently across rounds. In contrast, the regret bound we prove allows the contexts to be selected by an adversary, but adversarially selected contexts would violate the independence assumption needed for Theorem 7.
We now formalize the process of running a hypothesis test against an adaptively collected dataset. A bandit algorithm generates a history . Let the reward portion of the gathered dataset be denoted by . We define an adaptive test statistic selector as follows.
Definition 7.
Fix the reward portion of a bandit tableau and bandit algorithm . An adaptive test statistic selector is a function from action histories to test statistics such that is a realvalued function of the adaptively gathered dataset .
Importantly, the selection of the test statistic can depend on the sequence of arms pulled by (and in the contextual setting, on all contexts observed), but not otherwise on the reward portion of the tableau . For example, could be the statistic corresponding to the null hypothesis that the arm which was pulled the greatest number of times has mean :
By virtue of Theorems 6 and 7, and our view of adaptive data gathering as adaptively selected queries, we get the following corollary:
Corollary 3.
Let be an reward differentially private bandit algorithm, and let be an adaptive test statistic selector. Fix , and let for . Then for any adaptively selected statistic , and any product distribution corresponding to the null hypothesis for
If we set in Corollary 3, then – i.e. a valid value correction that only scales by a constant. For example, in the simple stochastic setting, we can recall corollary 1 to obtain:
Corollary 4.
Setting there exists a simple stochastic bandit algorithm that guarantees expected regret bounded by , such that for any adaptive test statistic evaluated on the collected data, there exists a valid value correction function .
Of course, our theorems allow us to smoothly trade off the severity of the value correction with the regret bound.
6 Experiments
We first validate our theoretical bounds on bias in the simple stochastic bandit setting. As expected the standard UCB algorithm underestimates the mean at each arm, while the private UCB algorithm of Mishra and Thakurta (2015) obtains very low bias. While using the suggested by the theory in Corollary 4 effectively reduces bias and achieves near optimal asymptotic regret, the resulting private algorithm only achieves nontrivial regret for large due to large constants and logarithmic factors in our bounds. This motivates a heuristic choice of that provides no theoretical guarantees on bias reduction, but leads to regret that is comparable to the nonprivate UCB algorithm. We find empirically that even with this large choice of we achieve an fold reduction in bias relative to UCB. This is consistent with the observation that our guarantees hold in the worstcase, and suggests that there is room for improvement in our theoretical bounds — both improving constants in the worstcase bounds on bias and on regret, and for proving instance specific bounds. Finally, we show that in the linear contextual bandit setting collecting data adaptively with a linear UCB algorithm and then conducting tests for regression coefficients yields incorrect inference (absent a value correction). These findings confirm the necessity of our methods when drawing conclusions from adaptively gathered data.
6.1 Stochastic MultiArmed Bandit
In our first stochastic bandit experiment we set and . The arm means are equally spaced between and with gap , with . We run UCB and private UCB for rounds with , and after each run compute the difference between the sample mean at each arm and the true mean. We repeat this process times, averaging to obtain high confidence estimates of the bias at each arm. The average absolute bias over all arms for private UCB was , with the bias for every arm being statistically indistinguishable from (see Figures 2
for confidence intervals) while the average absolute bias (over arms) for UCB was
, or over times higher. The most biased arm had a measured bias of roughly , and except for the top arms, the bias of each arm was statistically significant. It is worth noting that private UCB achieves bias significantly lower than the guaranteed by the theory, indicating that the theoretical bounds on bias obtained from differential privacy are conservative. Figures 2, 2 show the bias at each arm for private UCB vs. UCB, with confidence intervals around the bias at each arm. Not only is the bias for private UCB an order of magnitude smaller on average, it does not exhibit the systemic negative bias evident in Figure 2.Noting that the observed reduction in bias for exceeded that guaranteed by the theory, we run a second experiment with and , averaging results over iterations. Figure 3 shows that private UCB achieves sublinear regret comparable with UCB. While provides no meaningful theoretical guarantee, the average absolute bias at each arm mean obtained by the private algorithm was (statistically indistinguishable from 0 at 95% confidence for each arm), while the nonprivate UCB algorithm obtained average bias , times larger. The bias reduction for the arm with the smallest mean (for which the bias is the worst with the non private algorithm) was by more than a factor of 10. Figures 5,5
show the bias at each arm for the private and nonprivate UCB algorithms together with 95% confidence intervals; again we observe a negative skew in the bias for UCB, consistent with the theory in
Nie et al. (2017).6.2 Linear Contextual Bandits
Nie et al. (2017) prove and experimentally investigate the existence of negative bias at each arm in the simple stochastic bandit case. Our second experiment confirms that adaptivity leads to bias in the linear contextual bandit setting in the context of hypothesis testing – and in particular can lead to false discovery in testing for nonzero regression coefficients. The set up is as follows: for arms, we observe rewards , where . For each arm , we set . Subject to these constraints, we pick the parameters uniformly at random (once per run), and select the contexts uniformly at random (at each round). We run a linear UCB algorithm (OFUL AbbasiYadkori et al. (2011)) for rounds, and identify the arm that has been selected most frequently. We then conduct a test for whether the first coordinate of is equal to . By construction the null hypothesis of the experiment is true, and absent adaptivity, the value should be distributed uniformly at random. In particular, for any value of the probability that the corresponding value is less than is exactly . We record the observed value, and repeat the experiment times, displaying the histogram of observed values in Figure 6. As expected, the adaptivity of the data gathering process leads the values to exhibit a strong downward skew. The dotted blue line demarcates . Rather than probability of falsely rejecting the null hypothesis at 95% confidence, we observe that of the observed values fall below the threshold. This shows that a careful value correction in the style of Section 2.3 is essential even for simple testing of regression coefficients, lest bias lead to false discovery.
References
 AbbasiYadkori et al. [2011] Yasin AbbasiYadkori, Dávid Pál, and Csaba Szepesvári. Improved algorithms for linear stochastic bandits. In Proceedings of the 24th International Conference on Neural Information Processing Systems, NIPS’11, pages 2312–2320, USA, 2011. Curran Associates Inc. ISBN 9781618395993. URL http://dl.acm.org/citation.cfm?id=2986459.2986717.
 Agrawal [1995] Rajeev Agrawal. Sample mean based index policies with o(log n) regret for the multiarmed bandit problem. Advances in Applied Probability, 27(4):1054–1078, 1995. ISSN 00018678. URL http://www.jstor.org/stable/1427934.
 Audibert and Bubeck [2009] JeanYves Audibert and Sébastien Bubeck. Minimax policies for adversarial and stochastic bandits. In COLT, pages 217–226, 2009.
 Auer et al. [2002] Peter Auer, Nicolò CesaBianchi, and Paul Fischer. Finitetime analysis of the multiarmed bandit problem. Mach. Learn., 47(23):235–256, May 2002. ISSN 08856125. doi: 10.1023/A:1013689704352. URL https://doi.org/10.1023/A:1013689704352.

Bassily et al. [2016]
Raef Bassily, Kobbi Nissim, Adam Smith, Thomas Steinke, Uri Stemmer, and
Jonathan Ullman.
Algorithmic stability for adaptive data analysis.
In
Proceedings of the fortyeighth annual ACM symposium on Theory of Computing
, pages 1046–1059. ACM, 2016. 
Bubeck et al. [2012]
Sébastien Bubeck, Nicolo CesaBianchi, et al.
Regret analysis of stochastic and nonstochastic multiarmed bandit
problems.
Foundations and Trends® in Machine Learning
, 5(1):1–122, 2012.  Chan et al. [2011] T.H. Hubert Chan, Elaine Shi, and Dawn Song. Private and continual release of statistics. ACM Trans. Inf. Syst. Secur., 14(3):26:1–26:24, November 2011. ISSN 10949224. doi: 10.1145/2043621.2043626. URL http://doi.acm.org/10.1145/2043621.2043626.

Chu et al. [2011]
Wei Chu, Lihong Li, Lev Reyzin, and Robert Schapire.
Contextual bandits with linear payoff functions.
In
Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics
, pages 208–214, 2011.  Cummings et al. [2016] Rachel Cummings, Katrina Ligett, Kobbi Nissim, Aaron Roth, and Zhiwei Steven Wu. Adaptive learning with robust generalization guarantees. In Conference on Learning Theory, pages 772–814, 2016.
 Deshpande et al. [2017] Yash Deshpande, Lester Mackey, Vasilis Syrgkanis, and Matt Taddy. Accurate inference for adaptive linear models. arXiv preprint arXiv:1712.06695, 2017.
 Dimakopoulou et al. [2017] Maria Dimakopoulou, Susan Athey, and Guido Imbens. Estimation considerations in contextual bandits. arXiv preprint arXiv:1711.07077, 2017.
 Dubhashi and Panconesi [2009] Devdatt P Dubhashi and Alessandro Panconesi. Concentration of measure for the analysis of randomized algorithms. Cambridge University Press, 2009.
 Dwork et al. [2006] Cynthia Dwork, Frank McSherry, Kobbi Nissim, and Adam Smith. Calibrating noise to sensitivity in private data analysis. In Proceedings of the Third Conference on Theory of Cryptography, TCC’06, pages 265–284, Berlin, Heidelberg, 2006. SpringerVerlag. ISBN 3540327312, 9783540327318. doi: 10.1007/11681878˙14. URL http://dx.doi.org/10.1007/11681878_14.
 Dwork et al. [2010] Cynthia Dwork, Moni Naor, Toniann Pitassi, and Guy N. Rothblum. Differential privacy under continual observation. In Proceedings of the Fortysecond ACM Symposium on Theory of Computing, STOC ’10, pages 715–724, New York, NY, USA, 2010. ACM. ISBN 9781450300506. doi: 10.1145/1806689.1806787. URL http://doi.acm.org/10.1145/1806689.1806787.
 Dwork et al. [2015a] Cynthia Dwork, Vitaly Feldman, Moritz Hardt, Toniann Pitassi, Omer Reingold, and Aaron Roth. The reusable holdout: Preserving validity in adaptive data analysis. Science, 349(6248):636–638, 2015a.
 Dwork et al. [2015b] Cynthia Dwork, Vitaly Feldman, Moritz Hardt, Toniann Pitassi, Omer Reingold, and Aaron Roth. Generalization in adaptive data analysis and holdout reuse. In Proceedings of the 28th International Conference on Neural Information Processing Systems  Volume 2, NIPS’15, pages 2350–2358, Cambridge, MA, USA, 2015b. MIT Press. URL http://dl.acm.org/citation.cfm?id=2969442.2969502.
 Dwork et al. [2015c] Cynthia Dwork, Vitaly Feldman, Moritz Hardt, Toniann Pitassi, Omer Reingold, and Aaron Leon Roth. Preserving statistical validity in adaptive data analysis. In Proceedings of the Fortyseventh Annual ACM Symposium on Theory of Computing, STOC ’15, pages 117–126, New York, NY, USA, 2015c. ACM. ISBN 9781450335362. doi: 10.1145/2746539.2746580. URL http://doi.acm.org/10.1145/2746539.2746580.
 Feldman and Steinke [2017a] Vitaly Feldman and Thomas Steinke. Generalization for adaptivelychosen estimators via stable median. In Conference on Learning Theory, pages 728–757, 2017a.
 Feldman and Steinke [2017b] Vitaly Feldman and Thomas Steinke. Calibrating noise to variance in adaptive data analysis. arXiv preprint arXiv:1712.07196, 2017b.
 Hardt and Blum [2015] Moritz Hardt and Avrim Blum. The ladder: a reliable leaderboard for machine learning competitions. In Proceedings of the 32nd International Conference on International Conference on Machine LearningVolume 37, pages 1006–1014. JMLR. org, 2015.
 Hardt and Ullman [2014] Moritz Hardt and Jonathan Ullman. Preventing false discovery in interactive data analysis is hard. In Foundations of Computer Science (FOCS), 2014 IEEE 55th Annual Symposium on, pages 454–463. IEEE, 2014.
 Joseph et al. [2018] Matthew Joseph, Michael J. Kearns, Jamie Morgenstern, Seth Neel, and Aaron Roth. Fair algorithms for infinite and contextual bandits. AIES’18, 2018. URL http://arxiv.org/abs/1610.09559.
 Lai and Robbins [1985] T.L Lai and Herbert Robbins. Asymptotically efficient adaptive allocation rules. Adv. Appl. Math., 6(1):4–22, March 1985. ISSN 01968858. doi: 10.1016/01968858(85)900028. URL http://dx.doi.org/10.1016/01968858(85)900028.
 Li et al. [2010] Lihong Li, Wei Chu, John Langford, and Robert E. Schapire. A contextualbandit approach to personalized news article recommendation. In Proceedings of the 19th International Conference on World Wide Web, WWW ’10, pages 661–670, New York, NY, USA, 2010. ACM. ISBN 9781605587998. doi: 10.1145/1772690.1772758. URL http://doi.acm.org/10.1145/1772690.1772758.
 Mishra and Thakurta [2014] Nikita Mishra and Abhradeep Thakurta. Private stochastic multiarm bandits: From theory to practice. In ICML Workshop on Learning, Security, and Privacy, 2014.
 Mishra and Thakurta [2015] Nikita Mishra and Abhradeep Thakurta. (nearly) optimal differentially private stochastic multiarm bandits. In Proceedings of the ThirtyFirst Conference on Uncertainty in Artificial Intelligence, UAI’15, pages 592–601, Arlington, Virginia, United States, 2015. AUAI Press. ISBN 9780996643108. URL http://dl.acm.org/citation.cfm?id=3020847.3020909.
 Nie et al. [2017] X. Nie, X. Tian, J. Taylor, and J. Zou. Why adaptively collected data have negative bias and how to correct for it. ArXiv eprints, August 2017.
 Rogers et al. [2016] Ryan M. Rogers, Aaron Roth, Adam D. Smith, and Om Thakkar. Maxinformation, differential privacy, and postselection hypothesis testing. In IEEE 57th Annual Symposium on Foundations of Computer Science, FOCS 2016, 911 October 2016, Hyatt Regency, New Brunswick, New Jersey, USA, pages 487–494, 2016. doi: 10.1109/FOCS.2016.59. URL https://doi.org/10.1109/FOCS.2016.59.
 Russo and Zou [2016] Daniel Russo and James Zou. Controlling bias in adaptive data analysis using information theory. In Artificial Intelligence and Statistics, pages 1232–1240, 2016.
 Steinke and Ullman [2015] Thomas Steinke and Jonathan Ullman. Interactive fingerprinting codes and the hardness of preventing false discovery. In Conference on Learning Theory, pages 1588–1628, 2015.
 Tossou and Dimitrakakis [2016] Aristide C. Y. Tossou and Christos Dimitrakakis. Algorithms for differentially private multiarmed bandits. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, AAAI’16, pages 2087–2093. AAAI Press, 2016. URL http://dl.acm.org/citation.cfm?id=3016100.3016190.
 Tossou and Dimitrakakis [2017] Aristide C. Y. Tossou and Christos Dimitrakakis. Achieving privacy in the adversarial multiarmed bandit. CoRR, abs/1701.04222, 2017. URL http://arxiv.org/abs/1701.04222.
 Villar et al. [2015] Sofía S Villar, Jack Bowden, and James Wason. Multiarmed bandit models for the optimal design of clinical trials: benefits and challenges. Statistical science: a review journal of the Institute of Mathematical Statistics, 30(2):199, 2015.
 Wang et al. [2016] YuXiang Wang, Jing Lei, and Stephen E Fienberg. A minimax theory for adaptive data analysis. arXiv preprint arXiv:1602.04287, 2016.
Appendix A Differential Privacy Basics
We recall the standard definition of differential privacy, which can be defined over any neighboring relationship on data sets . The standard relation says that are neighbors (written as ) if they differ in a single element.
Definition 8 (Differential Privacy Dwork et al. [2006]).
Fix . A randomized algorithm is differentially private if for every pair of neighboring data sets , and for every event :
Differentially private computations enjoy two nice properties:
Lemma 1 (Post Processing Dwork et al. [2006]).
Let be any differentially private algorithm, and let be any (possibly randomized) algorithm. Then the algorithm