Megalodon: Efficiënte pretraining en inferentie van grote taalmodellen met onbeperkte contextlengte
Megalodon: Efficient LLM Pretraining and Inference with Unlimited Context Length
April 12, 2024
Auteurs: Xuezhe Ma, Xiaomeng Yang, Wenhan Xiong, Beidi Chen, Lili Yu, Hao Zhang, Jonathan May, Luke Zettlemoyer, Omer Levy, Chunting Zhou
cs.AI
Samenvatting
De kwadratische complexiteit en zwakke lengte-extrapolatie van Transformers beperken hun vermogen om op te schalen naar lange sequenties, en hoewel sub-kwadratische oplossingen zoals lineaire aandacht en state space-modellen bestaan, presteren ze empirisch minder goed dan Transformers in pretrainings-efficiëntie en nauwkeurigheid bij downstream-taken. Wij introduceren Megalodon, een neurale architectuur voor efficiënte sequentiemodellering met onbeperkte contextlengte. Megalodon erft de architectuur van Mega (exponentieel voortschrijdend gemiddelde met gated attention), en introduceert verder meerdere technische componenten om de capaciteit en stabiliteit te verbeteren, waaronder complex exponentieel voortschrijdend gemiddelde (CEMA), timestep-normalisatielaag, genormaliseerd aandachtmechanisme en pre-norm met een two-hop restconfiguratie. In een gecontroleerde head-to-head vergelijking met Llama2 behaalt Megalodon een betere efficiëntie dan Transformer op de schaal van 7 miljard parameters en 2 biljoen trainings-tokens. Megalodon bereikt een trainingsverlies van 1,70, wat halverwege ligt tussen Llama2-7B (1,75) en 13B (1,67). Code: https://github.com/XuezheMax/megalodon
English
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