Skip to main content
QUICK REVIEW

[Paper Review] Data Movement Is All You Need: A Case Study on Optimizing Transformers

Andrei Ivanov, Nikoli Dryden|arXiv (Cornell University)|Jun 30, 2020
Advanced Neural Network ApplicationsComputer Science96 references24 citations
TL;DR

This paper identifies data movement as the primary bottleneck in training Transformers, demonstrating that despite advances in compute, training has become memory-bound due to Amdahl’s Law. By globally optimizing data layouts and movement through systematic dataflow analysis and layout transformations, the authors reduce data movement by up to 22.91% and achieve a 1.30× speedup on BERT encoder layers and 1.19× on the full BERT model over state-of-the-art frameworks.

ABSTRACT

Transformers are one of the most important machine learning workloads today. Training one is a very compute-intensive task, often taking days or weeks, and significant attention has been given to optimizing transformers. Despite this, existing implementations do not efficiently utilize GPUs. We find that data movement is the key bottleneck when training. Due to Amdahl's Law and massive improvements in compute performance, training has now become memory-bound. Further, existing frameworks use suboptimal data layouts. Using these insights, we present a recipe for globally optimizing data movement in transformers. We reduce data movement by up to 22.91% and overall achieve a 1.30x performance improvement over state-of-the-art frameworks when training a BERT encoder layer and 1.19x for the entire BERT. Our approach is applicable more broadly to optimizing deep neural networks, and offers insight into how to tackle emerging performance bottlenecks.

Motivation & Objective

  • To identify the primary performance bottleneck in training Transformer models.
  • To analyze why existing deep learning frameworks underutilize GPU compute despite highly optimized kernels.
  • To investigate the role of data movement and suboptimal data layouts in degrading training performance.
  • To develop a global optimization strategy that systematically reduces data movement across the entire computation graph.
  • To demonstrate that data movement optimization yields greater performance gains than algorithmic or hardware-level improvements alone.

Proposed method

  • The authors model the Transformer computation as a stateful dataflow multigraph (SDFG), enabling systematic analysis of data movement across operations.
  • They perform a detailed dataflow analysis to identify memory-bound operators, particularly in multi-head attention, where 37% of runtime is spent on data movement.
  • The method introduces a global layout transformation strategy that reorders and restructures data layouts across operations to minimize redundant data movement.
  • The approach uses a parametric, flat dataflow representation to enable coarse- and fine-grained layout and fusion optimizations across multiple levels of granularity.
  • The authors evaluate their optimizations using a custom SDFG-based compiler stack, comparing performance against PyTorch, TensorFlow with XLA, and cuDNN.
  • They apply layout transformations that reduce memory access overhead, achieving up to 52% improvement in matrix-matrix multiplication (MMM) performance.

Experimental results

Research questions

  • RQ1What is the primary performance bottleneck in training modern Transformer models?
  • RQ2Why do existing deep learning frameworks fail to efficiently utilize GPU compute despite highly optimized kernels?
  • RQ3How does data layout impact data movement and overall training performance in Transformers?
  • RQ4Can global, end-to-end data movement optimization outperform localized or kernel-level optimizations?
  • RQ5To what extent can data movement reduction improve training throughput in BERT and its components?

Key findings

  • Data movement accounts for 37% of runtime in a BERT training iteration, despite tensor contractions being responsible for over 99% of arithmetic operations.
  • The authors reduce data movement by up to 22.91% through global layout and fusion optimizations, significantly improving performance.
  • The proposed method achieves a 1.30× speedup on a single BERT encoder layer and 1.19× on the full BERT model compared to state-of-the-art frameworks.
  • The performance gains are primarily due to optimized data layouts, which improve matrix-matrix multiplication (MMM) performance by up to 52%.
  • The study confirms that training has become memory-bound due to Amdahl’s Law and the disproportionate growth in compute vs. memory bandwidth.
  • The approach is generalizable beyond Transformers, offering a framework for optimizing data movement in other deep neural networks.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.