TL;DR
In standard Transformers, every attention head independently learns its own full-scale map of the universe just to decide which tokens to pay attention to—an extravagant parameter budget that turns out to be mostly redundant. By forcing all heads in a layer to share a single, compact "common coordinate system" while keeping tiny head-specific lenses inside it, the authors slash Query–Key parameters by over 90% while barely denting accuracy. Better yet, this plays nicely with FlashAttention and Grouped-Query Attention (GQA), shrinking the KV cache and speeding up million-token decoding by 1.31×.
What Problem Does This Paper Address?
If you've spent your day wrestling with GPU memory limits, you know the Transformer's attention mechanism is a greedy beast. Most recent efficiency breakthroughs—like Grouped-Query Attention (GQA) or FlashAttention—focus on shrinking the inference-time Key-Value (KV) cache or optimizing hardware memory traffic.
Meanwhile, the Query–Key (QK) pathway—the machinery that calculates attention scores to rank and select tokens—has largely been left alone. In standard Multi-Head Attention (MHA), every single head gets its own independent Query and Key projection matrices from model width $d$ to head dimension $d_k$, costing $2d^2$ parameters per layer.
Think of it like giving every detective in a precinct their own private, full-resolution satellite network when they're all looking at the same city streets. Post-training compression studies have hinted that trained QK matrices overlap heavily and live in a much smaller subspace. The authors ask: Instead of pruning this bloat after training, why not build a shared, low-dimensional geometry right from initialization?
Methods
The core intuition is an asymmetry between selection and content: Queries and Keys only need enough geometry to point at the right tokens, whereas Values do the heavy lifting of carrying rich representational content. Consequently, the Value and Output pathways remain completely standard here.
For the QK pathway, the authors introduce Basis-Mediated Bilinear Attention (BMB) in two flavors:
- Native BMB: Instead of $H$ separate projections, the layer first projects input tokens $X_l$ into a single shared, low-dimensional latent basis $Z_l = X_l B_l$ (where $B_l \in \mathbb{R}^{d \times r}$ and $r < d$). Inside this shared room, each head $h$ computes its own attention scores using a lightweight bilinear interaction matrix $M_{l,h} \in \mathbb{R}^{r \times r}$.
- BMB-UV (The Hardware-Friendly Variant): Custom bilinear products don't fit neatly into hyper-optimized kernels like FlashAttention. So, BMB-UV factors each head's matrix into two tiny learnable adapters: $M_{l,h} = U^Q_{l,h} (U^K_{l,h})^\top$, with $U \in \mathbb{R}^{r \times s}$. By multiplying the shared basis $Z_l$ with these tiny $U$ factors, BMB-UV materializes explicit per-head Queries and Keys of width $s$. This drops QK parameters from $2d^2$ down to $dr + 2Hrs$ while plugging straight into standard PyTorch SDPA and FlashAttention!
Datasets
The authors pretrain from scratch across both vision and language benchmarks (no newly invented datasets, ensuring apples-to-apples comparisons):
- ImageNet-1K: Used to pretrain ViT-Base/16 vision transformers for 30 epochs.
- C4 (RealNewsLike subset): Used to pretrain GPT-2 small (124M scale) language models.
- FineWeb-Edu & Downstream Tasks: Used to scale up GQA+BMB-UV to 0.11B and 1.33B parameters, evaluated on a two-shot nine-task accuracy suite, alongside a synthetic 1-million-token cache benchmark to test extreme-context decoding latency.
Key Insights and Ideas
- Shared Basis $\neq$ Identical Heads: What happens if you remove the head-specific matrices ($M$) and just use the shared basis ($BB^\top$) for every head? ImageNet accuracy craters by over 3.2 percentage points compared to native BMB. Heads genuinely need to specialize—they just don't need full, independent $d$-dimensional projections to do it.
- Orthogonal KV-Cache Compression: GQA shrinks the KV cache by reducing the number of KV heads. BMB-UV shrinks it along an orthogonal axis: reducing the width ($s$) of each cached key. Combining them compounds the savings.
- Functionally Identical, Optimization-Distinct: When $s = r$, Native BMB and BMB-UV can represent the exact same mathematical set of attention score matrices. Yet during training, Native BMB edges out slightly better final accuracy on vision, while BMB-UV runs 1.7× faster in token throughput (51.0k vs. 29.9k tokens/s on GPT-2) thanks to SDPA hardware acceleration—meaning BMB-UV wins decisively under fixed GPU-hour budgets.
Key Results
Across modalities, BMB carves away over 90% of QK parameters with remarkably little accuracy loss:
- Vision (ViT-Base on ImageNet-1K): At $r=s=32$, BMB-UV cuts QK parameters by 95.83% (from 14.16M down to 0.59M), trading off just 1.49 percentage points in top-1 accuracy (69.66% vs. 71.15% MHA baseline). Native BMB ($r=64$) hits 70.58% accuracy with 1.23M QK parameters, crushing standard low-rank baselines (65.79% at 7.67M QK parameters).
- Language (GPT-2 on C4 at 55 GPU-hours): Under an equal compute time budget, BMB-UV ($r=s=64$) reaches 25.71 perplexity using 1.77M QK parameters, beating all other compressed/shared baselines and trailing standard MHA (24.89 PPL, 14.16M QK params) by less than a point.
- 1B+ Scale & Long-Context Decoding: Combined with GQA at 1.33B parameters, BMB-UV uses 92.00% fewer QK parameters per layer than a published 1.55B GQA reference, losing just 0.15 percentage points across nine two-shot tasks. On a 1-million-token decoding benchmark, GQA+BMB-UV cuts logical KV storage by 25% and reduces per-token latency by 23.9% (1.31× speedup).
Limitations and Future Work
- Short-Context Overhead: Materializing the extra tiny projections isn't completely free when memory bandwidth isn't the bottleneck—at a shorter 16K context length, GQA+BMB-UV decode latency actually ticks up by 2.03% compared to dense GQA before paying off at ultra-long contexts.
- No Universal Rank Recipe: The tested ranks ($r, s \in \{32, 64\}$) don't establish a universal scaling law for choosing subspace dimensions automatically across arbitrary architectures.
- Unconstrained Subspace Question: Because BMB forces a shared subspace from scratch, whether standard, unconstrained MHA models naturally concentrate their QK projections into a comparably tiny shared subspace remains an open empirical question. Looking ahead, the authors point toward rethinking model scaling laws around capability per learned degree of freedom rather than raw parameter counts.
Summary updated