Introduction
Standard sequence-to-sequence (seq2seq) models rely heavily on the softmax function for both attention mechanisms and final output layers. While effective, softmax is strictly positive, assigning non-zero probability mass to every possible token or attention point, regardless of relevance. This "density" complicates interpretability, wastes computational resources on implausible candidates, and necessitates heuristic decoding strategies like beam search. This paper introduces sparse sequence-to-sequence models by replacing softmax with a new family of transformations called $\alpha$-entmax, enabling models to assign exactly zero probability to irrelevant inputs.
The $\alpha$-entmax Transformation
The core innovation is the $\alpha$-entmax transformation, a family of functions parametrized by a scalar $\alpha \ge 1$. This transformation generalizes both the standard softmax ($\alpha = 1$) and the sparsemax ($\alpha = 2$). For any $\alpha > 1$, the function can produce sparse outputs by mapping low-scoring elements to exactly zero.
The authors identify 1.5-entmax as a particularly effective variant, offering a smoother curvature than the piecewise-linear sparsemax while maintaining sparsity. To facilitate practical implementation, the paper provides a bisection-based approach for general $\alpha$ and a fast, exact sorting-based algorithm for 1.5-entmax that achieves GPU speeds comparable to optimized softmax. Training is performed using Fenchel-Young losses, which generalize cross-entropy to sparse distributions.
Experimental Evaluation
The proposed models were evaluated on two distinct NLP tasks:
- Morphological Inflection: Using the CoNLL–SIGMORPHON 2018 dataset, a character-level task requiring the transformation of a lemma (e.g., "draw") into a specific inflected form (e.g., "drawn").
- Machine Translation (MT): Word-level tasks including IWSLT 2017 (German $\leftrightarrow$ English), KFTT (Japanese $\leftrightarrow$ English), and WMT 2016 (Romanian $\leftrightarrow$ English).
Results and Discussion
Empirical results demonstrate that sparse models consistently outperform their dense counterparts. In morphological inflection, sparse models improved accuracy by 1% to 2.5% depending on resource availability. In MT, 1.5-entmax achieved the highest BLEU scores across all tested directions (e.g., 26.17 vs. 25.70 BLEU for German $\to$ English).
Beyond accuracy, sparsity offers significant advantages:
- Interpretability: Sparse attention mechanisms focus on fewer source words (averaging 5.5 vs. 24 for softmax in MT), creating cleaner alignments.
- Exact Decoding: In tasks with high output sparsity, such as morphological inflection, the number of hypotheses with non-zero probability often falls below the beam size, making beam search mathematically exact.
- Efficiency: Despite the sorting requirements of 1.5-entmax, the model maintains high throughput (~13,000 words/sec vs. 14,500 for softmax).
Conclusion
Sparse seq2seq models via $\alpha$-entmax provide a principled way to incorporate sparsity into neural architectures, improving both performance and interpretability. While 1.5-entmax serves as a robust default, the optimal $\alpha$ may vary by task. Future work includes extending these techniques to the self-attention layers of Transformer models.
Summary updated