PyGIP
PyGIP is a Python library designed for experimenting with graph-based model extraction attacks and defenses. It provides a modular framework to implement and test attack and defense strategies on graph datasets.
How to Cite
If you find it useful, please considering cite the following work:
@article{li2025intellectual,
title={Intellectual Property in Graph-Based Machine Learning as a Service: Attacks and Defenses},
author={Li, Lincan and Shen, Bolin and Zhao, Chenxi and Sun, Yuxiang and Zhao, Kaixiang and Pan, Shirui and Dong, Yushun},
journal={arXiv preprint arXiv:2508.19641},
year={2025}
}
Installation
PyGIP supports both CPU and GPU environments. Make sure you have Python installed (version >= 3.9, <3.13).
Base Installation
First, install the core package:
pip install PyGIP
This will install PyGIP with minimal dependencies.
CPU Version
pip install "PyGIP[torch,dgl]" \
--index-url https://download.pytorch.org/whl/cpu \
--extra-index-url https://pypi.org/simple \
-f https://data.dgl.ai/wheels/repo.html
GPU Version (CUDA 12.1)
pip install "PyGIP[torch,dgl]" \
--index-url https://download.pytorch.org/whl/cu121 \
--extra-index-url https://pypi.org/simple \
-f https://data.dgl.ai/wheels/torch-2.3/cu121/repo.html
Quick Start
Here’s a simple example to launch a Model Extraction Attack using PyGIP:
from datasets import Cora
from models.attack import ModelExtractionAttack0
# Load the Cora dataset
dataset = Cora()
# Initialize the attack with a sampling ratio of 0.25
mea = ModelExtractionAttack0(dataset, 0.25)
# Execute the attack
mea.attack()
This code loads the Cora dataset, initializes a basic model extraction attack (ModelExtractionAttack0), and runs the
attack with a specified sampling ratio.
And a simple example to run a Defense method against Model Extraction Attack:
from datasets import Cora
from models.defense import RandomWM
# Load the Cora dataset
dataset = Cora()
# Initialize the attack with a sampling ratio of 0.25
med = RandomWM(dataset, 0.25)
# Execute the defense
med.defend()
which runs the Random Watermarking Graph to defend against MEA.
If you want to use cuda, please set environment variable:
export PYGIP_DEVICE=cuda:0
Implementation & Contributors Guideline
Refer to Implementation Guideline
Refer to Contributors Guideline
License
PyGIP is licensed under the PolyForm Noncommercial License 1.0.0 for noncommercial use. For commercial licensing, please contact commercialization@fsu.edu.
Contact
For questions or contributions, please contact blshen@fsu.edu.
Metadata
Release files for PyGIP 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pygip-1.2.0.tar.gz | 489.6 kB | Without provenance | Details for pygip-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pygip-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for pygip-1.2.0-py3-none-any.whl |
Total release size: 1.0 MB
Release files / pygip-1.2.0.tar.gz
| Download URL | pygip-1.2.0.tar.gz |
|---|---|
| Size | 489.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
495081d02834792cb8f856c2ad161e12c32e78d601edc7f8c8139ec3541465a7
|
|
BLAKE2b-256 checksum How to use checksums |
3452171cfb1c07f40e41b96b58d82ea256f6ecc6313fd05857c08184e6dd71ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.0
|
Release files / pygip-1.2.0-py3-none-any.whl
| Download URL | pygip-1.2.0-py3-none-any.whl |
|---|---|
| Size | 533.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1bdf63b3131dea80f1b1363157aa0d64db0dcf0a20b2024a80d5a0eaf0360309
|
|
BLAKE2b-256 checksum How to use checksums |
95b3393e5d85f25f6b71ea0d389732bb94a69c1de06eadda3b223a3dc0768c39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.0
|
Security for PyGIP 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.