fairseq: A Fast, Extensible Toolkit for Sequence Modeling
Written for the Research library (claude-opus-5-5) from the paper text. Original — aclanthology.org/N19-4009.pdf
Summary
The authors present FAIRSEQ, an open-source PyTorch toolkit for sequence modeling. It aims to serve both research and production for tasks such as machine translation, summarization and language modeling. The design is modular. Users can plug in their own models, criterions, tasks, optimizers and learning rate schedulers while reusing the rest of the framework. Checkpoints store the full training state, and older checkpoints are upgraded automatically.
On the engineering side, the toolkit supports:
- length-based batching to minimize padding
- multi-GPU and multi-machine training via NCCL2, which overlaps gradient synchronization with the backward pass and accumulates gradients to reduce straggler idle time
- FP16 training with dynamic loss scaling
- fast incremental decoding with several search strategies
Reference models reach strong results. These include a big Transformer on WMT En–De and En–Fr, adaptive-input Transformer language models on WikiText-103 and One Billion Word, and a Transformer summarizer on CNN-DailyMail. The toolkit matters because it pairs fast, scalable training with a flexible codebase and released pretrained models. It is distributed under a BSD license.
Key points
- Translation: the big Transformer, trained on WMT'16 for En–De and WMT'14 for En–Fr, scores 29.3 BLEU on En–De and 43.2 on En–Fr (newstest14). Training takes about 1.3 h (En–De) and about 7.2 h (En–Fr) on 128 V100 GPUs.
- FP16 inference: half precision raises decoding throughput from 88.1 to 136.0 sentences/sec (+54%) on a V100 with no accuracy loss. The benchmark was the WMT'14 En–De test set.
- Language modeling: adaptive-input Transformer LMs reach a test perplexity of 18.7 on WikiText-103 (previous best cited: 29.2) and 23.0 on One Billion Word (previous best cited: 28.0).
- Summarization: on full-text CNN-DailyMail, the model scores ROUGE-1/2/L of 40.1/17.6/36.8. Adding pretrained LM representations (trained on 193M sentences) raises this to 41.6/18.9/38.5.
- Extensibility and availability: there are five plug-in types (models, criterions, tasks, optimizers, LR schedulers), including an Adafactor implementation. The code is at github.com/pytorch/fairseq.
Cited by
- Unsupervised Domain Clusters in Pretrained Language Models
- Unified Pre-training for Program Understanding and Generation
- The eBible Corpus: Data and Model Benchmarks for Bible Translation for Low-Resource Languages
- Findings of the 2021 Conference on Machine Translation (WMT21)
- XLS-R: Self-supervised Cross-lingual Speech Representation Learning at Scale
- wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representations
- Findings of the 2019 Conference on Machine Translation (WMT19)
- CLIFF: Contrastive Learning for Improving Faithfulness and Factuality in Abstractive Summarization
- SeamlessM4T: Massively Multilingual & Multimodal Machine Translation
- RobBERT: a Dutch RoBERTa-based Language Model
- 8-bit Optimizers via Block-wise Quantization
- On The Evaluation of Machine Translation Systems Trained With Back-Translation
- Reducing Transformer Depth on Demand with Structured Dropout
- IndicTrans2: Towards High-Quality and Accessible Machine Translation Models for all 22 Scheduled Indian Languages
- The FLORES Evaluation Datasets for Low-Resource Machine Translation: Nepali–English and Sinhala–English
- HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden Units
- Efficient Attentions for Long Document Summarization
- BlonDe: An Automatic Evaluation Metric for Document-level Machine Translation
- SpanBERT: Improving Pre-training by Representing and Predicting Spans
- Challenges and Applications of Large Language Models
- CCAligned: A Massive Collection of Cross-Lingual Web-Document Pairs
- Attention is Not Only a Weight: Analyzing Transformers with Vector Norms
- Reformulating Unsupervised Style Transfer as Paraphrase Generation
- Data Augmentation using Pre-trained Transformer Models
- WikiLingua: A New Benchmark Dataset for Cross-Lingual Abstractive Summarization
- HebDB: a Weakly Supervised Dataset for Hebrew Speech Processing
- FlauBERT: Unsupervised Language Model Pre-training for French
- PAQ: 65 Million Probably-Asked Questions and What You Can Do With Them
- Few-shot Learning with Multilingual Language Models
- HalleluBERT: Let Every Token That Has Meaning Bear Its Weight
- TAPEX: Table Pre-training via Learning a Neural SQL Executor
- CamemBERT: a Tasty French Language Model
- Facebook FAIR's WMT19 News Translation Task Submission
- BERTweet: A pre-trained language model for English Tweets
- PhoBERT: Pre-trained language models for Vietnamese
- Expanding the JHU Bible Corpus for Machine Translation of the Indigenous Languages of North America
- KILT: a Benchmark for Knowledge Intensive Language Tasks
- Lifting the Curse of Multilinguality by Pre-training Modular Transformers
- Scaling Speech Technology to 1,000+ Languages
- Samanantar: The Largest Publicly Available Parallel Corpora Collection for 11 Indic Languages
- TransQuest: Translation Quality Estimation with Cross-lingual Transformers
- The Curious Case of Hallucinations in Neural Machine Translation
- Recipes for Building an Open-Domain Chatbot
- WikiMatrix: Mining 135M Parallel Sentences in 1620 Language Pairs from Wikipedia
- Jais and Jais-chat: Arabic-Centric Foundation and Instruction-Tuned Open Generative Large Language Models
- AMR-TST: Abstract Meaning Representation-based Text Style Transfer
- mGPT: Few-Shot Learners Go Multilingual
- Masked Language Modeling and the Distributional Hypothesis: Order Word Matters Pre-training for Little
- Findings of the WMT 2020 Shared Task on Quality Estimation
- Findings of the WMT 2021 Shared Task on Quality Estimation
- Multilingual Translation from Denoising Pre-Training
- Efficient Transformers: A Survey
- Automatic Machine Translation Evaluation in Many Languages via Zero-Shot Paraphrasing
- Paraphrase Generation as Zero-Shot Multilingual Translation: Disentangling Semantic Similarity from Lexical and Syntactic Diversity
- Memorization Without Overfitting: Analyzing the Training Dynamics of Large Language Models
- VoxPopuli: A Large-Scale Multilingual Speech Corpus for Representation Learning, Semi-Supervised Learning and Interpretation
- Neural Text Generation with Unlikelihood Training
- Transformers: State-of-the-Art Natural Language Processing
- GPT3Mix: Leveraging Large-scale Language Models for Text Augmentation
- Findings of the WMT 2022 Shared Task on Quality Estimation
Cite
@inproceedings{ott2019fairseq,
title = {{fairseq: A Fast, Extensible Toolkit for Sequence Modeling}},
author = {Ott, Myle and Edunov, Sergey and Baevski, Alexei and Fan, Angela and Gross, Sam and Ng, Nathan and Grangier, David and Auli, Michael},
booktitle = {Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations)},
year = {2019},
doi = {10.18653/v1/n19-4009},
eprint = {1904.01038},
archivePrefix = {arXiv},
url = {https://doi.org/10.18653/v1/n19-4009}
}References
- Edouard Grave, Armand Joulin, and Nicolas Usunier. 2016. Improving neural language models with a continuous cache. arXiv, abs/1612.04426. find
- Karim Ahmed, Nitish Shirish Keskar, and Richard Socher. 2017. Weighted transformer network for machine translation. arxiv, 1711.02132. find
- Karl Moritz Hermann, Tomas Kocisky, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and Phil Blunsom. 2015. Teaching machines to read and comprehend. In NIPS. find our card
- Mikel Artetxe and Holger Schwenk. 2018. Massively multilingual sentence embeddings for zero-shot cross-lingual transfer and beyond. arXiv, abs/1812.10464. find our card
- Felix Hieber, Tobias Domhan, Michael Denkowski, David Vilar, Artem Sokolov, Ann Clifton, and Matt Post. 2018. Sockeye: A Toolkit for Neural Machine Translation. arXiv, abs/1712.05690. — [arXiv:1712.05690](https://arxiv.org/abs/1712.05690) find
- Alexei Baevski and Michael Auli. 2019. Adaptive input representations for neural language modeling. In Proc. of ICLR. find
- Yun Chen, Victor OK Li, Kyunghyun Cho, and Samuel R Bowman. 2018. A stable and effective learning strategy for trainable greedy decoding. arXiv, abs/1804.07915. find
- Hieu Hoang, Philipp Koehn, Ulrich Germann, Kenneth Heafield, and Barry Haddow. 2006. multi-bleu.perl. https://github.com/moses-smt/ mosesdecoder/blob/master/scripts/ generic/multi-bleu.perl. ↗
- Shamil Chollampatt and Hwee Tou Ng. 2018. A multilayer convolutional encoder-decoder neural network for grammatical error correction. arXiv, abs/1801.08831. find
- Rafal Józefowicz, Oriol Vinyals, Mike Schuster, Noam Shazeer, and Yonghui Wu. 2016. Exploring the limits of language modeling. arXiv, abs/1602.02410. find
- Yann N. Dauphin, Angela Fan, Michael Auli, and David Grangier. 2017. Language modeling with gated convolutional networks. In Proc. of ICML. find our card
- Marcin Junczys-Dowmunt, Roman Grundkiewicz, Tomasz Dwojak, Hieu Hoang, Kenneth Heafield, Tom Neckermann, Frank Seide, Ulrich Germann, Alham Fikri Aji, Nikolay Bogoychev, André F. T. Martins, and Alexandra Birch. 2018. Marian: Fast neural machine translation in C++. In Proc. of ACL 2018, System Demo… find our card
- Emily Dinan, Stephen Roller, Kurt Shuster, Angela Fan, Michael Auli, and Jason Weston. 2019. Wizard of Wikipedia: Knowledge-powered conversational agents. In Proc. of ICLR. find
- Sergey Edunov, Myle Ott, Michael Auli, and David Grangier. 2018a. Understanding back-translation at scale. In Conference of the Association for Computational Linguistics (ACL). find
- Yoon Kim, Yacine Jernite, David Sontag, and Alexander M Rush. 2016. Character-aware neural language models. In Proc. of AAAI. find our card
- Guillaume Klein, Yoon Kim, Yuntian Deng, Jean Senellart, and Alexander M. Rush. 2017. Open-NMT: Open-source toolkit for neural machine translation. In Proc. ACL. find
- Sergey Edunov, Myle Ott, Michael Auli, David Grangier, et al. 2018b. Classical structured prediction losses for sequence to sequence learning. In Proc. of NAACL. find
- Oleksii Kuchaiev, Boris Ginsburg, Igor Gitman, Vitaly Lavrukhin, Carl Case, and Paulius Micikevicius. 2018. OpenSeq2Seq: Extensible Toolkit for Distributed and Mixed Precision Training of Sequence-to-Sequence Models. In Proc. of Workshop for NLP Open Source Software. find
- Angela Fan, David Grangier, and Michael Auli. 2018a. Controllable abstractive summarization. In ACL Workshop on Neural Machine Translation and Generation. find our card
- Angela Fan, Mike Lewis, and Yann Dauphin. 2018b. Hierarchical neural story generation. In Proc. of ACL. find
- Guillaume Lample, Myle Ott, Alexis Conneau, Ludovic Denoyer, and Marc’Aurelio Ranzato. 2018. Phrase-based & neural unsupervised machine translation. In Proc. of EMNLP. find
- Angela Fan, Mike Lewis, and Yann Dauphin. 2019. Strategies for structuring story generation. arXiv, abs/1902.01109. find
- Chin-Yew Lin. 2004. Rouge: a package for automatic evaluation of summaries. In ACL Workshop on Text Summarization Branches Out. find
- Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N Dauphin. 2017. Convolutional Sequence to Sequence Learning. In Proc. of ICML. find our card
- Sebastian Gehrmann, Yuntian Deng, and Alexander M Rush. 2018. Bottom-up abstractive summarization. arXiv, abs/1808.10792. find our card
- Yizhu Liu, Zhiyi Luo, and Kenny Zhu. 2018. Controlling length in abstractive summarization using a convolutional neural network. In Proc. of EMNLP. find
- Edouard Grave, Armand Joulin, Moustapha Cissé, David Grangier, and Hervé Jégou. 2017. Efficient softmax approximation for gpus. In Proc. of ICML. find
- Ilya Loshchilov and Frank Hutter. 2016. Sgdr: Stochastic gradient descent with warm restarts. In Proc. of ICLR. find
- Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc V. Le, Geoffrey E. Hinton, and Jeff Dean. 2017. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. arXiv, abs/1701.06538. find
- Minh-Thang Luong, Hieu Pham, and Christopher D Manning. 2015. Effective approaches to attention-based neural machine translation. In Proc. of EMNLP. find
- Stephen Merity, Nitish Shirish Keskar, and Richard Socher. 2018. An analysis of neural language modeling at multiple scales. arXiv, abs/1803.08240. find
- Noam Shazeer and Mitchell Stern. 2018. Adafactor: Adaptive learning rates with sublinear memory cost. arXiv preprint arXiv:1804.04235. find
- Paulius Micikevicius, Sharan Narang, Jonah Alben, Gregory F. Diamos, Erich Elsen, David Garcia, Boris Ginsburg, Michael Houston, Oleksii Kuchaiev, Ganesh Venkatesh, and Hao Wu. 2018. Mixed Precision Training. In Proc. of ICLR. find
- Tianxiao Shen, Myle Ott, Michael Auli, and Marc’Aurelio Ranzato. 2019. Mixture models for diverse machine translation: Tricks of the trade. arXiv, abs/1902.07816. — [arXiv:1902.07816](https://arxiv.org/abs/1902.07816) find
- A. H. Miller, W. Feng, A. Fisch, J. Lu, D. Batra, A. Bordes, D. Parikh, and J. Weston. 2017. Parlai: A dialog research software platform. arXiv, abs/1705.06476. find our card
- Kaitao Song, Xu Tan, Di He, Jianfeng Lu, Tao Qin, and Tie-Yan Liu. 2018. Double path networks for sequence to sequence learning. arXiv, abs/1806.04856. find
- Makoto Morishita, Yusuke Oda, Graham Neubig, Koichiro Yoshino, Katsuhito Sudoh, and Satoshi Nakamura. 2017. An empirical study of mini-batch creation strategies for neural machine translation. In Proc. of WMT. find
- A. Vaswani, S. Bengio, E. Brevdo, F. Chollet, A. N. Gomez, S. Gouws, L. Jones, Ł. Kaiser, N. Kalchbrenner, N. Parmar, R. Sepassi, N. Shazeer, and J. Uszkoreit. 2018. Tensor2Tensor for Neural Machine Translation. arXiv, abs/1803.07416. find our card
- Ramesh Nallapati, Bowen Zhou, Cicero dos Santos, Caglar Gulcehre, and Bing Xiang. 2016. Abstractive text summarization using sequence-to-sequence rnns and beyond. In SIGNLL Conference on Computational Natural Language Learning. find
- Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention Is All You Need. In Proc. of NIPS. find
- Shashi Narayan, Shay B Cohen, and Mirella Lapata. 2018. Don’t give me the details, just the summary! topic-aware convolutional neural networks for extreme summarization. arXiv, abs/1808.08745. find
- Ashwin K Vijayakumar, Michael Cogswell, Ram-prasath R Selvaraju, Qing Sun, Stefan Lee, David Crandall, and Dhruv Batra. 2016. Diverse beam search: Decoding diverse solutions from neural sequence models. arXiv preprint arXiv:1610.02424. find our card
- Myle Ott, Michael Auli, David Grangier, and MarcAu-relio Ranzato. 2018a. Analyzing uncertainty in neural machine translation. In Proc. of ICML. find our card
- Felix Wu, Angela Fan, Alexei Baevski, Yann N. Dauphin, and Michael Auli. 2019. Pay less attention with lightweight and dynamic convlutions. In Proc. of ICLR. find
- Myle Ott, Sergey Edunov, David Grangier, and Michael Auli. 2018b. Scaling neural machine translation. In Proc. of WMT. find our card
- Romain Paulus, Caiming Xiong, and Richard Socher. 2017. A deep reinforced model for abstractive summarization. arXiv preprint arXiv:1705.04304. find our card
- Matt Post. 2018. A call for clarity in reporting bleu scores. arXiv, abs/1804.08771. find our card
- Jack W. Rae, Chris Dyer, Peter Dayan, and Timothy P. Lillicrap. 2018. Fast parametric learning with activation memorization. arXiv, abs/1803.10049. — [arXiv:1803.10049](https://arxiv.org/abs/1803.10049) find
- Abigail See, Peter J. Liu, and Christopher D. Manning. 2017. Get to the point: Summarization with pointer-generator networks. In ACL. find
- Rico Sennrich, Barry Haddow, and Alexandra Birch. 2016. Neural machine translation of rare words with subword units. In Proc. of ACL. find
- Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. 2018. Self-attention with relative position representations. In Proc. of NAACL. find our card