[Paper Review] Monarch Mixer: A Simple Sub-Quadratic GEMM-Based Architecture
Monarch Mixer (M2) introduces sub-quadratic mixing using Monarch matrices, achieving competitive or better performance than Transformers across non-causal, causal, and vision tasks with fewer parameters. It enables sub-quadratic scaling in both sequence length and model dimension and provides a causal parameterization.
Machine learning models are increasingly being scaled in both sequence length and model dimension to reach longer contexts and better performance. However, existing architectures such as Transformers scale quadratically along both these axes. We ask: are there performant architectures that can scale sub-quadratically along sequence length and model dimension? We introduce Monarch Mixer (M2), a new architecture that uses the same sub-quadratic primitive along both sequence length and model dimension: Monarch matrices, a simple class of expressive structured matrices that captures many linear transforms, achieves high hardware efficiency on GPUs, and scales sub-quadratically. As a proof of concept, we explore the performance of M2 in three domains: non-causal BERT-style language modeling, ViT-style image classification, and causal GPT-style language modeling. For non-causal BERT-style modeling, M2 matches BERT-base and BERT-large in downstream GLUE quality with up to 27% fewer parameters, and achieves up to 9.1$ imes$ higher throughput at sequence length 4K. On ImageNet, M2 outperforms ViT-b by 1% in accuracy, with only half the parameters. Causal GPT-style models introduce a technical challenge: enforcing causality via masking introduces a quadratic bottleneck. To alleviate this bottleneck, we develop a novel theoretical view of Monarch matrices based on multivariate polynomial evaluation and interpolation, which lets us parameterize M2 to be causal while remaining sub-quadratic. Using this parameterization, M2 matches GPT-style Transformers at 360M parameters in pretraining perplexity on The PILE--showing for the first time that it may be possible to match Transformer quality without attention or MLPs.
Motivation & Objective
- Motivate and develop a sub-quadratic architecture that scales in both sequence length and model dimension.
- Show Monarch matrices can express a wide class of linear transforms and be hardware-friendly on GPUs.
- Demonstrate M2’s performance in non-causal language and vision tasks and in causal language modeling.
- Provide theoretical foundations for causal parameterizations of Monarch-based layers.
- Benchmark throughput and parameter efficiency against Transformer baselines.
Proposed method
- Define Monarch matrices as products of block-diagonal factors interleaved with permutations to achieve O(p N^{(p+1)/p}) compute.
- Construct M2 by mixing along sequence and embedding axes with Monarch blocks and elementwise operations.
- Replace Transformer attention and MLP blocks with M2 primitives in BERT-like, ViT-like, and GPT-like settings.
- Provide a causal parameterization via multivariate polynomial evaluation/interpolation to enable sub-quadratic causal masking.
- Theoretically analyze causality conditions (Theorem 3) for M2 parameterizations.
- Offer an implementation narrative and hardware-utilization benchmarks on GPUs.
Experimental results
Research questions
- RQ1Can a sub-quadratic primitive (Monarch matrix) provide comparable or superior performance to Transformers in both sequence length and model dimension?
- RQ2Can Monarch-based layers be made causal with sub-quadratic computation?
- RQ3Do M2 variants match or exceed Transformer performance in non-causal language, causal language, and vision tasks while reducing parameters?
- RQ4What are the hardware utilization characteristics of M2 compared to dense MLPs and attention?
- RQ5How can polynomial-interpretation view enable principled causal parameterizations for M2?
Key findings
- M2 matches BERT-base and BERT-large GLUE quality with 27% and 24% fewer parameters, respectively, in non-causal language modeling.
- M2 achieves up to 9.1× higher throughput at sequence length 4K versus HuggingFace BERT.
- On ImageNet, M2-ViT-b outperforms ViT-b by 1% with half the parameters.
- M2-GPT with causal parameterization matches GPT-style Transformer perplexity at 360M parameters on The PILE without attention/MLPs.
- In causal settings, M2 achieves competitive perplexity, illustrating potential to match Transformer quality with a radically different architecture.
- Across benchmarks, M2 shows favorable FLOP utilization and sub-quadratic scaling gains over dense baselines.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.