Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

Megalodon: Efficient LLM Pretraining and Inference with Unlimited Context Length

About

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 Megalodon, a 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). Code: https://github.com/XuezheMax/megalodon

Xuezhe Ma, Xiaomeng Yang, Wenhan Xiong, Beidi Chen, Lili Yu, Hao Zhang, Jonathan May, Luke Zettlemoyer, Omer Levy, Chunting Zhou• 2024

Related benchmarks

TaskDatasetResultRank
Commonsense ReasoningHellaSwag
Accuracy77.5
1460
Commonsense ReasoningWinoGrande
Accuracy71.4
776
Language UnderstandingMMLU
Accuracy49.8
756
Question AnsweringARC Challenge
Accuracy53.1
749
Commonsense ReasoningPIQA
Accuracy80.1
647
Language ModelingWikiText-103 (test)
Perplexity17.23
524
Question AnsweringARC Easy
Normalized Acc79.8
385
Reading ComprehensionBoolQ
Accuracy80.5
219
Question AnsweringTriviaQA
Accuracy60.5
210
Instruction FollowingMT-Bench
MT-Bench Score6.27
189
Showing 10 of 18 rows

Other info

Code

Follow for update