Long-Context Generalization with Sparse Attention Pavlo Vasylenko, Marcos Treviso, André F. T. Martins Abstract Transformer-based architectures traditionally employ softmax to compute attention weights, which produces dense distributions over all tokens in a sequence. While effective in many settings, this density has been shown to be detrimental for tasks that demand precise focus on fixed-size patterns: as sequence length increases, non-informative tokens accumulate attention probability mass, leading to dispersion and representational collapse. We show in this paper that sparse attention mechanisms using α \alpha -entmax can avoid these issues, due to their ability to assign exact zeros to irrelevant tokens. Furthermore, we introduce Adaptive-Scalable Entmax (ASEntmax), which endows α \alpha -entmax with a learnable temperature parameter, allowing the attention distribution to interpolate between sparse (pattern-focused) and dense (softmax-like) regimes. Finally, we show that the ability to locate and generalize fixed-size patterns can be further improved through a careful design of position encodings, which impacts both dense and sparse attention methods. By integrating ASEntmax into standard transformer layers alongside proper positional encodings, we show that our models greatly outperform softmax, scalable softmax, and fixed-temperature α \alpha -entmax baselines on long-context generalization. 1 Introduction The transformer architecture ( Vaswani et al. 2017 ) has become the foundation of modern large language models (LLMs), establishing new benchmarks across diverse domains. However, as researchers push these models toward increasingly longer contexts—from thousands to millions of tokens—several fundamental limitations emerge that can be traced to the softmax transformation used in attention. Three critical limitations stand out: representational collapse occurs due to softmax’s inability to maintain distinct attention patterns as sequence length grows, erasing meaningful distinctions between tokens ( Barbero et al. 2024 ) ; over-squashing is exacerbated by softmax’s dense probability distribution, leading to exponential dilution of gradients ( Alon & Yahav 2021 ; Barbero et al. 2024 ) ; and attention dispersion arises from softmax’s fundamental property that forces probability mass to be distributed across all tokens, with attention weights necessarily approaching an uniform distribution as context grows ( Veličković et al. 2024 ; Nakanishi 2025 ) . Previous approaches to address these challenges include positional encoding innovations such as ALiBi ( Press et al. 2022 ) and RoPE ( Su et al. 2024 ) , which help to mitigate position bias issues. Recent works directly target the root cause—the softmax function itself. Nakanishi 2025 proposes Scalable-Softmax to scale logits based on context length, while Veličković et al. 2024 identify fundamental limitations of softmax for sharp out-of-distribution generalization and propose to learn adaptive temperatures to control the sharpness of softmax. While effective, these solutions often require careful tuning or address only a subset of the challenges. In this paper, we address the root cause of these problems by replacing softmax with \alpha -entmax ( Peters et al. 2019 ) , a differentiable sparse transformation that induces probability distributions where irrelevant tokens receive exactly zero attention . While \alpha -entmax has been used successfully in transformers ( Correia et al. 2019 ) , its length generalization properties, to the best of our knowledge, have never been studied. We show theoretically and empirically that \alpha -entmax consistently helps to address challenges in long context modeling. Our key contributions include: 1 1 1 Our code is available at https://github.com/deep-spin/adasplash . • Non-dispersion : We establish that \alpha -entmax attention distributions maintain consistent focus regardless of sequence length, with entropy bounded by \mathcal{O}(\log s) rather than approaching maximum entropy \mathcal{O}(\log n) as with softmax, where s\ll n is the number of tokens with nonzero probability. • Representational preservation : We demonstrate that \alpha -entmax is able to prevent representational collapse by maintaining distinguishable token representations even in extremely long contexts. • Over-squashing alleviation : We show how \alpha -entmax reduces the number of gradient paths from \mathcal{O}(n^{L}) to \mathcal{O}(s^{L}) , where L is the number of layers, significantly strengthening gradient flow for long-range dependencies. • Adaptive-scalable \alpha -entmax : We introduce ASEntmax , which adaptively adjust sparsity based on sequence length to maintain optimal token selection even in extremely long contexts. Furthermore, we develop NAPE (NoPE + ALiBi Positional Encoding), a hybrid scheme that combines attention heads between content-focused processing and locality-aware positional encoding, leading to a synergistic interaction with \alpha -entmax. • Empirical validation : We demonstrate substantial performance improvements across diverse tasks. For example, as shown in Figure 1 , ASEntmax achieves 76.7% accuracy on associative recall at 65K tokens after training on just 64 tokens—a 1000 \times length extrapolation. Figure 1 : Comparison of softmax and \alpha -entmax for long-context length on Multi-query Multi-token Associative Recall (left) and Reverse task (right). SSMax represents the Scalable Softmax approach by Nakanishi 2025 . While all methods benefit from using NAPE, our adaptive-scaling version of \alpha -entmax exhibits the best extrapolation results, effectively handling extremely long sequences. 2 Background 2.1 Transformers In this work, we study (causal) transformers with sparse attention distributions created by replacing softmax with \alpha -entmax. We present the precise mathematical formulation below, following closely the notation from ( Barbero et al. 2024 ) . Concretely, given a sequence of token embeddings \bm{X}\in\mathbb{R}^{n\times d} , where n is the sequence length and d is the hidden dimension, transformers compute query, key, and value projections \bm{Q}=\bm{X}\bm{W}_{Q} , \bm{K}=\bm{X}\bm{W}_{K} , and \bm{V}=\bm{X}\bm{W}_{V} . We denote with \bm{q}_{i},\bm{k}_{i},\bm{v}_{i}\in\mathbb{R}^{d} the d -dimensional query, key, and value vectors of the i -th token. For each query position i , the representation at layer \ell for the i -th token is computed as: \displaystyle\bm{u}^{(\ell)}_{i}=\sum_{j\leq i}p_{ij}^{(\ell)}\text{norm}_{1}^{(\ell)}\left(\bm{v}^{(\ell-1)}_{j}\right)+\bm{v}^{(\ell-1)}_{i},\quad\bm{v}_{i}^{(\ell)}=\text{FFN}^{(\ell)}\left(\text{norm}_{2}^{(\ell)}\left(\bm{u}_{i}^{(\ell)}\right)\right)+\bm{u}_{i}^{(\ell)}, (1) where p_{ij}^{(\ell)} are attention weights, \text{FFN}^{(\ell)} is the feed-forward network, \text{norm}(\cdot) represent LayerNorm modules ( Xiong et al. 2020 ) . The output is computed as \bm{y}_{i}=\text{norm}_{3}\left(\bm{v}^{(L)}_{i}\right) . The attention weights p_{ij}^{(\ell)}=\pi(\bm{z}_{i}^{(\ell)})_{j} are computed by applying a transformation \pi:\mathbb{R}^{n}\to\triangle_{n} to the attention logits z_{ij}^{(\ell)}=\langle\bm{q}_{i}^{(\ell)},\bm{k}_{j}^{(\ell)}\rangle/\sqrt{d} , where \triangle_{n}:=\{\bm{p}\in\mathbb{R}^{n}\,:\,\bm{p}\geq\mathbf{0},\mathbf{1}^{\top}\bm{p}=1\} represents the probability simplex. Standard transformers employ the softmax function as \pi . In this work, we study transformers by casting \pi as the \alpha -entmax transformation. 2.2 \alpha -entmax Figure 2 : Visualization of \alpha\text{-entmax}(\bm{z}/\theta) for different values of \alpha . Each panel shows how probability mass is distributed among five elements of \bm{z}=[2.0,1.8,1.6,1.4,1.2] as the temperature parameter decreases ( \theta^{-1} increases). The vertical lines show the temperature that leads to zero probability. \alpha -entmax ( Peters et al. 2019 ) is a differentiable transformation that generalizes softmax by allowing for sparse probability distributions. For an input vector \bm{z}\in\mathbb{R}^{n} and \alpha>1 , \alpha -entmax is defined as: \aentmax(\bm{z})_{i}=\left[(\alpha-1)z_{i}-\tau(\bm{z})\right]_{+}^{\frac{1}{\alpha-1}}, (2) where [\cdot]_{+}:=\max(0,\cdot) and \tau:\mathbb{R}^{n}\to\mathbb{R} yields a threshold that ensures the resulting distribution sums to 1 . A key property of \alpha -entmax is that tokens with scores below the threshold receive exactly zero probability , creating sparse attention patterns. When \alpha\rightarrow 1^{+} , this reduces to the standard softmax function. The sparsity level increases with \alpha , with \alpha=2 corresponding to the sparsemax function ( Martins & Astudillo 2016 ) . Figure 2 illustrates \alpha -entmax for different values of \alpha . We provide more information on \alpha -entmax in § A . While \alpha -entmax is a suitable choice for sparse attention, its theoretical and empirical impact on long inputs is still unclear. In the next section, we demonstrate how it fundamentally changes the way attention behaves for long contexts. 3 Theoretical Properties of \alpha -entmax for Long Contexts We analyze the theoretical properties of \alpha -entmax that make it especially suitable for long-context modeling, focusing on how it addresses the fundamental limitations of softmax. 3.1 Non-Vanishing Attention Probabilities A critical limitation of softmax in transformers is that attention weights inevitably decrease as the sequence length increases. Our first result demonstrates how \alpha -entmax avoids this issue. Lemma 3.1 (Non-Vanishing Attention Property) . Consider scalars a_{1},...,a_{n-1},c\in\mathbb{R} . Let \bm{x}=[a_{1},...,a_{n-1},c]^{\top}\in\mathbb{R}^{n} and \bm{x}^{*}=[a_{1},...,a_{n-1},b,c]^{\top}\in\mathbb{R}^{n+1} , with all entries bounded. The following properties hold: • For all \alpha\geq 1 , we have \alpha\text{-entmax}(\bm{x})_{n}\geq\alpha\text{-entmax}(\bm{x}^{*})_{n+1} . In the softmax case ( \alpha=1 ), Barbero et al. 2024 have shown that the inequality is always strict: \text{softmax}(\bm{x})_{n}>\text{softmax}(\bm{x}^{*})_{n+1} . • For all \alpha>1 , there is some b_{\max}\in\mathbb{R} such that, for any b\leq b_{\max} , we have \alpha\text{-entmax}(\bm{x})_{n}=\alpha\text{-entmax}(\bm{x}^{*})_{n+1} . Furthermore, for \alpha>1 , the difference \alpha\text{-entmax}(\bm{x})_{n}-\alpha\text{-entmax}(\bm{x}^{*})_{n+1} can take any value in [0,\alpha\text{-entmax}(\bm{x})_{n}] by appropriate choice of b . The proof can be found in § C.1 . This result demonstrates a fundamental difference between softmax and \alpha -entmax. Unlike softmax, where adding a new token always reduces the attention probability of existing tokens strictly, \alpha -entmax allows a distinct behavior: the attention probability can remain unchanged. This occurs because the \alpha -entmax’s thresholding effect allows tokens with logits below a certain threshold to receive exactly zero attention, letting the model focus only on the relevant tokens. Having established that \alpha -entmax prevents the vanishing of individual attention weights, we now formalize the broader concept of attention dispersion to better understand how attention distributions as a whole behave as the sequence length increases. 3.2 Attention Dispersion and Concentration Recent work by Nakanishi 2025 and Veličković et al. 2024 has highlighted attention dispersion as a fundamental limitation of softmax for long context generalization. Building upon these insights, we provide a formal definition to characterize attention dispersion and show how \alpha -entmax naturally exhibits concentration properties that address these limitations. Definition 3.2 (Attention Dispersion) . Let f:\mathbb{R}^{n}\rightarrow\triangle_{n} denote a transformation (such as softmax) mapping logits to the probability simplex \triangle_{n}:=\{\bm{p}\in\mathbb{R}^{n}\,:\,\bm{p}\geq\mathbf{0},\mathbf{1}^{\top}\bm{p}=1\} . 1. f exhibits complete dispersion if for any bounded sequence of logits (z_{n})_{n\in\mathbb{N}} , the normalized entropy approaches 1 as the sequence length increases: \lim_{n\to\infty}\frac{H(f(\bm{z}_{1:n}))}{\log n}=1. (3) 2. f exhibits concentration resilience if there are bounded sequences of logits where the normalized entropy remains bounded away from 1: \lim_{n\to\infty}\frac{H(f(\bm{z}_{1:n}))}{\log n}<1. (4) These definitions allow us to examine how softmax and \alpha -entmax behave as sequence length grows: Proposition 3.3 (Dispersion Properties of Attention Mechanisms) . Comparing softmax and \alpha -entmax ( \alpha>1 ) attention mechanisms: 1. \alpha -entmax can retain probability, while softmax always leaks: For any \alpha>1 and any logits \bm{z}\in\mathbb{R}^{n} , there are logits \bm{z}^{*}\in\mathbb{R}^{N} with N>n such that: \aentmax(\bm{z})_{i}=\aentmax(\bm{z}^{*})_{i}\quad\forall i\leq n. (5) This is impossible for \alpha=1 (softmax), for which we always have \softmax(\bm{z})_{i}<\softmax(\bm{z}^{*})_{i} . 2. Softmax exhibits complete dispersion: For any fixed temperature \theta>0 and any bounded sequence of logits (z_{n})_{n\in\mathbb{N}} : \lim_{n\to\infty}\frac{H(\softmax(\bm{z}_{1:n}/\theta))}{\log n}=1. (6) 3. \alpha -entmax can exhibit strong concentration resilience: When the support size grows sublinearly as |\mathcal{S}|=\mathcal{O}(n^{\beta}) with \beta<1 , \alpha -entmax maintains bounded normalized entropy: \lim_{n\to\infty}\frac{H(\aentmax(\bm{z}_{1:n}))}{\log n}\leq\beta<1. (7) The full proof can be consulted in § D . The key takeaway of this result is that the entropy of attention distributions reveals how concentrated or dispersed they are across tokens. While softmax distributions approach maximum entropy \Theta(\log n) as the sequence length increases (indicating complete dispersion), \alpha -entmax distributions maintain bounded entropy \mathcal{O}(\log s) where s is the support size. This allows models with \alpha -entmax to maintain focused, low-entropy attention patterns even when processing extremely long sequences, as long as the support size is smaller than the full sequence length. This non-dispersion property means transformers with \alpha -entmax can scale to very long contexts without the attention becoming dispersed , maintaining their ability to focus on relevant information regardless of how much additional context is present. However, attention dispersion is not the only obstacle to effective long-sequence modeling. 3.3 Representational Preservation and Over-squashing Alleviation Two other critical challenges in long-context transformers are representational collapse and over-squashing—both fundamentally linked to the properties of softmax attention ( Barbero et al. 2024 ) . To clarify these concepts, we provide precise definitions below. Definition 3.4 (Representational Collapse and Over-squashing) . A transformer model suffers from representational collapse when token representations become similar as sequence length grows: for any \epsilon>0 , there exists n_{\epsilon} such that \|\bm{v}_{i}^{(L)}-\bm{v}_{j}^{(L)}\|_{1}<\epsilon for all i,j\leq n when n>n_{\epsilon} . Over-squashing occurs when gradient signals are exponentially diluted as they flow through L layers, with \|\frac{\partial\bm{y}_{n}}{\partial\bm{v}_{i}^{(0)}}\|<\epsilon for any \epsilon>0 due to the \mathcal{O}(n^{L}) gradient paths in softmax attention. Building on these definitions, we show in § C.2 and § C.3 that \alpha -entmax addresses both issues: Proposition 3.5 (Representational Preservation) . There are choices of \bm{v}^{(0)}\in\mathbb{R}^{n\times d} and \bm{v}^{*(0)}\in\mathbb{R}^{(n+1)\times d} such that \alpha -entmax ( \alpha>1 ) can maintain distinct token representations even as n\to\infty : \|\bm{v}_{n}^{(L)}-\bm{v}_{n+1}^{*(L)}\|_{1}\geq c for any constant c>0 . Proposition 3.6 (Over-squashing Alleviation) . With support size s\ll n , \alpha -entmax with \alpha>1 reduces gradient paths from \mathcal{O}(n^{L}) to \mathcal{O}(s^{L}) , alleviating over-squashing via stronger gradient signals. To empirically validate these properties, we conducted controlled experiments with transformer architectures employing different attention mechanisms, fully described in § C . For representational collapse, we measured how token representations change when sequence length increases. For over-squashing, we analyzed gradient flow through an 8-layer network on a copying task, where the model must copy information across long distances. The results are shown in Figure 3 . The left panel shows the L_{1} norm of representation differences between original and extended sequences after multiple transformer layers. With softmax, this difference rapidly approaches zero as sequence length increases. In contrast, \alpha -entmax maintains bounded differences even at extreme lengths (128K tokens), with higher \alpha values providing stronger preservation. The right panel illustrates gradient flow strength across sequence lengths, showing how \alpha -entmax maintains significantly stronger gradient signals across layers compared to softmax. Figure 3 : Empirical verification of representational collapse and over-squashing. Left: Representation difference ( L_{1} norm) after 6 layers across sequence lengths. Softmax ( \alpha=1.0 ) exhibits inevitable collapse, while \alpha -entmax maintains bounded differences even at extreme lengths. Right: Gradient norms across layers in a transformer ( n=256 ). \alpha -entmax maintains up to 6\times stronger gradient signals than softmax, particularly in earlier layers, demonstrating its ability to alleviate over-squashing. 4 Adaptive-Scalable \alpha -entmax (ASEntmax) In the previous section we saw that \alpha -entmax, for any choice of \alpha>1 , can avoid some of the pitfalls of softmax thanks to its ability to assign zero weight to many tokens, ignoring irrelevant information. But what if it ignores too many tokens? Can it handle situations where many tokens are relevant and should be attended? We show in this section that indeed the model might not be able to cope with this for a fixed \alpha and a fixed temperature, and we propose a practical solution. 4.1 Controlling Sparsity in Long Contexts via ASEntmax We start by introducing the following remark for a sequence of Gaussian random variables. Remark 4.1 (Normal Concentration) . Let the attention logits \bm{z}=(z_{1},\dots,z_{n}) be IID \mathcal{N}(0,\sigma) random variables and denote M:=\max_{1\leq i\leq n}z_{i},\qquad m:=\min_{1\leq i\leq n}z_{i},\qquad\Delta:=M-m. (8) By standard results on the asymptotic behavior of extreme values of normal random variables ( Kamath 2015 ) , the expected range satisfies \mathbb{E}[\Delta]\leq 2\sigma\sqrt{2\log n} and \lim_{n\rightarrow\infty}\frac{\mathbb{E}[\Delta]}{2\sigma\sqrt{2\log n}}=1. Since the logit spread increases only as \sqrt{\log n} , a fixed temperature can cause excessive sparsity in long contexts. To address this, we propose Adaptive-Scalable \alpha -entmax (ASEntmax), which adaptively scales the temperature for each attention head and query based on the context size and content: \text{ASEntmax}(\bm{z})=\aentmax((\delta+\beta(\log n)^{\gamma})\bm{z}), (9) where \beta,\gamma,\delta\in\mathbb{R} are head-specific scalars. Concretely, for each head, we obtain vectors \bm{\beta} and \bm{\gamma} whose entries contain these coefficients for each query: \displaystyle\bm{\beta} \displaystyle=\text{softplus}(\bm{X}\bm{w}_{\beta})\in\mathbb{R}^{n}_{+},\quad\bm{\gamma}=s\tanh(\bm{X}\bm{w}_{\gamma})\in(-s,s)^{n}, (10) where \bm{w}_{\beta},\bm{w}_{\gamma}\in\mathbb{R}^{d} are learnable, head-specific projection vectors. The scaling factor (\log n)^{\gamma} in Eq. 9 is directly motivated by the asymptotic behavior of normal logits from Remark 4.1 . This allows the model learn a slowly rising ( \gamma>0 ) or dampening ( \gamma<0 ) temperature schedule without interfering in the positional encodings (which would happen with negative values of \beta ). Specifically, for IID Gaussian logits \mathcal{N}(0,\sigma) , when \delta=0 and \gamma=-0.5 the scaling counteracts the growth of logit ranges ( \Delta_{n} ) as context increases: \beta(\log n)^{-0.5}\cdot\Delta_{n}=\beta(\log n)^{-0.5}\cdot 2\sigma\sqrt{2\log n}=2\sigma\beta\sqrt{2}, (11) which remains constant as n increases, preventing excessive sparsification. Furthermore, with this parameterization, ASEntmax can recover standard \alpha -entmax when \beta=0 , hence allowing a smooth transition between scaled and unscaled regimes. By making \bm{w}_{\beta} and \bm{w}_{\gamma} head-specific and learnable, ASEntmax can adapt to the optimal scaling behavior for each head, balancing the natural concentration benefits of \alpha -entmax with precise control over how sparsity patterns evolve with sequence length. Finally, we note that simply scaling the query-key products is appealing from a practical perspective since it allows the direct use of fast optimized kernels for \alpha -entmax, such as AdaSplash ( Gonçalves et al. 2025 ) , without any modifications. Figure 4 : Learned positions per head. Besides a simple linear fit baseline ( \beta n ), we also show the fit of a log model ( \beta\log n ) and a log-power model ( \beta(\log n)^{\gamma} ), inherited by ASEntmax. Empirical Analysis. To empirically validate the importance of the parameter \gamma in our proposed scaling formulation, we conducted experiments on a language modeling task using a 120M-parameter transformer trained on 5B tokens from the FineWeb dataset ( Penedo et al. 2024 ) . Following the methodology of Nakanishi 2025 , we implemented learnable scaling parameters for the attention logits, but with a key difference: while they used a global scaling parameter, we learn separate scaling parameters for each attention head, motivated by Correia et al. 2019 ’s finding that attention heads develop distinct sparsity patterns. Figure 4 presents the learned scaling behaviors for representative attention heads, along with fitted curves from different scaling models. The results clearly demonstrate that scaling parameters vary significantly across heads, and that a simple log-scaling model \beta\log n (as used by Nakanishi 2025 ) provides poor fits for many heads. In contrast, our proposed form \delta+\beta(\log n)^{\gamma} provides consistently better fits capturing the diverse scaling behaviors across different attention heads. The complete distribution of fitted \beta and \gamma values across all heads is provided in § F , and additional training details can be found in § F.1 . 4.2 Interacting with Positional Encoding Positional bias is known to affect attention dynamics and generalization ( Barbero et al. 2025 ; Wu et al. 2025 ) . In this work, we also introduce NAPE (NoPE + ALiBi Positional Encoding), a hybrid scheme in which half of the attention heads receive no positional encoding (NoPE), enabling flexible, data-driven position inference, while the other half use a fixed monotonic bias (ALiBi) to encourage locality. This complementary design allows some heads to focus on global patterns while others encode recency, combining the strengths of both. While NAPE is not central to our theoretical results, we find it plays a crucial empirical role in enabling robust length generalization, especially when paired with the sparse inductive bias of \alpha -attention. As detailed in our theoretical and empirical analysis in § E , the NoPE component of NAPE enables models to develop effective relative positional encoding—supporting the flexibility hypothesis of Kazemnejad et al. 2023 —and, more broadly, \alpha -entmax interacts with positional encodings in ways that fundamentally alter attention behavior compared to softmax, such as creating hard attention windows with ALiBi or inducing frequency-dependent patterns with RoPE. 5 Experiments A number of works have turned to synthetic tasks as a probing ground for transformers’ length-generalization capabilities ( Anil et al. 2022 ; Dziri et al. 2023 ; Zhou et al. 2024 ) . Such tasks, like copying a sequence and sorting numbers, allow precise control over training and test lengths, revealing whether a model has truly learned an algorithm that scales or merely memorized patterns within a limited length. Vanilla transformers struggle in this setting: they often achieve perfect accuracy on sequences up to the training length, yet fail catastrophically on even slightly longer sequences ( Press et al. 2022 ) . To quantitatively evaluate our proposed improvements, we embrace this paradigm of synthetic tasks for long-sequence testing. Concretely, we evaluate our models on a diverse set of synthetic tasks designed to test different aspects of long-context modeling, covering both position-agnostic reasoning (where token positions are not critical) and position-sensitive operations (where relative or absolute positions matter): • Retrieval-focused tasks: These include Max Retrieval ( Barbero et al. 2024 ) , which requires identifying maximum values in sequences, and Multi-query Multi-token Associative Recall (MQMTAR)—a variant of that proposed by Arora et al. 2024 , but with multi-token keys and values—which involves matching queries to their corresponding key-value pairs. Both tasks test the model’s ability to maintain focus on relevant tokens regardless of their positions in long contexts. • Memory-dependent tasks: We evaluate models on Copy (reproducing input sequences). It assesses how well the model preserves token representations and accesses specific positional information throughout the network. On this line, we also evaluate on 2Back, described in § G . • Ordering tasks: This category contains tasks such as Sort (arranging tokens in ascending order) and Reverse (outputting tokens in reverse order). These evaluate compositional generalization and positional reasoning, becoming increasingly challenging as sequence length grows. Experimental Setup. All synthetic tasks are trained with a decoder-like transformer. Moreover, we evaluate models in extreme settings by using as few layers as possible as our goal is to test the attention mechanism coupled with our positional-encoding strategy, rather than the scaling capabilities of transformer. However, for the Reverse task, we increment the layer count until the softmax baseline generalizes to at least 1.5 \times the in-distribution length, as this task proved especially challenging for softmax models. To improve length extrapolation in models employing RoPE, we apply a RoPE scaling factor of 16. For NAPE, we set ALiBi slopes to m=\frac{1}{h} , where h is the head index. Finally, we use \delta=1 in ASEntmax models. More experimental details are described in § G . Discussion. The results, shown in Table 1 , reveal two critical factors for length generalization: positional encoding and attention sparsity. With RoPE, all methods struggle beyond 2 \times training length, while NAPE (NoPE + ALiBi) enables substantially better generalization across all tasks. Within NAPE variants, ASEntmax dramatically outperforms others at extreme lengths—maintaining 96.4% accuracy at 256 \times test length on MQMTAR (vs. 80.2% for softmax) and 96.4% at 4 \times on Reverse (vs. 0% for softmax). This positional encoding advantage aligns with our theoretical analysis showing that \alpha -entmax transforms positional biases into adaptive attention windows. Task-specific patterns further validate our theoretical claims. The consistent superiority of ASEntmax over basic \alpha -entmax confirms the benefits of adaptive scaling, particularly at extreme lengths where fixed- \alpha may become too sparse or too diffuse. SSMax performs well on the Copy task, even outperforming other methods, but struggles on more complex tasks like MQMTAR and Reverse at extreme lengths. This indicates that while scaling logits helps maintain peak attention magnitude, the explicit sparsity of \alpha -entmax provides additional benefits by completely removing irrelevant connections. These findings are further supported by results on the Max Retrieval task (Figure 5 ), where sparse attention mechanisms demonstrate superior length extrapolation compared to dense approaches, with ASEntmax maintaining over 60% accuracy even at 4096-length sequences—a dramatic improvement over standard Softmax and Adaptive Temperature ( Veličković et al. 2024 ) . Finally, Copy and Reverse show moderate generalization (up to 64 \times and 8 \times respectively), while Sort fails beyond 4 \times length for all methods. This pattern suggests that tasks requiring precise global ordering (Sort, Reverse) are inherently more challenging for length generalization than tasks dependent on local or independent token properties. We provide per-task results, including results for other positional encoding methods such as ALiBi and NoPE, in § H . Table 1 : Exact match accuracy (%) on representative tasks. For each task, we report in-distribution sequence length n in the first column ( n=64 for all tasks), followed by OOD results at increasing sequence lengths. L indicates the number of layers. Best results are in bold . MQMTAR (L=4) Reverse (L=6) Method ID 2\times 4\times 16\times 64\times 256\times 1024\times ID 1.5\times 2\times 4\times 8\times RoPE Softmax 100.0 3.1 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0 0.0 SSMax 99.8 6.2 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0 0.0 Entmax 99.8 49.4 4.5 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0 0.0 ASEntmax 100.0 66.9 0.8 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0 0.0 [.4pt/2pt] NAPE Softmax 100.0 100.0 100.0 99.5 97.8 80.2 3.0 100.0 36.0 0.0 0.0 0.0 SSMax 99.9 100.0 99.9 99.4 94.1 53.4 1.0 100.0 54.6 0.0 0.0 0.0 Entmax 100.0 100.0 100.0 99.2 92.7 66.8 9.3 100.0 99.0 86.0 28.5 0.2 ASEntmax 100.0 100.0 99.9 99.8 99.2 96.4 76.7 100.0 100.0 99.8 96.4 56.7 Copy (L=2) Sort (L=2) ID 2\times 4\times 8\times 16\times 32\times 64\times ID 2\times 4\times 8\times - RoPE Softmax 100.0 2.8 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0 - SSMax 100.0 0.0 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0 - Entmax 100.0 34.3 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0 - ASEntmax 100.0 5.3 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0 - [.4pt/2pt] NAPE Softmax 100.0 100.0 99.9 99.9 99.4 96.1 85.5 100.0 0.0 0.0 0.0 - SSMax 100.0 100.0 100.0 99.9 99.6 99.3 95.8 100.0 0.0 0.0 0.0 - Entmax 100.0 99.0 86.0 28.5 0.2 0.0 0.0 100.0 99.3 57.8 0.0 - ASEntmax 100.0 100.0 99.9 99.7 99.4 96.3 86.6 100.0 100.0 79.7 0.0 - Figure 5 : Accuracy (%) on the Max Retrieval task across different sequence lengths. Adaptive Temperature (Adapt. Temp.) represents the approach proposed by Veličković et al. 2024 . 6 Related Works Understanding and improving length generalization is a very active research area. We summarize below the related work in different dimensions. Attention Dispersion. Recent work has identified attention dispersion as a fundamental limitation in softmax-based transformers ( Dong et al. 2021 ; Zhai et al. 2023 ; Veličković et al. 2024 ) . For example, Veličković et al. 2024 demonstrate that softmax attention inevitably disperses focus as sequence length increases, while Nakanishi 2025 propose SSMax to scale attention logits based on sequence length. Our approach employs \alpha -entmax ( Peters et al. 2019 ) , which naturally produces sparse distributions by assigning exactly zero probability to irrelevant tokens. We provide theoretical guarantees that \alpha -entmax maintains bounded normalized entropy as sequence length increases—a property softmax fundamentally lacks. Our ASEntmax further improves \alpha -entmax with learnable, context-dependent scaling, leading to consistent gains over SSMax across diverse tasks. Representational Collapse and Over-Squashing. Studies analyzing attention patterns in neural networks have noted that increasing depth and context length can induce representational degeneration ( Dong et al. 2021 ; Noci et al. 2022 ; Arroyo et al. 2025 ) . In particular, Barbero et al. 2024 prove that with softmax attention, token representations become indistinguishable as sequence length increases and gradient paths grow as \mathcal{O}(n^{L}) , causing exponential signal dilution. Our analysis shows, theoretically and empirically, that \alpha -entmax can address both limitations by maintaining distinct token representations and by reducing gradient paths to \mathcal{O}(s^{L}) for increasing sequence lengths n . Positional Encodings. The interaction between attention mechanisms and positional encodings significantly impacts long-context generalization. Wu et al. 2025 show that causal masking with distance bias creates a position advantage for early tokens, while Barbero et al. 2025 analyze frequency components in RoPE ( Su et al. 2024 ) . Our work shows how \alpha -entmax transforms these biases: with NoPE, it helps attention to not always converge to early tokens; with ALiBi, it creates hard attention windows—similar to Hard-ALiBi ( Jelassi et al. 2024 ) ; with RoPE, it induces frequency-dependent sparsity. Based on this analysis, we introduce NAPE (NoPE + ALiBi), which combines ALiBi’s consistent recency bias with NoPE’s flexible content-based attention for improved long-context generalization. Similar to NAPE, Fu et al. 2025 propose to combine heads with ALiBi and RoPE to increase training stability. Attention Scaling. Recent work has shown that scaling attention logits is key for maintaining sharp, focused attention in long contexts. Techniques like YaRN ( Peng et al. 2024 ) and the entropy-aware approach of Zhang et al. 2024 use dynamic logit scaling—often alongside modified RoPE—to stabilize attention when training the model on extend contexts. Scalable-Softmax ( Nakanishi 2025 ) applies a simple \log n scaling to logits during training to control dispersion without the need for post-training adaptation. InfoScale ( Li et al. 2025 ) derive scaling rules from the principle of entropy invariance, while Scale-invariant Attention ( Anson et al. 2025 ) introduces position-dependent transformations to balance attention across both local and global contexts. Across these methods, adaptive scaling consistently improves extrapolation to longer sequences. Our ASEntmax builds on this line of work by introducing context-dependent, learnable scaling within the \alpha -entmax framework, enabling sparse, focused attention as context length increases. Sparse Attention. Previous sparse attention approaches include structured patterns like Longformer ( Beltagy et al. 2020 ) , BigBird ( Zaheer et al. 2020 ) , Flash-Attention ( Dao et al. 2022 ) , as well as adaptive methods like \alpha -entmax ( Peters et al. 2019 ) and Sparsefinder ( Treviso et al. 2022 ) , recently accelerated by AdaSplash ( Gonçalves et al. 2025 ) . Our work differs by providing a theoretical analysis of why sparsity helps with long-context generalization, linking it to fundamental limitations including dispersion, representational collapse, and over-squashing. 7 Conclusions In this paper, we present a principled approach to long-context modeling by replacing softmax with \alpha -entmax in transformer attention. Our theoretical analysis demonstrates how this simple change addresses three fundamental limitations: it avoids attention dispersion through naturally sparse distributions, prevents representational collapse by maintaining distinct token representations, and alleviates over-squashing by reducing gradient paths from \mathcal{O}(n^{L}) to \mathcal{O}(s^{L}) , where s\ll n is the number of tokens with nonzero probability. We further introduce Adaptive-Scalable \alpha -entmax (ASEntmax), which adaptively adjusts sparsity based on sequence length for each attention head and query input. Our empirical results confirm these theoretical predictions, with ASEntmax significantly outperforming softmax and existing alternatives across diverse tasks, maintaining high performance even at sequence lengths 1000 \times beyond training examples. These findings suggest that addressing the fundamental mathematical limitations of transformer attention mechanisms may provide a direct path to achieve robust long-context generalization. Limitations. While our experiments focus on controlled settings with small transformers, the theoretical principles we establish should extend to deeper architectures and larger scales; however, future research on sparse attention in production-scale models is still needed, especially with multi-stage approaches commonly employed for extending the context-length in traditional LLMs ( Grattafiori et al. 2024 ) . Appendix A \alpha -entmax Transformation For \alpha>1 , the \alpha -entmax transformation of a score vector \bm{z}\in\mathbb{R}^{n} is defined as ( Peters et al. 2019 ) : \alpha\text{-entmax}(\bm{z}):=\arg\max_{\bm{p}\in\triangle_{n}}\bm{p}^{\top}\bm{z}+H_{\alpha}(\bm{p}),\quad\triangle_{n}:=\{\bm{p}\in\mathbb{R}^{n}\,:\,\bm{p}\geq\mathbf{0},\mathbf{1}^{\top}\bm{p}=1\}, (12) where H_{\alpha}(\bm{p}) is the Tsallis( \alpha ) entropy ( Tsallis 1988 ) . The closed form for \alpha -entmax with \alpha>1 is p_{i}^{\star}=\bigl[(\alpha-1)\,z_{i}-\tau(\bm{z})\bigr]_{+}^{\tfrac{1}{\alpha-1}}, where [\cdot]_{+}=\max(0,\cdot) , and \tau(\bm{z}) is chosen so that \bm{p}^{\star} sums to 1 . Figure 2 illustrates how \alpha -entmax with tempered scores \bm{z}/\theta behaves for different choices of \alpha . Appendix B Model Definition and Notation In this work, we study (causal) transformers with sparse attention distributions created by replacing softmax with \alpha -entmax. We present the precise mathematical formulation of our model below, following closely the notation from ( Barbero et al. 2024 ) . Let \bm{Q}=\bm{X}\bm{W}_{Q},\bm{K}=\bm{X}\bm{W}_{K},\bm{V}=\bm{X}\bm{W}_{V}\in\mathbb{R}^{n\times d} be the query, key, and value projections of the input embeddings respectively, where n is sequence length and d the hidden size. We denote with \bm{q}_{i},\bm{k}_{i},\bm{v}_{i}\in\mathbb{R}^{d} the d -dimensional query, key, and value vectors of the i -th token. For a single attention head, transformers compute the representation of the i -th token through the following layer-wise transformations: 2 2 2 Following Barbero et al. 2024 , we omit the linear projections used to compute the vectors from the output of previous layers for clarity; however, this does not impact our derivations and conclusions. \displaystyle\bm{u}^{(\ell)}_{i} \displaystyle=\sum_{j\leq i}p_{ij}^{(\ell)}\text{norm}_{1}^{(\ell)}\left(\bm{v}^{(\ell-1)}_{j}\right)+\bm{v}^{(\ell-1)}_{i}, (13) \displaystyle\bm{v}_{i}^{(\ell)} \displaystyle=\text{FFN}^{(\ell)}\left(\text{norm}_{2}^{(\ell)}\left(\bm{u}_{i}^{(\ell)}\right)\right)+\bm{u}_{i}^{(\ell)}, (14) \displaystyle\bm{y}_{i} \displaystyle=\text{norm}_{3}\left(\bm{v}^{(L)}_{i}\right), (15) where \ell is the later index, p_{ij}^{(\ell)} represents the attention weights, \text{FFN}^{(\ell)}:\mathbb{R}^{d}\to\mathbb{R}^{d} represents the feed-forward network, and \text{norm}_{1}^{(\ell)},\text{norm}_{2}^{(\ell)}, and \text{norm}_{3} are normalization functions. The final representation \bm{y}_{i} is computed after applying L transformer layers. For next-token prediction tasks, the model output typically depends solely on \bm{y}_{n} , the final representation of the last token. The attention weights p_{ij}^{(\ell)} are computed by applying a transformation \pi:\mathbb{R}^{n}\to\triangle_{n} as follows: p_{ij}^{(\ell)}=\pi\left(\bm{z}_{i}^{(\ell)}\right)_{j}, (16) where \bm{z}_{i}^{(\ell)}\in\mathbb{R}^{n} is the vector of logits for token i at layer \ell , with elements z_{ij}^{(\ell)}=\langle\bm{q}_{i}^{(\ell)},\bm{k}_{j}^{(\ell)}\rangle/\sqrt{d} . The function \pi maps these logits to a probability distribution over the n tokens, with \triangle_{n} denoting the probability simplex. In standard transformers, \pi is the softmax function: \text{softmax}(\bm{z})_{j}=\frac{\exp(z_{j})}{\sum_{k\leq i}\exp(z_{k})}. (17) In our approach, we replace softmax with \alpha -entmax (§ A ). We group the attention weights into an attention matrix at the \ell -th layer, defined element-wise as [\bm{P}^{(\ell)}]_{ij}:=p_{ij}^{(\ell)} . This is a row-stochastic lower triangular matrix that can also be interpreted as a probabilistic directed graph. Finally, when incorporating positional information, we modify the attention logits computation according to the chosen positional encoding strategy: • NoPE : z_{ij}^{(\ell)}=\langle\bm{q}_{i}^{(\ell)},\bm{k}_{j}^{(\ell)}\rangle/\sqrt{d} . • ALiBi : z_{ij}^{(\ell)}=\langle\bm{q}_{i}^{(\ell)},\bm{k}_{j}^{(\ell)}\rangle/\sqrt{d}+m\cdot(j-i) , where m\in\mathbb{R} is a slope hyperparameter. • RoPE : z_{ij}^{(\ell)}=(\bm{q}_{i}^{(\ell)})^{\top}\bm{R}^{j-i}\bm{k}_{j}^{(\ell)} , where \bm{R}\in\mathbb{R}^{d\times d} is a block-diagonal rotation matrix. Appendix C Representational Collapse and Over-squashing C.1 Proof of Lemma 3.1 Adding a new element to the sequence of logits can only redistribute probability mass, so \aentmax(\bm{x})_{n}\geq\aentmax(\bm{x}^{*})_{n+1} must always hold, with equality iff \aentmax(\bm{x}^{*})_{n}=0 . Since softmax ( \alpha=1 ) cannot return zeros, we must have a strict inequality for \alpha=1 . For \alpha>1 , we need to find the value b_{\max} such that, for any b\leq b_{\max} , \aentmax(\bm{x}^{*})_{n}=0 holds. From the definition of \alpha -entmax ( 2 ), a token i receives non-zero probability iff (\alpha-1)z_{i}>\tau(\bm{z}) , where \tau(\bm{z}) is the threshold ensuring the sum of probabilities equals 1. Therefore, for the token b in the extended sequence \bm{x}^{*} to receive zero probability (thus not affecting other probabilities), we need: (\alpha-1)b\leq\tau(\bm{x}^{*}). (18) We know that \tau(\bm{x}^{*})\geq\tau(\bm{x}) in general for \alpha -entmax, as shown by Peters et al. 2019 ; Martins et al. 2022 . Therefore, a sufficient condition is: (\alpha-1)b\leq\tau(\bm{x}). (19) Solving for b , we get: b\leq\frac{\tau(\bm{x})}{\alpha-1}. (20) Thus, we can define b_{\max}=\frac{\tau(\bm{x})}{\alpha-1} . For any b\leq b_{\max} , the token at position n in \bm{x}^{*} receives zero attention, meaning it doesn’t affect the normalization. Therefore, \tau(\bm{x}^{*})=\tau(\bm{x}) , which means that the condition ( 20 ) is both necessary and sufficient, and: \aentmax(\bm{x})_{n}=\bigl[(\alpha-1)c-\tau(\bm{x})\bigr]_{+}^{\frac{1}{\alpha-1}}=\bigl[(\alpha-1)c-\tau(\bm{x}^{*})\bigr]_{+}^{\frac{1}{\alpha-1}}=\aentmax(\bm{x}^{*})_{n+1}. (21) By choosing different values of b such that b\leq b_{\max} , we can control the change in threshold \tau(\bm{x}^{*}) and consequently the difference \aentmax(\bm{x})_{n}-\aentmax(\bm{x}^{*})_{n+1} can be as large as \aentmax(\bm{x})_{n} . C.2 Proof of Proposition C.1 We prove Proposition C.1 by exhibiting the counterexample below. Proposition C.1 (Counterexample to Representational Collapse with \alpha -entmax) . Let \bm{v}\in\mathbb{R}^{(n-1)\times d} be a sequence of embedding vectors, and define: \bm{v}^{(0)}=[\bm{v},\bm{v}_{a}]^{\top}\in\mathbb{R}^{n\times d},\quad\bm{v}^{*(0)}=[\bm{v},\bm{v}_{a},\bm{v}_{a}]^{\top}\in\mathbb{R}^{(n+1)\times d}, (22) where the final token \bm{v}_{a}\in\mathbb{R}^{d} is repeated. For appropriate choice of embeddings and \alpha>1 , there exists a constant c>0 independent of n such that: \|\bm{v}_{n}^{(L)}-\bm{v}_{n+1}^{*(L)}\|_{1}\geq c>0 (23) after L transformer layers with \alpha -entmax attention, demonstrating that representational collapse is not inevitable. In contrast, Barbero et al. 2024 proved that for softmax attention, \|\bm{v}_{n}^{(L)}-\bm{v}_{n+1}^{*(L)}\|_{1}\to 0 as n\to\infty for any such construction. Proof. We prove this through explicit construction. Since \bm{v}^{(0)}_{1:n-1}=\bm{v}^{*(0)}_{1:n-1} and both sequences end with \bm{v}_{a} , the attention logits computed by the final tokens are: \displaystyle\bm{z}_{n}^{(1)} \displaystyle=[\bm{v}_{a}^{\top}\bm{v}_{1},\ldots,\bm{v}_{a}^{\top}\bm{v}_{n-1},\bm{v}_{a}^{\top}\bm{v}_{a}], (24) \displaystyle\bm{z}_{n+1}^{*(1)} \displaystyle=[\bm{v}_{a}^{\top}\bm{v}_{1},\ldots,\bm{v}_{a}^{\top}\bm{v}_{n-1},\bm{v}_{a}^{\top}\bm{v}_{a},\bm{v}_{a}^{\top}\bm{v}_{a}]. (25) Consider the specific embedding choice where: • \bm{v}_{a} is chosen such that \bm{v}_{a}^{\top}\bm{v}_{a}=\phi for some \phi\in\mathbb{R} . • \bm{v}_{i} for i=1,\ldots,n-1 are chosen such that \bm{v}_{a}^{\top}\bm{v}_{i}=b for some value b<\phi . This construction yields the following attention logits: \displaystyle\bm{z}_{n}^{(1)} \displaystyle=[b,b,\ldots,b,\phi], (26) \displaystyle\bm{z}_{n+1}^{*(1)} \displaystyle=[b,b,\ldots,b,\phi,\phi]. (27) Specific counterexample. Consider d=1 , \alpha=2.0 , \phi=0.5 , and b=0 . We can construct inputs as \bm{v}_{a}=\sqrt{0.5} and \bm{v}_{i}=0 for i=1,\ldots,n-1 . The attention logits are: \displaystyle\bm{z}_{n}^{(1)} \displaystyle=[0,\ldots,0,0.5], (28) \displaystyle\bm{z}_{n+1}^{*(1)} \displaystyle=[0,0,\ldots,0,0.5,0.5]. (29) For \alpha=2.0 (sparsemax), the attention distributions are: \displaystyle\text{sparsemax}(\bm{z}_{n}^{(1)}) \displaystyle=[p_{b},p_{b},\ldots,p_{b},p_{n}]\quad\text{(dense)} (30) \displaystyle\text{sparsemax}(\bm{z}_{n+1}^{*(1)}) \displaystyle=[0,0,\ldots,0,\frac{1}{2},\frac{1}{2}]\quad\text{(sparse)} (31) where 00 , with 00 . First condition. We need to choose parameters so that as n\to\infty , the original sequences remains dense and the extended sequence is in the sparse regime. From our analysis with Lemma 3.1 and D.1 , this requires: \displaystyle\frac{2^{-(\alpha-1)}}{\alpha-1}\leq\phi-b<\frac{1}{\alpha-1}. (40) From the \alpha -entmax definition, we have: \displaystyle(p_{b}^{(1)})^{\alpha-1} \displaystyle=(\alpha-1)b-\tau, (41) \displaystyle(p_{n}^{(1)})^{\alpha-1} \displaystyle=(\alpha-1)\phi-\tau, (42) where p_{b}^{(1)} is the probability for each b token and p_{n}^{(1)} is the probability for the \phi token. Subtracting the first equation from the second: (p_{n}^{(1)})^{\alpha-1}-(p_{b}^{(1)})^{\alpha-1}=(\alpha-1)(\phi-b). (43) From the normalization constraint (n-1)p_{b}^{(1)}+p_{n}^{(1)}=1 : p_{b}^{(1)}=\frac{1-p_{n}^{(1)}}{n-1}. (44) Substituting: \displaystyle(p_{n}^{(1)})^{\alpha-1}-\left(\frac{1-p_{n}^{(1)}}{n-1}\right)^{\alpha-1}=(\alpha-1)(\phi-b). (45) We know from the dense regime that p_{n}^{(1)}\to p^{*} , with 00 (52) The bound is strictly positive because b\neq\phi by the logit difference requirement, and because of the constant +1 term from the \bm{e}_{2} component. Therefore, \lim_{n\to\infty}\|\bar{\bm{v}}-\bm{v}_{a}\|_{1}\not\to 0 . For the case d=1 , we can use the simpler construction v_{i}=\frac{b}{\sqrt{\phi}} and v_{a}=\sqrt{\phi} , where the non-collapse condition becomes verifying that \frac{b}{\sqrt{\phi}}\neq\sqrt{\phi} , which follows from b\neq\phi . In contrast, as shown by Barbero et al. 2024 , the resulting representations become increasingly similar as n\to\infty with softmax ( \alpha=1.0 ), regardless of the input content, leading to representational collapse. ∎ Figure 6 : L_{1} norm of representation difference between original sequence and extended sequence after 6 transformer layers, with constant prefix (left) and random prefix (right). With softmax ( \alpha=1.0 ), representation difference rapidly approaches zero, demonstrating inevitable collapse. \alpha -entmax ( \alpha>1.0 ) maintains bounded differences even at extreme sequence lengths. Empirical Verification of Representational Preservation. To empirically validate our theoretical analysis, we conducted the following experiment: we implemented the counterexample construction using identity projection matrices for queries/keys/values and tested two scenarios with d=1 : 1. Constant prefixes: b=1 and \phi=1.2 . 2. Random prefixes: b\sim\mathcal{U}(0,1) and \phi=1.2 . Using a 6-layered transformer with residual connections, we experiment with increasing sequence lengths n\in\{128,256,\ldots,16384\} and \alpha\in\{1.0,1.5,1.75,2.0\} , and compute \|\bm{v}_{n}^{(L)}-\bm{v}_{n+1}^{*(L)}\|_{1} . Figure 6 shows how representational differences evolve across increasing sequence lengths. As established in the previous counterexample, while softmax attention inevitably leads to representational collapse in long contexts, \alpha -entmax can maintain distinct representations even as sequence length grows. Figure 7 : Left: Layer-wise gradient norms in an 8-layer transformer with sequence length n=256 . \alpha -entmax with \alpha>1.0 maintain substantially stronger gradient signals, especially in earlier layers, compared to softmax. This demonstrates how \alpha -entmax alleviates over-squashing by enabling more effective gradient flow through the network, with gradient norms up to 6x higher than softmax. Right: Visualization of the average number of non-zero gradient paths in a 8-layer transformer per layer, showing how \alpha -entmax creates fewer paths, which helps to alleviate over-squashing compared to softmax, which always selects all possible paths (within machine precision). C.3 Proof of Proposition 3.6 The following proposition demonstrates how \alpha -entmax helps alleviate the problem of over-squashing, the exponential dilution of gradient signals through deep networks. For clarity, we follow the same set of assumptions as Barbero et al. 2024 —independence of attention coefficients from the values and approximation of layer normalization with a constant factor. Proposition C.2 (Over-squashing Alleviation with \alpha -entmax) . Consider an L -layer transformer-like model where the attention distribution for each head is computed by \alpha -entmax with \alpha>1 . For a token n in the final layer, let \bm{v}_{n}^{(L)}\in\mathbb{R}^{d} be its hidden representation and \bm{y}_{n}=\mathrm{norm}_{3}\bigl(\bm{v}_{n}^{(L)}\bigr) (53) be its final normalized output. The sensitivity of \bm{y}_{n} to the initial embedding \bm{v}_{i}^{(0)} of token i experiences less over-squashing with \alpha -entmax than with softmax attention. Specifically, if the support size of the \alpha -entmax attention distributions is |\mathcal{S}_{j}^{(\ell)}|=s\ll n for tokens j across all layers \ell , then the number of gradient paths from token i to token n is reduced from \mathcal{O}(n^{L}) to \mathcal{O}(s^{L}) , and consequently helping to alleviate over-squashing by providing stronger gradient signals. Proof. We begin by expanding \frac{\partial\bm{y}_{n}}{\partial\bm{v}_{i}^{(0)}} through the chain rule. Since \bm{y}_{n}=\mathrm{norm}(\bm{v}_{n}^{(L)}) , and \bm{v}_{n}^{(L)} is the output of L transformer layers, we have: \frac{\partial\bm{y}_{n}}{\partial\bm{v}_{i}^{(0)}}=\frac{1}{\beta_{3}}\frac{\partial\bm{v}_{n}^{(L)}}{\partial\bm{v}_{i}^{(0)}}, (54) where \frac{1}{\beta_{3}} accounts for the normalization assumption. Expanding the gradient through all L layers: \frac{\partial\bm{v}_{n}^{(L)}}{\partial\bm{v}_{i}^{(0)}}=\sum_{k_{1},k_{2},\ldots,k_{L-1}}\frac{\partial\bm{v}_{n}^{(L)}}{\partial\bm{v}_{k_{L-1}}^{(L-1)}}\frac{\partial\bm{v}_{k_{L-1}}^{(L-1)}}{\partial\bm{v}_{k_{L-2}}^{(L-2)}}\cdots\frac{\partial\bm{v}_{k_{1}}^{(1)}}{\partial\bm{v}_{i}^{(0)}}. (55) Due to causal masking, the only non-zero terms occur when i\leq k_{1}\leq k_{2}\leq\cdots\leq k_{L-1}\leq n . For each pair of adjacent layers, we have: \frac{\partial\bm{v}_{j}^{(\ell+1)}}{\partial\bm{v}_{k}^{(\ell)}}=\left(\frac{\sigma_{\psi}}{\beta_{2}^{(\ell)}}+1\right)\frac{\partial\bm{u}_{j}^{(\ell)}}{\partial\bm{v}_{k}^{(\ell)}}, (56) where \bm{u}_{j}^{(\ell)}=\sum_{k\leq j}p_{j,k}^{(\ell)}\frac{\bm{v}_{k}^{(\ell)}}{\beta_{1}^{(\ell)}}+\bm{v}_{j}^{(\ell)} , and p_{j,k}^{(\ell)} are the attention probabilities computed using \alpha -entmax. Thus, for k\leq j , we have: \frac{\partial\bm{u}_{j}^{(\ell)}}{\partial\bm{v}_{k}^{(\ell)}}=\frac{p_{j,k}^{(\ell)}}{\beta_{1}^{(\ell)}}+\delta_{j,k}\bm{I}, (57) where \delta_{j,k} is the Kronecker delta and reflects the contribution from the residual connection, which happens when k=j . For simplicity, let \bar{p}_{j,k}^{(\ell)}=\frac{p_{j,k}^{(\ell)}}{\beta_{1}^{(\ell)}}+\delta_{j,k} . Taking the norm and combining all layers, we obtain: \left\|\frac{\partial\bm{y}_{n}}{\partial\bm{v}_{i}^{(0)}}\right\|\leq C\sum_{k_{1}\geq i}\sum_{k_{2}\geq k_{1}}\cdots\sum_{k_{L-1}\geq k_{L-2}}\bar{p}_{n,k_{L-1}}^{(L-1)}\bar{p}_{k_{L-1},k_{L-2}}^{(L-2)}\cdots\bar{p}_{k_{1},i}^{(0)}, (58) where C=\frac{1}{\beta_{3}}\prod_{\ell=1}^{L}\left(\frac{\sigma_{\psi}}{\beta_{2}^{(\ell)}}+1\right) is a constant independent of the sequence length. The crucial distinction between softmax and \alpha -entmax lies in the attention probabilities p_{j,k}^{(\ell)} . For \alpha -entmax with \alpha>1 , many tokens receive exactly zero attention. Specifically, if we define the support set for the j -th token as \mathcal{S}_{j}^{(\ell)}=\{k\,|\,p_{j,k}^{(\ell)}>0\text{ and }k\leq j\} , then p_{j,k}^{(\ell)}=0 for all k\notin\mathcal{S}_{j}^{(\ell)} . Consequently, \bar{p}_{j,k}^{(\ell)}=0 when k\notin\mathcal{S}_{j}^{(\ell)} and j\neq k (i.e., when there is no contribution from either attention or the residual connection). This means we can rewrite our bound as: \left\|\frac{\partial\bm{y}_{n}}{\partial\bm{v}_{i}^{(0)}}\right\|\leq C\sum_{k_{1}\in\mathcal{T}_{1}}\sum_{k_{2}\in\mathcal{T}_{2}(k_{1})}\cdots\sum_{k_{L-1}\in\mathcal{T}_{L-1}(k_{L-2})}\bar{p}_{n,k_{L-1}}^{(L-1)}\bar{p}_{k_{L-1},k_{L-2}}^{(L-2)}\cdots\bar{p}_{k_{1},i}^{(0)}. (59) where we precisely characterize the gradient flow paths via the sets \mathcal{T}_{1} and \mathcal{T}_{\ell}(k_{\ell-1}) , which identify tokens that receive non-zero gradient contributions: \displaystyle\mathcal{T}_{1} \displaystyle=\{k\in\{i,i+1,\ldots,n\}:k\in\mathcal{S}_{i}^{(0)}\text{ or }k=i\}, (60) \displaystyle\mathcal{T}_{\ell}(k_{\ell-1}) \displaystyle=\{k\in\{k_{\ell-1},k_{\ell-1}+1,\ldots,n\}:k\in\mathcal{S}_{k_{\ell-1}}^{(\ell-1)}\text{ or }k=k_{\ell-1}\}\quad\text{for }\ell>1. (61) These sets have the following meaning: • \mathcal{T}_{1} represents the tokens in layer \ell=1 that can receive non-zero gradients from token i in layer \ell=0 , either through attention ( k\in\mathcal{S}_{i}^{(0)} ) or via the residual connection ( k=i ). • \mathcal{T}_{\ell}(k_{\ell-1}) represents the tokens in layer \ell that can receive non-zero gradients from token k_{\ell-1} in layer \ell-1 , either through attention ( k\in\mathcal{S}_{k_{\ell-1}}^{(\ell-1)} ) or via the residual connection ( k=k_{\ell-1} ). The causal constraint ( k\geq i for \mathcal{T}_{1} and k\geq k_{\ell-1} for \mathcal{T}_{\ell} ) is explicitly incorporated in these definitions to account for the causal attention mask. Importantly, the cardinality of these sets directly corresponds to the potential gradient paths through the network. While softmax attention would yield |\mathcal{T}_{\ell}(k_{\ell-1})|=n-k_{\ell-1}+1 paths from each token, \alpha -entmax’s sparsity ensures |\mathcal{T}_{\ell}(k_{\ell-1})|=|\mathcal{S}_{k_{\ell-1}}^{(\ell-1)}|+1 . Hence, if the support size |\mathcal{S}_{j}^{(\ell)}|=s\ll n and assuming that i=j tokens are always in the support due to the residual connections, this reduces the number of terms in the sum from \mathcal{O}(n^{L}) to \mathcal{O}(s^{L}) , drastically reducing the total number of gradient paths. Furthermore, as a direct consequence of Lemma 3.1 , since \alpha -entmax may concentrate probability mass on fewer tokens, the non-zero p_{j,k}^{(\ell)} values can be larger than with softmax. In such cases, the gradients along the remaining paths will be stronger, helping to further alleviate over-squashing by concentrating gradient flow on important tokens. ∎ Empirical Verification of Over-squashing Alleviation. To empirically validate our theoretical prediction that \alpha -entmax reduces gradient paths from \mathcal{O}(n^{L}) to \mathcal{O}(s^{L}) , we conducted a controlled experiment using a delayed copying task. In this task, the model is presented with a sequence consisting of a prefix of random tokens, followed by a separator token, after which it must reproduce the prefix tokens—creating a natural long-range dependency. We trained 8-layer transformers with different attention mechanisms on sequences of length 256, where the model must copy information from the beginning of the sequence to predict tokens after the separator. Figure 7 shows the average gradient norm per layer when backpropagating from the loss to each layer input. Softmax exhibits consistently low gradient norms across all layers, indicating severe gradient dilution. In contrast, \alpha -entmax variants maintain substantially stronger gradient signals, particularly in the earlier layers of the network. This confirms that gradient information propagates more effectively through the network with \alpha -entmax, preserving signal strength even when flowing through multiple layers. The right part of Figure 7 quantifies the average number of non-zero gradient paths per layer. With softmax, nearly all possible connections remain active within numerical precision, creating \mathcal{O}(n^{2}) paths per layer. This compounds across layers, resulting in \mathcal{O}(n^{L}) total paths. \alpha -entmax dramatically reduces the number of active paths, with stronger sparsity (higher \alpha values) creating even sharper reductions. Notably, in the first layer less than 5 tokens are kept active on average. This empirically confirms our theoretical claim that \alpha -entmax prunes the computational graph to \mathcal{O}(s^{L}) paths. Appendix D Non-Dispersion of \alpha -entmax A critical problem in long-context modeling is the dispersion of attention, where relevant signals get diluted across increasingly long sequences. For clarity, we begin by examining how \alpha -entmax behaves with two-level logits, and then proceed to define dispersion more rigorously and how \alpha -entmax naturally counteracts this issue. Lemma D.1 (Threshold Behavior for Two-level Logits) . Consider logits \bm{z}\in\mathbb{R}^{n} where k tokens have value M and (n-k) tokens have value m with M>m . 1. For \alpha>1 , when \Delta:=M-m\geq\frac{k^{-(\alpha-1)}}{\alpha-1} , only the k tokens with value M receive non-zero attention. The threshold converges to \tau(\bm{z})=(\alpha-1)M-k^{-(\alpha-1)} , and each high-value token receives attention \frac{1}{k} while others receive zero attention. As a consequence, \alpha -entmax maintains a constant attention weight of \Theta(\frac{1}{k}) on high-value tokens regardless of the total sequence length n . 2. In contrast, softmax (with fixed temperature \theta>0 ) necessarily disperses with attention weights of \Theta(\frac{1}{n}) as n increases. For softmax to maintain concentration of at least c\in(0,1) on the k high-value tokens, the required logit difference must grow logarithmically with n : \frac{\Delta}{\theta}\geq\ln\left(\frac{n-k}{k}\cdot\frac{c}{1-c}\right) (62) Proof. We prove the two parts below. Part (i): Let \mathcal{S} be the support set. A token i is in \mathcal{S} if and only if z_{i}>\frac{\tau(\bm{z})}{\alpha-1} where \tau(\bm{z}) satisfies: \sum_{i=1}^{n}\left[\,(\alpha-1)z_{i}-\tau(\bm{z})\,\right]_{+}^{\frac{1}{\alpha-1}}=1. (63) For our two-level distribution, this becomes: \sum_{i:z_{i}=M}[\,(\alpha-1)M-\tau(\bm{z})\,]_{+}^{\frac{1}{\alpha-1}}+\sum_{i:z_{i}=m}[\,(\alpha-1)m-\tau(\bm{z})\,]_{+}^{\frac{1}{\alpha-1}}=1. (64) For only tokens with value M to receive non-zero attention, we need: (\alpha-1)M-\tau(\bm{z})>0\quad\text{and}\quad(\alpha-1)m-\tau(\bm{z})\leq 0. (65) Rearranging: (\alpha-1)m\leq\tau(\bm{z})<(\alpha-1)M . In this regime: k\cdot[\,(\alpha-1)M-\tau(\bm{z})\,]^{\frac{1}{\alpha-1}}=1. (66) Solving for \tau(\bm{z}) : \displaystyle[\,(\alpha-1)M-\tau(\bm{z})\,]^{\frac{1}{\alpha-1}} \displaystyle=\frac{1}{k} (67) \displaystyle(\alpha-1)M-\tau(\bm{z}) \displaystyle=k^{-(\alpha-1)} (68) \displaystyle\tau(\bm{z}) \displaystyle=(\alpha-1)M-k^{-(\alpha-1)}. (69) For this threshold to satisfy \tau(\bm{z})\geq(\alpha-1)m , we need: \displaystyle(\alpha-1)M-k^{-(\alpha-1)} \displaystyle\geq(\alpha-1)m (70) \displaystyle M-m \displaystyle\geq\frac{k^{-(\alpha-1)}}{\alpha-1} (71) \displaystyle\Delta \displaystyle\geq\frac{k^{-(\alpha-1)}}{\alpha-1}. (72) Thus, when \Delta\geq\frac{k^{-(\alpha-1)}}{\alpha-1} , only the k tokens with value M receive non-zero attention, each receiving an attention of \frac{1}{k} . Therefore, when \Delta\geq\frac{k^{-(\alpha-1)}}{\alpha-1} , the attention weights for \alpha\text{-entmax} are: \alpha\text{-entmax}(\bm{z})_{i}=\begin{cases}\frac{1}{k}&\text{if }z_{i}=M\\ 0&\text{if }z_{i}=m.\end{cases} (73) These weights remain \Theta(\frac{1}{k}) for high-value tokens regardless of n , demonstrating that \alpha -entmax can maintain constant attention on important tokens even as sequence length grows, as long as k is fixed as n\rightarrow\infty . Part (ii): For softmax with temperature \theta>0 , the attention weight for tokens with logit M is: \softmax(\bm{z}/\theta)_{i}=\frac{\exp(M/\theta)}{k\exp(M/\theta)+(n-k)\exp(m/\theta)}. (74) For softmax to maintain concentration of at least c on the k high-value tokens combined: \frac{k\exp(M/\theta)}{k\exp(M/\theta)+(n-k)\exp(m/\theta)}\geq c. (75) Through algebraic manipulation: \displaystyle k\exp(M/\theta) \displaystyle\geq c\left[k\exp(M/\theta)+(n-k)\exp(m/\theta)\right] (76) \displaystyle(1-c)k\exp(M/\theta) \displaystyle\geq c(n-k)\exp(m/\theta) (77) \displaystyle\frac{k\exp(M/\theta)}{(n-k)\exp(m/\theta)} \displaystyle\geq\frac{c}{1-c} (78) \displaystyle\frac{k}{n-k}\exp(\Delta/\theta) \displaystyle\geq\frac{c}{1-c} (79) \displaystyle\exp(\Delta/\theta) \displaystyle\geq\frac{n-k}{k}\cdot\frac{c}{1-c}. (80) Taking the natural logarithm: \frac{\Delta}{\theta}\geq\ln\left(\frac{n-k}{k}\cdot\frac{c}{1-c}\right). (81) This shows that as n grows, the required \Delta for maintaining concentration with softmax grows logarithmically with n . In contrast, for \alpha -entmax, assuming we have a k that is fixed as n grows, the condition \Delta\geq\frac{k^{-(\alpha-1)}}{\alpha-1} is independent of n , enabling constant focus regardless of sequence length. ∎ We now prove Proposition 3.3 , which concerns the concept of dispersion presented in Definition 3.2 . Proof. We address each claim in turn. For bounded sequences (z_{n})_{n\in\mathbb{N}} , we assume m,M\in\mathbb{R} with m\leq M such that m\leq z_{i}\leq M for every i\in\mathbb{N} . Part (i) - \alpha -entmax can retain probability, while softmax always leaks: For \alpha>1 , consider logits \bm{z}\in\mathbb{R}^{n} and an extended sequence \bm{z}^{*}\in\mathbb{R}^{N} with N>n , where all additional elements have values below the threshold, z_{i}^{*}\leq\tau(\bm{z})/(\alpha-1) for i>n . By the non-vanishing attention property of \alpha -entmax (Lemma 3.1 ), these additional elements receive exactly zero probability, resulting in: \alpha\text{-entmax}(\bm{z})_{i}=\alpha\text{-entmax}(\bm{z}^{*})_{i}\quad\forall i\leq n. (82) This demonstrates that \alpha -entmax can produce identical distributions despite arbitrarily different sequence lengths, maintaining the same concentration regardless of whether we have a distinct number of tokens. In contrast, for softmax ( \alpha=1 ), Barbero et al. 2024 proved that adding any element to the sequence strictly decreases the probability assigned to existing elements, making such invariance impossible. Part (ii) - Complete dispersion of softmax: For softmax with constant temperature \theta>0 , the attention weights for bounded logits can be bounded as: \frac{\exp(m/\theta)}{\sum_{j=1}^{n}\exp(z_{j}/\theta)}\leq\text{softmax}(\bm{z}_{1:n}/\theta)_{i}\leq\frac{\exp(M/\theta)}{\sum_{j=1}^{n}\exp(z_{j}/\theta)}. (83) Since \sum_{j=1}^{n}\exp(z_{j}/\theta)\geq n\cdot\exp(m/\theta) and \sum_{j=1}^{n}\exp(z_{j}/\theta)\leq n\cdot\exp(M/\theta) , we have: \frac{\exp(m/\theta)}{n\cdot\exp(M/\theta)}\leq\text{softmax}(\bm{z}_{1:n}/\theta)_{i}\leq\frac{\exp(M/\theta)}{n\cdot\exp(m/\theta)}. (84) This simplifies to: \frac{1}{n}\exp\left(-\frac{\Delta}{\theta}\right)\leq\text{softmax}(\bm{z}_{1:n}/\theta)_{i}\leq\frac{1}{n}\exp\left(\frac{\Delta}{\theta}\right), (85) where \Delta=M-m is bounded. These bounds show that as n\to\infty , all softmax weights are \Theta(1/n) . For the entropy: H(\text{softmax}(\bm{z}_{1:n}/\theta))=-\sum_{i=1}^{n}\text{softmax}(\bm{z}_{1:n}/\theta)_{i}\log\text{softmax}(\bm{z}_{1:n}/\theta)_{i}\,\,\rightarrow\,\,\log n. (86) Thus, \lim_{n\to\infty}\frac{H(\text{softmax}(\bm{z}/\theta))}{\log n}=1 , showing complete dispersion. Part (iii) - Strong concentration resilience of \alpha -entmax: First, we focus on the two-level case from Lemma D.1 , where k tokens have logit value M and (n-k) tokens have value m . When \Delta=M-m\geq\frac{k^{-(\alpha-1)}}{\alpha-1} , only the k tokens with value M receive non-zero attention: \alpha\text{-entmax}(\bm{z}_{1:n})_{i}=\begin{cases}\frac{1}{k}&\text{if }z_{i}=M\\ 0&\text{if }z_{i}=m.\end{cases} (87) The Shannon entropy of this distribution is: H(\alpha\text{-entmax}(\bm{z}_{1:n}))=-\sum_{i=1}^{k}\frac{1}{k}\log\frac{1}{k}=\log k. (88) The normalized entropy is: \frac{H(\alpha\text{-entmax}(\bm{z}_{1:n}))}{\log n}=\frac{\log k}{\log n}. (89) For fixed k as n\to\infty , this ratio approaches 0, confirming concentration resilience. For cases where the support grows sublinearly as k:=|\mathcal{S}|=\mathcal{O}(n^{\beta}) for some \beta<1 , the Shannon entropy is bounded by: H(\alpha\text{-entmax}(\bm{z}_{1:n}))\leq\log k=\mathcal{O}(\log n^{\beta})=\mathcal{O}(\beta\log n). (90) The normalized entropy is therefore: \lim_{n\to\infty}\frac{H(\alpha\text{-entmax}(\bm{z}_{1:n}))}{\log n}\leq\beta<1. (91) This confirms that the normalized entropy remains strictly bounded away from 1, even with growing support, as long as the growth is sublinear. ∎ This proposition shows that the entropy of attention distributions reveals how concentrated or dispersed they are across tokens. While softmax distributions with bounded logits must approach maximum entropy \mathcal{O}(\log n) as sequence length increases (indicating complete dispersion), \alpha -entmax distributions can maintain bounded entropy \mathcal{O}(\log k) where k is the support size. This allows models with \alpha -entmax to maintain focused, low-entropy attention patterns even when processing extremely long sequences. Moreover, this proposition demonstrates that \alpha -entmax attention distributions have a remarkable property: they do not necessarily disperse as sequence length increases. They can maintain identical attention patterns regardless of context length. This non-dispersion property means transformers with \alpha -entmax can scale to very long contexts without the attention becoming diluted, maintaining their ability to focus on relevant information regardless of how much additional context is present. Appendix E Interaction with Positional Encoding Here, we study—theoretically and empirically—how \alpha -entmax interacts with different positional encoding methods. We follow the same model definition and notation as in § B . E.1 No Positional Encoding (NoPE) We adopt the same set of assumptions as Wu et al. 2025 . Namely, A1 There exists C\in\mathbb{R} such that \underset{t\in\mathbb{N}}{\max}\big\{\|\bm{W}_{Q}^{(t)}\|_{2},\|\bm{W}_{K}^{(t)}\|_{2}\big\}\leq C . A2 The sequence \big\{\|\prod_{t=0}^{k}\bm{W}_{V}^{(t)}\|_{2}\big\}_{k=0}^{\infty} is bounded. The first assumption tells that key and query weight matrices are bounded. The second assumption ensures that the node representations’ trajectories across t layers stays within a fixed interval [-C^{2},C^{2}] . Proposition E.1 (No Positional Encoding with \alpha -entmax) . Let \mathcal{G} be the causal mask graph and \bm{P}^{(\ell)}\in\mathbb{R}^{n\times n} represent the causal attention matrix at layer \ell computed row-wise using \alpha -entmax ( \alpha subscript) with \alpha\in(1,2] or softmax ( soft subscript). In particular, let p^{(\ell)}_{ij} denote the (i,j) probability entry in \bm{P}^{(\ell)} . Further, let \tilde{\bm{P}}^{(\ell)}=\bm{P}^{(\ell)}\cdots\bm{P}^{(0)} represent the product of attention matrices through layer \ell , which we call the cumulative attention matrix, which captures how information from tokens in the input layer flows to tokens in layer \ell through the composition of attention operations. For softmax, Wu et al. 2025 have shown that \lim_{\ell\to\infty}\tilde{p}^{(\ell)}_{\text{soft},i1}=1 for all 1\tau(\bm{z}^{(\ell)}_{i}) , where z^{(\ell)}_{ij}=\langle\bm{q}^{(\ell)}_{i},\bm{k}^{(\ell)}_{j}\rangle and \tau(\bm{z}^{(\ell)}_{i}) is the entmax threshold. Otherwise, p^{(\ell)}_{\alpha,ij}=0 and the edge is removed for that layer. 2. Modified attention patterns: Unlike softmax, \alpha -entmax with \alpha>1 creates sparse attention patterns by completely removing some connections. For tokens that survive the threshold, the behavior of their attention weights depends on: • How far the token’s logit sits above the threshold • The relative differences between logits For tokens that remain connected through the dynamic attention graph \mathcal{G}^{(\ell)}_{\alpha} at all layers, the cumulative attention still exhibits a decay pattern: \tilde{p}^{(\ell)}_{\alpha,ij}\leq C(1-\delta_{ij})^{\ell} (92) where \delta_{ij} depends on the connectivity pattern of the dynamic attention graph. This decay rate differs from softmax due to edge pruning and the redistribution of probability mass. 3. Disrupted limit behavior: Unlike softmax, \alpha -entmax does not necessarily converge to the first token: (a) If for every layer \ell , there exists at least one directed path from token 1 to token i in the dynamic graph \mathcal{G}^{(\ell)}_{\alpha} , then: \lim_{\ell\to\infty}\tilde{p}^{(\ell)}_{\alpha,i1}=1. (93) (b) If at some layer \ell_{0} , directed paths from token 1 to token i are deleted in \mathcal{G}^{(\ell_{0})}_{\alpha} , then: 0\leq\lim_{\ell\to\infty}\tilde{p}^{(\ell)}_{\alpha,i1}<1, (94) with the exact limit determined by the structure of the strongly connected components formed in the dynamic graph. Proof. (i) Edge deletion: For \alpha -entmax, a coefficient is non-zero if and only if its pre-activation exceeds the layer-specific threshold. The stated condition follows directly from the definition of \alpha -entmax: p^{(\ell)}_{\alpha,ij}=[(\alpha-1)z^{(\ell)}_{ij}-\tau(\bm{z}^{(\ell)}_{i})]_{+}^{\frac{1}{\alpha-1}}, (95) where [x]_{+}=\max(0,x) . (ii) Modified attention patterns: For \alpha -entmax, the attention weights are determined by thresholding: p_{i}^{\alpha}=[(\alpha-1)z_{i}-\tau]_{+}^{\frac{1}{\alpha-1}}. (96) Let \tau^{\prime}=\frac{\tau}{\alpha-1} for simplicity. Consider two tokens with logits z_{i}\geq z_{j} both in the support. The ratio of their probabilities is: \frac{p^{\alpha}_{j}}{p^{\alpha}_{i}}=\left(\frac{z_{j}-\tau^{\prime}}{z_{i}-\tau^{\prime}}\right)^{\frac{1}{\alpha-1}}. (97) For softmax, the ratio is: \frac{p^{\text{soft}}_{j}}{p^{\text{soft}}_{i}}=e^{-(z_{i}-z_{j})}. (98) The comparison between these ratios depends on how far z_{j} sits above \tau^{\prime} . Let \Delta=z_{i}-z_{j} and b=z_{j}-\tau^{\prime} . Through algebraic manipulation, we can show: \frac{p^{\alpha}_{j}}{p^{\alpha}_{i}}\gtrless\frac{p^{\text{soft}}_{j}}{p^{\text{soft}}_{i}}\Leftrightarrow b\gtrless\frac{\Delta}{e^{(\alpha-1)\Delta}-1}. (99) This means the relative behavior of attention weights in \alpha -entmax compared to softmax depends on the specific configuration of logits and thresholds, rather than following a simple universal relationship. Since tokens that remain connected must distribute probability mass among fewer options (due to pruning), there exists some 0<\delta_{ij}<1 such that: \tilde{p}^{(\ell)}_{\alpha,ij}\leq C(1-\delta_{ij})^{\ell}. (100) The specific value of \delta_{ij} depends on the connectivity pattern of the dynamic attention graph and may differ significantly from the softmax case due to edge pruning and probability redistribution. (iii) Disrupted limit behavior. (a) Case where paths to token the first token persist: Suppose that for every layer \ell , there exists at least one directed path from token 1 to token i in the dynamic graph \mathcal{G}^{(\ell)}_{\alpha} — the unique “center node” as defined by Wu et al. 2025 . For any token j>1 , the geometric decay established in part (ii) applies: \tilde{p}^{(\ell)}_{\alpha,ij}\leq C(1-\delta_{ij})^{\ell}\to 0\text{ as }\ell\to\infty. (101) Since the row sums of \tilde{\bm{P}}^{(\ell)} must equal 1 (as it is a product of row-stochastic matrices), and all entries \tilde{p}^{(\ell)}_{\alpha,ij} with j>1 approach 0, we have: \lim_{\ell\to\infty}\tilde{p}^{(\ell)}_{\alpha,i1}=1-\lim_{\ell\to\infty}\sum_{j=2}^{i}\tilde{p}^{(\ell)}_{\alpha,ij}=1. (102) (b) Case where paths to token 1 are cut: The key difference from softmax arises when edge deletion creates a configuration where token 1 cannot reach token i . Let \ell_{0} be the first layer where paths from token 1 to token i are removed in \mathcal{G}^{(\ell_{0})}_{\alpha} . Let \mathcal{C}_{i}^{(\ell_{0})}\subset\{1,2,...,n\} be the set of tokens in the same strongly connected component as token i in \mathcal{G}^{(\ell_{0})}_{\alpha} . By our assumption, 1\notin\mathcal{C}_{i}^{(\ell_{0})} . At layer \ell_{0} , the attention probability is distributed only among tokens in \mathcal{C}_{i}^{(\ell_{0})} : \sum_{j\in\mathcal{C}_{i}^{(\ell_{0})}}p^{(\ell_{0})}_{\alpha,ij}=1\text{ and }p^{(\ell_{0})}_{\alpha,i1}=0. (103) For all layers \ell>\ell_{0} , the multiplication by zero ensures \tilde{p}^{(\ell)}_{\alpha,i1}=0 , and therefore: 0\leq\lim_{\ell\to\infty}\tilde{p}^{(\ell)}_{\alpha,i1}<1. (104) The exact limit depends on the structure of the strongly connected components formed in the dynamic graph through subsequent layers. In fact, the limit can be exactly zero whenever all paths from token 1 to token i are removed from \mathcal{G}_{\alpha} since layer \ell_{0} . ∎ This proposition demonstrates a fundamental difference between softmax and \alpha -entmax transformers: while softmax inevitably leads to concentration of attention on the first token, \alpha -entmax can potentially disrupt this position bias through its ability to dynamically prune edges in the attention graph. This provides a theoretical foundation for using sparse attention mechanisms to mitigate position bias in transformer architectures. E.2 ALiBi We start by recalling the definition of ALiBi from ( Press et al. 2022 ) . Definition E.2 (ALiBi Positional Encoding) . Let H be the number of attention heads. A general form of ALiBi bias for head h\in\{1,2,\ldots,H\} can be defined as: b_{ij}^{(h)}=\begin{cases}m_{h}(j-i)&\text{if }j\leq i\\ 0&\text{otherwise},\end{cases} (105) where m_{h}\in\mathbb{R}_{+} is the slope parameter for head h , defined as m_{h}=2^{-\frac{h}{H}} . Now, we consider how it interacts with \alpha -entmax. Proposition E.3 (ALiBi with \alpha -entmax) . Consider \alpha -entmax attention with the ALiBi bias from the above definition. Assume the raw attention logits z^{(h)}_{ij}\in[z^{(h)}_{\min},z^{(h)}_{\max}] for all i,j . Let d_{\max}^{(h)}=\left\lfloor\frac{z^{(h)}_{\max}-z^{(h)}_{\min}+\frac{1}{\alpha-1}}{m_{h}}+1\right\rfloor. (106) Then, any token j with (i-j)>d^{(h)}_{\max} receives zero attention from token i at head h . Proof. For a token j to receive non-zero attention from token i with \alpha -entmax, we require: (\alpha-1)(z^{(h)}_{ij}+b_{ij}^{(i)})>\tau, (107) where \tau is the threshold ensuring normalization. Since slopes are positive ( m_{i}>0 ), we have: (\alpha-1)(z^{(h)}_{ij}-(i-j)m_{h})>\tau. (108) In the extreme case where only the closest token receives attention (single-support case), we can solve for \tau exactly: 1=\left[(\alpha-1)(z^{(h)}_{\max}-\tau)\right]^{\frac{1}{\alpha-1}}\Rightarrow(\alpha-1)(z^{(h)}_{\max}-\tau)=1\Rightarrow\tau=z^{(h)}_{\max}-\frac{1}{\alpha-1}. (109) Since the logits drop by at least m_{h} per position due to the ALiBi bias, we have z^{(h)}_{\max}\geq z^{(h)}_{\min}+m_{h} , which gives us: \tau\geq z^{(h)}_{\min}+m_{h}-\frac{1}{\alpha-1}. (110) For a token j with distance (i-j) , even with the maximum logit z^{(h)}_{\max} : (\alpha-1)(z^{(h)}_{\max}-(i-j)m_{h})\leq(\alpha-1)(z^{(h)}_{\min}-m_{h})-1. (111) Solving for (i-j) : (i-j)\geq\frac{z^{(h)}_{\max}-z^{(h)}_{\min}+m_{h}+\tfrac{1}{\alpha-1}}{m_{h}}. (112) Hence, d^{(h)}_{\max}=\left\lfloor\frac{z^{(h)}_{\max}-z^{(h)}_{\min}+\frac{1}{\alpha-1}}{m_{h}}+1\right\rfloor. (113) ∎ This proposition establishes that with \alpha -entmax and ALiBi positional bias, there exists a head-dependent hard cutoff distance d^{(h)}_{\max} beyond which tokens receive exactly zero attention. This creates an adaptive but bounded attention window that depends on both content relevance ( z^{(h)}_{\max}-z^{(h)}_{\min} ) and the sparsity parameter \alpha , naturally limiting the effective context without requiring explicit truncation. This property allows the model to focus computational resources on a relevant window of tokens, which can be particularly valuable for efficiently processing long documents. E.3 RoPE To analyze the interaction between RoPE ( Su et al. 2024 ) and \alpha -entmax, we first establish our notation. Following Barbero et al. 2025 , we consider queries \bm{q}_{i}\in\mathbb{R}^{d} and keys \bm{k}_{j}\in\mathbb{R}^{d} , where i and j are token positions in the sequence. RoPE decomposes these vectors into d/2 two-dimensional chunks, denoted as \bm{q}_{i}^{(k)}\in\mathbb{R}^{2} and \bm{k}_{j}^{(k)}\in\mathbb{R}^{2} for k\in\{1,\ldots,d/2\} . Each chunk rotates at a different frequency g_{k}=\theta^{-2(k-1)/d} , where \theta (typically 10,000) is the base wavelength parameter. RoPE applies position-dependent rotations through matrices \rho(g_{k})^{i} to transform the original queries and keys. The resultant raw attention logit between query position i and key position j is: In a standard transformer with RoPE, z_{ij}=\sum_{k=1}^{d/2}\langle\bm{q}_{i}^{(k)},\rho(g_{k})^{j-i}\bm{k}_{j}^{(k)}\rangle, (114) where \rho(g_{k}) is the 2D rotation matrix with frequency g_{k} . Query-Key Interaction with RoPE. Let \phi_{ijk} be the angle between the original (unrotated) vectors \bm{q}_{i}^{(k)} and \bm{k}_{j}^{(k)} . That is: \displaystyle\cos(\phi_{ijk})=\frac{\langle\bm{q}_{i}^{(k)},\bm{k}_{j}^{(k)}\rangle}{\|\bm{q}_{i}^{(k)}\|_{2}\|\bm{k}_{j}^{(k)}\|_{2}}. (115) For a single 2D chunk, since rotation preserves vector magnitudes, the contribution to the raw score is: \displaystyle\langle\bm{q}_{i}^{(k)},\rho(g_{k})^{j-i}\bm{k}_{j}^{(k)}\rangle \displaystyle=\|\bm{q}_{i}^{(k)}\|_{2}\|\rho(g_{k})^{j-i}\bm{k}_{j}^{(k)}\|_{2}\cos(\phi_{ijk}+g_{k}(j-i)) (116) \displaystyle=\|\bm{q}_{i}^{(k)}\|_{2}\|\bm{k}_{j}^{(k)}\|_{2}\cos(\phi_{ijk}+g_{k}(j-i)), (117) where \phi_{ijk} is the original angle between \bm{q}_{i}^{(k)} and \bm{k}_{j}^{(k)} . As shown in Proposition 3.1 of Barbero et al. 2025 , RoPE allows for maximal attention at any arbitrary distance. However, RoPE combined with \alpha -entmax creates a hard boundary on attention distance due to the thresholding effect, which we analyze next. Approximation for Small Angles. First, note that we can use the angle-sum expansion for cosine as follows: \cos(\phi_{ijk}+g_{k}(j-i))=\cos(\phi_{ijk})\cos(g_{k}(j-i))-\sin(\phi_{ijk})\sin(g_{k}(j-i)). (118) Further, note that for small angles \phi_{ijk} we can use a second-order Taylor expansion for g_{k}(j-i) : 4 4 4 \cos(x)\approx 1-x^{2}/2+\text{higher order terms}. \cos(g_{k}(j-i))\approx 1-\frac{g_{k}^{2}(j-i)^{2}}{2}. (119) Finally, applying the dot-product: \displaystyle z_{ij} \displaystyle\approx\sum_{k=1}^{d/2}\|\bm{q}_{i}^{(k)}\|_{2}\|\bm{k}_{j}^{(k)}\|_{2}\cos(\phi_{ijk})-\sum_{k=1}^{d/2}\|\bm{q}_{i}^{(k)}\|_{2}\|\bm{k}_{j}^{(k)}\|_{2}\cos(\phi_{ijk})\frac{g_{k}^{2}(j-i)^{2}}{2}+\sin\text{terms} (120) \displaystyle\approx z_{\max}-\sum_{k=1}^{d/2}c_{k}g_{k}^{2}(i-j)^{2}. (121) Here, we simplified the last step by focusing on the quadratic decay from the cosine term while omitting the sine terms -\sin(\phi_{ijk})g_{k}(j-i) . For semantically aligned tokens where \phi_{ijk}\approx 0 , the sine term’s contribution is minimal since \lim_{x\to 0}\sin(x)=0 . Proposition E.4 (Maximum Attention Distance for RoPE (Small-Angle Regime)) . Let g_{\max}=\max_{k}g_{k} be the maximum frequency in RoPE. Within the small-angle domain where |i-j|\leq\frac{\pi}{2g_{\max}}, so that all rotational angles \theta=g_{k}(i-j) satisfy |\theta|\leq\frac{\pi}{2} , and assuming z_{\max}>\frac{\tau(\bm{z}_{i})}{\alpha-1} , there exists a critical distance d_{\max} beyond which tokens receive exactly zero attention: d_{\max}=\left\lfloor\sqrt{\frac{z_{\max}-\frac{\tau(\bm{z}_{i})}{\alpha-1}}{\sum_{k=1}^{d/2}c_{k}g_{k}^{2}}}\right\rfloor. (122) Proof. For a token to receive non-zero attention under \alpha -entmax, we must have z_{ij}>\frac{\tau(\bm{z}_{i})}{\alpha-1} . Substituting the decay pattern from Equation 120 , which is valid within the small-angle domain where cosine can be approximated using a Taylor expansion \cos\theta\approx 1-\frac{\theta^{2}}{2} : z_{\max}-\sum_{k=1}^{d/2}c_{k}g_{k}^{2}(i-j)^{2}>\frac{\tau(\bm{z}_{i})}{\alpha-1}. (123) Rearranging for (i-j)^{2} : (i-j)^{2}<\frac{z_{\max}-\frac{\tau(\bm{z}_{i})}{\alpha-1}}{\sum_{k=1}^{d/2}c_{k}g_{k}^{2}}. (124) Taking the floor of the square root gives us d_{\max} . ∎ Note that this analysis applies to the first attention window. Due to the periodicity of rotation operations, at distances beyond \frac{\pi}{g_{k}} for any frequency component k , the attention pattern may exhibit additional windows of non-zero attention, which we address next. Proposition E.5 (Frequency-Specific Cutoff for RoPE) . For each frequency component k , let \beta_{k}=\frac{\tau(\bm{z}_{i})}{(\alpha-1)\|\bm{q}_{i}^{(k)}\|_{2}\|\bm{k}_{j}^{(k)}\|_{2}} . Since at least one token must receive non-zero attention for \alpha -entmax to yield a valid probability distribution, \beta_{k}\leq 1 must hold for at least one component. Assuming \beta_{k}\in[-1,1] (covering all possible cosine values), there exists a sequence of distances \{d_{k,n}\}_{n=0}^{\infty} at which its contribution to attention crosses the threshold. The first such distance is: d_{k,0}=\left\lfloor\frac{1}{g_{k}}\arccos\left(\frac{\tau(\bm{z}_{i})}{(\alpha-1)\|\bm{q}_{i}^{(k)}\|_{2}\|\bm{k}_{j}^{(k)}\|_{2}}\right)\right\rfloor. (125) Due to the periodicity of cosine, subsequent threshold crossings occur at approximately: d_{k,n}\approx\frac{2\pi n\pm d_{k,0}}{g_{k}},\quad n\in\mathbb{N}. (126) Furthermore, d_{k,0} is non-increasing in \alpha and inversely proportional to g_{k} . Proof. For a single frequency component k , the contribution to the raw score from Equation 116 is: \langle\bm{q}_{i}^{(k)},\rho(g_{k})^{j-i}\bm{k}_{j}^{(k)}\rangle=\|\bm{q}_{i}^{(k)}\|_{2}\|\bm{k}_{j}^{(k)}\|_{2}\cos(g_{k}(j-i)+\phi_{ijk}). (127) For this to exceed the attention threshold under optimal alignment ( \phi_{ijk}=0 , which maximizes the contribution): \displaystyle(\alpha-1)\|\bm{q}_{i}^{(k)}\|_{2}\|\bm{k}_{j}^{(k)}\|_{2}\cos(g_{k}(j-i)) \displaystyle>\tau(\bm{z}_{i}) (128) \displaystyle\cos(g_{k}(j-i)) \displaystyle>\frac{\tau(\bm{z}_{i})}{(\alpha-1)\|\bm{q}_{i}^{(k)}\|_{2}\|\bm{k}_{j}^{(k)}\|_{2}}. (129) Taking the arccos of both sides and dividing by g_{k} gives the first threshold crossing distance d_{k,0} : |i-j|>\frac{1}{g_{k}}\arccos\left(\frac{\tau(\bm{z}_{i})}{(\alpha-1)\|\bm{q}_{i}^{(k)}\|_{2}\|\bm{k}_{j}^{(k)}\|_{2}}\right). (130) Due to the 2\pi -periodicity of cosine, subsequent threshold crossings occur at distances \frac{2\pi n\pm d_{k,0}}{g_{k}} for integers n>0 . Moreover, \tau(\bm{z}_{i})/(\alpha-1) grows as \alpha increases, making the arccos term smaller and consequently decreasing d_{k,0} . The inverse proportionality to g_{k} is evident directly from the formula. ∎ These theoretical analyses of RoPE with \alpha -entmax reveal two interesting takeaways. First, different frequency components in RoPE naturally create attention windows of different widths. High-frequency components (large g_{k} ) produce very narrow windows focused on local context, while low-frequency components (small g_{k} ) enable attention over longer distances. Second, the sparsity pattern induced by the combination of RoPE and \alpha -entmax is not uniform but varies across frequency components, creating a more complex attention structure than simple distance-based decay methods like ALiBi. E.4 Comparison between Positional Encoding Methods with \alpha -entmax The positional encoding scheme used in a transformer has significant implications for how attention behaves over long contexts. Our theoretical approach from previous subections reveals that \alpha -entmax interacts with positional encodings in ways that fundamentally alter attention behavior compared to softmax. We summarize our theoretical findings next, along with an empirical analysis within a controlled experimental setting. Theoretical Analysis. With NoPE ( Kazemnejad et al. 2023 ) , softmax transformers (without MLP layers) develop an implicit bias towards the first tokens as depth increases, as shown by Wu et al. 2025 . \alpha -entmax disrupts this behavior through its ability to create disconnected attention graphs. By assigning exactly zero attention to some connections, it may remove the implicit bias encouraging attention to concentrate on early tokens. When combined with ALiBi ( Press et al. 2022 ) , \alpha -entmax transforms the smooth linear decay into a hard attention window. For tokens separated by distance d>d_{\max}^{(h)} , where d_{\max}^{(h)}=\left\lfloor\frac{1}{m_{h}}(z_{\max}-z_{\min}+\frac{1}{\alpha-1})+1\right\rfloor , attention weights become exactly zero. This creates an adaptive but bounded attention window that depends on the input ( z_{\max}-z_{\min} ) and the sparsity parameter \alpha . With RoPE ( Su et al. 2024 ) , \alpha -entmax induces frequency-dependent sparsity. Each frequency component k has a critical distance d_{k} beyond which its contribution falls below the attention threshold. This creates a multi-scale attention pattern where nearby tokens interact through all frequency components, while distant tokens interact only through low-frequency components. These interactions between positional encodings and \alpha -entmax have important practical implications, and further motivate the introduction of our hybrid approach, NAPE (§ 4.2 ). By creating natural, content-adaptive attention windows, NAPE combine the benefits of sparse, focused attention with awareness of token positions, allowing models to effectively balance local and global information processing. This provides a principled alternative to manually designed sparse attention patterns like sliding windows or dilated attention, with the advantage of adapting to content relevance rather than using fixed patterns. Figure 8 : Per-head attention centroids across different positional encoding methods. Each panel represents one attention head’s behavior. The dashed line shows the identity function (attending to self). NoPE heads consistently exhibit an early-token bias, ALiBi heads maintain proximity-based attention, and RoPE heads display more varied patterns with irregular fluctuations. Empirical Analysis Setup. We simulated a sequence of length n=128 with attention heads using \alpha -entmax ( \alpha=1.5 ). For each query position i , we generated a vector of raw attention scores (logits) for all positions j\leq i according to: z_{ij}=z_{ij}^{\text{base}}+z_{ij}^{\text{prox}}+z_{ij}^{\text{noise}}, (131) where z_{ij}^{\text{base}}\sim\mathcal{U}(Z_{\min},Z_{\max}) represents the base content-based affinity, z_{ij}^{\text{prox}}=0.2(Z_{\max}-Z_{\min})(1-0.5\frac{|j-i|}{i}) introduces a proximity bias, and z_{ij}^{\text{noise}}\sim\mathcal{N}(0,\sigma^{2}) adds Gaussian noise. The parameters were set to Z_{\min}=-5.0 , Z_{\max}=5.0 , and \sigma=0.5 . This formulation models a realistic mixture of content-based attention (random component), a mild inherent bias toward nearby tokens (proximity component), and natural variation (noise component). We then applied different positional encoding methods to modify these base logits. Finally, we calculated the attention distribution using \alpha -entmax and determined the attention centroid for each query position i as \text{centroid}_{i}=\sum_{j=1}^{i}j\cdot p_{ij} , where p_{ij}=\alpha\text{-entmax}(\bm{z}_{i})_{j} . Empirical Results. The head-specific analysis in Figure 8 reveals distinct behaviors across positional encoding methods when combined with \alpha -entmax. While seems to NoPE exhibit a weak bias towards earlier positions, it also shows a modest variability, indicating more disperse attention. ALiBi clearly creates a consistent recency bias, with centroids following slightly below the identity line, maintaining low variability that indicates focused attention. RoPE demonstrates centroid patterns similar to NoPE but with lower entropy (higher variability), suggesting a focused attention in more distant positions. These observations may explain why NAPE—the hybrid NoPE+ALiBi— works well in practice, since ALiBi heads provide consistent positional structure focused on recent context, while NoPE heads can contribute complementary via early-token and semantic focus, creating a more balanced attention mechanism than either approach alone. In fact, as we show in § H.1 , models equipped with NoPE are flexible enough and can acquire relative positional encoding, thus also supporting the original hypothesis of Kazemnejad et al. 2023 . Therefore, in NAPE has the ability to encourage short-span focus with ALiBi alongside learning more longer-span focus that are guided via semantic information with NoPE. Appendix F Adaptive-Scalable \alpha -entmax (ASEntmax) F.1 Learning Scalers for Language Modeling To verify our scaling approach, we follow the setup from ( Nakanishi 2025 ) and trained a language model with learnable scales p_{i} for each i -th position. However, we do so independently for each head in the model. Specifically, we train a 12-layer transformer with approximately 120 million parameters. We set hidden size to 768, attention heads to 12, MLP intermediate size to 2048, learning rate to 6\times 10^{-4} , weight decay to 0.001 , batch size to 1M tokens, and sequence length to 1024. Each head thus contains 1024 learnable parameters (1 per position). Finally, we train on the FineWeb dataset for a total of 5 billion tokens. Figure 9 : Heatmaps for \beta and \gamma per head for Scalable \alpha -entmax. In Figure 4 we show how the \delta_{h}+\beta_{h}(\log n)^{\gamma_{h}} scaling performs well for different attention heads. In contrast, removing \gamma_{h} —as done by Nakanishi 2025 —leads to a severe degradation fit for several heads. Specifically, the linear fit has an overall R^{2}=0.12 , the log fit has R^{2}=-14 (severe underfitting), and our log with a \gamma exponent has R^{2}=0.17 . The full set of \beta_{h} and \gamma_{h} learned by our approach are shown in Figure 9 . Effect of Negative \gamma_{h} . Experiments on the Copy task, shown in Table 7 , suggest that, without scaling, \alpha -entmax can hurt performance, leading to a noticeable drop in accuracy in the OOD scenario. Introducing an adaptive temperature, however, substantially mitigates this effect. We hypothesize that Copy requires less sparse attention patterns, which can be accomplished by applying a negative power to the logarithm function. We confirm this hypothesis in Figure 13 , which shows that ASEntmax learns negative values of \gamma_{h} in all heads, resulting in more spread-out attention distributions. Appendix G Experimental Details G.1 Synthetic Data Following the data diversity assumptions of Zhou et al. 2024 , we generate a large number of samples—between 10 million and 50 million, depending on task complexity. See Table 2 for training/test details on for each task along with model hyperparameters. The 2Back and Local Count tasks are token-classification tasks, while the remaining tasks are generative. In Figure 10 , we show examples of the tasks we introduce in this work. 2Back. In this classification task, the model must predict the class of the token that appeared two positions earlier. Via this task, we examine the ability of models equipped with NoPE to learn relative positional bias and assess their behaviour in out-of-distribution scenarios (see H.1 ). Local Count. The Local Count task is a classification task in which the model must predict the number of times a word has occurred so far. We restrict the vocabulary size to 16, allowing multiple clusters of the same word to appear within a sequence multiple times. This increases the task’s difficulty, as the model must distinguish between different clusters of identical words. We sample the number of repetitions for each cluster uniformly from \mathcal{U}(1,48) to test whether models equipped with NoPE can learn a longer focus span than observed in the 2Back task. Flip-Flop ( Liu et al. 2023 ) . Flip-Flop uses sequences made up of alternating instructions "write", "ignore", and "read" ( w, i ,r ). Each instruction is paired with a bit (0 or 1). The model must memorize the bit if it follows a w , and recall the last stored bit when it encounters an r . For example, in the string "i 0 w 0 i 1 i 1 w 1 i 0 i 1 r" , the correct output is 1. We conducted experiments on two datasets with different “write” instruction probabilities: 10\% - sparse, 80\% - dense. Max Retrieval. We follow Veličković et al. 2024 in constructing the Max Retrieval dataset and the model architecture. Multi-Query Multi-Token Associative Recall (MQMTAR). MQMTAR is a retrieval task in which models must produce a sequence of multi-token values corresponding to the queries provided at the end of the input sequence (see Figure 10 ). MQMTAR employs three special tokens: (1) 0 for empty space; (2) 1 as the key–value delimiter; and (3) 3 as the query delimiter, which is also used to separate values in the target sequence. We set the lengths of both keys and values to be 2 tokens, resulting in 5 tokens per key-value pair in the input. The number of queries is 4, and the density of key-value pairs is 80\% of the total number of tokens. Finally, the size of alphabet is 256 from which we constructed 100K key-value pairs. Sort, Copy and Reverse. These are well-known tasks for testing models’ length generalization ( Kazemnejad et al. 2023 ) . We use a small vocabulary size of 32 to generate more sequences with repeated tokens, since models must handle such repetitions increasingly as sequence length grows. Figure 10 : Examples of the introduced tasks. MQMTAR : Each digit is a token; the alphabet size is 10, and the number of queries is 2. 2Back : A special token 0 is added at the beginning of the sequence to ensure the model has something to predict at the first two positions; the vocabulary size is 10. Local Count : The maximum number of repetitions is 4, and the vocabulary size is 8. G.2 Models All synthetic tasks are trained with a decoder-like transformer. We evaluate models in extreme settings by using as few layers as possible as our aim is to test the attention mechanism coupled with our positional-encoding strategy, rather than the scaling capabilities of transformer. However, for the Reverse task—which proved particularly challenging for softmax-based models—we increment the layer count until the softmax baseline generalizes to at least 1.5x the in-distribution length. For experiments with RoPE, we use the Hugging Face implementation from LLaMA 3 ( Grattafiori et al. 2024 ) , which includes RoPE scaling. Since our sequences are relatively short, the base frequency is set to its default value of 10{,}000 . To improve length extrapolation in RoPE-based models, we apply a scaling factor of 16 , which we found to be optimal for Flip-Flop under 4\times extrapolation (see Table 8 ); factors of 8 or 32 degrade performance. For NAPE, each ALiBi head uses a slope of m=\frac{1}{h} , where h is the head index. We employ 8 attention heads for all tasks except Copy and MQMTAR, where 16 heads yields a performance boost across all models. In case of ASEntmax, \beta^{i}_{h} and \gamma^{i}_{h} are computed per token i via linear projections followed by activations softplus and tanh respectively, allowing to scale attention adaptively based on content. For our experiments with \alpha -entmax, we use \alpha=1.5 as the default value for the \alpha -entmax models, unless mentioned otherwise. Furthermore, we use the Gemma2 implementation from Hugging Face, but disabling sliding-window attention in all layers. For experiments with \alpha -entmax, we replaced FlashAttention with AdaSplash ( Gonçalves et al. 2025 ) . For optimization, we use the AdamW with default betas and a cosine learning-rate scheduler with warm-up, setting 10K warm-up steps. Given the large training corpus, we do not employ dropout or weight decay. In addition, we use bfloat16 in all experiments. All models are relatively small (2–10M parameters) and fit on a single GPU. We observe that even when models are 100\% accurate in-distribution, they still require significantly more training; in some cases, the training loss reached as low as 10^{-8} . Therefore, the best checkpoint is selected based on performance at 8\times the in-distribution sequence length. In some cases such as the Sort task and models with RoPE, where generalization up to 8\times was not possible, we use BLEU as an intermediate metric and 2\times or 4\times the in-distribution sequence length. We perform evaluation with 1K samples per sequence length. 2Back and Local Count are evaluated using accuracy, as they are classification tasks, whereas for the remaining tasks, we use exact match accuracy—assigning 1 only if the entire predicted sequence matches the reference and 0 otherwise. We report results for the single best-performing model selected from experiments conducted with multiple random seeds (3) and various learning rates. Finally, for some tasks, we also report results for SEntmax—which learns \beta and \gamma directly, without linear projections or nonlinearities—and also for ASSMax—which applies our adaptive-scaling strategy to Softmax. Table 2 : Task details and hyperparameters. Task Samples Length Batch Vocab. Heads Layers Hid. dim. Int. dim. 2Back 10M 32-64 128 16 8 2 256 512 Local Count 10M 64-128 128 16 8 3 128 512 Flip-Flop 10M 32-64 128 4 8 4 256 512 Copy 20M 32-64 128 32 16 2 256 1024 Reverse 30M 32-64 128 32 8 6 256 512 MQMTAR 50M 32-64 128 256 16 4 512 1024 Sort 40M 32-64 128 32 8 2 256 1024 Appendix H Additional Results In this section, we provide a more detailed analysis of each task. H.1 2Back Table 3 : Accuracy (%) on 2Back. ID Out-of-Distribution Model 64 128 256 512 1024 2048 4096 RoPE Softmax 100.0 100.0 100.0 99.3 81.4 63.4 41.1 SSMax 100.0 100.0 100.0 99.8 98.5 90.4 69.0 Entmax 100.0 98.2 94.8 83.7 65.5 45.7 31.3 ASEntmax 100.0 100.0 100.0 95.0 61.2 36.2 22.1 NoPE Softmax 99.9 83.2 51.4 30.1 18.5 12.7 9.7 SSMax 100.0 80.5 47.2 27.2 16.9 11.8 9.2 Entmax 100.0 77.3 50.5 33.2 20.7 13.7 10.2 ASEntmax 100.0 90.3 55.1 36.5 24.3 16.2 11.5 NAPE Softmax 100.0 100.0 100.0 100.0 100.0 100.0 100.0 SSMAx 100.0 100.0 100.0 100.0 100.0 100.0 100.0 Entmax 100.0 100.0 100.0 100.0 100.0 100.0 100.0 ASEntmax 100.0 100.0 100.0 100.0 100.0 100.0 100.0 Following the hypothesis of Kazemnejad et al. 2023 that NoPE can learn a relative positional bias, we conducted experiments on the simple 2Back task, in which the model must predict the class of the token two positions earlier. Table 3 shows that models equipped with NoPE achieve perfect in-distribution performance. Moreover, the attention maps in Figure 11 (left) confirm that NoPE indeed acquires relative positional encodings, thus supporting the hypothesis. However, the OOD attention maps (right part) reveal that, as sequence length increases, the recency bias diffuses unevenly across positions. Such behavior is detrimental in tasks requiring attention to a fixed-size local context (e.g., associative recall, previous instructions in code, n-grams in text). By contrast, ALiBi constrains attention to a local window irrespective of content. Moreover, we observe that ASEntmax partially mitigates diffusion in the attention maps (bottom right), which is also reflected in the accuracy gains shown in Table 11 . In our design of positional encoding, NoPE + ALiBi (NAPE), half of the attention heads employ a faster-decaying variant of ALiBi to enforce a short-span focus, while the remaining heads use NoPE which can 1) learn a focus that spans longer and depends on position 2) guide attention semantically. Softmax Entmax \alpha=1.5 ASEntmax \alpha=1.5 Figure 11 : Comparison of attention maps for the 2Back task. Left: In-distribution, sequence length 64. Right: Out-of-distribution, sequence length 512 (for visualization clarity, we applied max pooling with a window size 4 and stride 4). The maps are shown for the second layer for all models. We can observe that diagonal patterns are less distorted with \alpha -entmax. Moreover, ASEntmax mitigate dispersal of the diagonal pattern up to 3\times the in-distribution sequence length and make it less distorted up to 8\times . H.2 Local Count As observed (Table 4 ), models using ALiBi perfectly solve the task, which is unsurprising given that ALiBi induces a recency bias. Furthermore, the results for ALiBi and NAPE suggest that models can rely exclusively on ALiBi heads in case of NAPE. With NoPE, however, the model is challenged because identical tokens are not distinguishable at the very first layer. Therefore, the model must develop a mechanism to locate the current cluster. Figure 12 indicates that by the third layer, the NoPE model exhibits a relative positional bias. Combined with the bias observed in 2Back, this indicates that NoPE models can acquire various content-based recency biases that differ from those induced by ALiBi or RoPE. Finally, for Local Count, we observe no improvement in NoPE models when using attention scaling. Table 4 : Accuracy (%) on Local Count. ID Out-of-distribution Model 128 256 512 1024 2048 4096 RoPE Softmax 100.0 99.4 91.6 55.2 31.1 17.3 SSMAx 100.0 100.0 81.3 42.6 23.0 13.4 Entmax 100.0 99.9 89.3 47.1 24.9 14.1 ASEntmax 100.0 100.0 79.1 41.4 22.4 13.1 NoPE Softmax 99.1 71.7 36.5 18.3 9.2 4.6 SSMax 99.1 71.4 36.8 18.6 9.3 4.7 Entmax 99.8 80.8 45.6 25.0 13.8 7.7 ASEntmax 99.6 78.1 42.6 22.5 11.9 6.4 ALiBi Softmax 100.0 100.0 100.0 100.0 100.0 100.0 Entmax 100.0 100.0 100.0 100.0 100.0 100.0 NAPE Softmax 100.0 100.0 100.0 100.0 100.0 100.0 SSMax 100.0 100.0 99.9 99.9 99.8 99.8 Entmax 100.0 100.0 100.0 100.0 100.0 100.0 ASEntmax 100.0 100.0 100.0 100.0 100.0 100.0 Figure 12 : Attention maps of Entmax model on Local Count. Left: Layer 1. Right: Layer 3; We observe a local pattern: attention weights fade as relative distance increases. Input sequence: (1..1 \times 10, 2..2 \times 4, 3..3 \times 10, 2..2 \times 4, 4..4 \times 10, 2..2 \times 4).. \times 4 H.3 Max Retrieval Solving this task requires an extremely concentrated attention distribution. Such distribution can be achieved by either lowering the temperature \theta for softmax or increasing the entmax parameter \alpha . As Table 5 shows, increasing \alpha yields substantial performance gains. However, if \alpha becomes too large, the distribution may collapse to a one-hot vector, causing entmax to lose all gradient signal and hindering learning (e.g. \alpha>16 ). Instead, this issue can be alleviated by scaling entmax based on the sequence length. With this approach, ASEntmax with \alpha=1.5 , learned \beta , and elevated \gamma achieves substantially improved performance on the task. Table 5 : Accuracy (%) on Max Retrieval ID Out-of-Distribution Model 16 32 64 128 256 512 1024 2048 4096 Softmax Veličković et al. 2024 98.6 97.1 94.3 89.7 81.3 70.1 53.8 35.7 22.6 Adapt. temp. Veličković et al. 2024 98.6 97.1 94.5 89.9 82.1 72.5 57.7 39.4 24.9 Softmax \theta=\sqrt{d} 99.2 98.5 96.7 93.2 86.7 73.5 54.4 36.4 24.1 Softmax \theta=0.1 99.5 99.0 97.8 95.1 89.6 77.9 60.2 41.2 28.5 Softmax \theta=0.0004 99.2 98.4 97.0 94.2 89.4 81.8 71.4 58.4 43.4 SSMax 99.4 98.9 97.8 95.9 92.3 85.0 74.7 59.9 44.7 Entmax \alpha=1.5 99.4 98.8 97.4 94.7 89.9 80.1 65.1 50.0 36.8 Entmax \alpha=2 99.5 99.1 98.0 96.0 92.1 84.5 72.0 58.4 44.6 Entmax \alpha=4 99.5 98.9 97.7 95.9 92.1 84.8 75.2 61.4 46.9 Entmax \alpha=16 99.6 99.4 98.7 97.5 95.2 91.0 82.8 70.3 53.4 Entmax \alpha=32 99.4 98.7 97.5 95.5 91.5 83.8 72.6 57.5 41.7 Entmax \alpha=64 99.1 98.4 96.8 93.9 88.7 78.6 64.6 45.5 28.1 ASEntmax, \alpha=1.5 , \beta_{learn} , \gamma=1 99.5 99.0 98.1 96.3 93.1 86.1 76.2 61.9 44.5 ASEntmax, \alpha=1.5 , \beta_{learn} , \gamma=2 99.6 99.2 98.4 96.9 94.4 89.0 81.4 69.5 55.1 ASEntmax, \alpha=1.5 , \beta_{learn} , \gamma=3 99.6 99.4 99.0 98.0 96.0 92.4 85.9 76.1 62.7 ASEntmax, \alpha=1.5 , \beta_{learn} , \gamma=4 99.3 98.7 97.6 95.4 91.3 84.6 73.6 59.7 45.9 H.4 MQMTAR We observe the same pattern across all tasks: despite theoretical extrapolation to 16\times via RoPE scaling, RoPE models poorly generalize beyond 4\times . Moreover, although models with ALiBi can extrapolate up to 64\times , ALiBi’s limited span inevitably leads to performance degradation on very long sequences. However, NAPE provides a substantial boost in all models. As in the copy task, Entmax alone underperforms Softmax, but adaptive scaling in ASEntmax makes the model superior, extending the generalization to an impressive 1024\times . We also conducted experiments with ASSMax to demonstrate that, despite adaptive scaling benefits and improved performance in comparison with the model without scaling, softmax dispersion still causes a significant performance drop on very long sequences. Table 6 : Exact match accuracy ( \% ) on Multi-query Multi-token Associative Recall. ID Out-of-Distribution Model 64 128 256 512 1024 2048 4096 8192 16K 32K 65K RoPE Softmax 100.0 3.1 0 0 0 0 0 0 0 0 0 SSMAx 99.8 6.2 0 0 0 0 0 0 0 0 0 Entmax 99.8 49.4 4.5 0 0 0 0 0 0 0 0 ASEntmax 100.0 66.9 0.8 0 0 0 0 0 0 0 0 NoPE Softmax 100.0 30.6 0 0 0 0 0 0 0 0 0 Entmax 100.0 26.1 0 0 0 0 0 0 0 0 0 SSMax 100.0 39.1 0 0 0 0 0 0 0 0 0 ASEntmax 100.0 58.3 0 0 0 0 0 0 0 0 0 ALiBi Softmax 100.0 100.0 99.5 99.0 98.0 93.9 77.8 38.8 6.8 0 0 Entmax 99.5 97.5 90.6 75.4 44.7 11.7 1.1 0 0 0 0 NAPE Softmax 100.0 100.0 100.0 99.4 99.5 98.2 97.8 90.2 80.2 34.2 3.0 SSMax 99.9 100.0 99.9 99.7 99.4 97.2 94.1 82.4 53.4 13.2 1.0 ASSMax 100.0 100.0 100.0 99.9 99.8 98.2 98.4 95.4 87.2 69.2 6.0 Entmax 100.0 100.0 100.0 99.9 99.2 97.8 92.7 86.2 66.8 35.8 9.3 SEntmax 100.0 100.0 100.0 99.9 99.8 98.8 91.5 12.0 0 0 0 ASEntmax 100.0 100.0 99.9 99.9 99.8 99.8 99.2 98.6 96.4 91.2 76.7 H.5 Copy As shown by Jelassi et al. 2023 , transformers generalize to the Copy task especially with appropriate positional encodings. Table 7 shows that the Softmax transformer generalizes up to 64\times the ID length. Notably, SSMax outperforms all other models which might suggest that scaling is crucial for this task. As we can also see, without scaling, \alpha -entmax can hurt performance, leading to a noticeable drop in accuracy in the OOD scenario. Introducing an adaptive temperature, however, substantially mitigates this effect: ASEntmax matches Softmax performance outperforming Entmax 4 times of the sequence length. We hypothesize that Copy requires less sparse attention patterns, which can be accomplished by applying a negative power to the logarithm function. We confirm this hypothesis in Figure 13 , which shows that ASEntmax learns negative values of \gamma in all heads, resulting in more spread-out attention distributions. Figure 13 : Distributions of \gamma per head and layer for ASEntmax trained on Copy. Table 7 : Exact match accuracy (%) on Copy task. ID Out-of-Distribution Model 64 128 256 512 1024 2048 4096 RoPE Softmax 100.0 2.8 0 0 0 0 0 SSMax 100.0 0 0 0 0 0 0 ASSMax 99.9 19.9 0 0 0 0 0 Entmax 100.0 34.3 0 0 0 0 ASEntmax 100.0 5.3 0 0 0 0 0 NoPE Softmax 56.3 0 0 0 0 0 0 SSMax 56.1 0 0 0 0 0 0 Entmax 34.6 0 0 0 0 0 0 ASEntmax 45.8 0 0 0 0 0 0 AliBi Softmax 100.0 99.8 99.8 98.8 98.3 93.9 26.8 Entmax 100.0 100.0 96.6 14.6 0.1 0 0 NAPE Softmax 100.0 100.0 99.9 99.9 99.4 96.1 85.5 SSMax 100.0 100.0 100.0 99.9 99.6 99.3 95.8 ASSMax 99.9 99.8 99.7 99.3 97.5 91.1 72.8 Entmax 100.0 99.0 86.0 28.5 0.2 0 0 SEntmax 100.0 100.0 99.9 99.0 96.2 69.7 6.5 ASEntmax 100.0 100.0 99.9 99.7 99.4 96.3 86.6 H.6 Flip-Flop We first conducted an ablation study to evaluate model performance with various RoPE scaling factors (Table 8 ). Although the random baseline accuracy for Flip-Flop is 50\% , our generative training setup with a vocabulary of 7 tokens (4 main and 3 special) can yield accuracies below 50\% . Therefore, we treat accuracies at or below 50\% as poor and select a scaling factor of 16 as optimal. The RoPE scaling factor defines the expansion multiple to which the model must generalize. Throughout all experiments, however, we observe that RoPE models poorly generalize at sequence lengths 8\times the in-distribution length. While Flip-Flop is considered a challenging task for testing length extrapolation ( Liu et al. 2023 ) , we found that ALiBi and NAPE strategy almost perfectly solves both the sparse and dense variants. Surprisingly, RoPE models generalize better with the sparse variants. Table 8 : Exact match accuracy (%) for ablation of LLaMA 3 RoPE scaling on Flip-Flop (sparse) ID Out-of-Distribution Model Factor 64 128 256 512 1024 2048 4096 Softmax - 100.0 79.9 54.4 51.5 48.8 50.8 50.8 [.4pt/2pt] Softmax 4 100.0 99.6 33.8 11.2 3.3 0.5 0.0 Softmax 8 100.0 100.0 72.6 0.2 0 0 0 Softmax 16 100.0 99.9 97.3 36.7 0 0 0 Softmax 32 100.0 99.2 71.6 51.3 51.1 49.3 49.2 Table 9 : Accuracy (%) on Flip-Flop (sparse). ID Out-of-Distribution Model 64 128 256 512 1024 2048 4096 8192 16K 32K RoPE Softmax 100.0 99.9 97.2 36.6 0.0 0.0 0.0 - - - SSMax 100.0 99.8 91.8 77.8 52.2 22.0 39.2 - - - Entmax 100.0 99.9 89.0 64.0 50.6 50.6 55.1 - - - ASEntmax 100.0 99.8 98.9 51.4 51.4 50.2 49.2 - - - ALiBi Softmax 100.0 99.9 99.8 99.9 99.9 100.0 99.7 99.7 99.9 99.7 Entmax 100.0 99.9 99.8 99.8 99.8 99.9 99.7 99.7 99.7 99.7 NAPE Softmax 100.0 99.8 99.6 99.3 99.7 99.6 99.6 99.6 99.3 99.4 SSMax 100.0 99.8 99.9 99.8 99.8 99.7 99.8 100.0 99.9 99.6 Entmax 100.0 99.9 99.8 99.9 99.9 100.0 99.7 99.7 99.8 99.7 ASEntmax 100.0 99.8 99.6 99.3 99.5 99.3 99.5 99.7 99.6 99.5 Table 10 : Accuracy (%) on Flip-Flop (dense). ID Out-of-Distribution Model 64 128 256 512 1024 2048 4096 RoPE Softmax 100.0 70.2 62.2 53.2 49.2 50.3 53.1 SSMax 100.0 69.1 60.4 53.2 48.5 51.0 53.1 Entmax 100.0 80.4 73.6 60.3 49.3 51.2 53.1 ASEntmax 100.0 100.0 100.0 49.6 48.9 51.1 53.1 NAPE Softmax 100.0 100.0 100.0 100.0 100.0 100.0 100.0 SSMAx 100.0 100.0 100.0 100.0 100.0 100.0 100.0 Entmax 100.0 100.0 100.0 100.0 100.0 100.0 100.0 ASEntmax 100.0 100.0 100.0 100.0 100.0 100.0 100.0 H.7 Reverse From Table 11 , we can see that ASEntmax with NAPE achieved impressive 8\times length generalization which to our knowledge, represents the largest extrapolation reported. Moreover, RoPE models fail even at a sequence length of 96. Although NAPE improves Softmax and SSMax, it does not enable generalization beyond 1.5\times the in-distribution length; however, applying adaptive scaling to Softmax (ASSMax) enables performance at 2\times the in-distribution length. Table 11 : Exact match accuracy (%) on Reverse. ID Out-of-Distribution Model 64 96 128 256 512 RoPE Softmax 100.0 0 0 0 0 SSMax 100.0 0 0 0 0 ASSMax 100.0 0 0 0 0 Entmax 100.0 0 0 0 0 ASEntmax 100.0 0 0 0 0 NoPE Softmax 100.0 0 0 0 0 SSMax 100.0 0 0 0 0 Entmax 100.0 77.1 0 0 0 ASEtmax 100.0 74.4 0 0 0 AliBi Softmax 100.0 0 0 0 0 Entmax 100.0 96.1 78.5 0 0 NAPE Softmax 100.0 36.0 0 0 0 SSMax 100.0 54.6 0 0 0 ASSMax 100.0 98.7 62.4 0 0 Entmax 100.0 99.0 86.0 28.5 0.2 SEntmax 100.0 100.0 98.1 51.4 0.0 ASEntmax 100.0 100.0 99.8 96.4 56.7 H.8 Sort Table 12 demonstrates superiority of \alpha -entmax on Sort, with two-layer models generalizing almost perfectly to 2\times under both NoPE and NAPE configurations. Furthermore, Softmax models with NAPE experience a performance decline relative to their NoPE counterparts, and adaptive scaling degrades performance for both Softmax and \alpha -entmax (we also report results for NoPE + SEntmax to be convinced). However, combining NAPE with adaptive scaling enhances \alpha -entmax. This pattern suggest that sparsity, adaptive scaling, and NAPE can act complementarily. Table 12 : Exact match accuracy (%) on Sort. ID Out-of-Distribution Model 64 128 256 512 RoPE Softmax 100.0 0 0 0 SSMax 100.0 0 0 0 Entmax 100.0 0 0 0 ASentmax 100.0 0 0 0 NoPE Softmax 100.0 97.6 46.6 0 SSMax 100.0 96.3 29.8 0 Entmax 100.0 99.9 66.2 0 SEntmax 100.0 99.4 47.7 0 ASEnmtax 100.0 97.5 20.8 0 AliBi Softmax 99.9 0 0 0 Entmax 99.2 0 0 0 NAPE Softmax 100.0 0 0 0 SSMax 100.0 0 0 0 ASSMax 100.0 99.5 9.4 0 Entmax 100.0 99.3 57.8 0 ASEntmax 100.0 100.0 79.7 0