English

Perfect Sampling in Turnstile Streams Beyond Small Moments

Data Structures and Algorithms 2025-04-11 v1

Abstract

Given a vector xRnx \in \mathbb{R}^n induced by a turnstile stream SS, a non-negative function G:RRG: \mathbb{R} \to \mathbb{R}, a perfect GG-sampler outputs an index ii with probability G(xi)j[n]G(xj)+1poly(n)\frac{G(x_i)}{\sum_{j\in[n]} G(x_j)}+\frac{1}{\text{poly}(n)}. Jayaram and Woodruff (FOCS 2018) introduced a perfect LpL_p-sampler, where G(z)=zpG(z)=|z|^p, for p(0,2]p\in(0,2]. In this paper, we solve this problem for p>2p>2 by a sampling-and-rejection method. Our algorithm runs in n12/ppolylog(n)n^{1-2/p} \cdot \text{polylog}(n) bits of space, which is tight up to polylogarithmic factors in nn. Our algorithm also provides a (1+ε)(1+\varepsilon)-approximation to the sampled item xix_i with high probability using an additional ε2n12/ppolylog(n)\varepsilon^{-2} n^{1-2/p} \cdot \text{polylog}(n) bits of space. Interestingly, we show our techniques can be generalized to perfect polynomial samplers on turnstile streams, which is a class of functions that is not scale-invariant, in contrast to the existing perfect LpL_p samplers. We also achieve perfect samplers for the logarithmic function G(z)=log(1+z)G(z)=\log(1+|z|) and the cap function G(z)=min(T,zp)G(z)=\min(T,|z|^p). Finally, we give an application of our results to the problem of norm/moment estimation for a subset Q\mathcal{Q} of coordinates of a vector, revealed only after the data stream is processed, e.g., when the set Q\mathcal{Q} represents a range query, or the set nQn\setminus\mathcal{Q} represents a collection of entities who wish for their information to be expunged from the dataset.

Cite

@article{arxiv.2504.07237,
  title  = {Perfect Sampling in Turnstile Streams Beyond Small Moments},
  author = {David P. Woodruff and Shenghao Xie and Samson Zhou},
  journal= {arXiv preprint arXiv:2504.07237},
  year   = {2025}
}

Comments

To appear in PODS 2025

R2 v1 2026-06-28T22:52:52.197Z