Sort, Partition, Randomize: Optimal Binary Hypothesis Testing under Local Differential Privacy

Elena Ghazi, Jawad Nasser, Flavio Calmon, Ibrahim IssaNeurIPS 2026

TL;DR

Suppose you need to determine which of two known distributions generated a dataset, but privacy rules require every single data point to be randomized before you ever see it. Finding the mathematically optimal way to add this privacy noise used to require exponential-time algorithms, making it impossible for anything beyond tiny alphabets. This paper proves that the optimal strategy always follows a remarkably clean recipe—Sort, Partition, Randomize—turning an intractable search into a fast, exact $O(k^3)$ dynamic program.

What Problem Does This Paper Address?

Imagine users hold a discrete data point $X$ from an alphabet of size $k$, drawn from either hypothesis $P_0$ or $P_1$. Under $\varepsilon$-Local Differential Privacy ($\varepsilon$-LDP), there is no trusted curator: each user independently passes their symbol through a noisy channel $Q$ before sharing it, ensuring that no output makes one input more than $e^\varepsilon$ times likelier than another.

As the analyst, you want to design $Q$ so that the privatized output distributions remain as distinguishable as possible. Distinguishability is measured via $f$-divergences—a family of statistical distances (like KL divergence, Total Variation, and Hellinger distance) that directly govern error rates and sample complexity in hypothesis testing.

Prior work showed that optimal LDP channels belong to a family called "staircase mechanisms," where output probabilities jump between just two levels ($1$ and $e^\varepsilon$, up to scaling). Unfortunately, searching over all possible staircase patterns requires solving a linear program with $2^k$ variables. Exact solutions were known for extreme privacy ($\varepsilon \to 0$) or very low privacy ($\varepsilon \to \infty$), leaving the entire middle ground computationally out of reach for larger alphabets.

Methods

Instead of brute-forcing $2^k$ subsets, the authors study the geometry of the joint range—the convex polytope of all pairs of output distributions achievable by $\varepsilon$-LDP channels (optionally capped at an output communication budget of $\ell$ symbols). Because $f$-divergences are convex, the maximum distinguishability always sits at an extreme point (corner) of this polytope.

Using local perturbation arguments and a flow-decomposition peeling technique, the authors prove that every extreme point corresponds to a Sort–Partition–Randomize (SPR) mechanism:

  1. Sort the $k$ input symbols by their likelihood ratio, $P_0(x)/P_1(x)$.
  2. Partition this sorted list into $s$ contiguous blocks (where $s \le \min(\ell, k)$).
  3. Randomize the block index using standard $s$-ary Randomized Response (reporting the true block with weight $e^\varepsilon$ and any other block with weight $1$).
Figure 2: An LR-contiguous partition and the corresponding staircase pattern, with inputs labeled so that r1 ≤r2 ≤· · · ≤r6 where ri = pi/qi. After normalization, this becomes 3-ary RR on the block label.

Because $f$-divergences sum cleanly across outputs, finding the best contiguous partition for a fixed number of blocks $s$ breaks down into optimal prefix subproblems. A straightforward dynamic program solves this across all $s \le \ell$ in $O(\ell k^2)$ time—or $O(k^3)$ time when output size is unconstrained.

Datasets

Not discussed in the paper (as a theoretical work, numerical validation is conducted on 100 synthetic distribution pairs $(P_0, P_1)$ sampled from a symmetric $\text{Dirichlet}(\mathbf{1})$ distribution rather than empirical datasets).

Key Insights and Ideas

  • Intuitive data compression: Optimal local privacy doesn't require exotic, interleaved noise matrices. You simply group symbols that provide similar statistical evidence ($P_0(x)/P_1(x)$) into coarse buckets, and privatize the bucket label.
  • Bridging the privacy regimes: Previously, we knew binary mechanisms were optimal at high privacy (small $\varepsilon$) and full $k$-ary randomized response could be optimal at low privacy (large $\varepsilon$). SPR reveals how optimal mechanisms smoothly morph between the two: as $\varepsilon$ grows, the optimal partition splits into finer and finer likelihood-ratio intervals.
  • The Private Neyman–Pearson Lemma: For hockey-stick ($E_\gamma$) divergences—which capture asymmetric false-alarm vs. missed-detection costs—the math collapses to a closed form. Regardless of your privacy budget $\varepsilon$ or output budget $\ell \ge 2$, a simple binary split at threshold $\gamma$ is optimal. Privacy doesn't shift the classical Neyman–Pearson decision boundary; it only adds binary randomized response to the resulting bit.

