TL;DR
multi-freq-ldpy is the first open-source Python package dedicated to frequency estimation under Local Differential Privacy (LDP) for complex data structures. It provides a fast, easy-to-use toolkit for researchers and engineers to implement state-of-the-art privacy protocols for multidimensional and longitudinal data, moving beyond simple single-attribute analysis.
What Problem Does This Paper Address?
Local Differential Privacy (LDP) has become the "gold standard" for privacy-preserving data collection, famously deployed by tech giants like Google, Apple, and Microsoft. Unlike centralized DP, where a trusted server adds noise to a database, LDP shifts the privacy mechanism to the user's side. Users sanitize their own data before sending it to an aggregator, ensuring that even a compromised server never sees the raw information.
The most fundamental task in LDP is frequency estimation—calculating how often specific values appear in a population (e.g., "How many users use Chrome vs. Firefox?"). While protocols for a single attribute are well-established, real-world data is rarely that simple. We often deal with:
- Multidimensional Data: Users have multiple attributes (age, city, browser).
- Longitudinal Data: Data is collected from the same users repeatedly over time.
Implementing these complex protocols from scratch is difficult, error-prone, and often slow in native Python. This paper introduces multi-freq-ldpy to bridge the gap between theoretical LDP research and practical, high-performance implementation.
Methods
The package is built on the familiar NumPy stack and utilizes Numba for just-in-time (JIT) compilation, ensuring that the heavy mathematical lifting of LDP protocols doesn't become a bottleneck.
The library is organized into four main modules:
pure_frequency_oracles: The building blocks, including standard protocols like Generalized Randomized Response (GRR), Optimal Local Hashing (OLH), and Unary Encoding (SUE/OUE).mdim_freq_est: Handles multiple attributes. It includes a novel solution developed by the authors called Random Sampling Plus Fake Data (RS+FD), which outperforms traditional methods by generating synthetic "fake" reports for non-sampled attributes to improve estimation accuracy.long_freq_est: Designed for data collected over time. It implements Microsoft’sdBitFlipPMand optimized versions of Google’s RAPPOR, using a two-round "memoization" framework to prevent privacy leakage across repeated reports.long_mdim_freq_est: The most complex module, combining both longitudinal and multidimensional estimation.
The package follows a consistent Client/Aggregator architecture: a Client function sanitizes the data on the user's side, and an Aggregator function estimates the true distribution from the noisy reports.
Datasets
The paper demonstrates the package using synthetically generated datasets following uniform distributions. These are used to provide "worked examples" that show how the library handles different domain sizes ($k$), user counts ($n$), and privacy budgets ($\epsilon$). While the paper doesn't introduce new real-world benchmarks, it provides the infrastructure for users to apply these protocols to any discrete dataset.
Key Insights and Ideas
- The "Multiple" Challenge: Estimating frequencies for multiple attributes isn't as simple as splitting your privacy budget. The authors highlight that naive budget splitting (SPL) often leads to high noise, whereas sampling techniques (SMP) or their own RS+FD approach provide much better utility.
- Memoization is Key for Time: For longitudinal data, you cannot simply re-randomize data every day; doing so allows an adversary to average out the noise and see the raw data. The package uses a "permanent" randomization step (memoization) to ensure long-term privacy.
- Performance via Numba: By using Numba, the authors achieve execution speeds comparable to C++ while maintaining the accessibility of Python, which is crucial for simulating large-scale LDP deployments (e.g., $10^6$ users).
Key Results
The paper serves primarily as a software announcement and documentation. The key "result" is the demonstration of simplicity:
- Code Efficiency: Complex LDP pipelines that would normally require hundreds of lines of code are reduced to just two main function calls (one for the client, one for the aggregator).
- Protocol Breadth: It centralizes six major single-attribute protocols and several advanced multidimensional/longitudinal solutions in one place.
- Accuracy: The worked examples show that even with high noise (low $\epsilon$), the aggregators can reconstruct the original uniform distributions with high fidelity when $n$ is large (e.g., 1 million users).
Limitations and Future Work
The authors acknowledge that the current version (v0.2.4) is focused strictly on frequency estimation (histograms). It does not yet support other common LDP tasks like mean estimation, heavy hitter discovery, or private machine learning.
Future Work includes: * Integrating more longitudinal LDP protocols (such as those focusing on "evolving" data where user values change over time). * Adding more advanced multidimensional solutions like "Sarve" (synthetic data approaches). * Expanding the library to support a wider variety of data types beyond discrete categories.
The multi-freq-ldpy package is open-source under the MIT license and can be found on GitHub or installed via pip install multi-freq-ldpy.
Summary updated