Megalodon: Efficient LLM Pretraining and Inference with Unlimited Context Length
Xuezhe Ma, Xiaomeng Yang, Wenhan Xiong, Beidi Chen, Lili Yu, Hao Zhang, Jonathan May, Luke Zettlemoyer, Omer Levy, Chunting Zhou
摘要
The quadratic complexity and weak length extrapolation of Transformers limits their ability to scale to long sequences, and while sub-quadratic solutions like linear attention and state space models exist, they empirically underperform Transformers in pretraining efficiency and downstream task accuracy. We introduce MEGA-LODON, an neural architecture for efficient sequence modeling with unlimited context length. MEGALODON inherits the architecture of MEGA (exponential moving average with gated attention), and further introduces multiple technical components to improve its capability and stability, including complex exponential moving average (CEMA), timestep normalization layer, normalized attention mechanism and pre-norm with two-hop residual configuration. In a controlled head-to-head comparison with LLAMA2, MEGALODON achieves better efficiency than Transformer in the scale of 7 billion parameters and 2 trillion training tokens. MEGALODON reaches a training loss of 1.70, landing mid-way between LLAMA2-7B (1.75) and 13B (1.67). The improvements of MEGALODON over Transformers are robust throughout a range of benchmarks across different tasks and modalities.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 19 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Rope to Nope and Back Again: A New Hybrid Attention Strategy 引用了 Measuring Massive Multitask Language Understanding
- Rope to Nope and Back Again: A New Hybrid Attention Strategy 引用了 Efficiently Modeling Long Sequences with Structured State Spaces
- Rope to Nope and Back Again: A New Hybrid Attention Strategy 引用了 WinoGrande: An Adversarial Winograd Schema Challenge at Scale
- The Curse of Depth in Large Language Models 引用了 Measuring Massive Multitask Language Understanding
- PIQA: Reasoning about Physical Commonsense in Natural Language 引用了 WinoGrande: An Adversarial Winograd Schema Challenge at Scale
- Measuring Massive Multitask Language Understanding 引用了 PIQA: Reasoning about Physical Commonsense in Natural Language
- Parallelizing Linear Transformers with the Delta Rule over Sequence Length 引用了 PIQA: Reasoning about Physical Commonsense in Natural Language
- Parallelizing Linear Transformers with the Delta Rule over Sequence Length 引用了 Efficiently Modeling Long Sequences with Structured State Spaces
- Parallelizing Linear Transformers with the Delta Rule over Sequence Length 引用了 WinoGrande: An Adversarial Winograd Schema Challenge at Scale
- Test-Time Training Done Right 引用了 Parallelizing Linear Transformers with the Delta Rule over Sequence Length
引用它的顶会 Paper19
- Parallelizing Linear Transformers with the Delta Rule over Sequence LengthSonglin Yang, Bailin Wang, Yu Zhang, Yikang Shen 等NeurIPS 2024 · 412 次引用
- Test-Time Training Done RightTianyuan Zhang, Sai Bi, Yicong Hong, Kai Zhang 等ICLR 2026 · 127 次引用
- The Curse of Depth in Large Language ModelsWenfang Sun, Xinyuan Song, Pengxiang Li, Lu Yin 等NeurIPS 2025 · 62 次引用
- Rope to Nope and Back Again: A New Hybrid Attention StrategyBowen Yang, Bharat Venkitesh, Dwaraknath Gnaneshwar, Hangyu Lin 等NeurIPS 2025 · 51 次引用
- LongReward: Improving Long-context Large Language Models with AI FeedbackJiajie Zhang, Zhongni Hou, Xin Lv, Shulin Cao 等ACL 2025 · 32 次引用
它引用的 Paper27
- Training data-efficient image transformers & distillation through attentionHugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa 等ICML 2021 · 8,974 次引用
- Measuring Massive Multitask Language UnderstandingDan Hendrycks, Collin Burns, Steven Basart, Andy Zou 等ICLR 2021 · 7,905 次引用
- Efficiently Modeling Long Sequences with Structured State SpacesAlbert Gu, Karan Goel, Christopher RéICLR 2022 · 3,482 次引用
- WinoGrande: An Adversarial Winograd Schema Challenge at ScaleKeisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula, Yejin ChoiAAAI 2020 · 3,037 次引用
- PIQA: Reasoning about Physical Commonsense in Natural LanguageYonatan Bisk, Rowan Zellers, Ronan Le Bras, Jianfeng Gao 等AAAI 2020 · 2,916 次引用
相关 Paper
- Long Sequence Modeling with Attention Tensorization: From Sequence to Tensor LearningAosong Feng, Rex Ying, Leandros TassiulasEMNLP Findings 2024 · 2 次引用
- Mega: Moving Average Equipped Gated AttentionXuezhe Ma, Chunting Zhou, Xiang Kong, Junxian He 等ICLR 2023 · 36 次引用
- Mini-Sequence Transformers: Optimizing Intermediate Memory for Long Sequences TrainingCheng Luo, Jiawei Zhao, Zhuoming Chen, Beidi Chen 等NeurIPS 2024 · 6 次引用
- Lizard: An Efficient Linearization Framework for Large Language ModelsChien Van Nguyen, Huy Huu Nguyen, Ruiyi Zhang, Hanieh Deilamsalehy 等ACL 2026 · 8 次引用
- Luna: Linear Unified Nested AttentionXuezhe Ma, Xiang Kong, Sinong Wang, Chunting Zhou 等NeurIPS 2021 · 145 次引用
