Published May 16, 2025 | Version v1
Software Open

PARSIFAL: Private and Robust Sign Federated Learning

Description

This is the software for the paper PARSIFAL: Private and Robust Sign Federated Learning (KDD '25).
 

Preparation

Environment

 
The codes were tested with python 3.9.
 
Dependencies:

FFHT_unofficial==0.3
mclbn256==1.3.5
nltk==3.8.1
numpy==1.25.2
ogb==1.3.6
pandas==1.4.4
pycryptodome==3.20.0
pycryptodomex==3.20.0
scikit_learn==1.4.1.post1
scipy==1.14.1
torch==2.2.1+cu118
torch_geometric==2.5.3
torcheval==0.0.7
torchmetrics==1.3.1
torchvision==0.17.1+cu118
tqdm==4.66.1

Data

PARSIFAL was tested on 4 datasets: MNIST, CIFAR10, IMDB, and PCBA.
 
Run proc_data.py to preprocess the datasets for Federated Learning.
 
Modify the main section in proc_data.py to configure the number of clients and non-iid parameter.

Run PARSIFAL

How to Run Tests

Run run_test.py

How to Customize Configuration

Running PARSIFAL with specified configurations needs 4 steps:
 
1. Configure PARSIFAL algorithm: conf = get_rosin_config(dataset, use_rkds, global_lr, rkds_th, using_ss)
- dataset: str, optional values including ['mnist', 'cifar10', 'imdb', 'pcba']
use_rkds: bool, set to True to activate density verification of PARSIFAL
global_lr: float, learning rate for Model Owner to update global model, independent with learning rate in local training, typical value [1e-4, 1e-3]
rkds_th: float, threshold for PARSIFAL to detect malicious clients, large threshold -> more clients might be regarded as malicious, 0 -> disable, typical value 0.8
using_ss: bool, set to True to enable secret sharing
 
2. Configure Federated Learning: conf = set_fl_config(conf, n_clients, dataset_alpha, malicious_type, malicious_clients)
n_clients: int, total number of data owners (including benign and malicious), default 100
dataset_alpha: float, split dataset by Dirichlet distribution Dir(alpha) when alpha in (0, +inf), small alpha -> high non-IIDness, set to None or 0 for IID
malicious_type: str, attack type, optional values: 'poi' for label flipping attack, 'neg' for gradient flipping attack
malicious_clients: int, amount of malicious participants
 
3. (Optional) Configure more settings: There are other settings in object conf. Use conf.property = value to set them. Most are not needed to set or modify for PARSIFAL test, just leaving them as default. Some useful parameters are listed below:
rkds_r: int, sketch rows, typically [10, 1000]
rkds_b: int, log2(sketch columns), typically [1, 5]
batch: int, batch size in local training of each client
learning_rate: float, learning rate of local training
train_epoch: int, global rounds of FL
 
4. Start test: test_config(config=conf)

Files

Files (226.2 kB)

Name Size Download all
md5:905b5a849fee372161fd8ae4c0fe602d
5.7 kB Download
md5:b26f849829596f58cdade99abc75004d
28.3 kB Download
md5:40bbb8ef61d5045c816d448b4c117d8e
24.7 kB Download
md5:e5d235d7c303dde3fff08f17acebd9cb
602 Bytes Download
md5:b0cad4ca681190505df2c1a2c09f5d28
17.6 kB Download
md5:712def017e491e7ee7d2d2590571b99f
19.9 kB Download
md5:114a7ed46798caa3954235a30cb71734
12.9 kB Download
md5:7f0901b71a83dde75abda9fb57a7a5e8
7.4 kB Download
md5:f83439d0e84d95aedc5f3b96836ce878
7.5 kB Download
md5:04f9ec597771b3eacc7170f9ccf91f41
24.4 kB Download
md5:efd1c42eec4536664d62939b614359c2
9.2 kB Download
md5:302e1d9b0a20d31607f7cc28efd8bd70
35.4 kB Download
md5:0fb46d953ab9d01d92aacd506f497db4
32.8 kB Download

Additional details

Software

Programming language
Python