Federated Adversarial Domain Adaptation

Federated learning improves data privacy and efficiency in machine learning performed over networks of distributed devices , such as mobile phones , IoT and wearable devices , etc . Yet models trained with federated learning can still fail to generalize to new devices due to the problem of domain shift . Domain shift occurs when the labeled data collected by source nodes statistically differs from the target node ’ s unlabeled data . In this work , we present a principled approach to the problem of federated domain adaptation , which aims to align the representations learned among the different nodes with the data distribution of the target node . Our approach extends adversarial adaptation techniques to the constraints of the federated setting . In addition , we devise a dynamic attention mechanism and leverage feature disentanglement to enhance knowledge transfer . Empirically , we perform extensive experiments on several image and text classification tasks and show promising results under unsupervised federated domain adaptation setting . 1 INTRODUCTION . Data generated by networks of mobile and IoT devices poses unique challenges for training machine learning models . Due to the growing storage/computational power of these devices and concerns about data privacy , it is increasingly attractive to keep data and computation locally on the device ( Smith et al. , 2017 ) . Federated Learning ( FL ) ( Mohassel & Rindal , 2018 ; Bonawitz et al. , 2017 ; Mohassel & Zhang , 2017 ) provides a privacy-preserving mechanism to leverage such decen-tralized data and computation resources to train machine learning models . The main idea behind federated learning is to have each node learn on its own local data and not share either the data or the model parameters . While federated learning promises better privacy and efficiency , existing methods ignore the fact that the data on each node are collected in a non-i.i.d manner , leading to domain shift between nodes ( Quionero-Candela et al. , 2009 ) . For example , one device may take photos mostly indoors , while another mostly outdoors . In this paper , we address the problem of transferring knowledge from the decentralized nodes to a new node with a different data domain , without requiring any additional supervision from the user . We define this novel problem Unsupervised Federated Domain Adaptation ( UFDA ) , as illustrated in Figure 1 ( a ) . There is a large body of existing work on unsupervised domain adaptation ( Long et al. , 2015 ; Ganin & Lempitsky , 2015 ; Tzeng et al. , 2017 ; Zhu et al. , 2017 ; Gong et al. , 2012 ; Long et al. , 2018 ) , but the federated setting presents several additional challenges . First , the data are stored locally and can not be shared , which hampers mainstream domain adaptation methods as they need to access both the labeled source and unlabeled target data ( Tzeng et al. , 2014 ; Long et al. , 2017 ; Ghifary et al. , 2016 ; Sun & Saenko , 2016 ; Ganin & Lempitsky , 2015 ; Tzeng et al. , 2017 ) . Second , the model parameters are trained separately for each node and converge at different speeds , while also offering different contributions to the target node depending on how close the two domains are . Finally , the knowledge learned from source nodes is highly entangled ( Bengio et al. , 2013 ) , which can possibly lead to negative transfer ( Pan & Yang , 2010 ) . In this paper , we propose a solution to the above problems called Federated Adversarial Domain Adaptation ( FADA ) which aims to tackle domain shift in a federated learning system through adversarial techniques . Our approach preserves data privacy by training one model per source node and updating the target model with the aggregation of source gradients , but does so in a way that reduces domain shift . First , we analyze the federated domain adaptation problem from a theoretical perspective and provide a generalization bound . Inspired by our theoretical results , we propose an efficient adaptation algorithm based on adversarial adaptation and representation disentanglement applied to the federated setting . We also devise a dynamic attention model to cope with the varying convergence rates in the federated learning system . We conduct extensive experiments on real-world datasets , including image recognition and natural language tasks . Compared to baseline methods , we improve adaptation performance on all tasks , demonstrating the effectiveness of our devised model . 2 RELATED WORK . Unsupervised Domain Adaptation Unsupervised Domain Adaptation ( UDA ) aims to transfer the knowledge learned from a labeled source domain to an unlabeled target domain . Domain adaptation approaches proposed over the past decade include discrepancy-based methods ( Tzeng et al. , 2014 ; Long et al. , 2017 ; Ghifary et al. , 2014 ; Sun & Saenko , 2016 ; Peng & Saenko , 2018 ) , reconstructionbased UDA models ( Yi et al. , 2017 ; Zhu et al. , 2017 ; Hoffman et al. , 2018 ; Kim et al. , 2017 ) , and adversary-based approaches ( Liu & Tuzel , 2016 ; Tzeng et al. , 2017 ; Liu et al. , 2018a ; Ganin & Lempitsky , 2015 ) . For example , Ganin & Lempitsky ( 2015 ) propose a gradient reversal layer to perform adversarial training to a domain discriminator , inspired by the idea of adversarial learning . Tzeng et al . ( 2017 ) address unsupervised domain adaptation by adapting a deep CNN-based feature extractor/classifier across source and target domains via adversarial training . Ben-David et al . ( 2010 ) introduce anH∆H-divergence to evaluate the domain shift and provide a generalization error bound for domain adaptation . These methods assume the data are centralized on one server , limiting their applicability to the distributed learning system . Federated Learning Federated learning ( Mohassel & Rindal , 2018 ; Rivest et al. , 1978 ; Bonawitz et al. , 2017 ; Mohassel & Zhang , 2017 ) is a decentralized learning approach which enables multiple clients to collaboratively learn a machine learning model while keeping the training data and model parameters on local devices . Inspired by Homomorphic Encryption ( Rivest et al. , 1978 ) , GiladBachrach et al . ( 2016 ) propose CryptoNets to enhance the efficiency of data encryption , achieving higher federated learning performance . Bonawitz et al . ( 2017 ) introduce a secure aggregation scheme to update the machine learning models under their federated learning framework . Recently , Mohassel & Zhang ( 2017 ) propose SecureML to support privacy-preserving collaborative training in a multiclient federated learning system . However , these methods mainly aim to learn a single global model across the data and have no convergence guarantee , which limits their ability to deal with non-i.i.d . data . To address the non-i.i.d data , Smith et al . ( 2017 ) introduce federated multi-task learning , which learns a separate model for each node . Liu et al . ( 2018b ) propose semi-supervised federated transfer learning in a privacy-preserving setting . However , their models involve full or semi-supervision . The work proposed here is , to our best knowledge , the first federated learning framework to consider unsupervised domain adaptation . Feature Disentanglement Deep neural networks are known to extract features where multiple hidden factors are highly entangled . Learning disentangled representations can help remove irrelevant and domain-specific features and model only the relevant factors of data variation . To this end , recent work ( Mathieu et al. , 2016 ; Makhzani et al. , 2016 ; Liu et al. , 2018a ; Odena et al. , 2017 ) explores the learning of interpretable representations using generative adversarial networks ( GANs ) ( Goodfellow et al. , 2014 ) and variational autoencoders ( VAEs ) ( Kingma & Welling , 2013 ) . Under the fully supervised setting , ( Odena et al. , 2017 ) propose an auxiliary classifier GAN ( AC-GAN ) to achieve representation disentanglement . ( Liu et al. , 2018a ) introduce a unified feature disentanglement framework to learn domain-invariant features from data across different domains . ( Kingma et al. , 2014 ) also extend VAEs into the semi-supervised setting for representation disentanglement . ( Lee et al. , 2018 ) propose to disentangle the features into a domain-invariant content space and a domainspecific attributes space , producing diverse outputs without paired training data . Inspired by these works , we propose a method to disentangle the domain-invariant features from domain-specific features , using an adversarial training process . In addition , we propose to minimize the mutual information between the domain-invariant features and domain-specific features to enhance the feature disentanglement . 3 GENERALIZATION BOUND FOR FEDERATED DOMAIN ADAPTATION . We first define the notation and review a typical theoretical error bound for single-source domain adaptation ( Ben-David et al. , 2007 ; Blitzer et al. , 2008 ) devised by Ben-David et al . Then we describe our derived error bound for unsupervised federated domain adaptation . We mainly focus on the high-level interpretation of the error bound here and refer our readers to the appendix ( see supplementary material ) for proof details . Notation . LetDS1 andDT denote source and target distribution on input space X and a ground-truth labeling function g : X → { 0 , 1 } . A hypothesis is a function h : X → { 0 , 1 } with the error w.r.t the ground-truth labeling function g : S ( h , g ) : = Ex∼DS [ |h ( x ) − g ( x ) | ] . We denote the risk and empirical risk of hypothesis h on DS as S ( h ) and ̂S ( h ) . Similarly , the risk and empirical risk of h on DT are denoted as T ( h ) and ̂T ( h ) . The H-divergence between two distributions D and D′ is defined as : dH ( D , D′ ) : = 2 supA∈AH |PrD ( A ) − PrD′ ( A ) | , whereH is a hypothesis class for input space X , and AH denotes the collection of subsets of X that are the support of some hypothesis inH . The symmetric difference spaceH∆H is defined as : H∆H : = { h ( x ) ⊕ h′ ( x ) ) |h , h′ ∈ H } , ( ⊕ : the XOR operation ) . We denote the optimal hypothesis that achieves the minimum risk on the source and the target as h∗ : = arg minh∈H S ( h ) + T ( h ) and the error of h∗ as λ : = S ( h∗ ) + T ( h∗ ) . Blitzer et al . ( 2007b ) prove the following error bound on the target domain . Theorem 1 . LetH be a hypothesis space of V C-dimension d and D̂S , D̂T be the empirical distribution induced by samples of size m drawn from DS and DT . Then with probability at least 1− δ over the choice of samples , for each h ∈ H , T ( h ) ≤ ̂S ( h ) + 1 2 d̂H∆H ( D̂S , D̂T ) + 4 √ 2d log ( 2m ) + log ( 4/δ ) m + λ ( 1 ) Let DS= { DSi } Ni=1 , and DT = { xtj } nt j=1 be N source domains and the target domain in a UFDA system , where DSi = { ( xsj , ysj ) } ni j=1 . In federated domain adaptation system , DS is distributed on N nodes and the data are not shareable with each other in the training process . The classical domain adaptation algorithms aim to minimize the target risk T ( h ) : = Pr ( x , y ) ∼DT [ h ( x ) 6= y ] . However , in a UFDA system , one model can not directly get access to data stored on different nodes for security and privacy reasons . To address this issue , we propose to learn separate models for each distributed source domain hS = { hSi } Ni=1 . The target hypothesis hT is the aggregation of the parameters of hS , i.e . hT : = ∑N i=1 αihSi , ∀α ∈ RN+ , ∑ i∈ [ N ] αi = 1 . We can then derive the following error bound : Theorem 2 . ( Weighted error bound for federated domain adaptation ) . LetH be a hypothesis class with VC-dimension d and { D̂Si } Ni=1 , D̂T be empirical distributions induced by a sample of size 1In this literature , the calligraphic D denotes data distribution , and italic D denotes domain discriminator . m from each source domain and target domain in a federated learning system , respectively . Then , ∀α ∈ RN+ , ∑N i=1 αi = 1 , with probability at least 1− δ over the choice of samples , for each h ∈ H , T ( hT ) ≤ ̂S̃ ( ∑ i∈ [ N ] αihSi ) ︸ ︷︷ ︸ error on source + ∑ i∈ [ N ] αi ( 1 2 d̂H∆H ( D̂Si , D̂T ) ︸ ︷︷ ︸ ( DSi , DT ) divergence +λi ) + 4 √ 2d log ( 2Nm ) + log ( 4/δ ) Nm︸ ︷︷ ︸ VC-Dimension Constraint ( 2 ) where λi is the risk of the optimal hypothesis on the mixture of DSi and T , and S̃ is the mixture of source samples with size Nm . d̂H∆H ( D̂Si , D̂T ) denotes the divergence between domain Si and T . Comparison with Existing Bounds The bound in ( 2 ) is extended from ( 1 ) and they are equivalent if only one source domain exists ( N = 1 ) . Mansour et al . ( 2009 ) provide a generalization bound for multiple-source domain adaptation , assuming that the target domain is a mixture of the N source domains . In contrast , in our error bound ( 2 ) , the target domain is assumed to be an novel domain , resulting in a bound involvingH∆H discrepancy ( Ben-David et al. , 2010 ) and the VC-dimensional constraint ( Vapnik & Vapnik , 1998 ) . Blitzer et al . ( 2007b ) propose a generalization bound for semisupervised multi-source domain adaptation , assuming that partial target labels are available . Our generalization bound is devised for unsupervised learning . Zhao et al . ( 2018 ) introduce classification and regression error bounds for multi-source domain adaptation . However , these error bounds assume that the multiple source and target domains exactly share the same hypothesis . In contrast , our error bound involves multiple hypotheses .

Summary: The authors present a novel algorithm for dealing with domain adaptation in the setting of federated learning (classification, specifically). That is, they tackle the issue of learning a model on a new domain when access to the data points used in training the source models is not possible due to privacy constraints. The approach uses the gradients of the source models, reweighed to account for the differing shifts between the different sources and the target domain, to fit the model on the target domain.