Key Results

  • Exponential to polynomial: Exact channel design drops from $O(2^k)$ LP variables (or $k^{\ell^2} 2^{O(\ell^3 \log \ell)}$ under communication budgets) down to $O(\ell k^2)$ time and $O(\ell k)$ space.
  • Exactness & Scalability: In synthetic KL-divergence experiments with $k=6$, the SPR dynamic program matches the exact exponential staircase LP to machine precision. At $k=100$—where the LP requires $2^{100}$ variables and is completely intractable—SPR computes the exact optimum effortlessly, visibly outperforming both binary and $k$-ary baselines across intermediate $\varepsilon \in [2, 8]$.
Figure 1: Average normalized KL utility Dkl(M0∥M1)/Dkl(P0∥P1) versus ε over 101 values in [0, 10], averaged over 100 Dirichlet(1) pairs (P0, P1) drawn with NumPy seed 0. For k = 6, the SPR dynamic program coincides with the KOV staircase LP (HiGHS via scipy.optimize.linprog) to numerical precision, validating the exactness of the SPR reduction. For k = 100, the KOV LP has 2100 variables and is omitted, while the SPR dynamic program remains tractable. The binary mechanism and k-ary RR capture the high- and low-privacy regimes but can be suboptimal in the intermediate regime, where the optimal SPR mechanism adapts by choosing an LR-contiguous partition between a coarse binary split and full randomized response. Implementation details and bootstrap confidence bands are reported in Appendix G.

Limitations and Future Work

  • Task-specific aggregation: Bucketing symbols by likelihood ratio is optimal for distinguishing $P_0$ from $P_1$, but permanently discards fine-grained data that might be needed for other downstream tasks.
  • Scope of assumptions: The guarantee holds for simple binary testing (known $P_0, P_1$ on finite alphabets), non-interactive protocols, and pure $\varepsilon$-LDP. Extending SPR to approximate $(\varepsilon, \delta)$-LDP, interactive multi-round testing, composite hypotheses, or multi-hypothesis testing (where likelihood ratios are vectors with no natural 1D sort order) remains open.
  • Non-additive objectives: While SPR structure still characterizes extreme points for broader objectives like Chernoff information, the $O(\ell k^2)$ dynamic program relies on the additive block structure of $f$-divergences (and Rényi divergences). Fast exact algorithms for non-additive objectives are left for future work.

Summary updated

Abstract

We study optimal design of $\varepsilon$-locally differentially private mechanisms for binary hypothesis testing in the non-interactive setting. We optimize a mechanism $Q$ for a single observation drawn from one of two known distributions $P_0,P_1$ on a finite alphabet of size $k$; applying $Q$ independently to multiple observations gives a non-interactive testing protocol. We measure testing utility using an $f$-divergence—including total variation, KL, and hockey-stick divergences—between the two induced output distributions. Previous work established structural properties of optimal mechanisms, but only yielded exponential-time algorithms. We prove a sharp structure: for every $\varepsilon$ and every $f$-divergence objective, after sorting the alphabet by likelihood ratio, there exists an optimal mechanism that partitions the sorted alphabet into contiguous blocks and applies randomized response to the block label. We call this class Sort–Partition–Randomize (SPR). This characterization yields an exact dynamic program that computes an optimal mechanism in $O(k^3)$ time, and more generally in $O(\ell k^2)$ time with an $\ell$-output budget. Our results make it possible to efficiently compute and characterize the exact optimum across the full privacy range, beyond asymptotic privacy regimes.
BibTeX
@inproceedings{ghazi2026sort,
  author = {Elena Ghazi and Jawad Nasser and Flavio Calmon and Ibrahim Issa},
  title = {{Sort, Partition, Randomize: Optimal Binary Hypothesis Testing under Local Differential Privacy}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=W2N0BOvMCF},
}
Figure