Graded Drift Critics for Transformer Decoders Under Domain Shift

When a translation model writes its output one token at a time, it is trained on human-written prefixes but deployed on its own. This mismatch is called exposure bias. Its practical importance is disputed. In standard domains, Transformers seem to recover from their own mistakes. Under domain shift, the same mistakes appear to push the model into fluent hallucinations. We propose a way to locate and close the region where recovery fails.

The method uses a small critic network. It reads the decoder's internal states and tries to predict how much of the input came from the model's own predictions rather than the gold text. The decoder is trained to make that fraction unreadable. Our hypothesis is that this regularizer helps exactly where the decoder's input embeddings poorly cover the target domain. We therefore treat embedding quality as an experimental variable, not a fixed background choice.

Core Claim

The two sides of the exposure-bias debate measure different regimes. He et al. use prefix-switching metrics on Wiki-103 to show that distortions from self-generated prefixes do not accumulate, and that Transformers recover even when 30% of prefix tokens are corrupted (Exposure Bias versus Self-Recovery). Wang and Sennrich show that exposure bias drives hallucination when translation models face out-of-domain input, and that sequence-level training reduces it (On Exposure Bias, Hallucination and Domain Shift in NMT).

Our working hypothesis reconciles them. Recovery depends on the decoder having seen states "near" the ones its own errors produce. That nearness is inherited from the input embedding space. Out of domain, predicted-token embeddings fall in sparsely trained regions, and recovery breaks.

If this is right, there is a specific remedy. Train the decoder so that its states stay in-distribution along the whole path from gold inputs to self-predicted inputs, not only at the two endpoints.

The mechanism adapts the interpolation critic of ACAI (Understanding and Improving Interpolation in Autoencoders via an Adversarial Regularizer). ACAI trains a critic to predict the mixing coefficient of decoded latent blends in image autoencoders. It then trains the autoencoder to make those blends look unmixed. We move this idea from image latents to the continuum between teacher-forced and self-fed Transformer decoder inputs.

Two existing methods are closest, and our proposal differs from each:

  • Professor Forcing (Professor Forcing) uses a binary discriminator on RNN hidden states, separating teacher-forced from free-running runs. We use a graded regression target on Transformer states. The graded target tells the decoder where along the drift its states first become distinguishable.
  • Scheduled Sampling for Transformers (Scheduled Sampling for Transformers) already feeds mixed embeddings through a two-pass decoder. It uses a fixed decay schedule and applies no pressure on the resulting states.

Research Program

Training procedure. Training follows the two-pass decoder of Mihaylova and Martins.

  1. Pass 1 runs under teacher forcing and produces next-token distributions. From each distribution we form a predicted embedding $e^{pred}_t$, the softmax-weighted average of the input embedding matrix. That paper found this soft average stable, whereas argmax replacement was harmful.
  2. Pass 2 feeds mixed inputs $\tilde e_t = (1-\alpha)\, e^{gold}_t + \alpha\, e^{pred}_t$, with one $\alpha \sim U[0,1]$ drawn per sentence. Here $\alpha = 0$ is pure gold and $\alpha = 1$ is pure self-prediction.

The critic and the loss. A critic $f_\phi$ reads the top-layer states $h_\alpha$ of pass 2. It is a small attention-pooling network that outputs a scalar estimate of $\alpha$. The critic minimizes $(f_\phi(h_\alpha) - \alpha)^2$. The translation model, with parameters $\theta$, minimizes

$$ \mathcal{L}_\theta = \mathrm{NLL}(y \mid \tilde e_{<t}, x) + \lambda\, f_\phi(h_\alpha)^2 , $$

where $\mathrm{NLL}$ is token cross-entropy on the gold target given the mixed prefix and source $x$. The term $\lambda$ weights the push to make every state on the path look like a gold-prefix state, which is ACAI's "predict zero" target. As in Mihaylova and Martins, gradients flow only through pass 2.

Diagnostic use of the critic. The trained critic doubles as an instrument. Run on genuinely free-running decodes, its per-position estimate of $\alpha$ is a measure of how far the decoder has drifted. We will correlate this estimate with He et al.'s prefix-switching metrics and with labeled hallucinations. This tests whether drift is flat in-domain and rising out-of-domain.

Embedding quality as a variable. We cross the method with three choices of decoder input embedding:

  • embeddings initialized from a strong pre-trained model and frozen,
  • the same from a small distilled encoder, and
  • embeddings learned from scratch.

The second condition is motivated by Zhan et al.'s finding, reported in the file, that latent augmentation degrades with weaker encoders. For each condition we measure the geometry of the embedding space on out-of-domain vocabulary, using isotropy and nearest-neighbor density.

This variable matters because the literature says downstream objectives cannot create structure absent from pre-trained inputs (Specializing Word Embeddings by Information Bottleneck; Data-dependent Gaussian Prior Objective). We therefore expect a ceiling. The critic can densify the decoder's state space between gold and predicted inputs. It cannot fix a predicted embedding that is semantically wrong. Mapping where that ceiling sits is a result in its own right.

Implementation. We will build everything in fairseq.

Baselines

