Structure-Conditioned Adversarial Alignment for Cross-Domain Parsing

A dependency parser trained on edited text such as news or encyclopedic prose loses accuracy on weblogs, product comments, fiction or vlog transcripts. A dependency parser is a model that draws, for every word, an arrow to the word it grammatically depends on. The usual adversarial fix trains a second network, called a domain discriminator, to guess whether a hidden vector came from the source or the target domain, and trains the encoder to fool it. Applied to whole representations, this fix is known to erase useful information. It is also unstable enough that the strongest recent unsupervised parser adaptation method abandoned it. This note proposes a narrower target for the discriminator. Pretrained transformers store parse trees in a small linear subspace in which distances between word vectors track distances in the tree. We propose to run the adversarial game only inside that subspace, and only conditioned on how far apart two words are in the tree. The discriminator never sees whole sentences. It sees pairs of projected word vectors labeled with a tree distance, and it tries to tell whether a pair at, say, distance 3 came from news or from web comments.

The motivation is a hypothesis that can be tested before any adaptation method is built. The hypothesis is that much of the cross-domain loss in parsing happens because unfamiliar vocabulary and phrasing bend the geometry of this syntactic subspace, not because target trees are intrinsically harder. If that holds, the fix should repair the geometry and leave everything else alone. Asking target sentences to "look like" source sentences in general is the wrong goal. Target domains genuinely have different tree shapes, such as shorter fragments in comments and longer chains in fiction. Aligning the marginal distribution would push against that real difference. Aligning conditionally on tree distance would not.

Core Claim

The claim has two parts, and each can fail separately. The diagnostic part is that a structural probe fit on source data loses tree recoverability on target sentences, and that across many target domains this loss predicts the parser's loss in labeled attachment score (LAS, the fraction of words given both the correct head and the correct relation label). A structural probe is a learned linear map under which squared distance between word vectors approximates distance in the parse tree.

The method part is that an adversarial discriminator restricted to this subspace and conditioned on (pseudo-)tree distance recovers more target accuracy than three alternatives: the same alignment done by moment matching, unconditional adversarial alignment of full representations, and self-training alone.

Concretely, let $h_i$ be the encoder's vector for word $i$, and let $B$ be a $k \times d$ probe matrix with $k \approx 64$–$128$ and $d$ the hidden size. The probe fixes the geometry through

$$ \lVert B(h_i - h_j) \rVert_2^2 \approx d_T(i,j), $$

where $d_T(i,j)$ is the number of edges between words $i$ and $j$ in the tree $T$. The discriminator $D$ receives $z_{ij} = B(h_i - h_j)$ together with a distance bucket $b$. For source sentences $b$ comes from the gold tree. For target sentences it comes from a confidence-vetted pseudo-parse. $D$ predicts the domain of each pair. The adapter parameters $\theta$ on top of a frozen encoder are trained with the parsing loss $\mathcal{L}_{\text{parse}}$ on source data plus a confusion term:

$$ \min_\theta \; \mathcal{L}_{\text{parse}}(\theta) + \lambda \, \mathbb{E}_{(z,b)} \, \mathrm{KL}\big(\tfrac{1}{2},\tfrac{1}{2} \,\|\, D(z_\theta, b)\big), $$

Here $\lambda$ weights alignment against parsing. The KL term pulls the discriminator's output toward a fair coin rather than toward the opposite domain. Gradients from this term reach only the $k$ projected dimensions. The orthogonal complement is left free to carry domain-specific cues.

Where This Sits

Three strands of prior work motivate the design. The first is that the adversarial literature documents a trade-off between invariance and discriminability. Chen et al. report that maximizing transferability suppresses fine structural variation (Chen et al.). Lu et al. show that over-alignment blurs decision boundaries (Lu et al.). Shi et al. show that aligning marginals alone can collapse features into uninformative subspaces (Shi et al.). Zhang et al. argue that the right label can depend on domain context (Zhang et al.). All four diagnose full-representation, marginal alignment. Our design answers them by restricting alignment in two ways, to a subspace and to a conditional.

