Federated Learning: Budowanie modeli uczenia maszynowego bez wglądu w rozproszone dane
Powszechnie stosowanym podejściem do budowy modeli uczenia maszynowego jest scentralizowane uczenie (centralised learning). Zbieramy wszystkie dostępne dane na maszynę centralną, przygotowuje zbiór treningowy, walidacyjny oraz testowy i uczymy nasz nowy model. Jednakże, w niektórych przypadkach dane dostępne na urządzeniach lokalnych nie mogę zostać przesłane i zgromadzone centralnie. Głównym powodem jest poufność tych danych czy ograniczenia związane z ich wielkością i możliwością przesłana. Rozwiązaniem, które pozwala na uczenie modeli globalnych na wszystkich danych rozproszonych po wielu urządzeniach brzegowych (edge device) lub serwerach bez bezpośredniego wglądu do tych danych jest Federated Learning. W trakcie prezentacji zostaną omówione wszystkie główne zagadnienia związane z tym podejściem oraz wskazane dlaczego to podejście może być wykorzystane również w przypadku firm, które nie korzystają z danych zbieranych przez urządzenia typu edge device.
Prezentacja Rafała Wojdana z Sotrendera na AI & NLP Day 2020
5. Federated Learning (Od 2019)
5
https://medium.com/accenture-the-dock/instilling-responsible-and-reliable-ai-development-with-federated-learning-d23c366c5efd
6. FL - korzyści
6
Mniejsze wymagania sprzętowe:
● Łączność (Connectivity)
● Przepustowość łącza (Bandwidth)
Predykcja w czasie rzeczywistym
● Opóźnienie (Latency)
Uczenie bez wglądu do danych
● Prywatność (Privacy)
Globalny model
● Generalizacja
7. Algorytmy update modelu w FL
7
● Federated Averaging
(FedAvg)
● Federated Stochastic
Gradient Descent
(FedSGD)
● Federated Learning
with Matched
Averaging (FedMA)
https://arxiv.org/pdf/1602.05629.pdf
8. Uśrednianie modelu (FedAvg) vs uśrednianie
gradientu (FedSGD)
8
https://arxiv.org/pdf/1602.05629.pdf
Porównanie:
● FedSGD gwarantuje zbieżność
● FedAvg lżejszy komunikacyjnie (mniej
update’ów modelu globalnego)
Przykład CIFAR-10
Liczba update’ów dająca 82% dokładności
(Accuracy):
● FedSGD 6 600
● FedAvg 630
FedAvg 10x mniej rund niż
FedSGD
9. Nowe hiperparametry
9
Hiperparametry:
C - część klientów, którzy uczestniczą w uczeniu w każdej rundzie
E - liczba iteracji treningowych u każdego klienta na lokalnym zbiorze
B - rozmiar lokalnego mini-batcha
Więcej: https://arxiv.org/pdf/1602.05629.pdf
10. Wyzwania techniczne dla Federated Learning
10
● Komunikacja
○ Liczba aktualizacji modelu globalnego
○ Przesłanie nowego modelu globalnego na urządzenia lokalne
● Zmienny udział lokalnych urządzeń
○ Część urządzeń dostępnych do update’u
○ Ograniczenia sprzętowe lokalnych urządzeń
○ Odłączenie od sieci FL
● Ochrona prywatności
17. Różne architektury i business case’y
17
https://www.arxiv-vanity.com/papers/1902.04885/
18. Problem dobry do zastosowania Federated
Learning
18
1) Dane ze źródła lepsza niż dane
przybliżone (proxy data) dostępne
centralnie
2) Wymóg prywatności
3) Dostępność etykiet - są
generowane w ramach procesu np.
przez użytkowników
Your problem and FL have liked each other
PROBLEM FEDERATED
LEARNING
19. Czemu korzystamy z FL w Sotrender?
19
Nasze wyzwania:
● Zróżnicowanie rozkładów w czasie
● Zróżnicowanie rozkładów pomiędzy klientami
● Zróżnicowany rozmiar danych
● Małe dane per klient
Separacja danych FB
Nie korzystamy z danych mobile.
Nie korzystamy z danych edge device.
Ale…
Jak szpitale musimy zachować
prywatność danych klientów.
20. Rozwiązania open source
20
● Xgboost https://github.com/mc2-project/secure-xgboost
● TFF - Tensorflow Federated
● PySyft dla PyTorcha
● IBM differential privacy
https://github.com/IBM/differential-privacy-library
23. Różnice między tradycyjnym rozproszonym
uczeniem, a Federated Learning
23
https://www.pdl.cmu.edu/SDI/2019/slides/2019-09-05Fede
rated%20Learning.pdf
24. Korzyści
24
Benefits
Here are some primary benefits of federated machine learning:
● FL enables devices like mobile phones to collaboratively learn a shared prediction model while keeping the training
data on the device instead of requiring the data to be uploaded and stored on a central server.
● Moves model training to the edge, namely devices such as smartphones, tablets, IoT, or even “organizations” like
hospitals that are required to operate under strict privacy constraints. Having personal data remain local is a strong
security benefit.
● Makes real-time prediction possible, since prediction happens on the device itself. FL reduces the time lag that
occurs due to transmitting raw data back to a central server and then shipping the results back to the device.
● Since the models reside on the device, the prediction process works even when there is no internet connectivity.
● FL reduces the amount of hardware infrastructure required. FL uses minimal hardware and what is available in
mobile devices is more than enough to run the FL models.
25. Wyzwania dla Federated Learning
25
Challenges
● There are a number of core challenges associated with FL. First, communication is a critical bottleneck in FL networks
where data generated on each device remain local. In order to train a model using data generated by the devices in the
network, it is necessary to develop communication-efficient methods that reduce the total number of communication
rounds, and also iteratively send small model updates as part of the training process, as opposed to sending the entire
data set.
● Additionally, FL methods must: anticipate low levels of device participation, i.e. only a small fraction of the devices being
active at once; tolerate variability in hardware that affects storage, computational, and communication capabilities of
each device in a federated network; and be able to handle dropped devices in the network.
● Finally, FL helps to protect data generated on a device by sharing model updates such as gradient data instead of raw
data. But communicating model updates throughout the training process can still reveal sensitive information, either to a
third party, or to the central server.
26. Model memorization
26
Understanding and mitigating the risks of model memorization is an active area of research. Techniques to measure memorization
are explored, e.g. in the 2018 paper The Secret Sharer: Measuring Unintended Neural Network Memorization & Extracting Secrets.
Memorization risk can be mitigated by pre-filtering rare or sensitive information before training. More sophisticated mitigation
techniques include differentially private model training as explored, for example, in the 2018 paper Learning Differentially Private
Recurrent Language Models, which shows how to learn model weights that are not too dependent on any one device’s data. For more
information on differential privacy, the canonical textbook “The Algorithmic Foundations of Differential Privacy” by Cynthia Dwork and
Aaron Roth is available from NOW publishers and online.
https://federated.withgoogle.com/#about
27. Wyzwania dla Federated Learning
27
Tutaj są 3 fajne: ML, komunikacja i privacy
https://medium.com/accenture-the-dock/instilling-responsi
ble-and-reliable-ai-development-with-federated-learning-d
23c366c5efd
● Wyzwania dla FL https://medium.com/datadriveninvestor/an-overview-of-federated-learning-8a1a62b0600d
1. Inference attack - pozyskanie informacji o specyficznych userach -> rozwiązanie to differential privacy
https://medium.com/georgian-impact-blog/a-brief-introduction-to-differential-privacy-eacf8722283b
2. Model poisoning
28. Wyzwania ML dla Federated Learning
28
1. Problemy ML - moim zdaniem
1. Rozkład danych
2. Ile epoch uczenia lokalnie
3. Ogólnie hiperparameters tuning
4. Wagi udziału każdego klienta
https://www.pdl.cmu.edu/SDI/2019/slides/2019-09-05Federated%20Learning.pdf kilka ciekawych przykładów nie tylko ML