When Does Adversarial Alignment Help Text Classifiers? Separating Label Shift from Feature Shift

Adversarial domain adaptation trains a text encoder so that a second network, the "discriminator," cannot tell whether an encoded example came from the labeled source domain or the unlabeled target domain. The NLP evidence on whether this works conflicts. One study finds that adversarial "domain-blinding" adds almost nothing over a much simpler trick: swapping the classifier's output bias for the target domain's label frequencies. Another finds that an energy-based adversarial method gains several points on Amazon reviews and more than 15 points on yes/no question answering, using no target labels at all. We argue the two results measure different kinds of shift. Matching the overall feature distributions of two domains is the wrong goal when the domains have different class proportions. For example, a target domain might contain 80% negative reviews where the source contains 50%. In that case, forcing the two feature distributions to match pushes target negatives toward source positives.

The proposal has two parts. First, we test this explanation directly by changing how unequal the class proportions are while keeping everything else fixed. Second, we build and test a label-free method that estimates the target's class proportions from unlabeled data and uses that estimate twice: to reweight the adversarial game, and to reset the output bias. The study also answers a practical question. If unsupervised prior correction alone recovers most of the gain, practitioners do not need adversarial training at all, and we will report that result.

Core Claim

The disagreement between Modular Domain Adaptation and EADA is explained mainly by how much label-distribution shift each benchmark contains. These two papers motivate the work.

Modular Domain Adaptation compares gradient reversal and deep residualization against two simple fixes on four multi-domain classification sets. Gradient reversal flips the discriminator's gradient so the encoder learns to erase domain cues. The fixes are DSBIAS, which replaces the output bias with target label log-frequencies, and DSNORM, a normalization of word counts. The paper finds that adversarial deconfounding gives no significant out-of-domain gain, while DSBIAS gives 2–4%. DSBIAS needs 100–250 labeled target examples to estimate the prior to within 1% of the oracle.

EADA replaces the binary discriminator with an autoencoder. The autoencoder reconstructs source features with low "energy" (reconstruction error) and target features with high energy, and the RoBERTa encoder is trained to lower target energy. EADA reports 86.44% average accuracy over 12 Amazon transfer pairs. Each of those Amazon domains is balanced at 1,000 positive and 1,000 negative reviews, so there is no label shift between source and target. That is the regime in which aligning whole feature distributions is harmless.

We claim three things. First, adversarial alignment, energy-based or not, will lose its advantage over source-only training as the target's class proportions move away from the source's. Second, DSBIAS's advantage will grow over the same range. Third, an alignment objective that is reweighted by an unsupervised estimate of the target prior will keep the benefits of both without any target labels.

The departure from prior work is specific. EADA never estimates or corrects the target prior. Modular Domain Adaptation corrects the prior only with labeled target samples and tests only the classical gradient-reversal discriminator. Neither paper varies label shift in a controlled way.

Research Program

We first remove the need for target labels in DSBIAS. Given a source-trained classifier, we estimate the target class prior $\hat\pi_T$ by expectation-maximization on the classifier's posteriors over unlabeled target text. Each step adjusts the posteriors by the ratio of the current prior estimate to the source prior, then re-averages them. We then swap the output bias to $\log \hat\pi_T$. We call this label-free DSBIAS. It is the strongest non-adversarial competitor, and it is built from Modular Domain Adaptation's own mechanism.

Second, we reweight EADA's energy game so that the autoencoder models the source distribution as it would look under the target's class proportions. Let $f$ be the encoder, $A$ the autoencoder, $E(z)=\lVert A(z)-z\rVert^2$ the reconstruction energy of a feature $z$, $m$ the margin, and $w(y)=\hat\pi_T(y)/\pi_S(y)$ the importance weight for source label $y$. The autoencoder minimizes

$$ \mathcal{L}_A=\mathbb{E}_{(x,y)\sim S}\big[w(y)\,E(f(x))\big]+\mathbb{E}_{x\sim T}\big[\max(0,\,m-E(f(x)))\big], $$

and the encoder minimizes the source classification loss plus $\lambda\,\mathbb{E}_{x\sim T}[E(f(x))]$. We re-estimate $\hat\pi_T$ every epoch from the current classifier. At inference we also apply the bias swap. We call the full method prior-weighted energy alignment (PWEA).

The reweighting is the key ingredient, and the reasoning behind it is straightforward. If the class-conditional feature distributions already agree across domains, the reweighted source marginal equals the target marginal. The adversarial pressure then falls to zero instead of pushing classes across the decision boundary. The unweighted objective, by contrast, demands that a 50/50 mixture match an 80/20 mixture, and it can only satisfy that by distorting class-conditional structure. This is a concrete source of the "discriminability dilemma" that EADA itself describes.

Third, we analyze where adversarial gains come from. For each method we measure accuracy and macro-F1. Macro-F1 matters because accuracy hides minority-class collapse under imbalance. We also measure prior-estimation error, and we measure class-conditional alignment: the error of a linear domain probe trained separately within each true target class, using held-out labels for analysis only. This tells us whether a method aligned the right thing. It aligned the right thing if class-conditional domain separability fell while the class margin was preserved.

