Counting Distinct Elements in the Turnstile Model with Differential Privacy under Continual Observation

Palak Jain, Iden Kalemaj, Sofya Raskhodnikova, Satchit Sivakumar, Adam D. Smith · DOI

Introduction

Counting the number of distinct elements in a data stream is a fundamental task in data processing, with applications ranging from monitoring unique website visitors to tracking active users in a network. In many modern applications, data is not merely added to a stream but can also be removed—a scenario known as the turnstile model. Examples include users de-registering from a service, items being removed from a digital shopping cart, or social media "unlikes."

While maintaining Differential Privacy (DP) for insertion-only streams is well-understood, the complexity of the turnstile model under continual observation—where a private estimate must be released at every time step—has remained an open question. This paper establishes that the turnstile model is fundamentally more difficult than the insertion-only setting, introduces a new parameter called "flippancy" to characterize this difficulty, and provides nearly matching upper and lower bounds for the achievable error.

The Complexity Gap: Why Deletions Matter

In an insertion-only stream of length $T$, private algorithms can maintain an estimate of distinct elements with an additive error that grows only polylogarithmically with $T$. However, the introduction of deletions changes the landscape of privacy significantly.

The authors demonstrate a "Turnstile Tax": a fundamental jump in the error required to maintain privacy. They prove that any item-level $(\epsilon, \delta)$-DP mechanism for turnstile streams must incur an additive error of at least $\Omega(T^{1/3})$. Even for the weaker notion of event-level privacy, the error is bounded below by $\Omega(T^{1/4})$. This suggests that the presence of deletions makes the stream's state much more sensitive to individual changes, necessitating significantly more noise to preserve privacy.

Flippancy: The Key Parameter

To bridge the gap between the easy insertion-only case and the hard worst-case turnstile case, the authors introduce flippancy ($w$). Flippancy is defined as the maximum number of times any single item oscillates between being present and absent in the stream.

  • Low Flippancy: If users rarely join and leave (e.g., $w$ is small), the stream behaves more like an insertion-only stream.
  • High Flippancy: If items are frequently added and removed, the sensitivity of the count increases, requiring higher noise.

By parameterizing the error in terms of $w$, the authors provide a more nuanced understanding of the problem: the error is not just a function of the stream length $T$, but of how volatile the individual elements are.

Algorithmic Framework

The paper proposes a new algorithmic framework to achieve privacy while minimizing error based on the flippancy of the stream. The approach relies on two primary components:

1. Modified Binary Tree Mechanism

The binary tree mechanism is a standard tool for private continual release, where noise is added to nodes representing partial sums. The authors adapt this by bounding the sensitivity of the tree nodes based on the flippancy $w$. By ignoring items that exceed a certain flippancy threshold, the algorithm can guarantee privacy for any stream while maintaining high accuracy for those that remain relatively stable.

2. Adaptive Flippancy Tracking

In practice, the maximum flippancy $w$ is rarely known in advance. To address this, the authors introduce Algorithm 3, which utilizes the Sparse Vector Technique (SVT). The SVT acts as a private monitor that triggers an "alarm" whenever the number of items exceeding the current flippancy estimate becomes too high. When the alarm sounds, the algorithm adaptively increases its noise scale and flippancy bound, allowing it to remain accurate without prior knowledge of the stream's volatility.

Key Results and Bounds

The paper establishes nearly matching upper and lower bounds for additive error $\alpha$:

  • Upper Bound: The proposed item-level $(\epsilon, \delta)$-DP mechanism achieves an error of $\tilde{O}(\min(\sqrt{w} \cdot \text{polylog } T, T^{1/3}))$.
  • Lower Bounds: The authors prove that $\Omega(T^{1/4})$ error is unavoidable for event-level privacy and $\Omega(T^{1/3})$ for item-level privacy in the worst case.
  • The "Likes" Model: Interestingly, the authors show that if the model is restricted such that an item can only be deleted if it was previously inserted (the "likes" model), event-level privacy becomes much easier, allowing for the same $\text{polylog}(T)$ error seen in insertion-only streams.

Conclusion and Future Work

This work provides a comprehensive theoretical foundation for private distinct counting in turnstile streams. By identifying flippancy as the critical parameter, the authors clarify why deletions make privacy harder and provide the first robust algorithms for this setting.

Future research directions include addressing memory constraints, as this work focuses on the privacy-accuracy trade-off rather than space efficiency. Integrating these flippancy-based techniques with streaming sketches like HyperLogLog remains a significant challenge. Additionally, closing the remaining gap in event-level privacy bounds for intermediate flippancy values remains an open theoretical problem.

Summary updated

BibTeX
@inproceedings{jain2023counting,
  author = {Palak Jain and Iden Kalemaj and Sofya Raskhodnikova and Satchit Sivakumar and Adam D. Smith},
  title = {{Counting Distinct Elements in the Turnstile Model with Differential Privacy under Continual Observation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=CQ38aC92WY},
}
Figure