Drop-in differential privacy for sklearn devotees
Diffprivlib wraps differential privacy in a scikit-learn interface so researchers can experiment with private ML without rewriting pipelines.

What it does
Diffprivlib is IBM’s general-purpose differential privacy library for Python. It offers mechanisms, models, data-analysis tools, and a privacy budget accountant for building differentially private machine learning workflows. The models module copies the scikit-learn API—GaussianNB and others use familiar fit and predict calls—so you can experiment with privacy-preserving training without learning a new dialect.
The interesting bit
The library treats privacy loss as a composable resource: the BudgetAccountant tracks cumulative spend across operations using advanced composition techniques, which is the kind of bookkeeping that is easy to describe in a paper but tedious to get right in code. It also exposes raw mechanisms for experts who want to build custom algorithms from scratch.
Key highlights
- Models for clustering, classification, regression, dimensionality reduction, and preprocessing that mirror
sklearnestimators. - A
BudgetAccountantthat tallies total privacy loss across multiple queries or model fits. - Differentially private histograms that reuse NumPy’s histogram interface.
- Low-level privacy mechanisms exposed for researchers implementing bespoke algorithms.
- Explicitly labeled for research and education; production deployments require IBM engagement.
Caveats
- The README states the public release is intended for research and education only, so shipping it to production involves talking to IBM first.
- Some estimators, such as
GaussianNB, emit warnings unless you supply aboundsparameter, so the zero-config experience is limited.
Verdict Worth a look if you are a researcher or student who wants to prototype differentially private machine learning inside the scikit-learn ecosystem. Look elsewhere if you need a library that is cleared for immediate production use without vendor coordination.
Frequently asked
- What is IBM/differential-privacy-library?
- Diffprivlib wraps differential privacy in a scikit-learn interface so researchers can experiment with private ML without rewriting pipelines.
- Is differential-privacy-library open source?
- Yes — IBM/differential-privacy-library is open source, released under the MIT license.
- What language is differential-privacy-library written in?
- IBM/differential-privacy-library is primarily written in Python.
- How popular is differential-privacy-library?
- IBM/differential-privacy-library has 919 stars on GitHub.
- Where can I find differential-privacy-library?
- IBM/differential-privacy-library is on GitHub at https://github.com/IBM/differential-privacy-library.