This crates provides a mobile friendly implementation of a Xaynet Federated Learning participant, along with FFI C bindings for building applications in languages that can use C bindings.
Participant provided by this crate is mobile friendly because the caller has
a lot of control on how to drive the participant execution. You can regularly pause
the execution of the participant, save it, and later restore it and continue the
execution. When running on a device that is low on battery or does not have access
to Wi-Fi for instance, it can be useful to be able to pause the participant.
This control comes at a complexity cost though. Usually, a participant is split two:
- a task that executes a state machine that implements the PET protocol and emit notifications.
- a task that react to these events, for instance by downloading the latest global model at the end of a round, or trains a new model when the participant has been selected for the update task.
The task that executes the PET protocol usually runs in background and we have little control over it. This is a problem on mobile environment:
- first, the app may be killed at any moment and we'd lose the participant state
- second we don't really want a background task to potentially perform CPU heavy or network heavy operations without having a say since it may drain the battery or consume too much data.
To solve this problem, the
Participant provided in this crate embeds the PET
state machine, and it's the caller responsibility to drive its execution (see
A receiver for events emitted by the participant internal state machine
Event sender that is passed to the participant internal state machine for emitting notification
A participant. It embeds an internal state machine that executes the PET
protocol. However, it is the caller's responsibility to drive this state machine by
A participant settings
Error returned upon failing to instantiate a new
Event emitted by the participant internal state machine as it advances through the PET protocol
Error that can occur when instantiating a new
Error returned when the settings are invalid
Represent the participant current task