NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Subset Sampling and Its Extensions

Jinchao Huang, Sibo WangarXiv 2023 · DOI

Abstract

In the era of massive datasets, returning all records matching a query is often computationally prohibitive. Query sampling offers a solution by providing representative subsets. This paper introduces the first optimal dynamic data structure for subset sampling (SS), allowing for efficient updates and queries. Furthermore, the authors extend these techniques to the External Memory (EM) model for out-of-core datasets and to Range Subset Sampling (RSS) for interval-constrained queries. The resulting theoretical bounds are either optimal or represent significant improvements over existing literature.

Introduction

Modern data analysis frequently encounters "Big Data" scenarios where query selectivity, though low, still results in billions of records. For instance, a 1% selectivity on a trillion-row dataset yields 10 billion records, creating immense I/O and network overhead. Subset Sampling (SS) addresses this by returning a random subset $X$ where each record $v$ is selected independently with probability $p(v)$.

While static SS has been solved with optimal query time, real-world databases require dynamism (handling insertions and deletions) and must often operate on data exceeding RAM capacity. Additionally, users frequently require sampling from specific ranges (e.g., products within a price bracket). This paper provides a comprehensive framework to address these challenges: dynamism, external memory efficiency, and range constraints.

Methodology

The authors propose a multi-layered "divide and conquer" approach centered on probability scales and efficient data structures.

Probability Baskets and Jump Optimization

To avoid the $O(n)$ cost of individual coin flips for each record, the algorithm partitions records into "baskets" based on their selection probabilities (e.g., $p(v) \in [2^{-l}, 2^{-l+1})$). Within each basket, a "jump solution" is employed. By utilizing geometric distributions, the algorithm calculates the number of records to skip before the next successful sample, reducing query time to the expected output size $\mu_S$.

Tabulation for Tiny Sub-problems

To achieve $O(1)$ query time for managing the "basket of baskets," the problem size is recursively reduced until it reaches $O(\log \log n)$. At this scale, the authors utilize a precomputed lookup table. This table stores "jump" instructions for all possible states of the sub-problem. To facilitate this, probabilities are discretized into $m^2$ levels, a process proven to maintain the statistical integrity of the sample.

Range Subset Sampling via Treaps

For Range Subset Sampling (RSS), the authors integrate SS structures into a Treap—a randomized binary search tree. Each node represents a "slab" of the key range and houses a secondary subset sampling structure. The inherent efficiency of Treap rotations allows for maintaining these secondary structures during dynamic updates with $O(\log n)$ overhead.

External Memory Adaptation

The External Memory (EM) adaptation addresses the slow random access of disks. The algorithm employs repeated size reduction until the problem fits within the machine's internal memory, where the tabulation methods can be efficiently applied.

Theoretical Results

The paper establishes several new benchmarks in computational complexity for subset sampling. The RAM results for Subset Sampling are theoretically optimal.

Comparison of computational bounds for various subset sampling problems, highlighting the improvements made in this paper for dynamic and range-constrained scenarios.

As shown in the table above, the dynamic SS implementation in RAM achieves $O(1 + \mu_S)$ query time with $O(1)$ amortized modification time. The Range Subset Sampling (RSS) extension provides $O(\log n + \mu_{S \cap [a,b]})$ query time, a significant result for interval-based queries.

Conclusion and Future Work

This work provides a robust theoretical foundation for dynamic and range-constrained subset sampling. While the RAM solutions are optimal, several avenues for future research remain. The current External Memory solution is restricted to static datasets; developing an I/O-efficient dynamic version is a primary goal. Additionally, extending Range Subset Sampling from 1D keys to multi-dimensional spatial ranges would broaden its applicability to geographic and multi-attribute data analysis. Finally, while the tabulation method is mathematically elegant, practical implementation requires careful tuning of discretization constants to manage space overhead.

Summary updated

BibTeX
@misc{huang2023subset,
  author = {Jinchao Huang and Sibo Wang},
  title = {{Subset Sampling and Its Extensions}},
  year = {2023},
  eprint = {2307.11585},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2307.11585},
}
Figure