On Controllable Sparse Alternatives to Softmax

Anirban Laha, Saneem Ahmed Chemmengath, Priyanka Agrawal, Mitesh M. Khapra, Karthik Sankaranarayanan, Harish G. Ramaswamy

TL;DR: This paper introduces a unified framework for probability mapping functions that allows researchers to explicitly control the degree of sparsity in a model's output. By introducing two new formulations, sparsegen-lin and sparsehourglass, the authors provide "knobs" to tune how many elements in a distribution are zeroed out, leading to more interpretable attention mechanisms and better performance in multilabel classification.

The Problem: Softmax and the "Full Support" Dilemma

In deep learning, converting a vector of raw scores (logits) into a probability distribution is a fundamental operation. The gold standard is softmax. However, softmax suffers from a "full support" problem: it assigns a non-zero probability to every single element, no matter how irrelevant. In large output spaces, this is computationally expensive and makes attention mechanisms harder to interpret, as the model technically "looks" at everything at once.

While sparsemax was previously proposed to allow for actual zeros in the distribution, it offers no control over how sparse the output should be. Furthermore, different mapping functions have different mathematical properties—like translation invariance (adding a constant to inputs doesn't change the output) or scale invariance (multiplying inputs by a constant doesn't change the output). Before this work, there wasn't a clear way to navigate the trade-offs between these properties or control sparsity levels dynamically.

Methods: The Sparsegen Activation Framework

To address these limitations, the authors propose the Sparsegen Activation Framework, a generalized optimization problem that encompasses softmax, sparsemax, and sum-normalization as special cases. Within this framework, they introduce two novel formulations:

1. Sparsegen-lin

This method is an extension of sparsemax that introduces a regularization parameter, $\lambda$. By tuning $\lambda$, practitioners can explicitly shrink or expand the "non-sparse" region of the input space.

Effect of the regularization parameter on the sparse region in sparsegen-lin.

The parameter $\lambda$ acts as a direct control for interpretability. In attention mechanisms, a higher $\lambda$ forces the model to focus on fewer words, creating "crisper" and more human-readable attention heatmaps without sacrificing accuracy.

2. Sparsehourglass

Different mapping functions force a choice between invariance properties. Softmax is translation-invariant but not scale-invariant, while sum-normalization is the opposite. Sparsehourglass provides a mathematical bridge to choose a middle ground that fits the specific needs of a problem domain. It uses an "anchor point" $q$ and a mirror technique to ensure the function remains monotonic and well-behaved even when inputs are negative.

Geometric intuition behind Sparsecone and Sparsehourglass, highlighting the anchor point q.

3. Convex Loss Functions

Training sparse models with standard losses can be difficult because the objectives often become non-convex. To solve this, the authors derived new hinge-loss variants specifically tailored for these sparse mappings. These variants are easier to optimize for multilabel classification tasks and are more aggressive at inducing true sparsity than traditional Huber-loss style approaches. Crucially, all these methods maintain closed-form solutions and are differentiable (or have sub-gradients), meaning they can be seamlessly integrated into existing neural networks and trained via standard backpropagation.

Experimental Setup and Key Results

The authors evaluated their framework across synthetic multilabel data, real-world multilabel classification (Birds, Scene, and Emotions datasets), and Natural Language Processing (NLP) tasks including Neural Machine Translation (NMT) and abstractive summarization.

Key Findings: * Superior NLP Performance: On the French-English translation task, sparsegen-lin achieved a BLEU score of 37.27, outperforming both softmax (36.38) and the original sparsemax (36.73). In abstractive summarization (Gigaword), it led with a ROUGE-1 score of 35.90, compared to softmax's 34.80. * Sparsity Without Accuracy Loss: The experiments demonstrated that adding explicit sparsity controls does not come at the cost of performance. In many cases, forcing the model to be more selective actually improved its generalization. * Multilabel Efficiency: The new hinge-loss variants consistently produced sparser and more accurate predictions on synthetic datasets compared to traditional log-loss or Huber-loss baselines.

Limitations and Future Work

While sparsehourglass is mathematically robust, it is not Lipschitz continuous at the origin ($z=0$), a common trait for scale-invariant functions.

The authors suggest several promising directions for future research, including applying controllable sparsity to memory networks to make read/write operations more efficient, using it in reinforcement learning to help agents focus on a smaller set of optimal actions, and investigating how sparse "teacher" models might better transfer knowledge to "student" models in knowledge distillation.

Summary updated

BibTeX
@inproceedings{laha2018controllable,
  author = {Anirban Laha and Saneem Ahmed Chemmengath and Priyanka Agrawal and Mitesh M. Khapra and Karthik Sankaranarayanan and Harish G. Ramaswamy},
  title = {{On Controllable Sparse Alternatives to Softmax}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2018},
  url = {https://openreview.net/forum?id=Hy-W5_-_WS},
}
Figure