The second strand supplies the method. A Structural Probe for Finding Syntax in Word Representations shows that a rank-64 to rank-128 linear map on BERT-Large layer 15 recovers Penn Treebank trees with undirected unlabeled attachment score (UUAS) of 82.5 and distance correlation of 0.87, against 48.9 for a linear-chain baseline. That work only measures in-domain recoverability. We reuse the probe as the arena for alignment and measure how its accuracy degrades out of domain. Adversarial Adaptation of Synthetic or Stale Data supplies the stabilizer. It found that forcing the discriminator toward a 50/50 output (RAND) beat standard gradient reversal on spoken-language shift, where reversal tends to overcorrect toward predicting the opposite domain. That work aligned full BiLSTM states for intent and slot tagging and did not touch tree structure. Feature Adaptation of Pre-Trained Language Models across Languages and Domains with Robust Self-Training supplies the frozen-encoder-plus-adapter setup, which it found less prone to memorizing noisy pseudo-labels than full fine-tuning.

The third strand constrains us, and it is the closest existing work. Unsupervised Domain Adaptation Method with Semantic-Structural Alignment for Dependency Parsing, called SSADP, splits parser features into semantic and structural extractors on BiLSTMs. It aligns the semantic extractor with class-wise maximum mean discrepancy (LMMD) and the structural graphs with a graph attention module. It explicitly rejected adversarial training as unstable, and it still suffered negative transfer on product comments. Our proposal differs in three ways. The structural space is found by a probe inside a pretrained transformer rather than built by a separate CNN. The conditioning variable is tree distance rather than a relation label. And we revisit adversarial training with the RAND objective and a controlled comparison against LMMD on the identical subspace. Semi-supervised Domain Adaptation for Dependency Parsing with Dynamic Matching Network learns which parser layers the target model should mimic and uses no discriminator. It informs which encoder layer we probe, since its evidence favors higher layers. Adversarial Topic-Aware Prompt-Tuning for Cross-Topic Automated Essay Scoring is relevant as a warning. Its adversarial topic-shared prompts help on average but trail syntax-aware systems on rigidly structured essays, which suggests that adversarial invariance without explicit structure misses exactly what parsing needs.

Research Program

The first stage is purely diagnostic. We fit a structural probe on source-domain gold trees at several encoder layers. We then evaluate the probe's UUAS on gold trees from every target domain, using target gold trees for measurement only. Alongside it we train a standard biaffine parser on the same frozen encoder with a small adapter and record LAS on each domain. The resulting per-domain pairs (probe UUAS drop, parser LAS drop) test the geometric hypothesis.

If the correlation is weak, the premise is wrong. The honest outcome would then be a negative diagnostic paper, and the method would not be pursued. As a control, we also fit a fresh probe on target gold trees. If a target-fit probe recovers trees well while the source-fit probe does not, the syntax is still present but rotated or stretched. That is the case alignment can fix. If neither probe recovers target trees, the information is simply missing, and alignment cannot help.

The second stage builds the method. The encoder is frozen. A small adapter feeds both the parser and the probe projection $B$. $B$ is initialized from the source probe and then either frozen or updated slowly, a choice we test. Target pseudo-parses come from the current parser. Only arcs whose marginal probability exceeds a threshold are used, following the vetting idea in Domain Adaptation for Dependency Parsing via Self-Training. Distances are bucketed as 1, 2, 3, 4–5 and 6 or more, and pairs are sampled so that each bucket is balanced within each domain. This balancing is what keeps genuine differences in tree shape from registering as domain signal.

The third stage covers analysis. We measure whether the complement of the subspace still carries domain identity, which it should because we leave it free. We check whether probe UUAS on target recovers, and whether gains concentrate on long-distance arcs, where lexical distortion should matter most.

Baselines

The naive reference is the same frozen encoder and adapter trained on source trees only, applied directly to the target. Every gain is reported relative to it.

The strongest existing unsupervised method is SSADP. On CODT1 it reports average gains of 1.12 UAS and 1.14 LAS over its baseline parsers (SSADP). On the Chinese setting we will match its source/target splits and report against those numbers. We will also rerun its LMMD and graph-alignment losses on top of our transformer encoder, so that differences in backbone do not decide the comparison. Beating it means a higher average target LAS than the rerun SSADP under an equal tuning budget. We also expect a clear margin on product comments, where SSADP itself reports negative transfer.

