Skip to main content

FLEX-Clash

flex-clash is a Python library dedicated to adversarial attacks and defences in Federated Learning. It offers the state-of-the methods and features to ease the implementation of custom methods. It is intended to extend the FLEXible framework.

Details

This repository includes both:

  • Features to implement poisoning attacks in Federated Learning.
  • Features to implement defences in the aggregator in Federated Learning.
  • State-of-the-art defences implementedin FLEXible.

Folder structure

  • flexclash/data: which contains the features to poison the clients' data.
  • flexclash/model: which contains the features to poison the clients' model updates.
  • flexclash/pool: which contains the features to implement any defence in the aggregation operator as well as the state-of-the-art implemented defences.
  • notebooks: which contains explanatory notebooks showing how to implement poisoning attacks and use the implemented defences.
  • test: which contains the test for the implemented features.

Explanatory notebooks

  • Poisoning_data_FLEX.ipynb: A notebook showing how to implement data-poisoning attacks using flexclash including both byzantine and backdoor attacks.
  • Poisoning_model_FLEX.ipynb: A notebook showing how to implement model-poisoning attacks using flexclash.
  • Defences_FLEX.ipynb: A notebook showing how to employ defences against adversarial attacks using flexclash.

Features

In the following we detail the poisoning attacks implemented:

Attack Description Citation
Data poisoning It consists of poisoning a certain amount of data of certain clients randomly or according to certain criteria. Several examples are shown in the notebooks. Data Poisoning Attacks Against Federated Learning Systems
Model poisoning It consists of directly poisoning the weights of the model update that the client shares with the server. Deep Model Poisoning Attack on Federated Learning

In the following we detail the defences implemented:

Defence Description Citation
Median It is a robust-aggregation operator based on replacing the arithmetic mean by the median of the model updates, which choose the value that represents the centre of the distribution. Byzantine-robust distributed learning: Towards optimal statistical rates.
Trimmed mean It is a version of the arithmetic mean, consisting of filtering a fixed percentage of extreme values both below and above the data distribution. Byzantine-robust distributed learning: Towards optimal statistical rates.
MultiKrum It sorts the clients according to the geometric distances of their model updates. Hence, it employs an aggregation parameter, which specifies the number of clients to be aggregated (the first ones after being sorted) resulting in the aggregated model. Machine Learning with Adversaries: Byzantine Tolerant Gradient Descent
Bulyan It is a federated aggregation operator to prevent poisoning attacks, combining the MultiKrum federated aggregation operator and the trimmed-mean. Hence, it sorts the clients according to their geometric distances, and according to a 𝑓 parameter filters out the 2𝑓 clients of the tails of the sorted distribution of clients and aggregates the rest of them. The Hidden Vulnerability of Distributed Learning in Byzantium

Installation

In order to install this repo locally:

pip install -e .

FLEX-Clash is available on the PyPi repository and can be easily installed using pip:

pip install flex-clash

Citation

If you use this repository in your research work, please cite Flexible paper:

Release files for flexclash 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flexclash 0.0.3
File Size Uploaded
flexclash-0.0.3.tar.gz 19.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flexclash 0.0.3
File Interpreter ABI Platform
flexclash-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 43.3 kB

Release files / flexclash-0.0.3.tar.gz

Download URL flexclash-0.0.3.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f0c8458e502c2158e9ede1eb4d5b3dee96ebaeb68a3d50d6ae370f7b569684ce
BLAKE2b-256 checksum
How to use checksums
3d11ae72fd857c54389bdcf10f9e927447238b02bd47fadcbc7766358b99d470
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

Release files / flexclash-0.0.3-py3-none-any.whl

Download URL flexclash-0.0.3-py3-none-any.whl
Size 23.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5fcf8b3159c0e7cdd9b080be098a8beb35b5b4dd74d1afb8eea7691dcc0d70b
BLAKE2b-256 checksum
How to use checksums
571e1e7cae34cab2f15ab8bf35a052fd905ffd35f1ec4bb6a05843d0fa060f50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page