Causal Optimal-Transport Attention: Positional Priors and Length Extrapolation
Organizations: Independent Researcher
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 , 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.
Figures & tables
| Arm | val@1024 | val@2048 | s/step |
|---|---|---|---|
| softmax | 0.42 | ||
| log- softmax | 0.45 | ||
| OT, | 0.98 | ||
| OT, | 1.54 | ||
| softmax + learnable | 0.62 |
| Training length (seeds) | gap in | gap at | gap beyond |
|---|---|---|---|
| 1024 (5) | ( – ) | ||
| 2048 (3) | ( – ) | ||
| 4096 (3) | ( – ) |
| Arm | far-mass growth | ||
|---|---|---|---|
| P1, | 3.444 | 3.427 | 0.032 |
| P1, | 3.445 | 3.395 | 0.015 |
| P1, | 3.448 | 3.385 | 0.004 |
| ALiBi (P4) | 3.441 | 3.355 |
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
| Result | Limit | Finite length |
|---|---|---|
| Thm. 6 | decreases towards ; about above it at | |
| Thm. 7 | within at , error halves from to | |
| Thm. 8 | discrete profile, then | within for at |
| Remark 22 | window mass | : doubling from to multiplies it by to ; within of the limit |
| Thm. 9 | , | : ratio to constant in to at (the amplitude: Appendix D.3 ) |
| Prop. 10 | binned mean within of one |
| Screening (25M) | Confirmation (100M) | |
| Width / depth / heads | 512 / 8 / 8 | 768 / 14 / 12 |
| MLP ratio, vocabulary | 4, 50,304 (tied) | 4, 50,304 (tied) |
| Non-embedding parameters | 25.2M | 99.2–99.5M |
| Training length | 512 | 1024 (also 2048, 4096) |
| Micro-batch accumulation | ( , ) | |
| Tokens / steps | 0.5B / 15,258 | 2B / 61,035 |
| Arm | Position term | Bounded far mass |
|---|---|---|
| B0 | RoPE, no bias | no (dilutes) |
| P1 | RoPE learnable , one exponent per head | iff |
| P2 | as P1 with fixed exponents (log-spaced – ) | no (dilutes) |
| P3 | RoPE KERPLE log kernel [ 4 ] | iff |
| P4 (ALiBi) | RoPE [ 32 ] | yes |
| P5 | P1 without RoPE | iff |
| Case | Arm | far mass | ||||
|---|---|---|---|---|---|---|
| dilutes | B0 | 3.474 | 3.865 | 0.679 | 0.889 | – |
| GRAPE-M | 3.471 | 3.930 | 0.701 | 0.899 | – | |
| O1 | 3.469 | 3.573 | 0.428 | 0.646 | – | |
| P2 | 3.461 | 3.460 | 0.424 | 0.627 | 0.00 | |
| learned | P5 | 3.489 | 3.498 | 0.253 | 0.480 | 0.34 |
| P6 | 3.460 | 3.440 | 0.364 | 0.561 | 0.18 |
| Arm | , YaRN-t | ms/step | |||
|---|---|---|---|---|---|
| B0 (RoPE) | 257 | ||||
| log- softmax | 347 | ||||
| GRAPE-M | – | 262 | |||
| GRAPE-AP | – | 482 | |||
| ALiBi (P4) | 260 | ||||
| O2 (P4 + OT) | 1582 |
| Length (seeds) | B0 | CABLE | B0 + YaRN-t | CABLE |
|---|---|---|---|---|
| 1024 (5) | ||||
| 2048 (3) | ||||
| 4096 (3) | ||||
| Checkpoints (seeds each) | Scale | Loss change | Far mass | ||
|---|---|---|---|---|---|
| before | after | ||||
| cap | ALiBi, GRAPE-A, FoX, CABLE (2) | 25M | ( to ) | 0.007–0.058 | 0.036–0.201 |
| cap | ALiBi, CABLE, CABLE (default lr) (3) | 100M | ( to ) | 0.003–0.045 | 0.036–0.093 |
| repair | P1, P2, P6 (2) | 25M | ( to ) | 0.55–0.63 | 0.32–0.39 |
| repair | LC (2) | 100M | ( to ) | 0.36–0.37 | 0.26–0.27 |
| repair | log bias, exploratory (3) | 100M | ( to ) | 0.58–0.61 | 0.39–0.44 |
| Exp. | Test | Observed | Outcome |
|---|---|---|---|
| 0001 | best below softmax at by , every seed | fails | |
| 0001 | best below softmax / log- at by , every seed | , | holds |
| 0002 | CABLE below B0 + YaRN-t in by , every seed | fails | |
| 0002 | GRAPE or O2 beats CABLE (switching rules) | no | not triggered |
| 0003 | CABLE below B0 + YaRN-t in by , every seed | , | holds |
| 0003 | gt1 below lt1 at by , every seed | – | holds |
Long-Context Language Modeling
Long-context language modeling studies how language models can use, retain, and efficiently process information across very long sequences.
See all 197 papers