MULTI-STEP DECENTRALIZED DOMAIN ADAPTATION
Year: 2019

Abstract:
Despite the recent breakthroughs in unsupervised domain adaptation (uDA), no prior work has studied the challenges of applying these methods in practical machine learning scenarios. In this paper, we highlight two significant bottlenecks for uDA, namely excessive centralization and poor support for distributed domain datasets. Our proposed framework, MDDA, is powered by a novel collaborator selection algorithm and an effective distributed adversarial training method, and allows for uDA methods to work in a decentralized and privacy-preserving way.

heading: MULTI-STEP DECENTRALIZED DOMAIN ADAPTATION
text: Anonymous authors Paper under double-blind review ABSTRACT
Despite the recent breakthroughs in unsupervised domain adaptation (uDA), no prior work has studied the challenges of applying these methods in practical machine learning scenarios. In this paper, we highlight two significant bottlenecks for uDA, namely excessive centralization and poor support for distributed domain datasets. Our proposed framework, MDDA, is powered by a novel collaborator selection algorithm and an effective distributed adversarial training method, and allows for uDA methods to work in a decentralized and privacy-preserving way.

heading: 1 Introduction
text: In practical machine learning systems, test samples are often drawn from a different data distribution than the training samples, due to variations in data acquisition processes between the training and test sets – caused by for example, different illumination conditions and cameras in the context of visual tasks. This shift in data distributions, known as domain shift, is a core reason which hinders the generalizability of predictive models to new domains. As manual labeling of data in each test domain is prohibitively expensive, unsupervised domain adaptation (uDA) has emerged as a promising solution to transfer the knowledge from a labeled source domain to unlabeled target domains (Long et al. (2015; 2017); Ganin et al. (2016); Tzeng et al. (2017); Hoffman et al. (2018); Shen et al. (2018); Sankaranarayanan et al. (2018); Hoffman et al. (2018)).
While uDA methods are indeed effective, little attention has been paid on how they would be incorporated in real-world machine learning systems. In this paper, we study and propose solutions for practical problems that arise while applying uDA techniques in ML systems, namely the challenges of distributed domain datasets and the overly centralized nature of existing uDA approaches. As a motivating example, consider a scenario wherein a model is trained for the task of fetal head detection from labeled ultrasound images collected in a hospital in Finland (source domain Sfin). Subsequently, this pre-trained model has to be deployed in three target hospitals - one in the US (Tus1) and two in China (Tcn1 and Tcn2). Due to variations in sonogram machines and medical training of sonographers, a domain shift is likely to occur in the test samples; hence we need to apply uDA to adapt the source classifier in the target domains.
Existing uDA methods are centralized by design, in that they assume that each target domain would always adapt from the labeled source domain (Sfin). This raises two issues: firstly, if the machine hosting the labeled source dataset is unavailable (e.g., it is undergoing maintenance or has connectivity issues), then clearly adaptation is not possible. More importantly, we argue that this choice of always adapting from a labeled source is not optimal from an adaptation perspective, because the domain discrepancy between the labeled source and a potential target domain could be high in some cases. Our work seeks to explore an interesting proposition: in addition to adapting from the labeled source, can we also perform uDA with other target domains, which themselves may have undergone domain adaptation in the past.
Further, existing uDA methods do not support distributed domain datasets and assume that source and target data are available on the same machine. Clearly, this raises privacy and legal concerns since either the source domain or the target domains need to send their sensitive data (i.e., sonograms) to each other to perform uDA. Moreover, such transfer of potentially large datasets also incurs severe communication costs.
In summary, this paper makes the following contributions:
• We formulate and study a brand-new problem focusing on the challenges of uDA in practical machine learning systems.
• We propose a multi-step uDA framework, wherein target domains can adapt not only from the labeled source, but also from other target domains. Powering this framework is a novel collaborator selector algorithm that chooses the optimal adaptation collaborator for each target domain, before initiating the adaptation.
• We propose an effective technique for allowing uDA algorithms and adversarial training to work across distributed datasets. Through extensive experiments on five image and speech datasets, we demonstrate the efficacy of our proposed solution.

