PrivacyGuard platform for Privacy Attacks and Analysis. Perform privacy analyses of ML models using Inference Attacks and Extraction Attacks.
Project description
PrivacyGuard
PrivacyGuard is a library that allows you to perform a privacy analysis (e.g., Membership Inference, Text Inclusion) of models in PyTorch or LLM models. This repo implements various privacy attacks, alongside analysis nodes to interpet the attack results. With PrivacyGuard, you can:
- Run an off-the-shelf analysis to approximately assess privacy leakage and data memorization in an already trained model.
- Run deeper analysis to better grasp the privacy issues (for instance, SOTA shadow models attack).
- Provide useful primitives for analysis such as grouped or balanced attacks and various metrics such as AUC/ROC or empirical epsilon.
- Execute LLM text generation attacks and probabilistic decoding methods.
Why PrivacyGuard?
-
Extensible API: PrivacyGuard has an extensible API that allows for easy creation of new analyses and attacks. This makes it easy for researchers to extend the library and build off of existing Privacy attacks, reproduce the results of existing attacks on new models and datasets, and develop new attacks.
-
End to End Privacy Attacks out of the box: PrivacyGuard abstracts away analysis details allowing for quick set up and execution of pragmatic and SOTA privacy attacks.
-
State-of-the-art methods: PrivacyGuard implements and maintains state of the art attacks, such as LiRA Likelihood Ratio Attack and probabilistic decoding methods
-
Flexible: PrivacyGuard is highly configurable, allowing researchers to plug in novel privacy attacks, models, datasets, and analyses.
-
Production ready: PrivacyGuard is a reliable and well supported library with comprehensive testing and CI, ensuring the library remains in a easy to use state.
Getting Started
To get started, we recommend running through the PrivacyGuard tutorial notebooks. These notebooks will guide you through the usage of PrivacyGuard, and contain everything you need to execute its suite of attacks on example datasets. The tutorial notebooks can be found here and are in the .ipynb tutorial format.
The tutorials are pre-populated with example outputs, but utilizing Jupyter and/or Google Colab you can run the code, see the results, modify the analyses and see the results of your changes.
To work and develop with PrivacyGuard, we recomemend cloning the repository and installing all dependencies.
git clone https://github.com/facebookresearch/PrivacyGuard.git --depth 1
cd PrivacyGuard
pip install tree-sitter==0.20.4 "setuptools<75" requests
pip install --no-build-isolation codebleu==0.6.0
pip install -e .
Installation
PrivacyGuard requires Python 3.10 or newer. A full list of PrivacyGuard's direct dependencies can be found in setup.py.
Join the PrivacyGuard Community
Getting help
Please open an issue on our issues page with any questions, feature requests or bug reports! If posting a bug report, please include a minimal reproducible example (as a code snippet) that we can use to reproduce and debug the problem you encountered.
Contributing
See the CONTRIBUTING file for how to help out. When contributing to PrivacyGuard, we recommend cloning the repository and installing all optional dependencies:
git clone https://github.com/facebookresearch/PrivacyGuard.git --depth 1 cd PrivacyGuard pip install -e .[tutorial]
The above example limits the cloned directory size via the --depth argument to git clone. If you require the entire commit history you may remove this argument.
License
PrivacyGuard is licensed under the Apache License, Version 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file privacyguard_platform-0.0.2.tar.gz.
File metadata
- Download URL: privacyguard_platform-0.0.2.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6b1b15eba0c43ad0cc37ecdece5fe76ae6b1352868f613aab64de271d457acc
|
|
| MD5 |
4301477ccb7859b3ae4fc82b0b7284c7
|
|
| BLAKE2b-256 |
23d79e8742e3906041f00fffaa1bc27b914c1ea4001ef08d6ace8475cecb39b7
|
Provenance
The following attestation bundles were made for privacyguard_platform-0.0.2.tar.gz:
Publisher:
release.yml on facebookresearch/PrivacyGuard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
privacyguard_platform-0.0.2.tar.gz -
Subject digest:
b6b1b15eba0c43ad0cc37ecdece5fe76ae6b1352868f613aab64de271d457acc - Sigstore transparency entry: 1203481236
- Sigstore integration time:
-
Permalink:
facebookresearch/PrivacyGuard@349c97cd9798ce71a098cd24b81004b1871049a9 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/facebookresearch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@349c97cd9798ce71a098cd24b81004b1871049a9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file privacyguard_platform-0.0.2-py3-none-any.whl.
File metadata
- Download URL: privacyguard_platform-0.0.2-py3-none-any.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
090a132e6e2ac1a3c8b0c7ad86d90f386af9771b1cf99afdaa76ce558481f217
|
|
| MD5 |
19bfa5b64de98fb2cda2396c8031f408
|
|
| BLAKE2b-256 |
91b1561f61e85dd67a7a1c50416057ddbab2c8b44b8e0b3987c65e12e5600634
|
Provenance
The following attestation bundles were made for privacyguard_platform-0.0.2-py3-none-any.whl:
Publisher:
release.yml on facebookresearch/PrivacyGuard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
privacyguard_platform-0.0.2-py3-none-any.whl -
Subject digest:
090a132e6e2ac1a3c8b0c7ad86d90f386af9771b1cf99afdaa76ce558481f217 - Sigstore transparency entry: 1203481238
- Sigstore integration time:
-
Permalink:
facebookresearch/PrivacyGuard@349c97cd9798ce71a098cd24b81004b1871049a9 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/facebookresearch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@349c97cd9798ce71a098cd24b81004b1871049a9 -
Trigger Event:
release
-
Statement type: