Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

Shortformer: Better Language Modeling using Shorter Inputs

About

Increasing the input length has been a driver of progress in language modeling with transformers. We identify conditions where shorter inputs are not harmful, and achieve perplexity and efficiency improvements through two new methods that decrease input length. First, we show that initially training a model on short subsequences before moving on to longer ones both reduces overall training time and, surprisingly, substantially improves perplexity. Second, we show how to improve the efficiency of recurrence methods in transformers, which let models condition on previously processed tokens when generating sequences that exceed the maximal length the transformer can handle at once. Existing methods require computationally expensive relative position embeddings; we introduce a simple alternative of adding absolute position embeddings to queries and keys instead of to word embeddings, which efficiently produces superior results. We show that these recurrent models also benefit from short input lengths. Combining these techniques speeds up training by a factor of 1.65, reduces memory usage, and substantially improves perplexity on WikiText-103, without adding any parameters.

Ofir Press, Noah A. Smith, Mike Lewis• 2020

Related benchmarks

TaskDatasetResultRank
Language ModelingWikiText-103 (test)
Perplexity17.56
524
Language ModelingWikiText-103 (val)
PPL17.47
180
Language ModelingToronto Book Corpus (TBC) (test)
PPL10.72
8
Language ModelingToronto Book Corpus (TBC) (dev)
Perplexity (PPL)13.13
7
Showing 4 of 4 rows

Other info

Code

Follow for update