heading: 2 Problem Formulation and Related Work
text: Consider a practical scenario of deploying a uDA method in a real-world ML system. Assume that a data collection exercise yields a labeled dataset upon which a model is trained using supervised learning. Thereafter, this model needs to be deployed to a population of users (or targets) whose data is unlabeled and divergent from the training dataset. Mathematically, we are presented with a single source domain S = (Rn, pS(x, y)), with input data XS and labels YS . There are multiple target domains {T j
∣∣j = 1, . . . ,K}, with data XjT drawn from target distribution pjT (x, y), without labeled observations. Using supervised learning, we train a representation mapping, MS , and a classifier, CS for the source domain. However, for the target domains, due to the absence of labeled observations, supervised learning is not possible and hence we would like to do adaptation with the source domain. We assume that target domains are introduced sequentially, one at a time.
Under this problem formulation, we highlight two unexplored research challenges:
Collaborator Selection. For each target domain that joins the system, how do we select an optimal collaborator for domain adaptation that will lead to highest post-adaptation accuracy for the target domain? Existing uDA methods (e.g., Hoffman et al. (2018); Tzeng et al. (2017); Ganin et al. (2016) always use the labeled source domain S as the adaptation collaborator for each target domain, however we argue that it is not optimal to always adapt for the labeled source domain for two reasons: i) if the domain shift between the target domain and the labeled source is high, we may not achieve a good adaptation performance (Wulfmeier et al. (2017)); (ii) from a practical perspective, it makes the entire system centralized and prone to failure if the device hosting the source dataset is unavailable for adaptation (e.g., due to connectivity issues). Instead, we propose a multi-step decentralized domain adaptation approach built upon the idea that a new target domain can adapt not only from the labeled source domain, but also from other target domains in the system which have already undergone domain adaptation.
More concretely, we define a collaborator set C as the set of domains that are available to collaborate with a target domain on an adaptation task. At step τ = τ0, only the source domain is present in the system, hence C0 = {S}. At step τ = τ1, the first target domain T 1 joins the system – at this moment, only the source domain S has a learned representationMS . Thereafter, T 1 performs uDA with the source S and learns a representation MT 1 . Subsequently, we have C1 = {S, T 1}, i.e., future target domains now have two candidates with whom they can collaborate to perform domain adaptation. In general, at step τ = τK , CK = {S} ∪ { T j ∣∣k = 1, . . . ,K}.
In §3.3, we propose an algorithm to select an optimal collaborator c ∈ CK for each target domain, that is likely to yield the best accuracy post-adaptation. Once the optimal collaborator is chosen, any existing uDA method could be employed to perform the pairwise adaptation between the chosen collaborator and the target domain. In §4, we show the effectiveness of this decentralized and multistep adaptation approach against conventional baselines and across a number of uDA techniques.
Distributed and Private Data. Existing uDA methods assume that the datasets from the source domain S and a given target domain T j are available on the same compute unit (e.g., on a server). However, this assumption is violated in practical scenarios, as the datasets are often private, and users or companies may not be allowed to share them with other parties due to legal reasons such as the data privacy law (GDPR) in Europe. In addition to the privacy issue, exchanging potentially large datasets incur high communication costs, making it undesirable in practical settings. This raises the question: can we make domain adaptation methods to work in a distributed and privacy-preserving manner such that the collaborators in the domain adaptation process can keep their data private and still receive the benefits of adaptation?
These challenges about making uDA algorithms work in a decentralized and distributed way are closely related, and addressing them is critical for practical usage of uDA methods. We first describe (in §3.2) our idea of supporting uDA with distributed domain datasets, by enabling knowledge exchange between adaptation collaborators using the gradients of Discriminator, which allows for the raw data and features of each domain to remain private. Next, in §3.3, we propose an algorithm for selecting an optimal collaborator for each target domain.

heading: 2.1 Related Work
text: Bobu et al. (2018) presented the problem of continuous unsupervised adaptation wherein the target domain is smoothly varying temporally. They proposed an iterative uDA method with a replay loss to prevent the model from forgetting knowledge from past domains. Although our solution of multi-step domain adaptation is also iterative, we do not assume any smooth ordering between target domains, hence warranting the need for collaboration selection. Zhao et al. (2018) proposed MDAN where a target domain can adapt from multiple labeled source domains. As there is only one labeled source domain in our setup, this method cannot be directly applied. However, we can still combine the adversarial losses from multiple domains as proposed in MDAN - as such, we implement a variant of MDAN as a baseline for our method.
In our paper, the training data from different domains is distributed in separate nodes, which relates our problem to distributed training. The motivation of most existing works in this field is to accelerate the training process by partitioning the training data into multiple computational nodes and calculating the gradients in parallel. If the results from all nodes are aggregated globally by a central node (e.g., parameter server (Li et al. (2014); Dai et al. (2015))), or by message passing process (e.g., All-Reduce (Sergeev & Del Balso (2018))), then it is called centralized distributed training. By contrast, if the system does not require to synchronize globally (Lian et al. (2017a); Tang et al. (2018b)), it is called decentralized training. Besides, decentralized training can be further accelerated by its conjunction with low-precision training (Tang et al. (2018a)), or asynchronous training (Lian et al. (2017b)). In addition to acceleration, federated learning (Bonawitz et al. (2019); Konečnỳ et al. (2016); Yang et al. (2019); Liu et al. (2018)) considers a training setting where the training data is stored over a large number of separate devices and cannot be shared due to privacy reasons. Our work builds upon the distributed training literature and we show, for the first time, how distributed training can be used in the context of uDA. Further, it is important to clarify that we use ‘decentralization’ in this paper in the context of domain adaptation, i.e., target domains can choose to adapt from any one of the available domains, instead of a single source domain (akin to a central node). This makes our techniques and their subsequent evaluation different from traditional decentralized learning papers.
Finally, an important goal of our paper is to support uDA while keeping the domain datasets private. There has been active research recently at the intersection of privacy and ML. Melis et al. (2019) showed that collaborative learning is vulnerable to membership inference attacks and leakage of dataset properties, and suggested employing dimensionality reduction and Dropout as ways to mitigate these attacks. Aono et al. (2017) demonstrated that the gradients of a classifier exchanged in distributed training can be used to reconstruct the raw training data and proposed using additively homomorphic encryption to fix the problem. Geyer et al. (2017) proposed a differential privacy approach to hide a single client’s data contribution during federated learning. Finally, Nasr et al. (2018) did an in-depth analysis of passive and active white-box attacks on deep learning models. To the best of our knowledge, no prior work has shown that sharing gradients of a discriminator in adversarial learning – which is the key component of our approach – can leak raw training data. As such, our approach provides clear privacy benefits over conventional uDA techniques. That said, we do not discount the possibility that privacy attacks could be developed on our technique in the future, and leave it open as a topic of further research.

