Abstract: Although neural machine translation (NMT) models perform well in the general domain, it remains rather challenging to control their generation behavior to satisfy the requirement of different users. Given the expensive training cost and the data scarcity challenge of learning a new model from scratch for each user requirement, we propose a memory-augmented adapter to steer pretrained NMT models in a pluggable manner. Specifically, we construct a multi-granular memory based on the user-provided text samples and propose a new adapter architecture to combine the model representations and the retrieved results. We also propose a training strategy using memory dropout to reduce spurious dependencies between the NMT model and the memory. We validate our approach on both style- and domain-specific experiments and the results indicate that our method can outperform several representative pluggable baselines.
What Problem Does This Paper Address?
Standard NMT models are typically trained on massive, generalized web datasets. While this makes them excellent generalists, they often fail to satisfy specific user requirements—such as translating in the style of a particular author or utilizing highly specialized technical terminology.
The traditional solution is fine-tuning, but this approach is computationally expensive, requires significant domain-specific data, and often leads to "catastrophic forgetting," where the model loses its general translation ability. Existing "pluggable" methods, like standard adapters, often hit a performance bottleneck because they rely solely on a small number of new parameters. This paper aims to break that bottleneck by giving adapters access to external, user-provided memory.
Methods
The researchers introduce a system that allows a frozen, pre-trained model to be steered toward specific styles or domains using just a handful of text samples. The method relies on three key innovations:
1. Multi-granular Continuous Memory
Instead of just storing words, the system uses parse trees to extract phrases of varying lengths (granularities), as shown in Figure 6(a). These phrases are translated using the base NMT model to create a "parallel phrase memory." Crucially, the system stores the continuous representations (vectors) from the model's internal layers rather than just raw text (Figure 6(b)). This allows for more nuanced retrieval during translation.
2. Memory-augmented Adapter Architecture
Unlike standard adapters that simply transform hidden states, this new architecture (Figure 6(c)) utilizes four inputs: an anchor, a query, a key, and a value. It employs an attention mechanism to retrieve relevant info from the memory and a gated fusion module to intelligently mix the retrieved information with the original model's representation. This gating mechanism acts as a safety net; if the retrieval pulls irrelevant info, the gate prioritizes the original model's output.
3. Memory Dropout Training
To prevent the adapter from becoming a "crutch" that simply copies from memory, the researchers randomly drop parts of the memory during training. This forces the model to learn meaningful dependencies rather than spurious ones, ensuring the adapter truly understands how to integrate external knowledge.
Key Results
The system was validated on style customization (Shakespeare and Lu Xun) and domain customization (IT, Medical, Law, and Koran).
- Style Customization: The method achieved a BLEU score of 21.6 (when combined with kNN decoding), a significant jump from the vanilla model's 14.7. It also outperformed ChatGPT and standard adapters in style-matching classifier scores.
- Domain Customization: In technical domains like Law and Medical, the memory-augmented adapter consistently outperformed standard adapters by 1-3 BLEU points.
- Efficiency: The system is effective even with as few as 250 exemplary sentences. Furthermore, inference time was only 1.15x that of a standard adapter, thanks to GPU acceleration for retrieval.
Conclusion
By combining a multi-granular phrase memory with a gated fusion adapter, this research provides a powerful, low-resource way to customize NMT models. The "pluggable" nature of the adapter ensures that the base model remains general-purpose while gaining the "expressive power" needed for niche user requirements. Future work may extend this framework to other sequence-to-sequence tasks like abstractive summarization or stylized dialogue generation.
Summary updated