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

Differentially Private Space-Efficient Algorithms for Counting Distinct Elements in the Turnstile Model

Rachel Cummings, Alessandro Epasto, Jieming Mao, Tamalika Mukherjee, Tingting Ou, Peilin Zhong

Introduction

In the field of real-time data analysis, tracking the number of distinct elements in a data stream is a fundamental task. However, when the data involves sensitive user information, providing these statistics requires rigorous privacy guarantees, typically through Differential Privacy (DP). The challenge intensifies in the "turnstile model," where data is fully dynamic—items can be both added and deleted—and the system must provide a "continual release" of the count at every time step.

Historically, achieving both differential privacy and sublinear memory usage in this model has been an open problem. While space-efficient DP algorithms exist for insertion-only streams, the turnstile model introduces fluctuating sensitivity that previously required linear memory $\Omega(T)$ to manage. This paper presents the first algorithm to achieve sublinear space and additive error, specifically $\tilde{O}(T^{1/3})$, for counting distinct elements in a private, dynamic stream.

The Challenge of the Turnstile Model

In a turnstile stream, the state of an item (whether it is present or absent) can change frequently. Previous DP streaming algorithms relied on a metric called flippancy, which measures how many times an item's status switches between "present" and "absent."

The primary issue with flippancy is that it is highly stateful. To determine if a deletion causes an item to disappear from the set of distinct elements, an algorithm must know the item's current count. Tracking these counts for all items in a massive universe requires memory proportional to the number of items or the stream length, defeating the purpose of a sublinear-space streaming algorithm. Consequently, prior state-of-the-art methods for turnstile streams failed to scale.

The Shift to Stateless Metrics: Occurrency

The authors' key insight is a shift from the stateful flippancy metric to a new, stateless metric called occurrency. Occurrency is defined as the total number of times an item appears in the stream, counting both insertions and deletions as increments.

Because occurrency does not depend on the current net count of an item, it is much easier to bound within low-memory constraints. By basing the sensitivity of the DP mechanism on occurrency rather than flippancy, the authors bypass the linear memory requirements that hindered previous research.

The Algorithmic Framework

The proposed solution integrates three core components to balance privacy, space, and accuracy:

  1. KSET Data Structure: The algorithm uses a low-space, non-private dictionary structure to maintain a sample of the distinct elements currently in the stream.
  2. Binary Tree Mechanism: To handle the requirement of continual release, the algorithm employs a standard DP binary tree mechanism. This structure processes changes in the KSET size and adds Gaussian noise to ensure that the released counts at each time step remain private.
  3. Probabilistic Blocklisting: To handle streams where the maximum occurrency of any single item is unknown, the authors introduce a novel blocklisting technique. Each time an element appears, it is sampled with a small probability $p$. If sampled, the item is added to a blocklist, and all its future appearances are ignored. This effectively caps the maximum occurrency (and thus the sensitivity) of any item, allowing the algorithm to maintain privacy even in arbitrary streams.

To prevent privacy leaks through the failure of the underlying data structures, the authors implemented a "graceful failure" mode. If the KSET exceeds its capacity, the algorithm returns a TOO-HIGH flag rather than a specific count, ensuring that the failure itself does not reveal sensitive information about the stream's composition.

Key Results and Optimality

The paper establishes several significant bounds for the distinct elements problem:

  • Known Occurrency ($W$): If the maximum occurrency is bounded by $W$, the algorithm achieves a $(1+\eta)$-relative approximation with $\tilde{O}_\eta(\sqrt{W})$ additive error and space.
  • Arbitrary Streams: For streams with unknown occurrency, the algorithm achieves a $(1+\eta)$-relative approximation with $\tilde{O}_\eta(T^{1/3})$ additive error and space.
  • Information-Theoretic Lower Bound: The authors prove a space lower bound of $\tilde{\Omega}(T/W)$ for any algorithm using blocklisting. When applied to arbitrary streams ($W = T^{2/3}$), this matches their $\tilde{O}(T^{1/3})$ result, proving their approach is near-optimal for this class of techniques.

Conclusion and Future Work

This work provides a major step forward in private streaming algorithms by demonstrating that sublinear space is possible in the turnstile model. While the $\tilde{O}(T^{1/3})$ error is a significant improvement, a gap remains between this result and the known theoretical lower bound for additive error in DP turnstile counting, which is $\Omega(T^{1/4})$. Future research is needed to close this gap and to explore unconditional space lower bounds that apply to all DP continual release algorithms, regardless of whether they utilize blocklisting.

Summary updated

BibTeX
@inproceedings{cummings2025differentially,
  author = {Rachel Cummings and Alessandro Epasto and Jieming Mao and Tamalika Mukherjee and Tingting Ou and Peilin Zhong},
  title = {{Differentially Private Space-Efficient Algorithms for Counting Distinct Elements in the Turnstile Model}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=O37Pg2cm7y},
}
Figure