# Moment Matching for Multi-Source Domain Adaptation

Moment matching aligns multiple labeled sources with an unlabeled target domain

Xingchao Peng, Qinxun Bai, Xide Xia, Zijun Huang, Kate Saenko, Bo Wang · arXiv · 2018-12-4

- **Problem** Most domain adaptation methods assume one labeled source, but real labeled data often come from several domains. These domains differ from each other as well as from the target, and pooling them mixes those shifts together.
- **Method** M3SDA matches the first two feature moments of each labeled source with the target and with each other source. It uses one classifier per domain and combines their outputs at test time, weighted by source-only accuracy.
- **Results** M3SDA reaches 41.5% average accuracy on DomainNet, against 38.5% for the best baseline, MCD under source combine. On digit benchmarks it reaches 86.13%.

## Why one labeled source falls short

Most domain adaptation methods assume that all labeled data come from one source, and they reduce the gap to the unlabeled target with discrepancy terms or adversarial training. In practice, labeled images often arrive from several collections that differ in lighting, weather, visual cues or even modality, so a single source gives a narrow picture of the task.

Multi-source adaptation adds a second difficulty. The sources differ from the target and also from each other, so pooling them mixes these shifts together. Earlier multi-source work that aligns each source only with the target leaves the shift between sources unaddressed.

A multi-source method tested only on such benchmarks says little about the harder setting, which is why the work starts by building a larger benchmark.

## How DomainNet was built

DomainNet covers six domains and 345 categories, with about 0.6 million images. The dataset comparison table lists 569,010 images for DomainNet, against 15,500 for Office-Home and 280,157 for Syn2Real.

Twenty annotators removed the outliers over about 2,500 hours, and an image stayed only if two annotators both agreed to keep it. This left 423.5k of the 1.2 million crawled images.

The quickdraw domain was built differently: its raw stroke points were joined into complete drawings with a B-spline routine, and 500 drawings per category were kept, giving 172.5k images. The six domains each describe a different visual style for the same set of categories.

## Moment distance and the training objective

The extractor sends labeled source samples and target samples into one shared latent space, so every distance is measured between features rather than raw images.

The moment distance compares the sources and the target through the first two moments of their features, indexed by k from 1 to 2. \\\[MD^2(D\_S,D\_T)=\\sum\_{k=1}^{2}\\Big(\\frac{1}{N}\\sum\_{i=1}^{N}\\\|E(X\_i^k)-E(X\_T^k)\\\|^2+\\binom{N}{2}^{-1}\\sum\_{i=1}^{N-1}\\sum\_{j=i+1}^{N}\\\|E(X\_i^k)-E(X\_j^k)\\\|^2\\Big)\\\] Here X\_i^k are samples from the i-th labeled domain, X\_T^k are target samples, and E(X^k) is the feature embedding of the k-th moment.

The first term averages the squared gap between each labeled domain and the target, and the second averages the squared gaps over every pair of labeled domains.

The training objective adds the per-domain classification losses to the moment distance, weighted by a trade-off parameter lambda. \\\[\\min\_{G,C}\\sum\_{i=1}^{N}L\_{D\_i}+\\lambda\\min\_{G}MD^2(D\_S,D\_T)\\\] Each L\_{D\_i} is the softmax cross entropy of classifier C\_i on the i-th labeled domain. Lambda is set to 0.5 in all experiments, and performance changes little for lambda between 0.1 and 1.

## Test-time ensemble weighting

At test time, target samples pass through the extractor and all N classifiers, and their outputs are combined in one of two ways. The first, M3SDA\*, takes the plain average of the classifier outputs.

The second assigns each source a weight from its source-only accuracy against the N-th domain, which is treated as the target. \\\[w\_i=\\frac{acc\_i}{\\sum\_{j=1}^{N-1}acc\_j}\\\] The weights sum to one over the N-1 sources, so a source with higher source-only accuracy on the target receives more weight in the final prediction.

## Classifier pairs in M3SDA-β

M3SDA expects the conditional label distribution p(y\|x) to align once the feature distributions align, and the authors note that this might not hold in practice. M3SDA-β responds to this by keeping two classifiers per domain, which form N pairs, and training with three alternating steps.

The first step trains the extractor and the classifier pairs to classify the labeled source samples correctly, with an objective similar to the one above. The second step fixes the extractor and trains the classifier pairs so that their outputs on target samples differ as much as possible, with the discrepancy measured as the L1-distance between the two outputs.

\\\[\\min\_{C'}\\sum\_{i=1}^{N}L\_{D\_i}-\\sum\_{i}\|P\_{C\_i}(D\_T)-P\_{C\_i'}(D\_T)\|\\\]

