@lop1498/frida
flwr new @lop1498/fridaFRIDA: Free-Rider Detection in Federated Learning
FRIDA is a Flower App that implements and evaluates privacy attack-based methods for detecting free-riders in Federated Learning. Free-riders are malicious clients that participate in the federation without contributing meaningful local training, instead sending manipulated or random model updates to benefit from the global model without cost.
FRIDA implements several detection attacks (Cosine, Yeom, DAGMM, L2, STD, DistScore, Inconsistency) and supports multiple free-rider strategies (plain, advanced disguised, gradient noiser) across image and text datasets.
Fetch the App
Install Flower:
pip install flwr
Fetch the app:
flwr new @pol-garcia-recasens/frida
This will create a new directory called frida with the following structure:
frida ├── src/ │ └── setup/ │ ├── __init__.py │ ├── client_app.py # Defines your ClientApp │ ├── server_app.py # Defines your ServerApp │ ├── client.py # Client and free-rider implementations │ ├── server.py # Strategy with attack detection │ ├── attacks.py # Detection attack implementations │ ├── model.py # Model definitions (AlexNet, VGG, LSTM, ...) │ ├── data_loader.py # Data loading and partitioning │ ├── download_dataset.py # Example script to download dataset │ └── train.py # Training and evaluation logic ├── pyproject.toml # Project metadata and configuration └── README.md
Run the App
You can run FRIDA in both simulation and deployment mode without making changes to the code. If you are starting with Flower, we recommend using simulation mode as it requires fewer components to be launched manually.
Prepare Your Data
FRIDA uses local offline datasets (pickle format). The dataset can be downloaded using the example script download_dataset.py. Download and place your dataset under ./data/<dataset_name>/:
./data/cifar10/ ├── train_data.pkl └── test_data.pkl
The dataset should follow the following format:
- <dataset_name>/train_data.pkl -> (train_images, train_labels)
- <dataset_name>/test_data.pkl -> (test_images, test_labels)
Where: train_images/test_images: np.ndarray uint8, shape (N, 32, 32, 3) train_labels/test_labels: np.ndarray int64, shape (N,)
Run with the Simulation Engine
TIP
Check the Simulation Engine documentation to learn more about Flower simulations and how to configure CPU/GPU resources for your ClientApp.
Install the dependencies and the frida package:
cd frida && pip install -e .
Specify the number of virtual SuperNodes and their resources in ~/.flwr/config.toml:
[superlink.local] options.num-supernodes = 4 options.backend.client-resources.num-cpus = 2 options.backend.client-resources.num-gpus = 1.0
Run with default settings (CIFAR-10, CNN, Yeom, 4 clients):
flwr run .
You can override settings defined in pyproject.toml. For example, to run with a different attack type and number of free-riders:
flwr run . --run-config "attack_types=yeom num_freeriders=4 num_rounds=10"
Key configuration options:
| Parameter | Description | Default |
|---|---|---|
| num_clients | Total number of federated clients | 4 |
| num_freeriders | Number of free-rider clients | 1 |
| freerider_type | Free-rider strategy (none, advanced_disguised, gradient_noiser) | none |
| attack_types | Detection method (cosine, yeom, dagmm, inconsistency, dist_score) | yeom |
| dataset | Dataset to use (cifar10, cifar100, fmnist, shakespeare) | cifar10 |
| architecture | Model architecture (CNN, AlexNet, VGG19, LeNet5, LSTM) | CNN |
| iid | IID or non-IID data partitioning | true |
| mitigation | Exclude detected free-riders from aggregation | false |
Run with the Deployment Engine
In deployment mode, each SuperNode loads its own local data partition from disk.
Prepare one data partition per SuperNode and place it in a local path on each node:
/path/to/node_data/ ├── train_data.pkl └── test_data.pkl
Launch each SuperNode with its local data path:
flower-supernode \ --insecure \ --superlink \ --node-config="data_path=/path/to/node_data/"
Finally, launch the run via flwr run pointing to your SuperLink:
flwr run . --stream
TIP
Follow this how-to guide to run FRIDA with Flower's Deployment Engine. After that, consider setting up secure TLS-enabled communications and SuperNode authentication.
Citation
If you use FRIDA in your research, please cite:
@article{recasens2026frida, title={Frida: Free-rider detection using privacy attacks}, author={Recasens, Pol G and Horv{\'a}th, {\'A}d{\'a}m and Gutierrez-Torre, Alberto and Torres, Jordi and Berral, Josep Ll and Pej{\'o}, Bal{\'a}zs}, journal={Journal of Information Security and Applications}, volume={97}, pages={104357}, year={2026}, publisher={Elsevier} }