arXiv:2611.01472cs.LGNov 2026

Manuscript Offprint

arXiv:2611.01472

Causal Optimal-Transport Attention: Positional Priors and Length Extrapolation

Ming Lian

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Causal masking obstructs the column balancing used by optimal-transport (OT) attention. We study a prefix-consistent unbalanced operator and characterize the positional prior it induces. Under bounded scores, for any fixed balancing strength ρ<1\rho < 1, its fixed point dilutes attention: every fixed window receives a vanishing share as the context grows. For constant scores, we derive an exact scale-invariant prior. We then classify positional encodings by whether their distant attention mass remains bounded away from one. Discrete window-mass bounds quantify the finite-length dilution of summable log-distance priors near exponent one. Preregistered experiments with 25M- and 100M-parameter language models establish improved loss extrapolation over softmax; exploratory comparisons favor an explicit distance bias at a fraction of the cost. CABLE outperforms RoPE with evaluation-time YaRN on every seed at three training lengths. Changing only the bias beyond the training length moves long-context loss in the predicted direction on all 30 tested checkpoints. Even with exponents constrained above one, many heads approach the summability boundary during training. A margin selected by prior-only calculations for a specified window, length range and growth tolerance controls distant-mass growth in the tested setting. These results connect loss extrapolation to positional decay over the lengths actually evaluated.

1 Introduction

Softmax attention normalizes each query's scores into a distribution over keys. Read through optimal transport, this is one row-normalization step of the Sinkhorn algorithm for an entropic OT problem, and also the exact solution of a one-sided entropic OT problem [19, 34]. Iterating Sinkhorn to convergence also enforces the column marginal [38]; with the uniform marginal used by Sinkformers, every key then receives the same total attention. Doubly stochastic attention has been proposed for non-causal models [34, 42]. It can empirically slow rank collapse, although pure self-attention still approaches rank one with depth [16].

Language models are causal, and here the column constraint breaks in two ways (Section 2). First, the only lower-triangular doubly stochastic matrix is the identity, so balanced OT degenerates. Second, relaxing the column marginal is not enough: any column normalization whose column sums run over all rows makes the output of row tt depend on row t+1t+1, whose query is computed from the token that row tt is trained to predict. Under teacher forcing this leaks the label and lowers the validation loss artificially. Recent work on doubly stochastic attention lists the causal column marginal as an open problem [42]; Foss [11] uses prefix column masses to avoid future leakage with a different update (Section 6).

We study the operator that resolves both obstructions: an unbalanced Sinkhorn iteration whose column scaling for row tt uses only the prefix mass Mtj=∑i≤tPijM_{tj} = \sum_{i \leq t} P_{ij}. It is prefix-consistent by construction, interpolates between softmax (ρ=0\rho = 0) and a strongly balancing regime (ρ→1\rho \to 1), and at its fixed point takes the form

log⁡Ptj=log⁡Ktj−γlog⁡Mtj−lset,γ=ρ1−ρ,\log P_{tj} = \log K_{tj} - \gamma \log M_{tj} - \mathrm{lse}_t, \qquad \gamma = \frac{\rho}{1 - \rho},

where lset\mathrm{lse}_t is the log-normalizer of row tt. In a preregistered comparison at 100M parameters, this operator lowers the validation loss at twice the training length by 0.45 nats relative to softmax. It also beats log-nn softmax, which multiplies the scores by a factor growing like log⁡t\log t [5, 25], by 0.30. The correction −γlog⁡M-\gamma \log M enters the logits where an additive positional bias would, and the evidence points to its dependence on distance: an explicit learnable log-distance bias with softmax does better, at 40% of the cost.

This paper explains why, and what the result says about positional priors in general. Our main object is the implicit prior of the causal OT operator: the attention pattern it produces when content does not discriminate between keys. The far mass at a given context length is the attention that queries put on keys more than the training length back. Attention dilutes if the share of every window of fixed size vanishes as the context grows. A relative prior is summable if its weights, as a function of distance, have a finite sum; a fixed window then keeps a share bounded away from zero, and the far mass stays bounded. The OT prior is not a function of distance alone, so for it we speak of dilution only.

References (46)