What Knowledge Is Needed? Towards Explainable Memory for kNN-MT Domain Adaptation

Wenhao Zhu, Shujian Huang, Yunzhe Lv, Xin Zheng, Jiajun Chen

Introduction

Neural Machine Translation (NMT) models often struggle when applied to specialized domains like law or medicine. kNN-MT has emerged as a state-of-the-art solution for domain adaptation by utilizing an external "datastore" of domain-specific examples. However, these datastores are notoriously large and redundant, storing every token occurrence from the target corpus. This paper investigates the fundamental question: what knowledge does an NMT model actually need to store to perform well in a new domain?

Methodology: Local Correctness and Knowledge Margin

The authors introduce Local Correctness (LAC) to quantify the relationship between a pre-trained NMT model and its external memory. Two primary metrics are proposed:

  1. Entry Correctness: Determines if the base model can already predict a specific token correctly using teacher-forcing.
  2. Knowledge Margin ($km$): Measures "neighborhood correctness" by finding the maximum neighborhood size in the representation space where the model consistently produces correct translations.

Based on these metrics, the authors developed the PLAC (Pruning with LocAl Correctness) algorithm. PLAC prunes entries where the model exhibits a high knowledge margin, effectively removing redundant "easy" knowledge while retaining the "hard" examples the model struggles with.

Key Findings

Redundancy in Domain Datastores

Analysis reveals significant redundancy; approximately 66.7% of datastore entries are already "known" by the base NMT model. Storing these is essentially keeping a dictionary of words the model already knows by heart. Figure 2 illustrates the distribution of known and unknown entries across various Knowledge Margin bins for different domains.

Distribution of known and unknown entries across different domains and Knowledge Margin intervals.

Knowledge Margin as a Performance Proxy

A critical insight is the strong correlation between the Knowledge Margin and translation accuracy. As shown in Figure 6, when the Knowledge Margin exceeds 32, the model's prediction accuracy on unseen data typically surpasses 95%. Conversely, low margins ($km < 4$) correspond to accuracy levels below 50%. This validates $km$ as a reliable indicator of model competence in specific regions of the representation space.

Correlation between Knowledge Margin and prediction accuracy across four OPUS domains.

Experimental Results

The researchers evaluated PLAC across six domains (Medical, Law, IT, Koran, Thesis) and two language pairs (De-En, Zh-En).

  • Memory Efficiency: PLAC achieved up to 45% reduction in datastore size (e.g., in OPUS-Medical and OPUS-Law) without compromising translation quality as measured by BLEU or COMET scores. In the OPUS-Law domain, the memory footprint was reduced from 1,328 MB to 739 MB.
  • Performance: PLAC consistently outperformed traditional pruning methods such as random or cluster-based pruning, highlighting the importance of neighborhood context over simple point-wise correctness.
  • Explainability: Unlike black-box pruning methods, PLAC provides a clear rationale: entries are removed because the model has demonstrated sufficient local expertise in those specific linguistic contexts.

Conclusion

By identifying and pruning redundant knowledge through the lens of Local Correctness, the authors demonstrate that kNN-MT can be made significantly more efficient and explainable. This approach reduces hardware requirements for deployment while maintaining high translation quality. Future work may extend these concepts to mitigate catastrophic forgetting during traditional model fine-tuning.

Summary updated

BibTeX
@inproceedings{zhu2023what,
  author = {Wenhao Zhu and Shujian Huang and Yunzhe Lv and Xin Zheng and Jiajun Chen},
  title = {{What Knowledge Is Needed? Towards Explainable Memory for kNN-MT Domain Adaptation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.findings-acl.177},
}
Figure