Skip to main content
QUICK REVIEW

[Paper Review] Monarch: Expressive Structured Matrices for Efficient and Accurate Training

Tri Dao, Beidi Chen|arXiv (Cornell University)|Apr 1, 2022
Advanced Neural Network ApplicationsComputer Science8 citations
TL;DR

Monarch proposes a class of structured matrices parameterized as products of two block-diagonal matrices, enabling hardware-efficient and expressive representations for deep learning. It achieves up to 2× faster training in ViT and GPT-2, reduces PDE/MRI reconstruction error by 40%, and enables 23% faster BERT pretraining via reverse sparsification and Monarch-based dense-to-sparse fine-tuning with no accuracy drop.

ABSTRACT

Large neural networks excel in many domains, but they are expensive to train and fine-tune. A popular approach to reduce their compute or memory requirements is to replace dense weight matrices with structured ones (e.g., sparse, low-rank, Fourier transform). These methods have not seen widespread adoption (1) in end-to-end training due to unfavorable efficiency--quality tradeoffs, and (2) in dense-to-sparse fine-tuning due to lack of tractable algorithms to approximate a given dense weight matrix. To address these issues, we propose a class of matrices (Monarch) that is hardware-efficient (they are parameterized as products of two block-diagonal matrices for better hardware utilization) and expressive (they can represent many commonly used transforms). Surprisingly, the problem of approximating a dense weight matrix with a Monarch matrix, though nonconvex, has an analytical optimal solution. These properties of Monarch matrices unlock new ways to train and fine-tune sparse and dense models. We empirically validate that Monarch can achieve favorable accuracy-efficiency tradeoffs in several end-to-end sparse training applications: speeding up ViT and GPT-2 training on ImageNet classification and Wikitext-103 language modeling by 2x with comparable model quality, and reducing the error on PDE solving and MRI reconstruction tasks by 40%. In sparse-to-dense training, with a simple technique called "reverse sparsification," Monarch matrices serve as a useful intermediate representation to speed up GPT-2 pretraining on OpenWebText by 2x without quality drop. The same technique brings 23% faster BERT pretraining than even the very optimized implementation from Nvidia that set the MLPerf 1.1 record. In dense-to-sparse fine-tuning, as a proof-of-concept, our Monarch approximation algorithm speeds up BERT fine-tuning on GLUE by 1.7x with comparable accuracy.

Motivation & Objective

  • Address the inefficiency and limited expressiveness of existing structured matrices in end-to-end deep learning training.
  • Overcome the lack of tractable approximation algorithms for converting dense weight matrices into structured forms during dense-to-sparse fine-tuning.
  • Enable hardware-efficient training of sparse models using a parameterization compatible with optimized GPU kernels.
  • Develop a novel intermediate representation for sparse-to-dense fine-tuning that maintains model quality while accelerating training.
  • Demonstrate the utility of Monarch matrices in scientific machine learning tasks such as PDE solving and MRI reconstruction.

Proposed method

  • Propose Monarch matrices as products of two block-diagonal matrices (up to permutation), enabling efficient batch-matrix multiplication on GPUs.
  • Leverage optimized BMM routines to achieve up to 2× speedup over dense matrix multiplication in training.
  • Show that Monarch matrices can represent key transforms like Fourier, convolution, and cosine transforms, ensuring high expressiveness.
  • Derive an analytical optimal solution for approximating a dense weight matrix with a Monarch matrix, despite the nonconvexity of the problem.
  • Introduce 'reverse sparsification'—a technique to train with Monarch matrices and then fine-tune to dense weights, accelerating dense model pretraining.
  • Apply Monarch-based projection in dense-to-sparse fine-tuning, using the analytical approximation to transfer knowledge from dense models efficiently.

Experimental results

Research questions

  • RQ1Can a structured matrix class be both hardware-efficient and expressive enough to represent common transforms used in deep learning and scientific computing?
  • RQ2Does the analytical solvability of the Monarch approximation problem enable practical and efficient dense-to-sparse fine-tuning?
  • RQ3Can Monarch matrices accelerate end-to-end training of sparse models without sacrificing model quality?
  • RQ4Can Monarch-based intermediate representations improve the efficiency of sparse-to-dense fine-tuning in large language models?
  • RQ5Can Monarch matrices improve reconstruction accuracy in data-limited scientific tasks like accelerated MRI and PDE solving?

Key findings

  • Monarch matrices achieve up to 2× faster training for ViT and GPT-2 on ImageNet and Wikitext-103 with comparable model accuracy.
  • Monarch-based MRI reconstruction (mSENSE) reduces reconstruction error by 40% compared to baseline methods, even with only one training scan.
  • Reverse sparsification using Monarch matrices speeds up GPT-2 pretraining on OpenWebText by 2× without accuracy degradation.
  • The same technique achieves 23% faster BERT pretraining than Nvidia’s optimized MLPerf 1.1 implementation.
  • Monarch-based dense-to-sparse fine-tuning accelerates BERT fine-tuning on GLUE by 1.7× with comparable accuracy.
  • The analytical solution for Monarch approximation enables efficient and accurate transfer of knowledge from dense to structured models.

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.