Source-linked AI summary
Domain-Adversarial Training of Neural Networks
Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, François Laviolette, Mario Marchand, Victor Lempitsky
TL;DR
Domain adaptation is needed when labeled source data differ from unlabeled target data distributions. DANN learns source-predictive, domain-invariant features through adversarial training and achieves state-of-the-art results across sentiment-analysis and image-classification benchmarks.
Problem
Domain adaptation must address limited labeled data and distribution shifts between available source training data and data encountered at test time.
Method
DANN combines task-predictive and domain-invariant representation learning in feed-forward networks using standard backpropagation and a gradient reversal layer.
Results
DANN achieves state-of-the-art performance across sentiment-analysis and image-classification domain-adaptation benchmarks, outperforming a competing method in five image cases.
Takeaways & Limitations
The approach can be added to almost any backpropagation-trainable neural architecture and extends beyond classification to descriptor learning for person re-identification.
Takeaways & Limitations
Unsupervised adaptation from MNIST to SVHN fails to improve on the non-adapted model, which achieves approximately 0.25 accuracy.
Abstract
from arXiv · showhide
We introduce a new representation learning approach for domain adaptation, in which data at training and test time come from similar but different distributions. Our approach is directly inspired by the theory on domain adaptation suggesting that, for effective domain transfer to be achieved, predictions must be made based on features that cannot discriminate between the training (source) and test (target) domains. The approach implements this idea in the context of neural network architectures that are trained on labeled data from the source domain and unlabeled data from the target domain (no labeled target-domain data is necessary). As the training progresses, the approach promotes the emergence of features that are (i) discriminative for the main learning task on the source domain and (ii) indiscriminate with respect to the shift between the domains. We show that this adaptation behaviour can be achieved in almost any feed-forward model by augmenting it with few standard layers and a new gradient reversal layer. The resulting augmented architecture can be trained using standard backpropagation and stochastic gradient descent, and can thus be implemented with little effort using any of the deep learning packages. We demonstrate the success of our approach for two distinct classification problems (document sentiment analysis and image classification), where state-of-the-art domain adaptation performance on standard benchmarks is achieved. We also validate the approach for descriptor learning task in the context of person re-identification application.
1. Introduction
The paper addresses domain adaptation by jointly learning features that are discriminative for the task and invariant across source and target domains. It implements this objective in a generic domain-adversarial neural network that trains with standard backpropagation and evaluates it across classification and descriptor-learning applications.
- Motivation: Domain adaptation learns mappings between training and test domains so source-trained predictors can be applied to the target domain.This addresses the difficulty of obtaining labeled data for new machine-learning tasks.
- Motivation: The proposed approach jointly learns representations that are discriminative for prediction and invariant to the change between source and target domains.Its goal is for final classification decisions to rely on features with the same or very similar distributions across domains.
- Method: A label predictor and domain classifier are optimized adversarially so the resulting feature extractor encourages domain-invariant features.The label predictor is used during training and testing, while the domain classifier distinguishes source from target during training.
- Method: DANN embeds feature extraction, label prediction, and domain classification in a feed-forward network trained with standard backpropagation and stochastic gradient descent.The architecture uses standard layers and loss functions and can be created for almost any existing feed-forward architecture.
- Evaluation: The evaluation spans synthetic data, sentiment analysis, MNIST, SVHN, Office benchmarks, and person re-identification descriptor learning.On Office benchmarks, domain-adversarial learning considerably improves over previous state-of-the-art accuracy.
2. Related work
Related work spans linear and increasingly nonlinear domain-adaptation representations, including neural networks, and methods that match source–target feature distributions. DANN differs by modifying representations and measuring domain disparity through separability by a discriminative classifier, without requiring labeled target data.
- Domain-adaptation research has progressed from predominantly linear hypotheses toward nonlinear representations, including neural networks.
- Unsupervised distribution-matching methods reweight or select source samples, or explicitly transform the source feature space toward the target distribution.
- DANN matches feature distributions by modifying the feature representation and measuring disparity through separability by a deep discriminatively-trained classifier, rather than reweighting or geometric transformation.
- Unlike supervised deep adaptation that can fine-tune source-trained networks using labeled target data, DANN does not require labeled target-domain data but can incorporate it.
- DANN is theoretically derived from Ben-David et al.’s work and directly optimizes the notion of H-divergence.
3. Domain Adaptation
The section formulates unsupervised domain adaptation as learning from labeled source data and unlabeled target inputs, with the goal of minimizing target risk. It motivates controlling domain discrepancy alongside source error, using source–target discrimination to estimate that discrepancy.
- Problem formulation: Unsupervised domain adaptation learns a classifier from labeled source samples and unlabeled target samples, without access to target labels.The source and target data arise from different distributions over X×Y, while the target sample is drawn from the target marginal over X.
- Domain discrepancy: The target-error analysis combines source risk with a distance measuring how distinguishable the source and target distributions are.These approaches rely on source risk being informative about target risk when the distributions are similar.
- Domain discrepancy: The H-divergence quantifies a hypothesis class’s capacity to discriminate examples generated by the source and target input distributions.The definition is introduced for binary classifiers, with the cited analysis also extending to multiclass settings under a symmetric hypothesis class.
- Proxy A-distance: The empirical H-divergence can be approximated by training a classifier to label source examples 0 and target examples 1.The resulting classifier’s discrimination risk approximates the relevant minimization term, yielding the Proxy A-distance (PAD).
- Proxy A-distance: In the experiments, PAD is estimated by training a linear SVM or deeper MLP on one subset of source–target examples and evaluating its error on the other subset.The held-out classifier error supplies ϵ for the PAD calculation.
- Generalization bound: The theoretical result directs learning toward a trade-off between minimizing source risk and empirical H-divergence, provided some classifier performs well on both domains.The bound also includes a complexity term depending on the hypothesis class’s VC dimension and sample sizes.
4. Domain-Adversarial Neural Networks (DANN)
DANN trains neural representations that preserve low source-domain classification risk while removing information about whether inputs come from the source or target domain. It achieves this through a domain-classification objective implemented with a gradient reversal layer and standard stochastic gradient descent.
- Core objective: DANN explicitly learns representations that are nondiscriminative about domain origin while preserving low classification risk on labeled source examples.The hidden-layer output serves as the internal representation whose domain information is suppressed.
- Domain adaptation component: A domain classifier estimates source-versus-target distinguishability from hidden representations, approximating the H-divergence used in the domain-adaptation regularizer.Target examples contribute domain labels but not task labels during training.
- Optimization: The resulting optimization is a saddle-point problem balancing source prediction risk against domain divergence through the adaptation hyper-parameter λ.Some parameters are minimized while domain-classifier parameters are maximized.
- Optimization: The gradient reversal layer acts as the identity during forward propagation but multiplies backpropagated gradients by −1 before passing them to preceding layers.This reverses the domain-classification gradient while retaining ordinary stochastic-gradient training.
- Outcome: Stochastic gradient descent with gradient reversal converges to the saddle point and produces features that are simultaneously domain-invariant and discriminative.The learned label predictor can then predict target-domain labels without labeled target examples.
5. Experiments
The experiments evaluate both shallow and deep domain-adversarial neural networks.
- 5. Experiments: The section presents empirical results for shallow domain-adversarial neural networks and deep models.Shallow models are covered in Subsection 5.1, while deep models are covered in Subsections 5.2 and 5.3.
5.1 Experiments with Shallow Neural Networks
Experiments with shallow neural networks show that DANN adapts decision boundaries to rotated target data while learning representations that reduce domain-discriminative structure. On Amazon Reviews, DANN also significantly outperforms NN and SVM in target accuracy and leads to lower representation domain discrepancy than standard NN.
- Toy adaptation experiment: DANN perfectly classifies both source and target examples in the rotated inter-twinning moons task, whereas NN remains insufficiently adapted to the target distribution.The source contains 300 labeled examples, while the target contains 300 unlabeled examples generated by a 35° rotation; both models use a 15-neuron hidden layer.
- Representation analysis: DANN’s adaptation regularizer suppresses hidden-layer neurons that capture the domains’ rotation angle, including the two predominant parallel-line patterns seen in NN.Standard NN neurons form clusters supporting the label boundary but also capture rotation-related domain structure; these patterns vanish in DANN.
- Amazon Reviews results: 0.87 and 0.83 are the respective probabilities that DANN significantly outperforms NN and SVM on Amazon Reviews target test accuracy.The comparison isolates the domain adaptation regularizer as the difference between DANN and NN.
- mSDA representation experiment: mSDA representations are evaluated as inputs to DANN, NN, and SVM using five layers, 50% corruption, and the concatenation of layer outputs with the original input.This experiment uses the same Amazon Reviews source-target domain pairs and follows the procedure of Chen et al. (2012).
- Representation domain discrepancy: DANN’s hidden representation makes source and target examples harder to distinguish than the standard NN representation, as shown by lower Proxy A-distance comparisons.The comparison fixes both hidden layers at 100 neurons and uses λ ≃0.31 for DANN.
5.2 Experiments with Deep Networks on Image Classification
Deep DANN is evaluated across image-domain adaptation benchmarks against source-only, train-on-target, and subspace-alignment baselines. The experiments show closer source–target feature distributions, substantial recovery of adaptation gaps, state-of-the-art Office results, and regularization effects during training.
- Experimental setup: The experiments evaluate deep DANN on small-image data sets and Office, comparing source-only, train-on-target, and subspace-alignment baselines.Train-on-target uses revealed target labels and serves as an upper bound, while source-only excludes the domain-classifier branch.
- Experimental setup: DANN uses convolutional feature extractors, a domain-classifier branch, and a scheduled adaptation parameter λ that increases from 0 to 1.The domain classifier generally uses x→1024→1024→2 layers, while MNIST uses x→100→2; SVHN training also uses dropout and ℓ2-norm restriction.
- Feature alignment: Adaptation makes source and target CNN activations much closer in t-SNE visualizations, with feature overlap associated with target-domain classification accuracy.The visualizations compare networks trained without adaptation against networks trained with the proposed adaptation procedure.
- Image adaptation results: The backpropagation-based method covers almost 80% of the gap between source-only training and target-labeled training, whereas SA slightly reduces classification accuracy.The result is reported for a challenging image adaptation setting in which the target domain differs through backgrounds and digit strokes.
- Office results: On the Office data set, the proposed method outperforms competitors and sets a new state-of-the-art under the fully-transductive evaluation protocol.The protocol uses labeled source examples and unlabeled target examples during adaptation.
- Training behavior: Target performance slightly over-fits as source accuracy improves, but the effect does not ruin validation accuracy and is stronger without the domain-classifier branch.The authors conclude that the adaptation technique serves as a regularizer.
5.3 Experiments with Deep Image Descriptors for Re-Identification
The experiments treat person re-identification as cross-domain descriptor learning, training on labeled source correspondences and unlabeled target images. Domain-adversarial training consistently improves re-identification across eight dataset pairs and brings source and target descriptor distributions closer together.
- Task and evaluation: Person re-identification matches probe images to gallery images across camera views using distances between learned image descriptors.Performance is evaluated with Cumulative Match Characteristic curves, reporting identification rate at rank-k.
- Domain-adaptation setup: Cross-dataset evaluation is framed as domain adaptation because descriptors trained on one camera network can perform substantially worse on another.Each dataset represents a domain, with source correspondences known during supervised training and target images used without probe-gallery correspondence.
- Architecture: The domain-adversarial model extends a siamese deep metric-learning architecture with a descriptor predictor and a two-layer domain classifier.The original network produces 500-dimensional descriptors; the domain classifier uses an intermediate 500-unit representation followed by one output.
- Results: Across eight dataset pairs, domain-adversarial training consistently improves re-identification performance, with considerable gains for pairs involving the more dissimilar PRID dataset.The experiments use PRID, VIPeR, and CUHK, including CUHK/p1 settings, as source and target domains.
- Results: In the VIPeR →CUHK/p1 experiment, adaptation produces closer and better-intermixed source and target descriptor distributions.This distributional alignment is shown with t-SNE visualizations and parallels the adaptation effect observed for image classification.
6. Conclusion
DANN adapts feed-forward neural networks by learning features predictive of source labels but uninformative about domain identity, using distribution alignment through standard backpropagation. The approach supports large-scale source-labeled and target-unlabeled training, achieves state-of-the-art benchmark results, and extends beyond classification to descriptor learning.
- Core approach: The method aligns feature distributions across domains using standard backpropagation while supporting large amounts of annotated source data and unannotated target data.The domain adaptation component can be added to almost any backpropagation-trainable neural network architecture.
- Core approach: DANN learns representations predictive of source labels but uninformative about whether inputs come from the source or target domain.This objective is motivated by domain adaptation theory and is implemented in both shallow and deep feed-forward architectures.
- Empirical results: The approach achieves state-of-the-art results on domain-adaptation benchmarks for sentiment analysis and image classification.These results demonstrate flexibility across a variety of benchmark tasks.
- Beyond classification: DANN is not confined to classification and can support descriptor learning for person re-identification.The approach was experimentally demonstrated in another feed-forward architecture and task setting.