Teacher-forced MLE (naive reference). A Transformer trained by maximum likelihood with standard teacher forcing, using identical architecture, data, embeddings and GPU-hours. Every other method must beat it on out-of-domain BLEU and hallucination rate.

Minimum Risk Training (strongest existing method). Fine-tuning the MLE model to maximize expected sentence-level BLEU over sampled candidates, as in Wang and Sennrich. This is the strongest competitor because it is the only method in the file shown to reduce domain-shift hallucination. The paper reports +0.8 BLEU over MLE for out-of-domain DE→EN, a hallucination reduction of up to 21% relative to MLE, and +0.7 BLEU on low-resource DE→RM (On Exposure Bias, Hallucination and Domain Shift in NMT).

  • Fair run: MRT is several times more expensive per step. We will run it from the same MLE checkpoint under two budgets: matched GPU-hours, and its own recommended setting.
  • What counts as beating it: our method matches or exceeds MRT's out-of-domain BLEU and hallucination reduction at equal GPU-hours. Matching it at lower cost is still a useful outcome. Losing at equal cost is a negative result we would report.

Mixed-embedding scheduled sampling. The two-pass method of Mihaylova and Martins, run with the same mixed inputs and a tuned decay schedule. The file reports up to +1 BLEU over teacher forcing on KFTT JA-EN and parity on IWSLT DE-EN (Scheduled Sampling for Transformers). This baseline is identical to ours except for the critic term, so it is the key ablation: it isolates whether the critic, rather than mere exposure to mixed inputs, does the work.

Binary-critic Professor Forcing on a Transformer. Professor Forcing ported to the same two-pass Transformer, with a discriminator that sees only $\alpha = 0$ versus $\alpha = 1$ states. No reported result found on Lacuna for Professor Forcing on Transformer translation. The original reports only character-level PTB (bits per character 1.50 to 1.48), handwriting and audio (Professor Forcing). This baseline isolates the graded target.

D2GPo. Soft targets built from embedding similarity (Data-dependent Gaussian Prior Objective), reported at +0.58 BLEU on WMT EN-DE. It serves as the teacher-forced, embedding-dependent comparison.

All methods get the same hyperparameter search budget of a fixed number of trials on the in-domain development set. No method is tuned on out-of-domain data.

Why not just…?

Why not just use scheduled sampling with mixed embeddings? It already exposes the decoder to its own soft predictions, and it is our nearest neighbor. However, Mihaylova and Martins report only parity on DE-EN, and the dependence on schedule tuning is documented (Scheduled Sampling for Transformers). Feeding mixtures does not by itself make the resulting states look in-distribution. The critic-free ablation directly tests whether the critic adds anything. If it does not, the proposal's mechanism is refuted.

Why not just penalize the distance between gold-prefix and mixed-prefix hidden states? This simple consistency loss is the most serious threat, because it is stable and needs no adversary. Our argument against it is conceptual. Forcing a state after a wrong prefix to equal the state after the gold prefix teaches the decoder to ignore what it actually wrote, which can hurt coherence. A distribution-matching critic only requires the state to be plausible. We will run this loss as a full baseline with the same budget. If it matches the critic, we will adopt it and report the critic as unnecessary.

Why not just use Minimum Risk Training? It directly optimizes sequence quality and is the proven out-of-domain method. Its costs are the sampling of candidate pools at every step and the absence of any state-level diagnostic. The equal-compute comparison settles the practical question. Separately, the critic's drift estimate gives an analysis tool that MRT does not.

Why not just use a text GAN? He et al. find that GANs underperform MLE overall (Exposure Bias versus Self-Recovery). Stabilizing them needs machinery such as MEMR (Rethinking Exposure Bias in Language Modeling). Our critic avoids sampling discrete tokens altogether by acting on continuous states, the same trick that let Professor Forcing sidestep non-differentiability.

Proposed Experiments

Main setting. Train on IWSLT 2017 DE-EN and evaluate both in-domain and on out-of-domain test sets following Wang and Sennrich's protocol. Report BLEU and hallucination rate using their annotation procedure. Add low-resource DE-RM, where hallucination is most frequent, and KFTT JA-EN to compare with scheduled sampling's reported gain. As a check that the method does nothing harmful in-domain, measure prefix-switching scores on Wiki-103 language modeling.

The experiment crosses method × embedding condition × domain.

Decisive check 1: is the gain specific to domain shift? The critic should beat the critic-free and consistency-loss ablations out of domain while being roughly neutral in domain. That pattern would match the self-recovery findings. Uniform gains would instead suggest generic regularization.

Decisive check 2: does the gain track embedding coverage? The out-of-domain improvement should grow as embedding coverage of the out-of-domain vocabulary worsens. The gain should therefore be largest for distilled or scratch embeddings and smallest for strong pre-trained ones. It should also correlate with measured neighbor density.

Decisive check 3: does the critic's drift signal predict hallucination? Under MLE, the critic's per-position estimate of $\alpha$ should rise over the sentence for out-of-domain sources and stay flat in-domain. It should also predict hallucinated outputs. A flat profile everywhere would undercut the reconciliation hypothesis, regardless of BLEU.

Decisive check 4: does the graded target matter? The graded critic should outperform the binary critic. This would show that supervising the intermediate path, ACAI's key idea, matters beyond endpoint matching.