SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.12109 · NeurIPS · 2023

Monarch Mixer: A Simple Sub-Quadratic GEMM-Based Architecture

Christopher Ré, Atri Rudra, Michael Poli, Isys Johnson, Sabri Eyuboglu, Daniel Fu, Armin Thomas, Simran Arora, Benjamin Spector, Jessica Grogan

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 7 functions out of this paper's own repositories and ran 4 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.

RepositoryRoleRan
HazyResearch/m2 — 4 of 7
FunctionStatusWhere it lives
ExponentialModulation Ran HazyResearch/m2/bert/src/mm/monarch_mixer_sequence_mixer.py
code served (permissive licence) · get_code("b8b4a54fca0d06f8")
HyenaFilter Ran HazyResearch/m2/bert/src/mm/monarch_mixer_sequence_mixer.py
code served (permissive licence) · get_code("0bc2ee1177b6118f")
PositionalEmbedding Ran HazyResearch/m2/bert/src/mm/monarch_mixer_sequence_mixer.py
code served (permissive licence) · get_code("c3fc52e16deda095")
Sin Ran HazyResearch/m2/bert/src/mm/monarch_mixer_sequence_mixer.py
code served (permissive licence) · get_code("46738ca5fd203f92")
MonarchMixerSequenceMixing Not yet run HazyResearch/m2/bert/src/mm/monarch_mixer_sequence_mixer.py
code served (permissive licence) · get_code("38673f48ffeede10")
OptimModule Not yet run HazyResearch/m2/bert/src/mm/monarch_mixer_sequence_mixer.py
code served (permissive licence) · get_code("6f2ce45de2079602")
fftconv_ref Not yet run HazyResearch/m2/bert/src/mm/monarch_mixer_sequence_mixer.py
code served (permissive licence) · get_code("1ea1c3c4388f11da")

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

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× 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.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2310.12109")
get_code_for_paper("2310.12109")
have("2310.12109")

Connect an agent — have() is free.