Paper commentary
Unsupervised Domain Adaptation by Backpropagation
Adversarial training teaches deep networks features that ignore domain shift
- Problem Deep models lose accuracy when test data differ from training data, and labels for the new domain are often missing. Earlier methods fixed the features first and then mapped one domain onto the other.
- Method The method attaches a domain classifier to the shared features through a gradient reversal layer. The layer passes data forward unchanged and flips the domain gradient on the way back, so the features learn to hide the domain.
- Results On MNIST to MNIST-M the approach scored .8149, compared to .5749 for the source-only model.
Why models trained on one domain stumble on another
Deep networks need a lot of labelled data, and the data they train on is often not the data they later see. Synthetic or semi-synthetic images can be produced in bulk and labelled for free, but their distribution differs from that of real photos. So a model that looks strong on its training set can fall off once it is deployed.
Domain adaptation is the name for learning a predictor when the training and test distributions differ. Most earlier work fixed the feature representation first and then built a mapping between the two domains. This paper instead asks whether the features themselves can be learned with the adaptation built in.
The focus is the unsupervised case, where target images carry no labels at all, because that is the harder version of the problem. The goal is a feature space where classes separate well and where source and target images look alike to the network.
A domain classifier that the features learn to fool
The key idea is to train two classifiers on shared features and let the features work against one of them. A label predictor learns the classes from labelled source images, while a domain classifier tries to tell source images from target images. The feature extractor is trained to help the label predictor and to hurt the domain classifier, so the domain signal is removed from the features.
The domain classifier's loss can stand in for how far apart the two feature distributions are, provided the classifier is trained well enough to separate them. Under the covariate shift assumption, making the feature distributions match should carry label accuracy from the source to the target domain. Measuring that distance directly is hard because the features are high-dimensional and keep changing during training.
The training objective is a saddle point rather than a minimum. The label and domain parameters each minimize their own loss, while the feature parameters minimize the label loss and maximize the domain loss.
How the reversal layer turns the saddle point into SGD
Plain SGD on the domain loss would make the features easier to separate by domain, which is the opposite of the goal. The gradient reversal layer fixes the sign inside an ordinary backpropagation graph. It acts as the identity in the forward pass and multiplies the incoming gradient by minus lambda in the backward pass.
The feature parameters then follow the update \[\theta_f \leftarrow \theta_f - \mu\left(\frac{\partial L_i^y}{\partial \theta_f} - \lambda \frac{\partial L_i^d}{\partial \theta_f}\right)\] The label predictor and the domain classifier take ordinary gradient steps with learning rate mu.
The layer has no parameters of its own, and lambda is a meta-parameter that backpropagation does not update. Downstream of the layer the domain loss enters the objective as \(E=\sum_{d_i=0} L_y^i - \lambda \sum_i L_d^i\), so the features receive the reversed gradient. After training, the label predictor applied to the feature extractor predicts labels for both domains.
Training uses SGD with 0.9 momentum and a learning rate that starts at 0.01 and is annealed as training progresses. Each batch holds 128 samples, and half of each batch comes from the source domain with known labels.
Digit and sign transfers
The first transfer uses MNIST as the labelled source and MNIST-M as the target, where digits sit on blended photo patches. The source-only model scored .5749 there, while the approach scored .8149, compared to .6078 for subspace alignment. Subspace alignment gained little over the source-only model, which the authors read as a sign of how hard this shift is.
Synthetic digits to SVHN is the scenario the authors call a common one, with 500,000 generated images as the source. The source-only model scored .8665 and the approach scored .9048, compared to .8672 for subspace alignment. The approach covers 66.1% of the gap between the source-only model and the train-on-target model, which scored .9244.
In the reverse direction, SVHN to MNIST, the approach scored .7107, compared to .5919 for the source-only model. The authors link this to SVHN-trained features being more generic, so they intermix the two domains less than the MNIST-trained features do. On Synthetic Signs to GTSRB the approach scored .8866, compared to .7400 for the source-only model, covering 56.7% of the gap.
GTSRB has 43 classes instead of 10, which makes the feature shift more complex.
OFFICE transfers under a transductive setting
OFFICE is small, with 2817 labelled images in 31 categories in its largest domain. The authors therefore fine-tune an AlexNet pre-trained on ImageNet, with the domain classifier attached to the 256-dimensional bottleneck of fc7. They use five random splits per transfer task and the whole unlabelled target domain.
On AMAZON to WEBCAM the approach scored .673, compared to .594 for DDC and .536 for DANN. The authors call this the most challenging shift in the benchmark, and it is where the largest gain appears.
On DSLR to WEBCAM and WEBCAM to DSLR the approach scored .940 and .937, compared to .925 and .917 for DDC. Within this table those are the highest values in their columns. Several of the compared numbers come from previously published results, so the protocols are not identical in every row.
Limitations
Unsupervised adaptation from MNIST to SVHN did not work, and the authors count it as a failure example. They know of no unsupervised method that does this transfer, so they had no comparison point. Training on SVHN without adaptation stayed hard for the first 150 epochs, so learning rate annealing was dropped there.
The semi-supervised test uses GTSRB with 1280 labelled training samples, and the rest serves as validation. Validation error is lower than for models trained on target data only or on source data only.
The lambda schedule was not optimized or tweaked, so better schedules remain untested. The domain classifier branch is described as somewhat arbitrary, and tuning it might improve adaptation. Larger-scale tasks remain future work, and the Gradient Reversal layer code is planned for release rather than available yet.
Paper info
- Authors
- Yaroslav Ganin, Victor Lempitsky
- Venue
- arXiv · Preprint
- First published
- 2014-9-26
- Added
- 2026-11-11
- Updated
- 2015-2-27
- Version
- v2
- arXiv
- 1409.7495
- Category
- stat.ML · cs.LG · cs.NE
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
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
Yaroslav Ganin, Victor Lempitsky (2014). Unsupervised Domain Adaptation by Backpropagation. arXiv:1409.7495v2. https://arxiv.org/abs/1409.7495v2
BibTeX
@misc{ganin2014unsupervised,
title = {{Unsupervised Domain Adaptation by Backpropagation}},
author = {Yaroslav Ganin and Victor Lempitsky},
year = {2014},
eprint = {1409.7495},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1409.7495v2}
}