heading: 3 Our Approach

heading: 3.1 Primer on Adversarial Domain Adaptation
text: Before describing our approach, we provide a primer on adversarial domain adaptation which is a widely used approach for uDA and serves as the basic foundation of our solution. The core idea here is to use adversarial learning to align the feature representations of the source and target domains, thereby allowing a source classifier to be used in the target domain. Initially, a source extractor ES and a source classifierCS are trained using supervised learning by solving the optimization problem:
min ES ,CS
Lcls = −E(xs,ys)∼(XS ,YS) K∑
k=1
1[k=ys][log(CS(ES(xs))]
The goal of the adaptation process is to learn a target extractorET using adversarial learning. To this end, the source extractor ES is used to initialize the target extractor ET . The weights of the source model are fixed during adversarial training. As in standard adversarial learning, two losses are optimized in the training process, a discriminator loss LadvD and a mapping loss LadvM . Different uDA methods compute these two losses in their own way, e.g., ADDA (Tzeng et al. (2017)) uses the following loss formulations:
min D LadvD = −Exs∼XS [log(D(ES(xs))]− Ext∼XT [log(1−D(ET (xt))] (1)
min ET LadvM = −Ext∼XT [log(D(ET (xt))] (2)
whereD represents a domain discriminator which aims to distinguish source domain data and target domain data. Details about other uDA methods are provided in §A.4 in the Appendix.
Our work in general applies to any feature-alignment based uDA technique, which allows for source and target encoders to be trained independently. We note that there are indeed uDA approaches which optimize the source classification loss and adversarial loss in the same batch during training, but they are not compatible with our problem formulation wherein a pre-trained source model is to be deployed on a set of target domains. Further, uDA approaches based on generative modeling (Hoffman et al. (2018); Hosseini-Asl et al. (2018)) are also out of scope of our work.

heading: 3.2 Distributed Domain Adaptation
text: Prior adversarial uDA methods assume that source and target data is available on the same compute unit to perform adversarial learning. However as discussed in §2, data from different domains is often distributed and private in realistic applications, and sharing it could be legally prohibited. We present an approach of performing domain adaptation with distributed domain datasets. In this vein, two key questions are: a) how to distribute the adversarial network architecture across nodes?, b) how to exchange information between the source and target nodes during training?
We propose to split each constituent neural network in the adversarial training framework across source and target nodes. Consequently, the extractor, domain discriminator and task classifier have source components (ES ,DS ,CS) and target components (ET ,DT ,CT ). Source data and target data can therefore be fed separately into their own model components to prevent any exchange of raw data or feature representations across nodes. Given this network architecture, we now present our training strategy (also summarized in Algorithm 1). The first step is pre-training and initialization. We assume that the extractor and classifier (ES and CS) of the source domain have been trained either using supervised learning or through prior domain adaptation, and the source discriminator DS is initialized randomly. Thereafter, the target domain components,ET ,CT andDT , are initialized with the respective source components. Figure 3 in Appendix A illustrates our distributed architecture and in §A.4, we provide the equations for various adversarial losses.
During adversarial training, for each step, source and target domains sample a training batch from their own domain data and calculate stochastic gradients for DS on source domain data and for ET , DT on target domain data accordingly. However, as shown in Eq.1, the discriminator needs to be trained on data from both the source and target domains, therefore we need a mechanism to transfer knowledge across between source and target domains. As opposed to transferring the raw data or extracted features across nodes, our approach performs knowledge exchange through the gradients of the discriminators. This in turn does afford certain privacy benefits, as we do not transmit raw data or the extracted features or even the gradients of the feature extractor which can potentially leak raw data (Aono et al. (2017)). Although to the best of our knowledge, no prior work has shown that discriminator gradients can leak training data, we do not discount the possibility that such privacy attacks can be developed in the future. We leave their study and mitigation as a future work.
A simple strategy for knowledge transfer between nodes would be to exchange and average the gradients of the two discriminators after each step, and then update DS and DT with the averaged gradients. While this will ensure that the discriminators are synchronized, it incurs a significant communication cost for each step. Instead, we propose a simple but effective method, called Lazy Synchronization, to reduce the communication cost of the algorithm. The basic idea is to synchronize the source and target discriminators every p training steps. We refer to the training steps at which the synchronization takes place as the sync-up steps while the other steps during which both nodes are computing the gradients locally are called local steps. For discriminatorsDS andDT , their local
gradients are accumulated during local steps, and during the sync-up steps the accumulated gradients are averaged and applied toDS andDT . Through this, we can ensure there is no divergence between the discriminators, and at the same time we are able to decrease the communication cost to 1/p. Note that as we only exchange discriminator gradients, our communication costs are independent of the feature extractors, which can be potentially very deep and large in size.
Algorithm 1: DISTRIBUTED UDA: Lazy-Synchronized Distributed Domain Adaptation Result: ET and CT
1 Input: Pre-trained ES and CS ; Randomly Initialize DS ; Initialize ET = ES , DT =DS , and CT = CS ; Sync up step p; number of total steps N ; 2 for n = 1, 2, ..., N do 3 Source node and target node sample a
batch of data respectively, ξ(n)s and ξ (n) t ;
4 Calculate gradients ∇g(DS , ξ(n)s ) on source node, gradients∇g(ET , ξ(n)t ) and∇g(DT , ξ(n)t ) on target node ; 5 if isTargetNode then 6 Apply∇g(ET , ξ(n)t ) to ET 7 end 8 Add ∇g(DS , ξ(n)s ) to source gradients
buffer GS , add ∇g(DT , ξ(n)t ) to target gradients buffer GT ;
9 if n%p == 0 then 10 Exchange gradients buffer and
calculate averaged gradients gavg = GS+GT 2p ;
11 Apply gavg to DS and DT ; 12 Clear GS and GT ; 13 end 14 end
Algorithm 2: COLAB SELECT: Wasserstein-Distance Guided Collaborator Selection
1 Input: Candidate set C = {(p1, E1, C1), (p2, E2, C2). . . (pN , EN , CN )}, Target Dataset pT ; 2 for (pi, Ei, Ci) in C do 3 Wi =
compute wasserstein distance(pi, pT );
4 Compute source error s using a small labeled test set.; 5 Compute the Lipschitz Constant K for the source extractor Ei and classifier Ci. ; 6 itmax = s + 2.K.Wi; 7 end 8 Optimal Collaborator O = argmin
i=1...N
( itmax ); 9 Return EO and CO;
Algorithm 3: MDDA: Multi-step Decentralized Domain Selection
1 Input: Initial Candidate set C = {(ES , CS)}, Ordering of K target domains T = T1, T2 . . . TK ; 2 for Ti in T do 3 Obtain the optimal collaborator O ∈ C using COLAB SELECT; 4 Run DISTRIBUTED DA between O and Ti to obtain ETi and CTi ; 5 C← C ∪{(ETi , CTi )}; 6 end
The target extractor ET is independent of the source data, therefore it is updated for each batch using the adversarial formulation proposed by the underlying adaptation algorithm. For instance, Equation 9 shows the loss function to update ET as proposed in ADDA. On the other hand, GRL (Ganin et al. (2016)) uses a gradient reversal technique which results in LadvM = −LadvD , Shen et al. (2018) uses the Wasserstein Distance as a metric for adversarial training. Details about the adversarial loss functions of different algorithms used in this paper are provided in §A.4. Finally, the target classifier CT is initialized with CS and is not updated in the training process. The intuition is that if the feature space of the target domain can be successfully aligned with the source domain, then CS can directly be used in the target domain without any adaptation.
In §4.2, we empirically show that our method can obtain comparable accuracy to non-distributed training algorithms, while at the same time, preserving private user data and minimizing the communication costs in the training process.

heading: 3.3 Wasserstein distance guided collaborator selection
text: We now discuss how to select an optimal adaptation collaborator c ∈ CK for each target domain. Indeed, we should select a collaborator that is likely to yield the lowest target error post adaptation, but can we choose the optimal collaborator even before performing domain adaptation? In a
seminal theoretical work, Ben-David et al. (2010) showed that the target error is bounded by the sum of source error and the divergence between source and target distributions. Redko et al. (2017) and Shen et al. (2018) did a similar analysis using the Wasserstein distance, which, together with Lipschitz functions, forms the basis for our collaborator selection method.
A function f : X → R is θ-Lipschitz if it satisfies the inequality ‖f(x)−f(y)‖ ≤ θ‖x−y‖ for some θ ∈ R+. The smallest such θ is called the Lipschitz constant Lip(f) of f . Further, the 1-Wasserstein distance (Villani (2008)) between two distributions p1 and p2 – using the duality formula – is
W1(p1, p2) = sup f :Lip(f)≤1 Ep1 [f ]− Ep2 [f ] (3)
Shen et al. (2018) computed the following robustness bound p2 (h, h
′) ≤ p1 (h, h′) + 2θW1 (p1, p2) (4) for any two θ-Lipschitz hypotheses h and h′, where we denoted
p(h, h ′) = Ep [‖h− h′‖] . (5)
Our method is motivated by the observation that the above bound is a good approximation of the error p2(h) = p2(h, h
true), provided that both the true hypothesis htrue and the learned hypotheses h = E ◦ C are θ-Lipschitz, and the push-forward measures E∗p are close together in the Wasserstein distance, for a sufficiently small θ. These conditions are motivated by the fact that the domains should be well aligned for unsupervised domain adaptation to be effective. Using a Lipschitz continuous extractor allows us to perform adversarial alignment of higher order features, while maintaining a Lipschitz continuity guarantee on the true hypothesis as a function of the encoded features E(x), where x ∼ p2. Now assume we are trying to use domain adaptation to find a model for a domain D = (Rn, p) and we have a set of candidate domains Dk = (Rn, pk), k = 1, . . . ,K each with a pre-trained model Mk = (Ek, Ck), obtained by using either supervised learning or prior domain adaptation. We use the estimate provided by Equation 4 to select the optimal collaborator domain
Dopt = argmin k=1,...,K pk(Ek ◦ Ck) + 2θW1(pk, p) (6)
and thereafter perform adaptation from Dopt to D.
Enforcing Lipschitz continuity and computing the Wasserstein distance. Training neural networks with minimal Lipschitz constants can be done by directly regularizing the spectral norm of the linear part of each layer Mises & Pollaczek-Geiringer (1929); Gouk et al. (2018), or a gradient penalty Gulrajani et al. (2017), or indirectly by using L1 or L2 weight decay. Enforcing a hard constraint on θ can be done by rescaling the linear part of each layer or, indirectly, by weight clipping. For the feature extractor and classifier neural networks, we employ Spectral Norm regularization proposed by Gouk et al. (2018). Further, to compute the Wasserstein distance between distributions, we train a Wasserstein critic with gradient penalty as proposed by Gulrajani et al. (2017). This critic can also be trained in a distributed manner following our lazy synchronization strategy (§ 3.2).

heading: 3.4 Multi-Step Decentralized Domain Adaptation (MDDA)
text: Using the two core ideas discussed § 3.2 and § 3.3, we now summarize our multi-step DA algorithm MDDA (Algorithm 3). Assume we are given a source domain with pre-trained model and an arbitrary ordering of K unlabeled target domains. For every target domain that joins the system, we run collaborator selection with the candidates available in the system. Upon selecting an optimal collaborator, we run the distributed DA algorithm to enable uDA in a privacy-preserving manner. The adaptation process results in a feature extractor ET and a classifier CT for the target domain. Finally, the recently adapted target domain is added to the candidate set, and may serve as a potential collaborator for future domains.

heading: 4 Evaluation

heading: 4.1 Implementation
text: Datasets. We conduct experiments on five image and audio datasets: Rotated MNIST, Digits, and Office-Caltech, DomainNet and Mic2Mic. Rotated MNIST is a variant of MNIST with numbers rotated from 0°to 330°at increments of 30°. Each rotation is considered a separate domain. The
Digits adaptation task has five domains: MNIST (M), USPS (U), SVHN (S) (Netzer et al. (2011)), MNIST-M and SynNumbers (SYN) (Ganin & Lempitsky (2014)). Each domain consists of 10 digit classes ranging from 0-9 in different styles. The Office-Caltech dataset contains object images from 10 classes obtained from Amazon (A), DSLR camera (D), Web camera (W), and Caltech256 (C). DomainNet (Peng et al. (2018)) is a new dataset from which we use four labeled image domains containing 345 classes each: Real (R), QuickDraw (Q), Infograph (I), and Sketch (S). Finally, Mic2Mic (Mathur et al. (2019)) is a speech-based keyword detection dataset wherein the keywords are recorded with four different microphones: Matrix Creator (C), Matrix Voice (V), ReSpeaker (R) and USB (U). Each microphone represents a domain.
Baselines. To evaluate our collaborator selection strategy, we compare it against the following:
• Labeled Source. This represents the most commonly used approach in uDA works, wherein every target domain performs a pairwise adaptation with the labeled source domain S.
• Random Collaborator. Here, we randomly choose a collaborator c ∈ CK from the collaborator set and perform adaptation with the target domain.
• Multi-Collaborator. This approach is based on MDAN proposed by Zhao et al. (2018), wherein all available candidate domains are used for adaptation, however the contribution of each domain is dynamically re-weighted in the adversarial training process. However, note that MDAN assumes that all the candidate domains are labeled and jointly optimize the classification loss with the adversarial training. In our scenario, only one candidate domain has labeled data (S) while others are unlabeled. As such, we implement a modified version of MDAN which only optimizes their proposed adversarial loss in line with our problem formulation in §3.1.
Further, we compare our proposed distributed adversarial learning architecture against (i) a nondistributed uDA baseline wherein the source and target data reside on the same node, and (ii) DPSGD proposed by Lian et al. (2017a) for distributed training of neural networks.
Experiment Setup. We follow the same evaluation protocol as earlier uDA works (Hoffman et al. (2018); Tzeng et al. (2017)) wherein the unlabeled training instances from source and target domains are used for adversarial training, and the adapted model is evaluated on a held-out test dataset from target domain. In addition, we use a small subset of the training instances (10% of the total instances) for doing collaborator selection. Further, as we explained earlier, we assume that target domains join the system sequentially in an order, one at a time. Therefore, for each dataset, we randomly select different orderings of source and target domains and present average results across them. Our system is implemented with Tensorflow 2.0 and trained on Nvidia V100 GPUs. For more details about network architectures and training hyper-parameters, please see Appendix A.

heading: 4.2 Results
text: We now present our results of applying MDDA on five datasets. Overall, our results show that MDDA selects the right collaborator for adaptation in 82% of the cases, which result in the highest mean target domain accuracy when compared to other baselines.
Performance of Collaborator Selection. For each dataset, we choose three random orderings of source and target domains, e.g., for Office-Caltech, we choose O1=W,A,D,C; O2=D,C,A,W; and O3=A,D,W,C. Here the first domain in the order (in bold) represents the labeled source domain, while the others are unlabeled target domains in the order in which they join the system. Please refer to Appendix A for details about the orderings used for other datasets.
Figure 1 shows the accuracy of our collaborator selection algorithm. For this experiment, we perform adaptation between a target domain and each available candidate, and based on the target accuracy after each pairwise adaptation, we obtain the collaborator that yields the highest accuracy for each target domain. This serves as the ground truth for our algorithm. Thereafter, we run our collaborator selection algorithm on each ordering and obtain the optimal collaborator based on Algorithm 2. By comparing the output of our algorithm with the ground truth, we obtain Figure 1 which shows that on average, our algorithm has a selection accuracy of 82%. On further analysis, we found that our algorithm primarily makes mistakes when two candidates have similar domain discrepancy (estimated using the W1 distance) with the target domain and we pick the second most optimal collaborator. In such scenarios, although the top-1 collaborator selection accuracy drops,
it typically does not impact the target error significantly because adapting with the second-most optimal domain also yields a good adaptation performance.
Table 1 shows, for three different orderings, the mean accuracy across all target domains with MDDA and other baselines. We observe that in majority of the scenarios, MDDA outperforms the labeled-source adaptation baseline which is commonly used in uDA methods. This confirms our key intuition that a labeled source domain is not always optimal for domain adaptation, and demonstrates the value of a more flexible and decentralized approach like MDDA. Interestingly, we observe that while the multi-collaborator baseline is less accurate than MDDA in general, its performance is particularly poor on Rotated MNIST in which the number of collaborators are quite high – while a detailed investigation of this finding is outside the scope of this paper, we surmise that this technique does not scale well as the number of collaborator domains increase. MDDA, on the contrary, only performs pairwise adaptation once an optimal collaborator is selected, as such it scales gracefully as the number of target domains increase.
The results presented so far used the adversarial loss formulation from Eq. 1 and 2 which was proposed in ADDA. In Table 2, we evaluate the applicability of MDDA to methods that use other adversarial loss formulations such as (i) when a Gradient Reversal Layer (GRL) is used to compute the mapping loss, (ii) when Wasserstein Distance is used as a loss metric for domain discriminator (Shen et al. (2018)) and (iii) a recently proposed uDA technique called CADA (Zou et al. (2019)) which enforces consensus between source and target features. More details about these techniques and their optimization objectives are provided in Appendix A.
We observe that while different techniques yield different target accuracies, MDDA can work in conjunction with all of them to improve the overall accuracy over the conventional labeled source baseline.
RM DI M2M OC DN 0
20
40
60
80
100
S el
ec tio
n A
cc ur
ac y
(in %
)
Figure 1: Mean accuracy of collaborator selection for three orderings for Rotated MNIST (RM), Digits (DI), Mic2Mic (M2M), Office (OC) and DomainNet(DN).
Performance of Distributed Domain Adaptation. We now evaluate our Lazy-synchronized DA algorithm from a domain adaptation lens. Our key objective is to evaluate the target-domain accuracy and communication trade-off, i.e., can we save communication costs associated with distributed training while ensuring similar levels of target domain accuracy as the conventional non-distributed DA algorithms. In Figure 2, we plot the target domain accuracy with the number of adversarial training steps for three uDA tasks. It can be observed that even with lazy synchronization (sync-up step size p = 4), we can achieve similar target accuracy and convergence rate as non-distributed and synchronized training methods, while incurring only 25% of the communication costs (as we are exchanging data every 4 steps). We also note that the distributed training baseline (DPSGD) performs poorly for adversarial training primarily because of the non-overlapping label spaces on each node (with respect to the domain label).
Table 3 expands this finding to show the target domain accuracy for 10 adaptation tasks under different training mechanisms. Further, we also report the average time taken to perform the adversarial training for different datasets. Note that the training time is the sum of local computation time and
communication time across nodes. In conventional non-distributed DA, it is assumed that the domain datasets are available on the same node, as such there is no communication required during the training, which expectedly results in the fastest training process, at the expense of user privacy. In the fully-synchronized case, the amount of communication equals the size of discriminator gradients multiplied by the number of training steps, whereas in the lazy-synchronized case, the communication amount is one pth of the amount of fully synchronized case, where p is the sync-up step. Based on the amount of data communicated across nodes, we estimate the communication time by assuming a bandwidth of 40Mbps which is roughly the average upload speed for broadband connections globally1. The computation time is measured for each training step and aggregated to get the total computation time. By adding the total computation time with the total communication time, we obtain the total training time reported in Table 3.
As shown in Table 3, the Lazy-Synchronized approach achieves target accuracy close to nondistributed and fully-synchronized approaches. For example, in the D→ A task in Office-Caltech, our approach – while ensuring that domain data remains private – results in 91.77% target domain accuracy, which is indeed close to the 92.01% and 92.13% accuracy of non-distributed and fullysynchronized training mechanism. Further, we observe that the training time of our approach is significantly less than the fully-synchronized approach due to the reduced communication.

heading: 5 Limitations and Conclusion
text: We introduced a novel perspective on uDA research and explored practical challenges associated with deploying uDA methods in real-world ML systems. Our proposed framework MDDA is the first-ever solution aiming to make uDA work in a decentralized and distributed manner.
As uDA is a rapidly evolving field, we did not study every class of uDA algorithms (e.g., those which combine feature-level adaptations with instance-level adaptations) in this paper. We also made an assumption that target domains are introduced sequentially in the system, however there could indeed be other ways in which ML models would evolve in practice (e.g., multiple target domains join together or in batches). We leave those scenarios as future work. Finally, our method provides user privacy by only sending discriminator gradients across nodes. While no prior work has shown that discriminator gradients can leak raw data, we do not discount the possibility that privacy attacks could be developed on MDDA in the future. We leave a detailed privacy study of MDDA as a future work.
1https://www.speedtest.net/global-index

heading: A Appendix
text: Here we provide details about our experiment setup and model architectures. We are also in the process of obtaining necessary clearances to release our source code to the community.

heading: A.1 Domain Orderings.
text: As we mentioned in our problem formulation, the order of target domains joining the system can effect the decisions of our collaborator selecting algorithm, and lead to different target accuracies. To measure the effect of target orders, we reported three different orders for each data set in our experiments. We specify these order as follows:

heading: A.2 Model Architectures and Hyperparameters.
text: We now describe the neural architectures used for each dataset along with the hyperparameters used in supervised and adversarial learning.
Rotated MNIST: We use the well-known LeNet architecture for this dataset as shown below. The model was trained for each source domain with a learning rate of 10−4 using the Adam optimizer and a batch size of 32.
Conv2D(filters = 20, kernel_size = 5, activation=’relu’), MaxPooling2D(pool_size = 2, strides = 2), Conv2D(filters = 50, kernel_size = 5, activation=’relu’), MaxPooling2D(pool_size = 2, strides = 2), Flatten(), Dense(500, activation=’relu’), Dense(10, activation=’softmax’)
In order to enforce the Lipschitz continuity, we added spectral norm regularization during the training process. In the adversarial training process, we used the ADDA losses to perform domain adaptation with a learning rate of 10−5 for the target extractor and 10−4 for the discriminator.
Office-Caltech: We used Keras Inception-V3 pre-trained on ImageNet as the base model for this task. We added a bottleneck layer and a final classification layer. The model was trained for each source domain with a learning rate of 10−5 using the Adam optimizer and a batch size of 32.

heading: InceptionV3(include_top=False, input_shape=(299, 299, 3),avg=’pool’), Dense(256, activation=’relu’) Dense(10, activation=’softmax’)
text: In order to enforce the Lipschitz continuity, we added spectral norm regularization during the training process. In the adversarial training process, we used the ADDA losses to perform domain adaptation with a learning rate of 10−5 for the target extractor and 1e-4 for the discriminator.
DomainNet: We used Keras ResNet50-v2 pre-trained on ImageNet as the base model for this task. The model was trained for each source domain with a learning rate of 1e-5 using the Adam optimizer and a batch size of 64.

heading: ResNet50V2(include_top=False, input_shape=(224, 224,3), avg=’pool’), Dense(245, activation=’softmax’)
text: In order to enforce the Lipschitz continuity, we added spectral norm regularization during the training process. In the adversarial training process, we used the ADDA losses to perform domain adaptation with a learning rate of 10−6 for the target extractor and 10−4 for the discriminator.
Mic2Mic: We mainly used three convolutional layers for this task. The model was trained for each source domain with a learning rate of 10−5 using the Adam optimizer and a batch size of 64.
Conv2D(filters = 64, kernel_size = (8,20), activation=’relu’) MaxPooling2D(pool_size = (2,2)), Conv2D(filters = 128, kernel_size = (4,10), activation=’relu’), MaxPooling2D(pool_size = (1,4)), Conv2D(filters = 512, kernel_size = (2,2)),

heading: Flatten(), Dense(256, activation=’relu’),
text: Dense(31)
In order to enforce the Lipschitz continuity, we added spectral norm regularization during the training process. In the adversarial training process, we used the ADDA losses to perform domain adaptation with a learning rate of 10−6 for the target extractor and 10−4 for the discriminator.
Digits: We constructed a neural network with three convolutional layer and some additional techniques like Dropout, BatchNormalization, for this task. The model was trained for each source domain with a learning rate of 10−5 using the Adam optimizer and a batch size of 64.
inputs = tf.keras.Input(shape=(32,32,3), name=’img’) x = Conv2D(filters = 64, kernel_size = 5, strides=2)(inputs) x = BatchNormalization()(x, training=is_training) x = Dropout(0.1)(x, training=is_training) x = ReLU()(x) x = Conv2D(filters = 128, kernel_size = 5, strides=1)(x) x = BatchNormalization()(x, training=is_training) x = Dropout(0.3)(x, training=is_training) x = ReLU()(x) x = Conv2D(filters = 256, kernel_size = 5, strides=1)(x) x = BatchNormalization()(x, training=is_training) x = Dropout(0.5)(x, training=is_training) x = ReLU()(x) x = Flatten()(x) x = Dense(512)(x) x = BatchNormalization()(x, training=is_training) x = ReLU()(x) x = Dropout(0.5)(x, training=is_training)
outputs = Dense(10)(x)
In order to enforce the Lipschitz continuity, we added spectral norm regularization during the training process. In the adversarial training process, we used the ADDA losses to perform domain adaptation with a learning rate of 10−6 for the target extractor and 10−4 for the discriminator.

heading: A.3 Architecture Diagram
text: Figure 3 shows the general architecture of our distributed lazy-synchronized training technique. As explained in Algorithm 1 and § 3.2, we split each constituent neural network in the adversarial training framework across source and target nodes. Consequently, the extractor, domain discriminator and task classifier have source components and target components. Knowledge exchange between the nodes is done through exchanging the discriminator gradients in the sync-up steps.

heading: A.4 Details of Domain Adaptation Algorithms
text: We now discuss the adversarial training formulation of the various uDA algorithms with which we evaluated the efficacy of our proposed MDDA framework. As shown in Table 4.2, we evaluate our method with four domain adaptation techniques: ADDA (Tzeng et al. (2017)), Gradient Reversal (Ganin et al. (2016)) and Wasserstein DA (Shen et al. (2018)), and CADA (Zou et al. (2019)) Below are the adversarial training formulations of these techniques as proposed in their original papers.
ADDA. Following the same notations used earlier in the paper, the adversarial loss formulations of ADDA can be represented mathematically as:
min D LadvD = −Exs∼XS [log(D(ES(xs))]− Ext∼XT [log(1−D(ET (xt))] (7)
min ET LadvM = −Ext∼XT [log(D(ET (xt))] (8)
The Discriminator D is optimized using LadvD where the domain data from source and target domains are assigned different domain labels (0 and 1). To update the feature extractor ET , ADDA proposes to invert the domain labels, which results in the loss formulation given in LadvM .
In order to run ADDA in a distributed manner, we decompose the discriminator D into DS and DT which results in the following loss functions:
LadvDS = −Exs∼XS [log(DS(ES(xs))] (9)
LadvDT = −Ext∼XT [log(1−DT (ET (xt))] (10)
min ET LadvM = −Ext∼XT [log(DT (ET (xt))] (11)
Thereafter, we compute local gradients for DS and DT ,
∇g(DS , xs) = δLadvDS δDS
(12)
∇g(DT , xt) = δLadvDT δDT
(13)
and aggregate them in the sync-up step as shown in Algorithm 1. The aggregated gradients are used to optimize DS and DT , while ET is optimized using the loss function in Equation 11.
Gradient Reversal. The Gradient Reversal approach uses the same loss formulation for the discriminators DS and DT as ADDA as shown in Equations 7, 9, 10.
However, to update the target extractor ET , it leverages the gradient reversal strategy, resulting in the following loss function.
min ET LadvM = −LadvDT
= Ext∼XT [log(1−DT (ET (xt))] (14)
The computation of local gradients for DS and DT follow the same process as shown in Equations 12 and 13.
Wasserstein DA. In this recently published technique, authors use the Wasserstein distance as the loss function for discriminator. Wasserstein distance between two datasets is defined as
Wasserstein(Xs, Xt) = 1
ns ∑ xs∼XS D(ES(xs))− 1 nt ∑ xt∼XT D(ET (xt)) (15)
where ns and nt are the number of samples in the dataset. The discriminator loss is computed as:
min D LadvD = −Exs∼XS ,xt∼XT [Wasserstein(xs, xt)] + γLgrad (16)
where Lgrad is the gradient penalty used to enforce the Lipschitz constraint on the discriminator. Further, the target extractor is optimized using the following loss function:
min ET LadvM = Exs∼XS ,xt∼XT [Wasserstein(xs, xt)] (17)
We use the same strategy to compute local gradients for DS and DT as shown in Eq 12 and 13.
CADA. Consensus Adversarial Domain Adaptation is a technique recently proposed by Zou et al. (2019) which enforces the source and target extractors to arrive at a consensus in the feature space through adversarial training. It uses the same loss formulation for the discriminators DS and DT as ADDA as shown in Equations 7, 9, 10. However, the key difference is that CADA optimizes both the source and target feature extractors in the training process, until the discriminator can no longer distinguish the features from source and target domains.
min ES LadvM1 = −Exs∼XS [log(DS(ES(xs))] (18)
min ET LadvM2 = −Ext∼XT [log(DT (ET (xt))] (19)
Thereafter, a shared classifier is trained on the sourced labeled data by keeping the source feature extractor fixed. The shared classifier can be used with the target extractor to make predictions.
min CShared
Lclf = −E(xs,ys)∼(XS ,YS) K∑
k=1
1[k=ys][log(CShared(ES(xs))]

Review summaries:
This paper tackles unsupervised domain adaptation in a decentralized setting.  The high-level observation is that the conventional unsupervised domain adaptation has two bottlenecks, namely excessive centralization and poor support for distributed domain datasets. The paper proposes Multi-Step Decentralized Domain Adaptation (MDDA) to transfer the knowledge learned from the source domain to the target domain without sharing the data.