Manuscript Offprint
arXiv:2610.11145Tight Bounds for Equivalence Testing with Non-Adaptive Conditional Samples
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
We study distribution testing with access to non-adaptive conditional samples. Specifically, we give tight bounds for equivalence testing, determining whether two unknown distributions are equal to or -far from each other in total variation distance. Our algorithm and lower bound show that queries are necessary and sufficient for this problem. These results demonstrate that the complexity of uniformity, identity, and equivalence testing with non-adaptive conditional samples are all .
1 Introduction
Hypothesis testing is a classic problem in statistics: given samples from a distribution, determine whether or not it satisfies some property. Within the field of theoretical computer science, it has been studied under the name of distribution testing, as a subproblem within the broader area of property testing [Gol17]. Study of distribution testing was initiated by seminal works of Goldreich, Goldwasser, and Ron [GGR96], Goldreich and Ron [GR00], and Batu, Fortnow, Rubinfeld, Smith, and White [BFR+00]. The problem has since received extensive attention (see, e.g., [BFF+01, BKR04, Pan08, ADJ+11, BFRV11, Val11, VV11, ILR12, DDS+13, CDVV14, VV17, Wag15, AD15, ADK15, BV15, DKN15, DK16, Can16, BCG17, BC17, CDKS17, DDK18, DKW18, DGPP18, DGK+21, CJKL22], and [Rub12, BW18, Kam18, Can20, Can22] for surveys).
We now have a rich understanding of many core problems in this area. For example, the most classic question is uniformity testing: given samples from a discrete distribution over , test whether it is uniform over the domain versus -far from the uniform distribution in statistical distance. We have tight upper and lower bounds for this problem, demonstrating that the sample complexity of uniformity testing is [GR00, Pan08, VV14, DKN15, ADK15, DGPP18]. In this work, we are concerned with equivalence testing (sometimes called two-sample testing or closeness testing): given samples from two discrete distributions and over , test whether they are equal versus -far from each other in statistical distance. The sample complexity for this problem is the more complex expression [Val11, CDVV14].
Observe that the sample complexity for both these problems (and many others in distribution testing) is (strongly) sublinear in the domain size : ignoring dependence on , they are both for some . However, these bounds are tight, which can be problematic when the domain size is extremely large and thus any polynomial in is intractable. For example,
*New York University. g@csail.mit.edu. Supported by an NSERC Discovery Grant and an Ontario Early Researcher Award.
testing uniformity on the -dimensional Boolean hypercube requires samples, which remains exponential in the dimension. Motivated by testing over extremely large domains, Canonne, Ron, and Servedio [CRS14, CRS15] and Chakraborty, Fischer, Goldhirsh, and Matsliah [CFGM13, CFGM16] introduced the conditional sampling model. This model gives the algorithm stronger query access to the distributions being tested: rather than passively sampling from the distribution, the algorithm queries the distribution by specifying a query set and receiving a sample from the distribution conditional on being from . We use COND to denote this type of conditional sampling access; in contrast, we use SAMP to denote the standard sampling oracle.
COND can significantly reduce the complexity of many distribution testing problems. For example, uniformity testing (and the more general problem of identity testing, which tests whether is equal to a specific distribution on ) requires only conditional samples [CRS14, FJO15], entirely independent of the domain size, compared to samples under SAMP. Equivalence testing also enjoys dramatic savings: under COND, equivalence testing needs only samples [FJO15, ACK15b, CCK24, AFL26], doubly logarithmic in the domain size, compared to samples under SAMP. Motivated by the power of COND, there has been significant investigation into its implications on distribution testing [Can15, FJO15, ACK15b, RT16, FLV17, SSJ17, BCG17, KT19, Nar21, CKM23, CCKM24, AFL26, BBCS26], in particular under the more restrictive subcube conditioning model [BC18, CCK21, CJLW21, BCSV23, AFL24, CM24, MKP25, CCR25, GHKO26, LNQR26], as well as for adjacent problems such as group testing [ACK15a], sublinear algorithms [GTZ17], and crowdsourcing [GTZ18].
However, most algorithms in the conditional sampling model are adaptive: they assume that the results of a query can be observed before the algorithm specifies the next query set. One can thus naturally consider a non-adaptive variant, where the algorithm must specify all query sets in advance of observing their results. We use NACOND to denote the non-adaptive conditional sampling model. What is the difference between these models – how powerful is adaptivity? Prior work by Acharya, Canonne, and Kamath [ACK15b] showed that NACOND can be exponentially weaker than COND: they showed that even testing uniformity under NACOND requires samples, whereas the harder problem of testing equivalence requires only samples [FJO 15]. However, later work of Kamath and Tzamos showed that NACOND remains exponentially stronger than SAMP: they give sample algorithms for uniformity, identity, and equivalence testing under NACOND, whereas even uniformity testing under SAMP requires samples [Pan08].
Thus, prior work has established exponential (or greater) separations between SAMP, COND, and NACOND for these testing problems. However, a significant algorithmic gap was left by Kamath and Tzamos [KT19]. Under NACOND, they gave an -sample algorithm for uniformity testing, which nearly matches the lower bound of Acharya, Canonne, and Kamath [ACK15b]. However, their algorithms for identity and equivalence testing were significantly worse, at and samples respectively, significantly greater than the lower bound (inherited from the easier problem of uniformity). This quantitative gap is in sharp contrast to both SAMP and COND, where we now have an essentially tight understanding of all three testing problems. A recent work of Chakraborty, Chakraborty, Kumar, and Meel (CCKM) [CCKM24] provided an algorithm for equivalence testing that requires COND samples with only one round of adaptivity.
Theorem 1. Let , and let and be two (unknown) distributions over . There exists an algorithm that takes non-adaptive conditional samples from and and, with probability , distinguishes between the case and . Furthermore, any algorithm with such guarantees requires at least non-adaptive conditional samples.
Results are summarized in Table 1.
| Model | Uniformity | Identity | Equivalence |
|---|---|---|---|
| SAMP | [Pan08, VV14] | [Pan08, VV14] | [CDVV14] |
| NACOND | [KT19] [ACK15b] | This work [ACK15b] | This work This work |
| COND | [CRS15] | [FJO15] | [AFL26] [CCK24] |
Table 1: Comparison of uniformity, identity, and equivalence testing in different sampling models. Problems get more challenging as one moves up and to the right.
Our results address open questions that were explicitly raised by Kamath and Tzamos [KT19]. For equivalence testing under NACOND, we improve upon the sample complexity of their algorithm, from to the near-optimal . We also improve the lower bound from samples (inherited from the easier problem of uniformity testing [ACK15b]) to the nearly-matching samples. Since identity testing is easier than equivalence testing, the same algorithm improves the sample complexity of Kamath and Tzamos [KT19] to . These results show that, under NACOND, the sample complexities of testing uniformity, identity, and equivalence are all . We find this somewhat surprising, since identity and equivalence testing under SAMP and COND have significant gaps: under SAMP, the sample complexity increases by a poly factor, while under COND, an entirely new dependence on arises.
We highlight one interesting question, on the power of rounds of adaptivity of conditional samples. Falahatgar, Jafarpour, Orlitsky, Pichapati, and Suresh (FJOPS) [FJO15] give an identity testing algorithm that takes conditional samples, nearly matching the lower bound of . A careful study of their algorithm shows that it can be implemented with only one round of adaptivity. In contrast, any NACOND algorithm (which has zero rounds of adaptivity) requires samples. Thus, a single round of adaptivity extracts the full power of adaptive conditional samples. In contrast, for equivalence testing, it is unclear how many rounds of adaptivity are required to reduce the sample complexity from (optimal under NACOND) to (optimal under COND).
2.1 Techniques
Upper Bound. Our algorithm (Algorithm 1) is very similar to ANACONDA of Kamath and Tzamos [KT19]. Their algorithm operates by repeatedly isolating a query set by first choosing a random probability , and then independently including each element in with probability . If , they argue that this approach has a reasonable chance of identifying a set which is discrepant between the two distributions: specifically, there exists a symbol such that the (conditional) probability of has a large absolute difference between and . Given such a set , we can easily test for such a discrepancy by examining the empirical distribution.
Our algorithm diverges from theirs in two primary ways, incorporating ideas from the adaptive algorithm for equivalence testing with conditional samples of FJOPS . Specifically, we replace ANACONDA's discrepancy measure with a chi-squared-like discrepancy measure of FJOPS. This discrepancy captures relative differences, rather than absolute differences, which can be valuable when the symbols have small mass. Additionally, our algorithm incorporates another loop which searches over the magnitude of the discrepancy that we test for. Intuitively, this can be seen as a better allocation of our testing effort across scales – if we are searching for a large discrepancy (which requires few samples to test), we take proportionally more random trials in an attempt to capture the discrepancy. This tradeoff will show up in the final work investment part of the proof.
Analysis is inspired by the adaptive equivalence testing algorithm of FJOPS. Consider the domain to be sorted in decreasing order with respect to the distribution (“the weight”). Let be the aggregate mass in the tail beginning at symbol .
FJOPS randomly selects several symbols according to the distribution w, in hopes that if , one will be discrepant relative to its tail (quantified by the expectation with respect to w in Lemma 6). For one such symbol i, they try to estimate . Their goal is to form a query set S that simultaneously a) has i be the highest weight symbol selected, and b) have the weight be comparable to the selected weight from tail elements. This can be achieved with reasonable probability by selecting each domain element with probability . With such a set S in hand, the discrepancy test of Corollary 5 allows us to identify that this is the case.
In our non-adaptive setting, a key challenge is that we are unable to estimate . Instead, the argument goes in the opposite order: we randomly select a , and for each symbol such that , we consider the event a), that is the highest weight symbol selected. We can argue that, under this event, the symbol contributes significant expected discrepancy (Lemma 10). This time, we do not require b), that the weight of symbol and the sampled tail are comparable – Lemma 8 supports a different approach, where we examine the expected discrepancy of the random tail. We can sum these contributions across all 's (since the corresponding events are disjoint) and achieve a large expected discrepancy in aggregate (Corollary 11).
A large expected discrepancy does not suffice for our algorithm: we require that the algorithm actually obtains a query set with significant discrepancy. We show that, given a large expected discrepancy, our algorithm is likely to sample a sufficiently discrepant set (quantified in Lemma 7). This conversion from expectation to probability is done using Levin's economical work-investment strategy. Again, with a query set S in hand, we can identify a discrepancy using the test of Corollary 5.
Lower Bound. To construct a hard instance for our lower bound, we describe two distributions and . Both distributions share the same support . The support size is chosen randomly from , and the specific support is chosen uniformly at random from all sets of that size. This construction is similar to that of Acharya, Canonne, and Kamath [ACK15b], who used it to prove lower bounds for non-adaptive support size estimation and uniformity testing. For the case when , we let both distributions be uniform over this support. For the case where , we apply a Paninski-style construction [Pan08] to the support. Specifically, we randomly partition into two sets of size : we multiplicatively perturb the probability of elements in these sets by and , respectively, for the distribution . Keeping the same partition, we perturb the probabilities in the opposite direction and for the distribution . The two types of randomization each contribute a different factor to the lower bound. The randomization over the support size contributes a factor of , while the random perturbation contributes a factor of .
The proof works by bounding the total variation distance between the transcripts (i.e., the results of the conditional samples) when and . We start by focusing on the case when the support and queries are fixed, and the randomness is only in the choice of the random perturbation (Section 6.2). We follow the second-moment method, and bound the total variation distance in terms of the expected square of the likelihood ratio of the transcripts. Conditioning on a fixed perturbation, the likelihood ratio of the transcript can be written as a product of the likelihood ratio of individual results in the transcript. However, in the case where , we average over a single perturbation shared by all queries, which introduces correlations when conditioning is removed. Controlling these correlations is the main challenge in our argument. A lengthy calculation allows us to bound the total variation distance between the transcripts as , where is a function solely of the size of the intersection between the query set and the support (Lemma 13). Along the way, we require a variant of the Khintchine inequality (Lemma 14): rather than taking a weighted sum with uniformly random signs, the random partition of introduces a balancedness condition which we must account for.
Next, we incorporate randomness over the choice of the support . As hinted in Lemma 13, the key quantity is the size of the intersection between a query set and the support : . If the intersection is small (i.e., 0 or 1), the distribution of the query result will be identical under versus . On the other hand, if the intersection is large, averaging over the random partition results in a relatively low contribution to the distance between the transcripts. Indeed, the only queries that incur significant distance are those where . An averaging argument over the size of the set bounds the expected value of by (Lemma 15).
A careful combination of both sources of randomness (as well as incorporation of the random seed of the algorithm) allows us to bound the total variation distance between two transcripts over samples as . Accuracy of the testing algorithm requires the distance between the transcripts to be , thus necessitating , as desired.
AI Disclosure
The algorithm and analysis were developed in collaboration with an AI model. The model initially failed to attribute ideas to other work in the literature, identify lemmas as variants of known results, and write the solution in a manner easily comprehensible to a human reader. To the best of our ability, we attempted to remedy all of these issues, including carefully writing all parts of the paper. We take full responsibility for correctness, presentation, and communication of the results.
3 Preliminaries
We study discrete distributions over . We denote the (unknown) distributions of interest using and , where is the probability mass placed by distribution on symbol (and similarly for ). For a set , let . If , write for the distribution obtained by conditioning on :
Definition 2 (Conditional sampling [CRS14, CFGM13]). A conditional sampling oracle for takes a query set and returns an independent sample from . If , then a symbol is returned uniformly at random.
We focus on non-adaptive conditional access (NACOND), in which all query sets must be chosen before observing any of the responses. Alternatively, one could consider adaptive conditional access (COND), in which query sets may depend on previous responses.
Definition 3. The total variation distance between distributions p and q is defined as
3.1 Useful Tools from Previous Work
We borrow two tools from the work of Falahatgar, Jafarpour, Orlitsky, Pichapati, and Suresh [FJO 15].
A chi-squared-like discrepancy test. Prior algorithms on non-adaptive conditional sampling [KT19] worked as follows: repeatedly draw a random query set and test whether we can identify a discrepancy within the conditional distributions. Kamath and Tzamos searched for discrepancies based on absolute differences between conditional symbol probabilities, i.e., symbols for which are sufficiently large. We follow the same general framework, but we search for discrepancies based on relative differences between conditional symbol probabilities, as proposed by FJOPS [FJO 15]. We employ their algorithm TEST-EQUAL:
Lemma 4 (Lemma 1 of [FJO 15]). Fix . Suppose we have samples from two distributions and , where and are unknown. There exists an algorithm, TEST-EQUAL, that, with probability , distinguishes between the cases where and
It requires samples from each distribution.
We reproduce the pseudocode of TEST-EQUAL from [FJO 15] as Algorithm 2 in Appendix A.1.
The above lemma is a test for discrepancy between Bernoulli distributions. The following corollary allows us to test whether two discrete distributions have a discrepant coordinate. The reduction to Lemma 4 is simple: given a batch of samples, define an indicator for each unique symbol observed, and run the previous Bernoulli test (with a scaled-down failure probability) for each of these events. The proof is detailed further in Appendix A.2.
Corollary 5. Fix . Suppose we have samples from two discrete distributions p and q over . There exists an algorithm that, with probability , distinguishes between the cases where p = q and there exists some such that
It requires samples from each distribution.
A Tail-Discrepancy Lemma. Let w, v be n-dimensional vectors defined as follows:
Throughout the paper, we use the convention that .
w is a distribution which is a uniform mixture of p and q, while v is a rescaled difference between distributions p and q. Observe that and .
In the analysis of the algorithm, we assume that . Since this ordering will only be used for the sake of analysis (not by the algorithm itself), this is without loss of generality. We further define:
T and m are vectors which quantify tail properties of p and q. Specifically, T represents the tail mass of their mixture w, and m measures the (rescaled) difference between p and q in this tail.
The following structural lemma of allows us to relate these quantities to the total variation distance between p and q. Specifically, if p and q are far from each other, this manifests in the differences between their local difference and their tail difference (appropriately rescaled).
Lemma 6 (Lemma 8 of ).
4 The Algorithm
Our algorithm is described as Algorithm 1. It is very simple to describe: informally, it chooses a random set of a random size, and checks whether the two distributions are noticeably discrepant on the induced conditional distributions. This is independently repeated several times, and further wrapped in a loop which iterates over choices for the magnitude of the discrepancy. Crucially, note that this algorithm is non-adaptive, as all queries can be performed oblivious to the results of previous queries.
We note that our algorithm is almost identical to ANACONDA [KT19]. There are two main differences. Most significantly, we search for relative discrepancy (as described in Corollary 5), rather than absolute discrepancy. We also include a new outer loop which iterates over possibilities for the size of the discrepancy. Lower order differences with ANACONDA include various parameter settings.
The pseudocode uses the following parameter settings for the number of repetitions and the number of queries . Note that both quantities depend on the candidate magnitude for the discrepancy t.
Each discrepancy test has failure probability , set small enough to bound failure across all tests by a constant.
Algorithm 1 An algorithm for equivalence testing with non-adaptive conditional samples
1: function NONADAPTIVEEQUIVALENCE(n, ε, NACOND_p, NACOND_q) 2: for each threshold do 3: for do 4: Choose an integer uniformly at random, and define . 5: Choose a random set , independently selecting each i with probability 1/r. 6: Perform queries to NACOND_p and NACOND_q on S. 7: Use these samples to run the test of Corollary 5 with threshold t, failure prob. . 8: if the discrepancy test returns diff then 9: return . 10: end if 11: end for 12: end for 13: return p = q. 14: end function
There are thresholds. The sample complexity of this algorithm is
5 Analysis of Algorithm 1
For a query set , we define as follows:
This quantity identifies the maximum discrepancy (in the sense of Corollary 5) of any symbol in the conditional distribution corresponding to S. The following key lemma says that, over the randomness in sampling the various query sets S, Algorithm 1 is likely to sample at least one set that realizes a large discrepancy.
Lemma 7. Suppose . We let be the query set sampled by Algorithm 1 at repetition with threshold . Then with probability at least 9/10, there exists such that .
With this lemma in hand, the proof of the upper bound in Theorem 1 is not hard. If , then for all the query sets , we have that . If , this lemma guarantees that we will identify a query set realizing discrepancy at least with probability at least 9/10. Correctness follows from the guarantees of the discrepancy test in Corollary 5 and a union bound over all invocations. The claimed sample complexity follows from the calculation in Section 4.
It remains to prove Lemma 7. As a first step, we convert the tail-discrepancy lemma of FJOPS [FJO 15] (Lemma 6) to a quadratic variant which will be more convenient for downstream calculations (Lemma 8 in Section 5.1). As our main technical lemma, we show that a randomly sampled set will have large discrepancy in expectation (Corollary 11 in Section 5.2). An application of Levin's work-investment strategy (Section 5.3) allows us to convert this expectation into getting a set having sufficient discrepancy with sufficient probability, concluding Lemma 7.
5.1 A Quadratic Tail-Discrepancy Lemma
We show that the linear tail-discrepancy lemma of FJOPS [FJO 15] can be converted to a quadratic version, using Cauchy-Schwarz inequality. It turns out that these quadratic differences are better suited for the chi-square-like discrepancy we are trying to witness with Corollary 5. At the same time, we exclude symbols i which have extremely small weight under p and q. Later analysis derives lower bounds on discrepancy exclusively from when a symbol is the heaviest element sampled and its weight is comparable to the sampling probability (see the definition of event and Lemma 10 in Section 5.2). Since our algorithm has a minimum sampling probability of , any item with less weight will never satisfy the latter criterion. Consequently, to match the events we are able to extract discrepancy from, we aggregate over the corresponding set of symbols. At the same time, ignoring the remaining symbols loses only a small amount of the witnessed total variation distance.
Lemma 8. Define the following set of indices:
If , then
Proof. The coordinates with have total probability mass at most . Similarly, the coordinates with have total mass at most . Observing that entrywise, we have that . Thus, removing from the summation in Lemma 6 gives
Thus,
We are left with for some . Since ,
The first inequality bounds the term by 1, and the remaining terms using . We factor the summand of the summation as follows:
Cauchy-Schwarz says that
Combining this with (5.1) and (5.2) gives the desired statement.
5.2 Expected Discrepancy under Random Restrictions
The goal of this section is to establish that the expected discrepancy is large, where the randomness is over the choice of the sampling probability and the selected elements of the query set S. In the following section, we demonstrate that our sampling strategy allows us to convert this large expectation into a reasonable probability of selecting a sufficiently discrepant set, establishing Lemma 7.
We bucket the indices based on their weight . Specifically, we define
We define to be the event where symbol is included in a query set , and no earlier symbol is selected:
The following proposition says that with a judicious choice of sampling probability, the probability that symbol i is the heaviest selected symbol is comparable to the probability it is selected at all.
Proposition 9. Fix , and let be the index of the bucket that belongs to. Let be a sampling probability, and let be a random set where every symbol in is independently included with probability . Then .
Proof. First, we have that occurs precisely when symbol is selected and none of the previous symbols are selected: . Observe that : the latter inequality holds because the 's are in decreasing order and form a probability distribution. If this weren't the case, this prefix would contain more than 1 mass. Note further that , based on the definition of our bucketing scheme. Combining these inequalities, we have that , and thus as desired, where the latter inequality holds for .
The following lemma captures the expectation of extracted when the event occurs:
Lemma 10. Fix , and let be the index of the bucket that belongs to. Let be a sampling probability, and let be a random set where every symbol in is independently included with probability . Then
where the randomness is only over the choice of the random set S.
With this lemma in hand, we demonstrate how it allows us to conclude that the overall discrepancy we expect to capture is large. The proof essentially aggregates over the events (which are disjoint), applies Lemma 10 to each, and then applies our quadratic tail-discrepancy lemma (Lemma 8) to their sum. We instantiate in Line 4 of Algorithm 1 as .
Corollary 11. Suppose . Then
where the randomness is over the choice of the sampling probability and the selected elements of the query set S.
Proof. We first use the law of total expectation over the random choice of j:
Noting that the 's are disjoint events, we have that
Applying Lemma 10 gives
Observing that ,
Applying Lemma 8 and the assumption that , we can conclude:
We proceed to prove Lemma 10.
Proof of Lemma 10. Fix coordinate , the index of the bucket it belongs to, and the sampling probability . We will condition on the event , where is the first symbol selected and every subsequent symbol is selected with probability , and the choice of the index . Define the following quantities:
U and W are the total weight of the set S, without and with the contribution of symbol i. Y captures how the relative difference between p and q at symbol i compares to their relative difference (on average) across the rest of the set S.
We compute the (conditional) expectation Y:
where we recall the definitions and .
We establish the pointwise bound
First, we deal with degenerate cases: if , , or , it is not hard to see that and the bound holds vacuously. Therefore, we assume that , and .
We inspect the following lower bound for , examining the contribution at symbol i.
We first derive an alternative form for the numerator. We write
Using and , we expand the numerator as
Therefore,
To deal with the second term in the denominator, write each complement probability in terms of its remaining mass:
Also and , so
and
As a last observation, . Putting this all together,
which proves (5.4) in this case.
We use the following technical lemma to bound the expectation of the quantity in the denominator, whose proof appears in Appendix B.
Lemma 12. Let , let , and let satisfy
Let be independent variables, and set . Then
We apply Lemma 12 with and the vector being the vector for . It is not hard to verify the lemma conditions using the definition and choice of , the fact that is non-increasing, and corresponds to . This gives
We let , and decompose for the sake of applying Cauchy-Schwarz. Specifically:
Returning to the pointwise bound (5.4) and taking (conditional) expectation of both sides:
The last inequality uses (5.3) and (5.5). Finally, use from Proposition 9 and :
13
☐
5.3 Converting Expectation to Probability with Work Investment
Corollary 11 establishes a lower bound on the expected discrepancy of a random . This is sufficient to conclude a (sub-optimal) algorithm for testing equivalence. We let . Corollary 11 states that . A reverse Markov's inequality says that . Thus, sampling sets gives reasonable probability that at least one of them has . Running the test of Corollary 5 on each of the sampled sets with threshold gives a correct algorithm that requires samples – the square of our target sample complexity.
We avoid this quadratic factor through more careful analysis using Levin's work-investment strategy [Gol14]. We specifically use the refinement due to Berman, Raskhodnikova, and Yaroslavtsev [BRY14]. Intuitively, could occur due to various distributions on . It could be since with probability . In this case, we could achieve an query complexity by drawing random sets and testing for discrepancy on each with threshold . Alternatively, perhaps with probability 1. In this case as well, we can achieve our target query complexity by drawing a single random set and testing for discrepancy with threshold . Morally similar properties hold for any distribution on , though we do not know beforehand which case we fall into. Levin's work-investment strategy iterates over a range of multiplicatively decreasing thresholds and increasing number of samples per set, effectively trying all possibilities at the cost of only a logarithmic overhead.
Proof of Lemma 7. Instantiate the last threshold in Line 2 of Algorithm 1 to be . By Corollary 11, . Our first step is to discount all sets with discrepancy below , since our algorithm never attempts to test for discrepancies below . They can contribute at most to the expectation, and thus
For each threshold t, let
and instantiate
We compute the probability that the lemma's conclusion does not hold:
Consider some set with discrepancy . The algorithm will test some such that . We can represent this property as a sum of indicators, which “picks out” the for which this holds:
Taking the expectation of both sides with respect to the random choice of j and S,
Observing that , we have
Thus, with probability at least , some sampled set satisfies , as claimed.
6 Lower Bound
We proceed to prove the lower bound in Theorem 1, which shows that every algorithm for equivalence testing with non-adaptive conditional samples requires samples. In Section 6.1, we describe the hard instance. The two distributions share a random support of a random size. When , they are both uniform on this support, and when , they feature a Paninski-style construction [Pan08], where a random half of the symbols in have their probabilities multiplicatively perturbed by and the other half are perturbed by ( is perturbed in the opposite direction). In Section 6.2, we analyze the total variation distance between the transcripts (i.e., the sequence of responses) under the two cases ( versus ) for a fixed support and set of queries: the only randomness is over the pattern of the perturbation. A lengthy calculation involving the square of the likelihood ratio produces a bound which depends on the sizes of the intersections of the queries with the support. In Section 6.3, we randomize over the support to show that a single query (in expectation) contributes little to the total variation distance between transcripts. Finally, in Section 6.4, we assemble these pieces and complete the proof by relating the transcripts’ total variation distance to the test’s success probability.
6.1 The Hard Input Distribution
Our hard instance is defined as follows. A random support is chosen to be the domain for both and . In the case where , they are both uniform over . In the case where , we choose a random half of and multiply its weights under and by and , respectively, and we reverse these multiplicative factors for the other half.
In more detail, let . Choose uniformly from , set , and choose uniformly among all subsets of size . Write for the uniform distribution over . Choose a sign vector , with exactly 's and 's, uniformly at random:
We consider the following null hypothesis and alternative hypothesis :
with both distributions zero outside D.
6.2 Comparing Answers on a Fixed Support
We first fix the support D and a list of queries, and compare the answers in the uniform and perturbed cases. We call the entire list of answers the transcript. In this section, under those restrictions, we upper bound the total variation distance between the transcripts under and . In the following section, we incorporate the randomness in the choice of D as well.
We use the following function to quantify how much a query contributes to our bound on the transcript distance, as a function of m, the size of the overlap between the query set and the support D. If a query intersects D at 0 or 1 point, the response will follow the same distribution under both hypotheses. Otherwise, we quantify the contribution as , larger intersections contribute less to the bound due to cancellations between the random signs.
Lemma 13. Fix , a support , and a list of queries , where for each , is the query set and is the queried distribution. Let be the number of support points in the ith query. Let and be the distributions of the entire answer list under and , respectively, conditional on the support (but not the random perturbation vector ).
There is an absolute constant C such that
Proof. We use the second-moment method to bound the total variation distance, by looking at the second moment of the likelihood ratio. Specifically, we upper bound the total-variation distance between the transcripts in terms of their chi-squared distance:
where L is the likelihood ratio
If a query has or 1, then the answer distribution is identical under the two hypotheses and the likelihood ratio for this query will be 1, regardless of the sign vector . For the sequel, we focus on the remaining queries which have .
Focus on the likelihood ratio for a single answer. For a fixed sign vector , let be its average over the support points in query – that is, the fraction of points that are spiked upwards minus the fraction of points that are spiked downwards, which gives a measure of the excess mass assigned to under .
We let be the ratio of the probability of answering under to that under . For distribution and under , the probability of outputting any is . Under , the probability is . Taking their ratio (and with a similar calculation for ), for any , we have:
Note that these likelihood ratios are conditioned on a particular , whereas the transcript distribution chooses uniformly at random, which averages the likelihood ratio over all . For any , a symmetry argument implies that . Since the same is true for a sample under (since the distribution is uniform), we have that
The challenge in analysis is that we are doing several samples with respect to a single sign vector , not just one sample, and we must account for correlations between the likelihood ratios of individual samples. The likelihood ratio for the whole transcript is as follows:
Note that, conditioned on a fixed sign vector , the answers are independent, justifying the product of the 's inside the expectation.
We look at the square of the likelihood ratio by taking a product with the same expression using independent randomness; we let denote an independently sampled sign vector.
Recall our goal is to bound
We can factor the expectation in the last equality since the 's are independent under the null. We rewrite each individual factor in this product as
We proceed to derive an expression for
We illustrate by focusing on a query to ; a query to will be analogous. Fix the sign vectors . We substitute the expression for and and expand the expectation:
We expand the numerator as follows:
The terms which are linear in vanish when we average over , as we substitute
Only the terms which are quadratic in remain, yielding
Doing the same calculations for a query to , we obtain an expression where the only difference is the denominator becomes .
At this point, we have obtained:
We further upper bound this using the inequality :
where we have defined
We use the power series expansion of this exponential:
The term evaluates to 1. The term vanishes:
where the first equality uses the definition of and independence of and , and the second equality uses (6.3). We then sum over to get .
Consequently,
It remains to bound these absolute moments. We do this by bounding the moments of each and then applying the triangle inequality. The proof of the following lemma (a variant of Khintchine inequality) appears in Appendix C.
Lemma 14. Let have even cardinality, and let be uniformly sampled from the set of all balanced sign vectors on . There is an absolute constant such that, for every vector and every ,
Specifically, we apply this bound to the two terms in the numerator of :
For the first term, fix and choose the coefficients in Lemma 14 to be
Then
Thus, for every integer , the lemma gives
\mathbb{E}_{\sigma}\left[\left|\frac{1}{s_{i}}\sum_{x\in S_{i}\cap D}\sigma_{x}\sigma_{x}^{\prime}\right|^{k}\right|\sigma^{\prime}\right]\leq\left(C_{0}\sqrt{\frac{k}{s_{i}}}\right)^{k}.This bound holds for every fixed , so averaging over gives the same bound on the joint expectation over both sign vectors.
For the second term, choose on and zero elsewhere in . Now , and the squared coefficients again sum to . The lemma gives
The same bound applies to . Independence of the two sign vectors then gives
Taking kth roots, we obtain the following bounds, with both norms over the two independent sign vectors:
We turn our attention to the denominator of , which is , where the sign depends on whether the query is to or . Regardless, based on the range of , we can lower bound this expression by . Using this denominator bound and then the triangle inequality gives
(6.5)
The last inequality uses , , and introduces a new absolute constant . Observe here that the dependence on the size of the intersection is , which is precisely how we defined the function .
We can now bound the moments of Z.
where we let . The two inequalities are triangle inequality and (6.5).
We now return to the series we were trying to bound. First, we consider the case . Equation (6.6) gives , and turns the bound into a geometric series:
The TV inequality from the start of the proof now gives
as desired by the lemma statement. When , we can use the trivial bound to conclude the proof.
6.3 Averaging over the Support Size
The previous section assumed a fixed support . In this section, we incorporate the randomness in the choice of . Informally speaking, a query set will only be informative if the size of its intersection with is non-zero (more precisely, at least 2) but also not too large (as the contribution to the total variation bound decays as ). Thus, a fixed query set would only contribute significantly under a few choices of the size of (on average, accounting for the random selection of itself). Since our hard instance construction randomizes over scales of the size of , unless we take at least that many queries, the distance between transcripts under and remains small.
Lemma 15. Let , choose uniformly from , and set . Choose to be a uniformly random subset of of size . For every fixed set ,
Proof. Let . For the time being, fix the support size and define
The randomness in the following bounds is exclusively over a uniformly random support of this fixed size, and we incorporate randomness in s itself at the very end of the proof.
We bound separately for small and large values of . We start with : intuitively, this captures the case where the query is unlikely to contain enough support points to contribute to the expectation. Since when or 1, and when , we have . Taking expectations gives
If (i.e., the expected intersection is substantial), split according to whether . If so, then will be small: . In the other case, may be large (we again will use the crude bound ), but we bound the probability that this case happens using Chebyshev's inequality. The indicators , for , are negatively correlated random variables: conditioning on one point belonging to the fixed-size support makes another less likely to belong. Hence, noting that
Chebyshev's inequality then gives . Consequently,
At this point, we sum over the choice of the support size . The expected intersection size doubles at each successive scale. We split the analysis as we did before, when and when . In the former case, a geometric series bounds the sum of conditional expectations by . In the latter case, we can similarly bound the sum of conditional expectations by the geometric series . Together,
The support scale is uniform among these L choices, so dividing by L gives the desired bound on expectation.
6.4 Completing the lower bound
At this point, we complete the argument by assembling the two pieces from the previous sections.
Proof of the lower bound of Theorem 1. Suppose an algorithm makes N queries, and fix its random seed . We represent its query list as
where denotes the -th query set and denotes which oracle we query. Note that since the algorithm is non-adaptive, the query list is independent of the input.
We augment the transcript by including the identity of the support D and the random seed . This can only give the testing algorithm more information and thus will not increase its error.
probability. Conditioning on , the answer lists under and are exactly those compared in Lemma 13, where the fixed query list is . Let denote the distribution of the augmented transcripts, and let denote the distribution of the augmented transcripts conditioned on a particular support and query list determined by a random seed . Because the augmented transcripts have the same distribution of under both and ,
Applying Lemma 13 for each fixed , then using linearity of expectation and Lemma 15, gives
(6.10)
Correctness requires us to output that with probability at least under and with probability at most under . These correspond to cases when we are given transcripts drawn from distributions and , respectively. We can lower bound the total variation distance between these cases by this gap in probabilities, and thus
It follows that
as desired.
References
[ACK15a] Jayadev Acharya, Clément L. Canonne, and Gautam Kamath. Adaptive estimation in weighted group testing. In Proceedings of the 2015 IEEE International Symposium on Information Theory, ISIT '15, pages 2116–2120. IEEE Computer Society, 2015.
[ACK15b] Jayadev Acharya, Clément L. Canonne, and Gautam Kamath. A chasm between identity and equivalence testing with conditional queries. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques., RANDOM '15, pages 449–466, Dagstuhl, Germany, 2015. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik.
[AD15] Jayadev Acharya and Constantinos Daskalakis. Testing Poisson binomial distributions. In Proceedings of the 26th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '15, pages 1829–1840. SIAM, 2015.
[ADJ 11] Jayadev Acharya, Hirakendu Das, Ashkan Jafarpour, Alon Orlitsky, and Shengjun Pan. Competitive closeness testing. In Proceedings of the 24th Annual Conference on Learning Theory, COLT '11, pages 47–68, 2011.
[ADK15] Jayadev Acharya, Constantinos Daskalakis, and Gautam Kamath. Optimal testing for properties of distributions. In Advances in Neural Information Processing Systems 28, NIPS '15, pages 3577–3598. Curran Associates, Inc., 2015.
[AFL24] Tomer Adar, Eldar Fischer, and Amit Levi. Improved bounds for high-dimensional equivalence and product testing using subcube queries. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques., RANDOM '24, pages 48:1–48:21, Dagstuhl, Germany, 2024. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik.
[AFL26] Tomer Adar, Eldar Fischer, and Amit Levi. Optimal mass estimation in the conditional sampling model. In Proceedings of the 37th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '26, pages 4105–4174. SIAM, 2026.
[BBCS26] Ari Biswas, Mark Bun, Clément L. Canonne, and Satchit Sivakumar. Interactive proofs for distribution testing with conditional oracles. In Proceedings of the 17th Conference on Innovations in Theoretical Computer Science, ITCS '26, pages 18:1–18:13, Dagstuhl, Germany, 2026. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik.
[BC17] Tuğkan Batu and Clément L. Canonne. Generalized uniformity testing. In Proceedings of the 58th Annual IEEE Symposium on Foundations of Computer Science, FOCS '17, pages 880–889. IEEE Computer Society, 2017.
[BC18] Rishiraj Bhattacharyya and Sourav Chakraborty. Property testing of joint distributions using conditional samples. Transactions on Computation Theory, 10(4):16:1–16:20, 2018.
[BCG17] Eric Blais, Clément L. Canonne, and Tom Gur. Distribution testing lower bounds via reductions from communication complexity. In Proceedings of the 32nd Computational Complexity Conference, CCC '17, pages 28:1–28:40, Dagstuhl, Germany, 2017. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik.
[BCŠV23] Antonio Blanca, Zongchen Chen, Daniel Štefankovič, and Eric Vigoda. Complexity of high-dimensional identity testing with coordinate conditional sampling. In Proceedings of the 36th Annual Conference on Learning Theory, COLT '23, pages 1774–1790, 2023.
[BFF 01] Tuğkan Batu, Eldar Fischer, Lance Fortnow, Ravi Kumar, Ronitt Rubinfeld, and Patrick White. Testing random variables for independence and identity. In Proceedings of the 42nd Annual IEEE Symposium on Foundations of Computer Science, FOCS '01, pages 442–451. IEEE Computer Society, 2001.
[BFR 00] Tuğkan Batu, Lance Fortnow, Ronitt Rubinfeld, Warren D. Smith, and Patrick White. Testing that distributions are close. In Proceedings of the 41st Annual IEEE Symposium on Foundations of Computer Science, FOCS '00, pages 259–269. IEEE Computer Society, 2000.
[BFRV11] Arnab Bhattacharyya, Eldar Fischer, Ronitt Rubinfeld, and Paul Valiant. Testing monotonicity of distributions over general partial orders. In Proceedings of the 2nd Conference on Innovations in Computer Science, ICS '11, pages 239–252, Beijing, China, 2011. Tsinghua University Press.
[BKR04] Tuğkan Batu, Ravi Kumar, and Ronitt Rubinfeld. Sublinear algorithms for testing monotone and unimodal distributions. In Proceedings of the 36th Annual ACM Symposium on the Theory of Computing, STOC '04. ACM, 2004.
[BRY14] Piotr Berman, Sofya Raskhodnikova, and Grigory Yaroslavtsev. Lp-testing. In Proceedings of the 46th Annual ACM Symposium on the Theory of Computing, STOC '14, pages 164–173. ACM, 2014.
[BV15] Bhaswar Bhattacharya and Gregory Valiant. Testing closeness with unequal sized samples. In Advances in Neural Information Processing Systems 28, NIPS '15, pages 2611–2619. Curran Associates, Inc., 2015.
[BW18] Sivaraman Balakrishnan and Larry Wasserman. Hypothesis testing for high-dimensional multinomials: A selective review. The Annals of Applied Statistics, 12(2):727–749, 2018.
[Can15] Clément L. Canonne. Big data on the rise? - testing monotonicity of distributions. In Proceedings of the 42nd International Colloquium on Automata, Languages, and Programming, ICALP '15, pages 294–305, 2015.
[Can16] Clément L. Canonne. Are few bins enough: Testing histogram distributions. In Proceedings of the 35th ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, PODS '16, pages 455–463. ACM, 2016.
[Can20] Clément L. Canonne. A survey on distribution testing: Your data is big. but is it blue? Theory of Computing, (9):1–100, 2020.
[Can22] Clément L. Canonne. Topics and techniques in distribution testing: A biased but representative sample. Foundations and Trends® in Communications and Information Theory, 19(6):1032–1198, 2022.
[CCK 21] Clément L. Canonne, Xi Chen, Gautam Kamath, Amit Levi, and Erik Waingarten. Random restrictions of high-dimensional distributions and uniformity testing with subcube conditioning. In Proceedings of the 32nd Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '21, pages 321–336. SIAM, 2021.
[CCK24] Diptarka Chakraborty, Sourav Chakraborty, and Gunjan Kumar. Tight lower bound on equivalence testing in conditional sampling model. In Proceedings of the 35th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '24, pages 4371–4394. SIAM, 2024.
[CCKM24] Diptarka Chakraborty, Sourav Chakraborty, Gunjan Kumar, and Kuldeep Meel. Equivalence testing: The power of bounded adaptivity. In Proceedings of the 27th International Conference on Artificial Intelligence and Statistics, AISTATS '24, pages 3592–3600. JMLR, Inc., 2024.
[CCR 25] Deeparnab Chakrabarty, Xi Chen, Simeon Ristic, C Seshadhri, and Erik Waingarten. Monotonicity testing of high-dimensional distributions with subcube conditioning. In Proceedings of the 57th Annual ACM Symposium on the Theory of Computing, STOC '25, pages 1019–1030. ACM, 2025.
[CDKS17] Clément L. Canonne, Ilias Diakonikolas, Daniel M. Kane, and Alistair Stewart. Testing Bayesian networks. In Proceedings of the 30th Annual Conference on Learning Theory, COLT '17, pages 370–448, 2017.
[CDVV14] Siu On Chan, Ilias Diakonikolas, Gregory Valiant, and Paul Valiant. Optimal algorithms for testing closeness of discrete distributions. In Proceedings of the 25th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '14, pages 1193–1203. SIAM, 2014.
[CFGM13] Sourav Chakraborty, Eldar Fischer, Yonatan Goldhirsh, and Arie Matsliah. On the power of conditional samples in distribution testing. In Proceedings of the 4th Conference on Innovations in Theoretical Computer Science, ITCS '13, pages 561–580. ACM, 2013.
[CFGM16] Sourav Chakraborty, Eldar Fischer, Yonatan Goldhirsh, and Arie Matsliah. On the power of conditional samples in distribution testing. SIAM Journal on Computing, 45(4):1261–1296, 2016.
[CJKL22] Clément L. Canonne, Ayush Jain, Gautam Kamath, and Jerry Li. The price of tolerance in distribution testing. In Proceedings of the 35th Annual Conference on Learning Theory, COLT '22, pages 573–624, 2022.
[CJLW21] Xi Chen, Rajesh Jayaram, Amit Levi, and Erik Waingarten. Learning and testing junta distributions with subcube conditioning. In Proceedings of the 34th Annual Conference on Learning Theory, COLT '21, pages 1060–1113, 2021.
[CKM23] Diptarka Chakraborty, Gunjan Kumar, and Kuldeep S Meel. Support size estimation: The power of conditioning. In 48th International Symposium on Mathematical Foundations of Computer Science, MFCS '23, pages 33:1–33:13, 2023.
[CM24] Xi Chen and Cassandra Marcussen. Uniformity testing over hypergrids with subcube conditioning. In Proceedings of the 35th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '24, pages 4338–4370. SIAM, 2024.
[CRS14] Clément L. Canonne, Dana Ron, and Rocco A. Servedio. Testing equivalence between distributions using conditional samples. In Proceedings of the 25th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '14, pages 1174–1192. SIAM, 2014.
[CRS15] Clément L. Canonne, Dana Ron, and Rocco A. Servedio. Testing probability distributions using conditional samples. SIAM Journal on Computing, 44(3):540–616, 2015.
[DDK18] Constantinos Daskalakis, Nishanth Dikkala, and Gautam Kamath. Testing Ising models. In Proceedings of the 29th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '18, pages 1989–2007. SIAM, 2018.
[DDS 13] Constantinos Daskalakis, Ilias Diakonikolas, Rocco A. Servedio, Gregory Valiant, and Paul Valiant. Testing k-modal distributions: Optimal algorithms via reductions. In Proceedings of the 24th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '13, pages 1833–1852. SIAM, 2013.
[DGK 21] Ilias Diakonikolas, Themis Gouleakis, Daniel M Kane, John Peebles, and Eric Price. Optimal testing of discrete distributions with high probability. In Proceedings of the 53rd Annual ACM Symposium on the Theory of Computing, STOC '21. ACM, 2021.
[DGPP18] Ilias Diakonikolas, Themis Gouleakis, John Peebles, and Eric Price. Sample-optimal identity testing with high probability. In Proceedings of the 45th International Colloquium on Automata, Languages, and Programming, ICALP '18, pages 41:1–41:14, 2018.
[DK16] Ilias Diakonikolas and Daniel M. Kane. A new approach for testing properties of discrete distributions. In Proceedings of the 57th Annual IEEE Symposium on Foundations of Computer Science, FOCS '16, pages 685–694. IEEE Computer Society, 2016.
[DKN15] Ilias Diakonikolas, Daniel M. Kane, and Vladimir Nikishkin. Testing identity of structured distributions. In Proceedings of the 26th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '15, pages 1841–1854. SIAM, 2015.
[DKW18] Constantinos Daskalakis, Gautam Kamath, and John Wright. Which distribution distances are sublinearly testable? In Proceedings of the 29th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '18, pages 2747–2764. SIAM, 2018.
[FJO 15] Moein Falahatgar, Ashkan Jafarpour, Alon Orlitsky, Venkatadheeraj Pichapati, and Ananda Theertha Suresh. Faster algorithms for testing under conditional sampling. In Proceedings of the 28th Annual Conference on Learning Theory, COLT '15, pages 607–636, 2015.
[FLV17] Eldar Fischer, Oded Lachish, and Yadu Vasudev. Improving and extending the testing of distributions for shape-restricted properties. In Proceedings of the 34th Symposium on Theoretical Aspects of Computer Science, STACS '17, pages 31:1–31:14, Dagstuhl, Germany, 2017. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik.
[GGR96] Oded Goldreich, Shafi Goldwasser, and Dana Ron. Property testing and its connection to learning and approximation. In Proceedings of the 37th Annual IEEE Symposium on Foundations of Computer Science, FOCS '96, pages 339–348. IEEE Computer Society, 1996.
[GHKO26] William Gay, William He, Nicholas Kocurek, and Ryan O'Donnell. Sampling and identity-testing without approximate tensorization of entropy. In Proceedings of the 43rd International Conference on Machine Learning, ICML '26, pages 34375–34392. JMLR, Inc., 2026.
[Gol14] Oded Goldreich. On multiple input problems in property testing. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques., RAN-DOM '14, pages 704–720, Dagstuhl, Germany, 2014. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik.
[Gol17] Oded Goldreich. Introduction to Property Testing. Cambridge University Press, 2017.
[GR00] Oded Goldreich and Dana Ron. On testing expansion in bounded-degree graphs. Electronic Colloquium on Computational Complexity (ECCC), 7(20), 2000.
[GTZ17] Themistoklis Gouleakis, Christos Tzamos, and Manolis Zampetakis. Faster sublinear algorithms using conditional sampling. In Proceedings of the 28th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '17, pages 1743–1757. SIAM, 2017.
[GTZ18] Themis Gouleakis, Christos Tzamos, and Manolis Zampetakis. Certified computation from unreliable datasets. In Proceedings of the 31st Annual Conference on Learning Theory, COLT '18, pages 3271–3294, 2018.
[ILR12] Piotr Indyk, Reut Levi, and Ronitt Rubinfeld. Approximating and testing k-histogram distributions in sub-linear time. In Proceedings of the 31st ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, PODS '12, pages 15–22. ACM, 2012.
[Kam18] Gautam Kamath. Modern Challenges in Distribution Testing. PhD thesis, Massachusetts Institute of Technology, September 2018.
[KT19] Gautam Kamath and Christos Tzamos. Anaconda: A non-adaptive conditional sampling algorithm for distribution testing. In Proceedings of the 30th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '19, pages 679–693. SIAM, 2019.
[LNQR26] Daeho Lee, Shivam Nadimpalli, Mingda Qiao, and Ronitt Rubinfeld. Testing unate distributions. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques., RANDOM '26, pages 57:1–57:24, Dagstuhl, Germany, 2026. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik.
[MKP25] Kuldeep S. Meel, Gunjan Kumar, and Yash Pote. Distance estimation for high-dimensional discrete distributions. In Proceedings of the 28th International Conference on Artificial Intelligence and Statistics, AISTATS '25, pages 955–963. JMLR, Inc., 2025.
[Nar21] Shyam Narayanan. On tolerant distribution testing in the conditional sampling model. In Proceedings of the 32nd Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '21, pages 357–373. SIAM, 2021.
[Pan08] Liam Paninski. A coincidence-based test for uniformity given very sparsely sampled discrete data. IEEE Transactions on Information Theory, 54(10):4750–4755, 2008.
[RT16] Dana Ron and Gilad Tsur. The power of an example: Hidden set size approximation using group queries and conditional sampling. Transactions on Computation Theory, 8(4):15:1 – 15:19, 2016.
[Rub12] Ronitt Rubinfeld. Taming big probability distributions. XRDS, 19(1):24–28, 2012.
[SSJ17] Imdad S. B. Sardharwalla, Sergii Strelchuk, and Richard Jozsa. Quantum conditional query complexity. Quantum Information & Computation, 17(7& 8):541–566, 2017.
[Val11] Paul Valiant. Testing symmetric properties of distributions. SIAM Journal on Computing, 40(6):1927–1968, 2011.
[Ver18] Roman Vershynin. High-Dimensional Probability: An Introduction with Applications in Data Science. Cambridge University Press, 2018.
[VV11] Gregory Valiant and Paul Valiant. Estimating the unseen: An -sample estimator for entropy and support size, shown optimal via new CLTs. In Proceedings of the 43rd Annual ACM Symposium on the Theory of Computing, STOC '11, pages 685–694. ACM, 2011.
[VV14] Gregory Valiant and Paul Valiant. An automatic inequality prover and instance optimal identity testing. In Proceedings of the 55th Annual IEEE Symposium on Foundations of Computer Science, FOCS '14, pages 51–60. IEEE Computer Society, 2014.
[VV17] Gregory Valiant and Paul Valiant. An automatic inequality prover and instance optimal identity testing. SIAM Journal on Computing, 46(1):429–455, 2017.
[Wag15] Bo Waggoner. testing and learning of discrete distributions. In Proceedings of the 6th Conference on Innovations in Theoretical Computer Science, ITCS '15, pages 347–356. ACM, 2015.
A Testing Primitives
A.1 Test-equal Pseudocode
The pseudocode for TEST-EQUAL appears in Algorithm 2. Note that this procedure employs the common technique of Poissonization: rather than drawing exactly m samples from a distribution, we draw a random Poi(m) samples. This is convenient for the sake of analysis, as the number of occurrences of each symbol will be independently distributed as Poi(m ), where is the probability of that symbol. With high probability, the total number of samples used by TEST-EQUAL is – consequently, we can simply increase our (fixed) sample budget by a constant factor, and if this budget is exceeded due to the Poissonization (a rare event), we can answer arbitrarily and fold any incorrect answer into the failure probability .
Algorithm 2 TEST-EQUAL [FJO 15]
Require: error bound , error probability , distributions and .
Repeat times and output the majority:
1: Let and be two independent Poisson variables with mean .
2: Draw samples from the first distribution and from the second one.
3: Let and .
4: If , then output same, else diff.
A.2 Proof of Corollary 5
The algorithm first draws samples from both p and q. It then runs TEST-EQUAL on each of the observed symbols, of which there are at most 2d, with parameters and . To run these tests, it draws a fresh batch of samples of size , which is reused across all tests. If all of the tests return same, then return same, if any of the tests return diff, then return diff.
If , then a union bound over all tests implies that, with probability , they will all return same and thus the test correctly outputs same. On the other hand, suppose there exists some such that . Algebraic manipulation implies that , and thus the probability that is not observed in either of the two batches is at most . The test on symbol will correctly output diff with probability at least and thus the test outputs diff with probability at least .
B A Moment Bound for Random Restrictions
We restate the lemma for convenience:
Lemma 12. Let , let , and let satisfy
Let be independent variables, and set . Then
Proof. We rescale all quantities by units of : let , , and . Define
Since , s_r = \sum_\ell b'_\ell^{r-1} b'_\ell \rho \leq 2^{r-1} \tau. We proceed to bound the first four moments of . To do so, we can expand the powers of and, using multinomial expansion, group terms by which indices coincide. To illustrate, if we were to expand , we would have the terms where the indices do match, \sum_\ell b'_\ell^2 \xi_\ell^2, and don't match, . Taking expectation of the first sum, it comes to \sum_\ell \rho b'_\ell^2 = s_2, which is upper bounded by . Taking the expectation of the second sum and using independence of the s, we get . We can upper bound this by the unrestricted sum . Other cases for the higher moments follow similarly.
Therefore, using ,
☐
C A Moment Bound for Balanced Signs
In this section, we prove the following technical lemma:
Lemma 14. Let have even cardinality, and let be uniformly sampled from the set of all balanced sign vectors on . There is an absolute constant such that, for every vector and every ,
Note that the challenge here comes from the balance requirement, as that introduces dependence between the signs. Otherwise, if the were independent Rademacher random variables, this would be recognizable as the Khintchine inequality.
Lemma 16 (Khintchine inequality [Ver18]). Let be a finite set, and let the signs be independently and uniformly sampled from . There is an absolute constant such that, for every vector and every ,
We essentially reduce to this statement by introducing a random perfect matching over D, where opposite signs are assigned to endpoints of the matching.
Proof of Lemma 14. Choose a uniformly random perfect matching between the elements of the set . For each pair in this matching, independently set or with equal probability. The resulting sign vector satisfies the conditions of the lemma.
Conditional on a fixed matching, each pair contributes to the sum , with independent uniform choices of sign across pairs. Applying the Khintchine inequality (Lemma 16) to this Rademacher sum gives
\left(\mathbb{E}\left[\left|\sum_{x}a_{x}\sigma_{x}\right|^{k}\right|\mathrm{m a t c h i n g}\right]\right)^{1/k}\leq C\sqrt{k}\left(\sum_{\{u,v\}\mathrm{m a t c h e d}}(a_{u}-a_{v})^{2}\right)^{1/2}.Since and each point belongs to one pair,
We raise the conditional moment bound to the kth power, and note that the bound holds pointwise for every matching, giving
Taking kth roots proves the lemma with .