Streaming Private Continual Counting via Binning

Joel Daniel Andersson, Rasmus Pagh

TL;DR

This paper introduces a "binning" technique to make high-accuracy, differentially private continual counting memory-efficient. By approximating optimal matrix factorizations with sublinear space, the authors achieve state-of-the-art privacy-utility trade-offs that are practical for large-scale applications like deep learning.

What Problem Does This Paper Address?

In the world of Differential Privacy (DP), continual observation is a challenging setting where data arrives one element at a time, and we must provide a private answer (like a running total) at every single step. A classic example is continual counting: maintaining a prefix sum of a binary stream (0s and 1s).

This is a critical building block for private machine learning. In Differentially Private Stochastic Gradient Descent (DP-SGD), we often need to track prefix sums of gradient vectors. The "gold standard" for accuracy in this task is the factorization mechanism, specifically using the Bennett matrix ($\sqrt{A}$).

The catch? These optimal mechanisms typically require $O(n)$ space, where $n$ is the number of time steps. In deep learning, where models have millions of parameters, storing $n$ high-dimensional vectors is impossible—researchers have estimated that some tasks would require over 40 petabytes of memory. While memory-efficient alternatives like the "binary mechanism" exist, they suffer from significantly higher error.

Methods

The authors propose a framework to approximate these high-accuracy factorization matrices using binning.

The core idea is simple: take the optimal lower-triangular matrix $L$ and group adjacent entries with similar values into "bins." Within each bin, the entries are replaced by a single average value.

Illustration of the concept of binning on a 20-by-20 matrix. (a) shows the original matrix, and (b) shows the matrix after binning, where each row has at most 4 unique values.

The Binning Algorithm

The paper introduces a greedy algorithm (Algorithm 1) that constructs these bins by merging intervals in each row based on two parameters:

  1. Multiplicative threshold ($c$): Merges entries if their ratio is close to 1.
  2. Additive threshold ($\tau$): Merges small values that don't significantly impact the overall noise.

Because the resulting matrix $\hat{L}$ has very few unique values per row, the algorithm only needs to store a few "buffers" (running sums) to compute the output. This reduces the space complexity from linear ($O(n)$) to sublinear ($O(\sqrt{n} \log n)$ theoretically, and often $O(\log n)$ empirically).

Datasets

The paper evaluates the mechanism using synthetic data streams to measure two primary error metrics: Mean Squared Error (MeanSE) and Maximum Squared Error (MaxSE). They test streams up to length $n \approx 10^4$. The evaluation focuses on comparing their binned approach against the optimal Bennett factorization and the classic binary mechanism.

Key Insights and Ideas

  • Small Perturbations, Big Savings: The authors prove that if you perturb the entries of a factorization matrix slightly (via binning), the resulting increase in privacy-related noise is minimal. You can trade a tiny bit of accuracy for massive memory savings.
  • Monotone Ratio Matrices (MRMs): The paper identifies a specific class of matrices—MRMs—that are particularly well-suited for binning. The Bennett matrix belongs to this class, which explains why the approach works so well for counting.
  • Beyond Simple Counting: The method isn't just for 0/1 sums. The authors show it also works for generalized counting problems that include momentum and weight decay, which are standard components in modern ML optimizers.

Key Results

  • Matching the "Optimal": Empirically, the binned mechanism matches the error of the asymptotically optimal Bennett matrix while using vastly less space. For $n=10^4$, they achieve near-optimal error with just a few dozen buffers.
  • Beating the Binary Mechanism: The approach significantly outperforms the standard binary mechanism, which has been the go-to for low-memory private counting for years. In some cases, the error is 10x to 20x lower.
  • Surprising Improvements: In certain practical regimes, the binned version actually achieved lower error than the theoretically optimal Toeplitz factorizations. This suggests that the "heuristics" of binning can sometimes improve upon lower-order error terms that asymptotic theories ignore.
Plots showing the trade-off between space complexity and error. The black line shows that the binning method achieves lower error than the binary mechanism (dotted line) while maintaining sublinear space.

Limitations and Future Work

  • Class Restrictions: The theoretical guarantees currently only apply to "Monotone Ratio Matrices." While this covers many important cases, it's not a universal solution for every possible linear query.
  • Preprocessing: Calculating the exact sensitivity of the binned factorization requires a quadratic-time ($O(n^2)$) offline preprocessing step. While this only needs to be done once for a given $n$, it could be a bottleneck for extremely long streams.
  • Tightness of Bounds: The authors note that their empirical results are much better than their theoretical space bounds suggest. Future work could involve proving tighter bounds to explain why the method is so efficient in practice (potentially showing $O(\log n)$ space is sufficient).

Summary updated

BibTeX
@inproceedings{andersson2025streaming,
  author = {Joel Daniel Andersson and Rasmus Pagh},
  title = {{Streaming Private Continual Counting via Binning}},
  booktitle = {SaTML},
  year = {2025},
  doi = {10.1109/satml64287.2025.00038},
}
Figure