Workflow Lint and test (master) PyPI GitHub license Documentation Status Gitter chat


The XAIN project is building a privacy layer for machine learning so that AI projects can meet compliance such as GDPR and CCPA. The approach relies on Federated Learning as enabling technology that allows production AI applications to be fully privacy compliant.

Federated Learning also enables different use-cases that are not strictly privacy related such as connecting data lakes, reaching higher model performance in unbalanced datasets and utilising AI models on the edge.

This repository contains the source code for running the Coordinator. The Coordinator is the component of Federated Learning that selects the Participants for training and aggregates the models using federated averaging.

The Participants run in a separate environment than the Coordinator and connect to it using an SDK. You can find here the source code for it.

Quick Start

XAIN requires Python 3.6.4+. To install the xain-fl package just run:

$ python -m pip install xain-fl

Install from source

Clone this repository:

git clone

Install this project with the dev profile (NOTE: it is recommended to install the project in a virtual environment):

cd xain-fl
pip install -e '.[dev]'

Verify the installation by running the tests


Building the Documentation

The project documentation resides under docs/. To build the documentation run:

$ cd docs/
$ make docs

The generated documentation will be under docs/_build/html/. You can open the root of the documentation by opening docs/_build/html/index.html on your favorite browser or simply run the command:

$ make show

Running the Coordinator locally

To run the Coordinator on your local machine, use the command:

$ python xain_fl/ -f test_array.npy

For more information about the CLI and its arguments, run:

$ python xain_fl/ --help

Run the Coordinator from a Docker image

There are two docker-compose files, one for development and one for release.

Development image

To run the coordinator’s development image, first build the Docker image:

$ docker build -t xain-fl-dev -f .

Then run the image, mounting the directory as a Docker volume, and call the entrypoint:

$ docker run -v $(pwd):/app -v '/app/xain_fl.egg-info' xain-fl-dev coordinator

Release image

To run the coordinator’s release image, first build it:

$ docker build -t xain-fl .

And then run it (this example assumes you’ll want to use the default port):

$ docker run -p 50051:50051 xain-fl



$ docker-compose -f docker-compose-dev.yml up


$ docker-compose up