Efficient Domain Adaptation for Non-Autoregressive Machine Translation

Wangjie You, Pei Guo, Juntao Li, Kehai Chen, Min Zhang

Abstract

Non-Autoregressive Translation (NAT) models provide significant inference speedups but often suffer from performance degradation in specialized domains due to a lack of target-side context. We introduce Bi-$k$NN (Bidirectional-Iterative-$k$NN), a non-parametric adaptation method that equips NAT models with a bidirectional contextual memory. By utilizing a bidirectional datastore and iterative refinement, Bi-$k$NN achieves an average improvement of 7.8 BLEU points over base NAT models, outperforming domain-specific fine-tuned models while remaining significantly faster than autoregressive alternatives.

Introduction

Neural Machine Translation (NMT) faces a persistent challenge in domain adaptation. Models trained on general corpora (e.g., news) frequently underperform on specialized text such as legal or medical documents. While Large Language Models (LLMs) offer strong zero-shot capabilities, their high computational cost and slow autoregressive generation make them impractical for high-throughput translation tasks.

Small, specialized models are more efficient, but they present a trade-off: Autoregressive (AT) models offer high quality but are slow (generating word-by-word), while Non-Autoregressive (NAT) models are fast (generating all words in parallel) but lack the necessary context to handle domain-specific terminology effectively. Existing $k$-nearest neighbor ($k$NN) retrieval methods, which work well for AT models, typically fail for NAT because they rely on previously generated words that are not available during parallel NAT decoding.

Methodology: The Bi-$k$NN Framework

To address these limitations, we propose Bi-$k$NN, which reimagines the interaction between a translation model and an external domain-specific datastore.

Overview of the Bi-kNN architecture and its iterative retrieval process.

The framework introduces four primary innovations:

  1. Bidirectional Datastore Construction: Unlike standard $k$NN-NMT which uses unidirectional context, Bi-$k$NN employs random masking during training. This teaches the model to generate search keys based on context from both the left and right sides of a target word, providing a richer representation for retrieval.
  2. Datastore Renewal: To maintain efficiency and accuracy, the datastore is "polished" by adding missed items, removing indistinguishable or confusing entries, and pruning redundant data.
  3. Robust Meta-Network: A lightweight "Meta-network" adaptively balances the model's internal predictions with the database's suggestions. This network learns to trust the database more when the model's confidence is low or when search results are highly consistent.
  4. Iterative Decoding: Because NAT models generate the entire sequence at once, Bi-$k$NN uses a multi-pass approach. Each iteration uses the output of the previous pass to perform a more context-aware $k$NN search, progressively refining the translation.

Experimental Results

We evaluated Bi-$k$NN on German-English (De-En) translation across five benchmarks: WMT’19 (general domain) and four specialized domains (IT, Medical, Law, and Koran).

Performance Gains

Bi-$k$NN demonstrates remarkable effectiveness in domain adaptation. As shown in the results table below, the method consistently outperforms base NAT models and even surpasses models that have been explicitly fine-tuned on domain-specific data.

Comparison of BLEU scores across different domains and model architectures.

Key findings include:

  • Substantial BLEU Improvement: Bi-$k$NN improved the Base-NAT model by an average of 7.8 BLEU points across all specialized domains.
  • Superiority over Fine-Tuning: The non-parametric Bi-$k$NN approach beat domain-specific fine-tuned NAT models by an average of 2.4 BLEU points.
  • Competitive with LLMs: Despite having only 73M parameters, the adapted NAT model achieved BLEU scores comparable to or better than much larger models like LLaMA-2 (7B) and GPT-3.5-turbo on several domain tasks.

Efficiency and Speed

A critical advantage of Bi-$k$NN is its speed. While the $k$NN retrieval and iterative passes add some overhead, the system remains 1.5x to 2x faster than traditional Autoregressive Transformer models. Furthermore, because the method is non-parametric, it avoids "catastrophic forgetting"—users can switch between domains simply by swapping the datastore without retraining the underlying model.

Conclusion

Bi-$k$NN successfully bridges the gap between the speed of non-autoregressive translation and the quality required for specialized domain adaptation. By providing NAT models with a bidirectional contextual memory and an iterative refinement process, we achieve state-of-the-art performance in domain-specific NMT while maintaining a significant speed advantage over traditional methods. Future work will focus on reducing retrieval latency for even larger datastores and extending this bidirectional approach to other natural language processing tasks.

Summary updated

BibTeX
@inproceedings{you2024efficient,
  author = {Wangjie You and Pei Guo and Juntao Li and Kehai Chen and Min Zhang},
  title = {{Efficient Domain Adaptation for Non-Autoregressive Machine Translation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.findings-acl.810},
}
Figure