For the English UD 2.12 EWT and GUM domains, no reported unsupervised adaptation result was found on Lacuna. The closest number, from Domain-Weighted Batch Sampling for Neural Dependency Parsing, is a 0.95 LAS average gain over random batch sampling. That gain uses labeled in-domain sentences, so it belongs to a semi-supervised regime. We will use it only in a secondary experiment that grants every method the same small labeled target set.

The strongest non-adversarial competitor is vetted self-training on the same pseudo-parses with the same adapter, and it matters most. Our method consumes those pseudo-parses anyway, so any gain must come from the alignment term rather than from the extra target signal.

Three ablations isolate the key ingredients. The first replaces the adversarial term with maximum mean discrepancy on the identical projected, distance-conditioned pairs, which asks whether adversarial training matters at all. The second drops the distance conditioning, which asks whether conditioning matters. The third applies the same discriminator to full adapter outputs instead of the $k$-dimensional subspace, which asks whether the subspace matters. We also compare standard gradient reversal against RAND inside our method.

All systems share the encoder, adapter size, unlabeled target text and number of training steps. Each gets the same hyperparameter search of about twenty configurations, selected on a source-domain development set, since the unsupervised setting allows no target labels for selection. Results are averaged over five seeds.

Why not just…?

Why not just self-train on target pseudo-parses? This is the real threat. Robust self-training with class-aware distillation reached 71.89% on MonoAmazon against 69.21% for plain self-training, with no discriminator. In parsing, though, a single wrong arc can corrupt a whole tree, so pseudo-label noise compounds. Our alignment signal uses pseudo-parses only to choose a distance bucket. It does not use them as supervision targets. That should make it more tolerant of noisy arcs. The experiment settles the question directly: self-training versus self-training plus alignment, with identical pseudo-labels. If alignment adds less than about 0.3 LAS on average, we will report that the conditional adversarial term is not worth its cost.

Why not just use MMD on the same subspace? SSADP's experience suggests moment matching is more stable. If MMD on the identical conditioned pairs matches our adversarial version, the contribution becomes "where and how to condition," not "adversarial training." We would state it that way. RAND's advantage over reversal in Ray et al. gives some reason to expect a learned discriminator to catch non-Gaussian distortions that a fixed kernel misses. This remains an empirical question that the MMD ablation answers.

Why not just continue pretraining the encoder on target text, or add a few labeled target sentences? Continued pretraining addresses the lexical side of shift directly, and no reported result was found on Lacuna for it on these parsing benchmarks. We will include it as an extra reference point and also stack it with our method. A few labeled sentences plus sampling ratios work, as the DWBS result shows. That is a different regime, and our secondary experiment grants all methods the same labels, so the comparison stays fair.

Proposed Experiments

The primary English setting is leave-one-domain-out over the five EWT and eleven GUM genres of UD 2.12. For each held-out genre, the model trains on the remaining genres and adapts using unlabeled held-out text, giving sixteen shifts. The Chinese setting follows SSADP and DMN on CODT1 and NLPCC-2019: news (BC) to product comments, product blogs and web fiction. Metrics are LAS and UAS, LAS broken down by arc length, and target probe UUAS with its distance correlation. Following SSADP, we also report a Weisfeiler-Lehman structural similarity score for comparability.

Four checks decide the proposal. First, across the sixteen English shifts, the rank correlation between source-probe UUAS drop and parser LAS drop should be clearly positive. We would treat a correlation below 0.4 as refuting the premise. Second, the full method should beat vetted self-training on average target LAS and on a majority of domains. Third, the distance-conditioned version should beat the unconditioned one most on domains whose tree-depth distribution differs most from the source, as measured by divergence between gold depth histograms. This is the specific prediction that separates conditional from marginal alignment. Fourth, the subspace-restricted discriminator should be more stable than the full-representation one, measured as lower seed variance and fewer diverged runs. If this fails, Lin et al.'s objection to adversarial parsing stands.