Express Language Modeling

Albert Gong, Annabelle Michael Carrell, Raaz Dwivedi, Lester MackeyNeurIPS 2026

TL;DR

Transformers hit a computational brick wall on long sequences because attention scales quadratically with length, and most clever mathematical shortcuts fail when models have to generate text one token at a time (causal masking). This paper introduces EXPRESS, a clever "meta-procedure" that converts offline, non-causal attention approximations into fast, streaming, causal ones without losing their mathematical accuracy guarantees. Paired with a custom GPU kernel, their resulting Thinformer Express algorithm outpaces FlashAttention 2 by up to 61× on massive contexts while shrinking memory footprints during long-form reasoning.

What Problem Does This Paper Address?

If you feed a language model a massive book or ask it to reason step-by-step through a hard math problem, you run into the tyranny of quadratic scaling. In standard attention, every token looks at every prior token, meaning compute grows as $\Theta(n^2)$ and the Key-Value (KV) memory cache balloons linearly with sequence length $n$.

Researchers have developed sub-quadratic approximations—like thinning algorithms, which pick a small, representative "coreset" of tokens to attend over. However, the best of these only work for unmasked (non-causal) attention, where the entire sequence is visible at once. Language modeling requires causal masking: token 50 can only look at tokens 1 through 49, and during generation, tokens arrive one by one in a stream. Maintaining a single static summary doesn't work when the past is constantly evolving. The challenge is updating a compressed cache on the fly without letting memory, compute, or approximation error blow up.

Methods

The authors introduce two main contributions: a general streaming wrapper (EXPRESS) and a specific attention mechanism (Thinformer Express), backed by an I/O-aware Triton GPU implementation.

  • EXPRESS (The Meta-Procedure): EXPRESS takes any offline "halving" algorithm (a tool that shrinks a set of points in half while preserving its statistical average) and turns it into an updatable, fixed-budget weighted cache of target size $s$ (denoted $n_{\text{out}}$ in the paper). It operates in three phases:
  • Exact phase: Store the first $s$ tokens directly.
  • Thin phase: Group incoming tokens into batches and incrementally compress them—first via fast uniform subsampling, then via geometric tree-like halving (COMPRESS2)—before adding them to the main cache.
  • Halve phase: Whenever the main cache hits $4s$ tokens, apply the halving algorithm twice to shrink it back down to $s$, doubling the weights of surviving tokens so the math stays unbiased.
Visualizing the EXPRESS cache: queries attend over a sparse, weighted subset of prior key-value pairs.
  • Thinformer Express: The authors plug Kernel Halving (from the state-of-the-art non-causal Thinformer) into EXPRESS. Instead of picking tokens randomly, Kernel Halving uses an attention-mimicking mathematical kernel to actively balance the selected key-value pairs, ensuring the weighted coreset closely reconstructs exact softmax attention.
  • Triton Implementation: Similar to FlashAttention 2, they write custom Triton kernels that tile computations in fast GPU SRAM, avoiding slow memory reads/writes and parallelizing halving operations during context prefill.

Datasets

The authors evaluate their methods across standard long-context and mathematical reasoning benchmarks (no new datasets are introduced):

  • LongBench-E: Used for long-context prefill perplexity (up to 32k+ tokens) and KV cache compression, specifically highlighting TREC-E (question classification), TriviaQA-E (few-shot QA), and HotpotQA-E (multi-hop QA).
  • MATH-500: Competition-level math problems where reasoning models generate over 4,000 tokens on average from ~75-token prompts, testing streaming decoding.

Key Insights and Ideas

  • Constant memory, near-zero maintenance cost: Remarkably, the EXPRESS cache never exceeds $6s$ tokens—completely independent of total sequence length $n$. Furthermore, the time spent maintaining the cache scales only logarithmically with $n$. On MATH-500, updating the cache took just 390 ms on average, compared to 35,400 ms spent actually querying it!
  • Minimax-optimal error: Converting a non-causal halving algorithm into a causal streaming one via EXPRESS only inflates approximation error by a tiny $\approx \sqrt{\log s}$ factor, achieving $\log^{3/2}(n)/s$ error—matching theoretical lower bounds up to log factors.
  • Plug-and-play modularity: EXPRESS doesn't actually care how you halve the cache. Even when the authors plugged in an heuristic halving method with no theoretical guarantees (from BalanceKV), EXPRESS immediately turned it into a top-performing streaming decoder.

Key Results

  • Long-Context Prefill: At 512k tokens, Thinformer Express achieves a 61× speedup (cache size $2^9$) and 30× speedup ($2^{10}$) over FlashAttention 2, while HyperAttention runs out of GPU memory. On ChatGLM2-6B-32K, it beats HyperAttention on both speed and perplexity, staying within 1.06× of exact attention's perplexity even when replacing all layers.
Speedup over FlashAttention 2 across sequence lengths up to 512k tokens.
  • Accelerating KV Cache Compression: Using Thinformer Express during prefill before applying compressors like SnapKV, StreamingLLM, and PyramidKV on Llama-3.1-8B-Instruct substantially cuts total attention runtime on LongBench-E with virtually no accuracy drop.
  • Long-Form Reasoning (MATH-500): Running DeepSeek-R1-Distill-Llama-8B, Thinformer Express dominates five leading cache-compression baselines, retaining 99% of exact attention's accuracy using only 61% of the cache size and 55% of the compute time.

Limitations and Future Work

  • Domain scope: Experiments are currently limited to text—specifically English, Chinese, and mathematical reasoning. Because the underlying math is kernel-agnostic, extending EXPRESS to multimodal data (vision, audio) is a natural next step.
  • Hardware optimizations left on the table: While their Triton kernel is fast, it doesn't yet use newer Hopper/Blackwell GPU tricks seen in FlashAttention 3—such as warp specialization, the Tensor Memory Accelerator (TMA), persistent kernels, or FP8 precision—all of which could yield even larger real-world speedups.

Summary updated

Abstract

We introduce a new tool, Express, for converting a non-causal attention approximation into a causal approximation with matching approximation guarantees. When combined with the state-of-the-art Thinformer approximation, Express improves upon the best known causal attention guarantees, delivering $\log^{3/2}(n)/s$ approximation error with only $O(s)$ memory and $O(s^2 \log^2(n))$ compression overhead for a sequence of length $n$. We pair these developments with an efficient I/O-aware Triton implementation, demonstrate substantial speedups over FlashAttention 2, and use Express to accelerate three distinct components of the language modeling pipeline: long-context prefill, KV cache compression, and long-form decoding.
BibTeX
@inproceedings{gong2026express,
  author = {Albert Gong and Annabelle Michael Carrell and Raaz Dwivedi and Lester Mackey},
  title = {{Express Language Modeling}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=nf2SQeKcr9},
}
Figure