Baselines

The naive reference point is source-only fine-tuning of RoBERTa-base on the source domain, evaluated on the target. Every gain is reported relative to it.

The strongest existing adversarial method is EADA, run with its published architecture and margin on the same backbone. On Amazon reviews it reports 86.44% average accuracy over the 12 pairs, 2.5 points above an adversarial RoBERTa baseline (EADA). Our reproduction must land near this figure before any other comparison counts. We also run classical gradient reversal (domain-adversarial training with a binary discriminator), because that is the variant Modular Domain Adaptation found ineffective. Reproducing its null result on their datasets is a sanity check.

The strongest non-adversarial competitor is label-free DSBIAS, defined above. As an upper reference we also run labeled DSBIAS with 250 target labels, following Modular Domain Adaptation, which reports a 2–4% accuracy boost. That number is reported across datasets rather than per pair. For EADA on the Media Frames Corpus, SENTI or arXiv, there is no reported result found on Lacuna, so those cells are produced by our runs.

Two ablations isolate the proposal's ingredients. PWEA without the bias swap tests whether reweighting the adversarial game matters on its own. Unweighted EADA plus the bias swap tests whether the gain is simply additive. PWEA with the oracle target prior bounds how much prior-estimation error costs.

All methods share the same backbone, data splits, unlabeled target pool, and early-stopping rule. Early stopping uses a source-validation criterion only, because target labels may not be used for model selection. Each method gets the same search budget of 20 configurations over learning rate and adversarial weight, and we report means and standard deviations over five seeds. Beating the baselines means two things. PWEA must exceed both EADA and label-free DSBIAS in macro-F1 by more than two seed standard deviations at moderate-to-strong label shift. It must also stay within one standard deviation of EADA when there is no label shift.

Why not just…?

Why not just use label-free prior correction and skip adversarial training? This is the real threat, and the study is designed so it can win. If label-free DSBIAS matches PWEA on the naturally shifted datasets (Media Frames Corpus, SENTI, arXiv), the conclusion is that adversarial alignment in text classification mostly repairs label shift and is not worth its instability. That would be a clean, useful result that extends Modular Domain Adaptation to the unsupervised case. Prior correction cannot help on balanced Amazon pairs, though, where EADA still beats source-only. So we expect the two to separate wherever there is real feature shift. The controlled grid described below locates exactly where that happens.

Why not just train lightweight adapters or use linear-probe-then-fine-tune? GLUE-X evaluates linear probing followed by fine-tuning across 21 pretrained models and finds it leaves an average 20.05% out-of-distribution drop largely intact. Adapters in Multi-BERT work because they are trained per domain with labels, which our setting lacks. We include linear-probe-then-fine-tune as an extra source-only variant so this question is answered empirically rather than assumed.

Why not just align class-conditionally with target pseudo-labels? Pseudo-labels are the other common route to class-aware alignment; ATOP uses nearest-neighbor pseudo-labels for its topic-specific prompts. Under strong label shift, however, a source classifier's pseudo-labels are biased toward the source majority, so the alignment inherits the error it is meant to fix. PWEA needs only class proportions, a far smaller quantity to estimate than per-example labels. We add a pseudo-label class-conditional energy variant as a baseline. If it matches PWEA at the 90/10 setting, our reweighting is not the operative ingredient.

Proposed Experiments

The decisive experiment is a controlled label-shift grid on Amazon reviews. We keep each source domain balanced and resample each target domain (Books, DVDs, Electronics, Kitchen) to positive:negative ratios of 50/50, 70/30, 85/15 and 95/5. Text is drawn from the same reviews, so feature shift stays fixed and only label shift varies.

The hypothesis makes falsifiable predictions. At 50/50, EADA and PWEA should tie and label-free DSBIAS should equal source-only. As the ratio skews, EADA's macro-F1 should fall toward or below source-only, and DSBIAS's gain should rise. PWEA should track the better of the two at every point. If EADA's gain holds steady across the grid, the explanation is wrong, and the disagreement with Modular Domain Adaptation must come from something else, such as discriminator design.

The second experiment uses naturally shifted data: the Media Frames Corpus, SENTI and arXiv splits from Modular Domain Adaptation. Here we test whether PWEA adds anything beyond label-free DSBIAS where real shifts mix label and feature change. The third uses the BoolQ↔MS Marco pairs from EADA and the SST-2→IMDB/Yelp/Amazon/Flipkart transfers from GLUE-X. These check that the method does not lose EADA's reported gain of more than 15 points on question answering and extend coverage to sentiment shifts between corpora. We will report the estimated target priors for these datasets, since their label imbalance is itself part of the explanation being tested.

Across all settings, the class-conditional probe analysis gives the mechanistic check. Unweighted alignment should increase cross-class confusion in target features under skew, and PWEA should not.