The third step fixes the classifier pairs and updates the extractor so that the discrepancy on target samples shrinks. \\\[\\min\_{G}\\sum\_{i}\|P\_{C\_i}(D\_T)-P\_{C\_i'}(D\_T)\|\\\] The three steps alternate until the whole network converges.

## The moment-based bound

Earlier bounds, following Ben-David et al., control target error with an H∆H-divergence between the source and target distributions, and they do not directly point to moment-based methods. The paper therefore introduces a k-th order cross-moment divergence, written dCM\_k, and extends the earlier analysis to a bound stated in terms of it.

The setting is binary classification with a hypothesis space of VC dimension d, with m labeled samples in total and a fraction beta\_j of them drawn from the j-th source. For the empirical minimizer of the alpha-weighted source error, the bound holds with probability at least 1 minus delta, for any epsilon greater than zero. \\\[\\epsilon\_T(\\hat h)\\le\\epsilon\_T(h\_T^\*)+\\eta\_{\\alpha,\\beta,m,\\delta}+\\epsilon+\\sum\_{j=1}^{N}\\alpha\_j\\Big(2\\lambda\_j+a\_{n\_{j\\epsilon}}\\sum\_{k=1}^{n\_{j\\epsilon}}d\_{CM\_k}(D\_j,D\_T)\\Big)\\\] Here lambda\_j is the minimum over h of the sum of the target and j-th source errors, and eta is the sample-size term defined in the theorem.

The last term makes the target error depend on the cross-moment divergence between the target and each source, which motivates aligning moments for each target-source pair. Since the divergence is a metric, \\( d\_{CM\_k}(D\_1,D\_T)+d\_{CM\_k}(D\_2,D\_T)\\ge d\_{CM\_k}(D\_1,D\_2) \\) holds, so target alignment cannot be perfect while the sources themselves stay apart.

That is why source pairs are aligned too.

## Digit and Office-Caltech10 results

The digit experiments use five datasets, MNIST, Synthetic Digits, MNIST-M, SVHN and USPS, and each one takes a turn as the target while the rest serve as sources. Four of the sets are sampled at 25000 training and 9000 testing images, while USPS is used whole with 9298 images. Each setting is run five times, and the mean and standard deviation are reported.

The baselines cover discrepancy methods such as DAN, JAN, MEDA and CORAL, and adversarial methods such as DANN, ADDA, MCD and DCTN.

M3SDA reaches 86.13% average accuracy on the digit benchmarks, and M3SDA-β reaches 87.65%. MCD, the highest baseline average in the table, reaches 86.10.

Office-Caltech10 has ten categories from four domains: Amazon, Caltech, DSLR and Webcam. With ResNet-101 pre-trained on ImageNet, M3SDA reaches 96.1% average accuracy and M3SDA-β reaches 96.4%. The authors state that these are the best results reported on this dataset, and note that AlexNet gave weaker results than ResNet-101.

## Single-source baselines on DomainNet

Seven single-source methods were run on DomainNet: DAN, JAN, DANN, RTN, ADDA, MCD and SE. Each was run on 30 source-target pairs over the six domains, with each domain split 70%/30% into training and testing. DAN, JAN, DANN and RTN use AlexNet, ADDA and MCD use ResNet-101, and SE uses ResNet-152.

The authors report that DomainNet is hard for these methods, most of all for the infograph and quickdraw domains. The authors attribute the difficulty mainly to the large number of categories. In the painting-to-real setting, the number of categories was increased from 20 to 345, and SE performs best with few categories but is worst once the count exceeds 150.

## Multi-source DomainNet results

Two multi-source standards are used: single best, which takes the best single source, and source combine, which pools all sources into one domain for single-source adaptation. The baselines are the single-source methods under both standards, and DCTN for the multi-source setting.

Averaged over the six target settings, M3SDA reaches 41.5% and M3SDA-β reaches 42.6%. Among the baselines, the highest average is 38.5 for MCD under source combine, and DCTN reaches 38.2; the plain average M3SDA\* reaches 40.8.

Plain averaging gives 40.8%, and the source-accuracy weights raise the mean accuracy to 41.5%, an improvement of 0.7.

When quickdraw is the target, the single-best source-only row scores 11.8 and the source-combine source-only row scores 13.3. On that target the multi-source models score 4.4 for M3SDA\*, 5.2 for M3SDA and 6.3 for M3SDA-β. The authors call this negative transfer.

Under source combine, DAN, RTN, JAN and DANN fall below their source-only baseline, which the authors also read as negative transfer from pooling several sources.

## Limitations

The M3SDA objective assumes that aligning feature marginals also aligns the conditional label distribution, and the authors note that this might not hold in practice. M3SDA-β is the paper's response to that assumption, and its accuracy is reported on the same benchmarks rather than in a separate check of the assumption.

On quickdraw targets the proposed models fall below source-only baselines on DomainNet, and the paper does not offer a fix for that case.

The experiments use digit datasets, Office-Caltech10 and DomainNet, and the Office-Caltech10 results rely on ResNet-101. The stated sensitivity check covers lambda between 0.1 and 1. The theory concerns binary classification with a hypothesis space of VC dimension d, and the bound is stated for the empirical minimizer of the alpha-weighted source error.

## Paper info

- **Authors**: Xingchao Peng, Qinxun Bai, Xide Xia, Zijun Huang, Kate Saenko, Bo Wang
- **Venue**: arXiv · Preprint
- **First published**: 2018-12-4
- **Added**: 2026-11-12
- **Updated**: 2019-8-27
- **Version**: v4
- **arXiv**: 1812.01754
- **Category**: cs.CV
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1812.01754v4) · [PDF ↗](https://arxiv.org/pdf/1812.01754v4)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Xingchao Peng, Qinxun Bai, Xide Xia, Zijun Huang, Kate Saenko, Bo Wang (2018). Moment Matching for Multi-Source Domain Adaptation. arXiv:1812.01754v4. https://arxiv.org/abs/1812.01754v4

**BibTeX**

```
@misc{peng2018moment,
  title = {{Moment Matching for Multi-Source Domain Adaptation}},
  author = {Xingchao Peng and Qinxun Bai and Xide Xia and Zijun Huang and Kate Saenko and Bo Wang},
  year = {2018},
  eprint = {1812.01754},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1812.01754v4}
}
```

## Other paper commentary

- [Variational image compression with a scale hyperprior](https://refivu.com/en/papers/862ebff4-6ece-4ccf-a0cf-aa1b89192db4-variational-image-compression-with-a-scale-hyperprior.md)
- [DeblurGAN: Blind Motion Deblurring Using Conditional Adversarial Networks](https://refivu.com/en/papers/bcd086aa-43d4-404f-aae8-d730dc8d20db-deblurgan-blind-motion-deblurring-using-conditional.md)
- [Ups and Downs: Modeling the Visual Evolution of Fashion Trends with One-Class Collaborative Filtering](https://refivu.com/en/papers/c7f79e17-0229-4098-a2b0-1f184335cf4d-ups-and-downs-modeling-the-visual-evolution-of.md)
- [ProxylessNAS: Direct Neural Architecture Search on Target Task and Hardware](https://refivu.com/en/papers/40299bf6-79d4-4e50-829c-39acb400238f-proxylessnas-direct-neural-architecture-search-on-target.md)
- [Beyond Correlation Filters: Learning Continuous Convolution Operators for Visual Tracking](https://refivu.com/en/papers/cc3e5d8d-4cc2-494c-bc24-c9b0fd010736-beyond-correlation-filters-learning-continuous-convolution.md)
- [3D Semantic Segmentation with Submanifold Sparse Convolutional Networks](https://refivu.com/en/papers/03d04653-f014-489b-8502-00fe22ca0646-3d-semantic-segmentation-with-submanifold-sparse.md)
- [Semi-Supervised Learning with Deep Generative Models](https://refivu.com/en/papers/e4821cb7-e7f9-4874-ba36-d94522c55bbb-semi-supervised-learning-with-deep-generative-models.md)
- [The Google Similarity Distance](https://refivu.com/en/papers/bb278d2d-7ba0-4fc6-9c9b-7e248f6965c2-the-google-similarity-distance.md)
- [HOGWILD!: A Lock-Free Approach to Parallelizing Stochastic Gradient Descent](https://refivu.com/en/papers/4f25abad-2562-433a-bc64-107b6d812ffb-hogwild-a-lock-free-approach-to-parallelizing-stochastic.md)
- [Fourier Features Let Networks Learn High Frequency Functions in Low Dimensional Domains](https://refivu.com/en/papers/0db80d86-03b8-4275-8e19-39d4c7f0fd3d-fourier-features-let-networks-learn-high-frequency-functions.md)
- [HunyuanVideo: A Systematic Framework For Large Video Generative Models](https://refivu.com/en/papers/bf878ce4-776a-4af5-9994-66e35572b481-hunyuanvideo-a-systematic-framework-for-large-video.md)
- [CSRNet: Dilated Convolutional Neural Networks for Understanding the Highly Congested Scenes](https://refivu.com/en/papers/991e4e38-4c34-4634-839b-1c56b435a442-csrnet-dilated-convolutional-neural-networks-for.md)

## Terms in this paper

- [Accuracy](https://refivu.com/en/terms/1995c0cd6282-accuracy)
- [Resnet-101](https://refivu.com/en/terms/e1917778abec-resnet-101)
- [Maximum Mean Discrepancy](https://refivu.com/en/terms/2b1ea1367bf7-maximum-mean-discrepancy)
- [feature extractor](https://refivu.com/en/terms/d73e930d7b50-feature-extractor)
- [negative transfer](https://refivu.com/en/terms/0ee483083d0c-negative-transfer)
- [H∆H-divergence](https://refivu.com/en/terms/83edd3ddad94-h-h-divergence)
- [Ofﬁce-Caltech10](https://refivu.com/en/terms/4df8af464d84-office-caltech10)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/8dd0a99c-d46a-4b5e-bfd0-6d72f38da2fc-moment-matching-for-multi-source-domain-adaptation)
