Packing: Towards 2x NLP BERT Acceleration

AI-generated keywords: BERT Packing Pre-training Speed-up Performance

AI-generated Key Points

  • Authors address the need for accelerating BERT pre-training
  • Methods to exploit characteristics of pre-training dataset, particularly padding tokens
  • Removal of padding tokens leads to significant increase in sequences per second
  • Introduction of two deterministic packing algorithms: SPFHP and NNLSHP
  • SPFHP determines packing order for large Wikipedia dataset in 0.02 seconds
  • NNLSHP takes longer to converge but produces more depth efficient solutions
  • Additional masking and modification required for datasets with multiple sequences per sample
  • Changes have minimal impact on performance gain on modern hardware
  • Pretraining BERT-Large using packed dataset achieves desired 2x speed-up without compromising performance or convergence
Also access our AI generated: Comprehensive summary, Lay summary, Blog-like article; or ask questions about this paper to our AI assistant.

Authors: Matej Kosec, Sheng Fu, Mario Michael Krell

License: CC BY-SA 4.0

Abstract: We find that at sequence length 512 padding tokens represent in excess of 50% of the Wikipedia dataset used for pretraining BERT (Bidirectional Encoder Representations from Transformers). Therefore by removing all padding we achieve a 2x speed-up in terms of sequences/sec. To exploit this characteristic of the dataset, we develop and contrast two deterministic packing algorithms. Both algorithms rely on the assumption that sequences are interchangeable and therefore packing can be performed on the histogram of sequence lengths, rather than per sample. This transformation of the problem leads to algorithms which are fast and have linear complexity in dataset size. The shortest-pack-first histogram-packing (SPFHP) algorithm determines the packing order for the Wikipedia dataset of over 16M sequences in 0.02 seconds. The non-negative least-squares histogram-packing (NNLSHP) algorithm converges in 28.4 seconds but produces solutions which are more depth efficient, managing to get near optimal packing by combining a maximum of 3 sequences in one sample. Using the dataset with multiple sequences per sample requires additional masking in the attention layer and a modification of the MLM loss function. We demonstrate that both of these changes are straightforward to implement and have relatively little impact on the achievable performance gain on modern hardware. Finally, we pretrain BERT-Large using the packed dataset, demonstrating no loss of convergence and the desired 2x speed-up.

Submitted to arXiv on 29 Jun. 2021

Ask questions about this paper to our AI assistant

You can also chat with multiple papers at once here.

AI assistant instructions?

Results of the summarizing process for the arXiv paper: 2107.02027v1

In this paper, the authors address the need for accelerating the pre-training process of BERT in order to make it more accessible and adaptable for researchers and industry professionals. They introduce methods to exploit the characteristics of the pre-training dataset, particularly the presence of padding tokens which represent over 50% of the Wikipedia dataset used for pretraining BERT at a sequence length of 512. By removing all padding, they are able to achieve a significant increase in sequences per second. To take advantage of this characteristic, two deterministic packing algorithms are developed and compared. The first algorithm called shortest-pack-first histogram-packing (SPFHP) determines the packing order for a large Wikipedia dataset consisting of over 16 million sequences in just 0.02 seconds while the second algorithm non-negative least-squares histogram-packing (NNLSHP) takes longer to converge at 28.4 seconds but produces solutions that are more depth efficient by combining a maximum of three sequences in one sample. Using a dataset with multiple sequences per sample requires additional masking in the attention layer and modification of the MLM loss function; however these changes have minimal impact on performance gain on modern hardware. Finally, by pretraining BERT-Large using their packed dataset they show that there is no loss of convergence and successfully achieve their desired 2x speed-up without compromising performance or convergence. Overall, this paper provides valuable insights into accelerating BERT pre-training through efficient packing algorithms and demonstrates its feasibility without compromising performance or convergence.
Created on 19 Jul. 2023

Assess the quality of the AI-generated content by voting

Score: 0

Why do we need votes?

Votes are used to determine whether we need to re-run our summarizing tools. If the count reaches -10, our tools can be restarted.

The previous summary was created more than a year ago and can be re-run (if necessary) by clicking on the Run button below.

Similar papers summarized with our AI tools

Navigate through even more similar papers through a

tree representation

Look for similar papers (in beta version)

By clicking on the button above, our algorithm will scan all papers in our database to find the closest based on the contents of the full papers and not just on metadata. Please note that it only works for papers that we have generated summaries for and you can rerun it from time to time to get a more accurate result while our database grows.

Disclaimer: The AI-based summarization tool and virtual assistant provided on this website may not always provide accurate and complete summaries or responses. We encourage you to carefully review and evaluate the generated content to ensure its quality and relevance to your needs.