Abstract
In the evolving landscape of Neural Machine Translation (NMT), the pretrain-then-finetune paradigm has yielded impressive results. However, the persistent challenge of Catastrophic Forgetting (CF) remains a hurdle. While previous work has introduced Continual Learning (CL) methods to address CF, these approaches grapple with the delicate balance between avoiding forgetting and maintaining system extensibility. To address this, we propose a CL method, named F-MALLOC (Feed-forward Memory ALLOCation). F-MALLOC is inspired by recent insights highlighting that feed-forward layers emulate neural memories and encapsulate crucial translation knowledge. It decomposes feed-forward layers into discrete memory cells and allocates these memories to different tasks. By learning to allocate and safeguard these memories, our method effectively alleviates CF while ensuring robust extendability. Besides, we propose a comprehensive assessment protocol for multi-stage CL of NMT systems. Experiments conducted following this new protocol showcase the superior performance of F-MALLOC, evidenced by higher BLEU scores and almost zero forgetting.
Introduction
The standard workflow in Neural Machine Translation (NMT) involves pretraining a large-scale model on general-domain corpora followed by fine-tuning on specific domains such as medical or legal texts. A significant drawback of this approach is Catastrophic Forgetting (CF), where the model loses its ability to perform on the original general domain or previously learned specific domains after adapting to a new one.
Existing Continual Learning (CL) strategies generally fall into two categories: regularization-based methods, which constrain parameter updates to preserve old knowledge, and architecture-based methods, which isolate parameters for specific tasks. However, these methods often struggle to balance extensibility, efficiency, and the complete prevention of forgetting as the number of sequential tasks increases.
Methodology
F-MALLOC treats the Feed-Forward Networks (FFN) within Transformer architectures as discrete "neural memories." The method employs a three-stage pipeline to manage these memories across a sequence of tasks.
1. Importance-based Pruning
To preserve general domain knowledge without requiring the original massive pretraining data, F-MALLOC identifies crucial FFN cells using Jensen-Shannon (JS) divergence. By measuring the output disturbance caused by dropout on a small external dataset, the model identifies "read-only" cells essential for general translation. The remaining cells are marked as "writable" for future tasks.
2. Task-specific Allocation
As new domains arrive, the model learns a task-specific binary mask. This mask acts as a gate, determining which writable cells are activated for a given task. A hard attention mechanism with temperature annealing is used to ensure discrete cell selection.
3. Gradient Safeguarding
To prevent overwriting, F-MALLOC blocks gradient updates to any memory cells allocated to previous tasks. This "write-protection" ensures that learning a new domain, such as "Law," does not degrade performance on a previously learned domain like "IT."
Results and Discussion
The researchers evaluated F-MALLOC against eight competitive baselines, including EWC, Knowledge Distillation (KD), and Prune-Then-Expand (PTE), using the OPUS multi-domains dataset (Medical, Law, IT, Koran, and Subtitles).
Performance and Forgetting
F-MALLOC achieved a state-of-the-art average Forgetting Ratio (FR) of 0.71%, significantly lower than sequential fine-tuning (~48%) and regularization methods like EWC (~11%). It consistently delivered superior BLEU scores across all evaluated domains.
Memory Efficiency and Transfer
A key finding was the model's ability to reuse memory cells. Similar domains (e.g., Law and Medical) naturally shared more cells, facilitating knowledge transfer. Furthermore, after five tasks, approximately 40% of the FFN capacity remained available, indicating high scalability for future domains. The method also demonstrated robustness to the order in which tasks were presented.
Conclusion
F-MALLOC offers a robust solution for continual learning in NMT by reframing FFN layers as manageable memory banks. By combining importance-based pruning with strict gradient safeguarding, it eliminates catastrophic forgetting while maintaining high translation quality and extensibility. Future research will explore extending this memory allocation logic to attention layers and addressing the complexities of multilingual continual learning.
Summary updated