NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Speeding Up Entmax

Maxat Tezekbayev, Vassilina Nikoulina, Matthias Gallé, Zhenisbek Assylbekov

Abstract

Sparse output transformations like $\alpha$-entmax improve neural machine translation by eliminating irrelevant tokens from probability distributions. However, their computational cost—specifically the need to sort logits—limits their scalability. We present $\alpha$-ReLU, a sparse transformation that avoids sorting by relaxing the sum-to-one constraint. Our results show that $\alpha$-ReLU matches the speed of softmax while outperforming it in translation quality and effectively mitigating the "empty translation" problem.

Introduction

In modern Natural Language Processing (NLP), the Softmax function is the standard for normalizing model outputs into probability distributions. Despite its ubiquity, softmax assigns a non-zero probability to every token in a vocabulary, regardless of relevance. This "density" can lead to decoding errors, such as the "empty string" problem where models erroneously favor termination over content.

To address this, researchers introduced $\alpha$-entmax, which produces sparse distributions by mapping low-scoring tokens to exactly zero. While effective, $\alpha$-entmax requires calculating a dynamic threshold ($\tau$) by sorting the entire vocabulary of logits at every step. For large vocabularies (e.g., 50,000+ words), this sorting becomes a significant bottleneck during both training and inference.

Methods: The $\alpha$-ReLU Transformation

We propose $\alpha$-ReLU, a transformation that maintains sparsity without the sorting overhead. Unlike entmax, $\alpha$-ReLU drops the requirement that outputs must sum to exactly one. The transformation is defined as a shifted ReLU function raised to a power determined by $\alpha$:

$$\alpha\text{-ReLU}_i(\mathbf{z}) := [(\alpha - 1)z_i - \tau]_+^{\frac{1}{\alpha-1}}$$

The critical innovation is that $\tau$ is a constant, not a function of the input vector $\mathbf{z}$. By fixing $\tau$, we eliminate the need for sorting. To ensure stable training, we utilize a specific $\alpha$-ReLU loss based on Tsallis $\alpha$-entropy, which preserves simple gradient dynamics ($\text{prediction} - \text{target}$).

Experimental Setup

We evaluated $\alpha$-ReLU against Softmax and $\alpha$-entmax on three Neural Machine Translation (NMT) benchmarks:

  • IWSLT’14 De$\to$En (Small: 172K examples)
  • WMT’13 En$\to$Ru (Medium: 1.3M examples)
  • WMT’14 En$\to$De (Large: 4.5M examples)

Key Results

Training and Inference Efficiency

$\alpha$-ReLU significantly improves wall-clock efficiency. By avoiding the sorting step required by entmax, it achieves training speeds comparable to an optimized Softmax implementation.

Test BLEU scores vs. training time across three NMT benchmarks.

At inference time, the benefits are even more pronounced. As shown in the figure below, $\alpha$-ReLU maintains a low computational footprint even as beam size increases, whereas $\alpha$-entmax's latency grows rapidly due to sorting requirements.

Inference time vs. beam size.

Translation Quality and Sparsity

$\alpha$-ReLU achieved higher BLEU scores than Softmax on the IWSLT and WMT En$\to$Ru tasks and matched performance on the large-scale WMT En$\to$De task. Furthermore, like $\alpha$-entmax, $\alpha$-ReLU effectively solves the "empty string" problem by zeroing out the probability of irrelevant termination tokens. While $\alpha$-ReLU is slightly less sparse than entmax, it provides sufficient regularization to improve model robustness.

Conclusion and Future Work

$\alpha$-ReLU demonstrates that strict probability normalization is not a prerequisite for high-performance sparse NMT. By relaxing the sum-to-one constraint and using a fixed threshold, we achieve the benefits of sparsity with the speed of softmax. Future work includes extending the mathematical estimation of the optimal $\tau$ to non-Transformer architectures and exploring the use of $\alpha$-ReLU in internal attention layers, which currently require careful normalization to prevent training divergence.

Summary updated

BibTeX
@inproceedings{tezekbayev2022speeding,
  author = {Maxat Tezekbayev and Vassilina Nikoulina and Matthias Gallé and Zhenisbek Assylbekov},
  title = {{Speeding Up Entmax}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2022},
  url = {https://openreview.net/forum?id=Fe-TIG0n0FC},
}
Figure