LOTFormer: Doubly-Stochastic Linear Attention via Low-Rank Optimal Transport

Ashkan Shahbazi, Chayne Thrash, Yikun Bai, Keaton Hamm, Navid NaderiAlizadeh, Soheil Kolouri · Submission to ICLR 2026 · Rejected

TL;DR

LOTFormer introduces the first attention mechanism that is simultaneously linear-time ($\mathcal{O}(n)$) and provably doubly-stochastic. By routing attention through a small, learnable intermediate "pivot" distribution via entropic optimal transport, it prevents tokens from overfocusing on a handful of positions without ever computing an explicit $n \times n$ attention matrix.

What Problem Does This Paper Address?

Standard Transformer attention suffers from two distinct problems:

  1. Quadratic Scaling: Softmax attention scales as $\mathcal{O}(n^2)$ in both computation and memory with sequence length $n$, making long context windows expensive.
  2. Token Overfocusing: Standard softmax normalizes only along rows (row-stochastic). As a result, certain keys can be disproportionately attended to by almost every query, creating "attention sinks" that degrade representation quality, robustness, and interpretability.

Enforcing doubly-stochastic attention—where both rows and columns sum to one—balances token participation and improves performance. However, prior doubly-stochastic methods (such as Sinkformer or ESPFormer) require iterative Sinkhorn normalization over the full matrix or sorting steps, remaining quadratic during training and inefficient at inference. Meanwhile, existing linear attention methods approximate softmax via low-rank kernels but lose doubly-stochastic guarantees.

Methods

LOTFormer resolves this trade-off by modeling attention as a low-rank Optimal Transport (OT) problem conditioned on an intermediate reference:

  • Learnable Pivot Measure: Instead of transporting directly between $n$ queries and $n$ keys, LOTFormer introduces a learnable pivot distribution $\sigma$ with support on $r \ll n$ points ($Z \in \mathbb{R}^{r \times d_k}$) and weights $p^0 \in \Delta_r^+$.
  • Dual Entropic OT: The model solves two small entropy-regularized OT sub-problems:
  • Queries $\to$ Pivot ($\Gamma^{(1)} \in \mathbb{R}^{n \times r}$)
  • Pivot $\to$ Keys ($\Gamma^{(2)} \in \mathbb{R}^{r \times n}$)
  • Glued Coupling: The full coupling is composed as $A = (\Gamma^{(1)})^\top \text{Diag}(\sigma)^{-1} \Gamma^{(2)}$. This matrix is mathematically guaranteed to be doubly-stochastic and has rank at most $r$.
  • Linear-Time Projection: Multiplying $A$ by values $V$ factorizes into $O(nr)$ matrix-vector operations: $Y = \Gamma^{(2)}V$, $Z' = \text{Diag}(\sigma)^{-1}Y$, and $O = \Gamma^{(1)}Z'$. The $n \times n$ matrix is never explicitly formed.
  • Special [CLS] Handling: In Vision Transformers, strict double-stochasticity conflicts with the role of the [CLS] token (which must aggregate from all tokens, rather than being balanced 1-to-1). LOTFormer decouples [CLS] with a dedicated softmax/polarized attention row while keeping patch-to-patch interactions doubly-stochastic.
  • Depthwise Convolution (DWC): Following recent vision-linear attention designs, a lightweight 1D depthwise convolution is optionally applied to the value stream to provide a local inductive bias.
Queries (n) ---> [OT 1] ---> Pivot (r << n) ---> [OT 2] ---> Keys (n)
                             (Learned clusters)

Datasets

The authors evaluated LOTFormer across three distinct benchmark domains (no new datasets were introduced):

  • Long Range Arena (LRA): Benchmarking long-context modeling across 5 tasks: ListOps, Text (byte-level IMDb), Retrieval (AAN), Pathfinder, and Image (CIFAR-10 as sequential pixels).
  • ImageNet-1K / ImageNet-100: Visual classification using a DeiT-Tiny backbone.
  • IWSLT’14 German-to-English (De$\to$En): Neural machine translation using standard Transformer and DiffTransformer backbones.

Key Insights and Ideas

  • Glued Couplings Avoid the Full Cost Matrix: Standard low-rank optimal transport algorithms optimize low-rank factors against the ground-truth $n \times n$ cost matrix, defeating the purpose of linear attention. Composing two separate OT problems through a shared pivot completely bypasses computing $n \times n$ pairwise distances.
  • Attention as Soft Clustering: LOTFormer implicitly assigns queries and keys into $r$ soft clusters centered around the pivot points. Token interactions are mediated through cluster correspondences.
  • The [CLS] Bottleneck in Doubly-Stochastic Attention: A pure doubly-stochastic matrix with low entropy tends toward a permutation matrix. If applied naively to classification tokens, [CLS] is forced to attend to only a single token. Isolating [CLS] as a dedicated global aggregator while constraining spatial tokens to be doubly-stochastic solves this fundamental conflict.

Key Results

  • Long Range Arena (LRA): LOTFormer achieves state-of-the-art results, scoring 62.9% average accuracy with DWC (surpassing PolaFormer at 60.72% and standard Transformer at 58.14%). On sequential Image classification, it achieves 54.1%, outperforming all prior linear baselines by over 11 points.
  • ImageNet-1K: On DeiT-Tiny, LOTFormer ($r=32$) with polarized [CLS] and DWC achieves 74.8% Top-1 accuracy, outperforming PolaFormer (74.6%), FLattenAttention (74.1%), and quadratic doubly-stochastic baselines like Sinkformer (70.2%).
  • Machine Translation (IWSLT'14): In both Transformer and DiffTransformer backbones, fine-tuning with LOTFormer reaches higher BLEU scores (34.72 and 34.91) than Sinkformer and ESPFormer.
  • Throughput & Scaling: Wall-clock forward pass times scale strictly linearly with sequence lengths up to $N = 2^{17}$ tokens, in stark contrast to the quadratic explosion of softmax, Sinkformer, and ESPFormer.

Limitations and Future Work

  • Static Pivot Capacity: The pivot support size $r$ is a fixed hyperparameter per model and layer. The authors suggest investigating adaptive and multi-scale pivots to dynamically allocate capacity based on sequence complexity.
  • Sinkhorn Iteration Schedules: Fixed Sinkhorn iteration counts ($T=5$) were used during training; exploring dynamic or annealed schedules between training and inference could improve speed-accuracy trade-offs.
  • Aggregator Token Dependencies: Doubly-stochastic attention requires ad-hoc decoupling or polarization for special aggregator tokens (like [CLS]), meaning it is not completely plug-and-play across architectures with arbitrary token roles.

Summary updated

BibTeX
@misc{shahbazi2025lotformer,
  author = {Ashkan Shahbazi and Chayne Thrash and Yikun Bai and Keaton Hamm and Navid NaderiAlizadeh and Soheil Kolouri},
  title = {{LOTFormer: Doubly-Stochastic Linear Attention via Low-Rank Optimal Transport}},
  year = {2025},
  eprint = {2509.23436},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.23436},
}
Figure