atlas

Research map / Architectures and efficiency / Attention and transformers

Various Lengths, Constant Speed: Efficient Language Modeling with Lightning Attention

ICML 2024 · Architectures and efficiency › Attention and transformers · approach: Linear attention approximations · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes Lightning Attention, an exact IO-aware linear attention implementation that splits causal attention into intra-block (left product) and inter-block (right product) computations to avoid cumsum, plus the TransNormerLLM (TNL) architecture, and reports competitive LLM benchmarks.

Problem

Linear attention has low theoretical advantage in causal language modeling because the cumsum operation makes training slow, and linear attention models often underperform softmax transformers.

Approach

Divide the sequence into blocks; compute intra-block attention with conventional masked attention and inter-block contributions with the linear kernel trick via a running KV state, eliminating cumsum and enabling constant training speed across sequence lengths with tiled forward/backward kernels in Triton.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use TNL instead of TNN44M language model · WikiText-103 testPPL: 24.67 -> 24.03Helped
Use LRPE-d instead of Mix positional encoding (ablation)TNL · 385M, 100K updatesLoss: 2.248 -> 2.236Helped
Add decay temperature (ablation)TNL · 385M, 100K updatesPPL: 4.804 -> 4.770Helped
Add gating mechanism (ablation)TNL · 385M, 100K updatesLoss: 2.263 -> 2.248Helped
Replace SRMSNorm with RMSNorm (ablation)TNL · 385M, 100K updatesLoss: 2.248 -> 2.247No clear effect
Replace SRMSNorm with LayerNorm (ablation)TNL · 385M, 100K updatesLoss: 2.248 -> 2.247No clear effect
Replace Swish with 1+elu in GLA (ablation)TNL · 385M, 100K updatesLoss: 2.248 -> 2.252No clear effect
Remove the GLA activation (ablation)TNL · 385M, 100K updatesLoss: 2.248 -> 2.283Hurt
Remove the GLU activation (ablation)TNL · 385M, 100K updatesLoss: 2.254 -> 2.248No clear effect

Surprising findings

Limitations

Experimental setup

Datasets: Wikitext-103 self-collected corpus (~2T tokens)

Benchmarks: Wikitext-103 BoolQ PIQA HellaSwag WinoGrande ARC-e ARC-c OpenBookQA MMLU C-Eval SCROLLS

Metrics: perplexity accuracy acc_norm training loss TGS (tokens per GPU per second) throughput runtime ms memory GB ROUGE F1

Baselines: LLaMA with FlashAttention-2 HGRN TNN FlashAttention-2 RWKV OPT Pythia Falcon Baichuan2 LLaMA2

Builds on: TransNormer FlashAttention-2 HGRN TNN LRPE

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy