From Softmax to Sparsemax: A Sparse Model of Attention and Multi-Label Classification
Unbabel Lda(Unbabel有限公司);Instituto de Telecomunicações (IT)(电信研究所(IT));Instituto Superior Técnico(高等技术学院);Instituto de Engenharia de Sistemas e Computadores (INESC-ID)(系统与计算机工程研究所(INESC-ID))
We propose sparsemax, a new activation function similar to the traditional softmax, but able to output sparse probabilities. After deriving its properties, we show how its Jacobian can be efficiently computed, enabling its use in a network trained with backpropagation. Then, we propose a new smooth and convex loss function which is the sparsemax analogue of the logistic loss. We reveal an unexpected connection between this new loss and the Huber classification loss. We obtain promising empirical results in multi-label classification problems and in attention-based neural networks for natural language inference. For the latter, we achieve a similar performance as the traditional softmax, but with a selective, more compact, attention focus.
Instituto Superior Técnico, University of Lisbon(里斯本大学高等技术学院);INESC-ID
This paper introduces and evaluates two novel Hierarchical Attention Network models [Yang et al., 2016] - i) Hierarchical Pruned Attention Networks, which remove the irrelevant words and sentences from the classification process in order to reduce potential noise in the document classification accuracy and ii) Hierarchical Sparsemax Attention Networks, which replace the Softmax function used in the attention mechanism with the Sparsemax [Martins and Astudillo, 2016], capable of better handling importance distributions where a lot of words or sentences have very low probabilities. Our empirical…
Recently, speech recognition with ad-hoc microphone arrays has received much attention. It is known that channel selection is an important problem of ad-hoc microphone arrays, however, this topic seems far from explored in speech recognition yet, particularly with a large-scale ad-hoc microphone array. To address this problem, we propose a Scaling Sparsemax algorithm for the channel selection problem of the speech recognition with large-scale ad-hoc microphone arrays. Specifically, we first replace the conventional Softmax operator in the stream attention mechanism of a multichannel end-to-end…
How Sparse Probability Maps Shape Mixture-of-Experts Routing
Técnico, Universidade de Lisboa(里斯本大学高等技术学院);INESC-ID(INESC-ID研究所);Instituto de Telecomunicações(电信研究所);ELLIS Unit Lisbon(ELLIS里斯本分部);Gandara AI(Gandara AI公司)
Cornell University(康奈尔大学);NTT Communication Science Laboratories(NTT通信科学实验室)
Modern neural networks are often augmented with an attention mechanism, which tells the network where to focus within the input. We propose in this paper a new framework for sparse and structured attention, building upon a smoothed max operator. We show that the gradient of this operator defines a mapping from real values to probabilities, suitable as an attention mechanism. Our framework includes softmax and a slight generalization of the recently-proposed sparsemax as special cases. However, we also show how our framework can incorporate modern structured penalties, resulting in more interpr…
Converting an n-dimensional vector to a probability distribution over n objects is a commonly used component in many machine learning tasks like multiclass classification, multilabel classification, attention mechanisms etc. For this, several probability mapping functions have been proposed and employed in literature such as softmax, sum-normalization, spherical softmax, and sparsemax, but there is very little understanding in terms how they relate with each other. Further, none of the above formulations offer an explicit control over the degree of sparsity. To address this, we develop a unifi…
Sequence-to-sequence models are a powerful workhorse of NLP. Most variants employ a softmax transformation in both their attention mechanism and output layer, leading to dense alignments and strictly positive output probabilities. This density is wasteful, making models less interpretable and assigning probability mass to many implausible outputs. In this paper, we propose sparse sequence-to-sequence models, rooted in a new family of $α$-entmax transformations, which includes softmax and sparsemax as particular cases, and is sparse for any $α> 1$. We provide fast algorithms to evaluate these t…
Attention mechanisms in deep learning architectures have often been used as a means of transparency and, as such, to shed light on the inner workings of the architectures. Recently, there has been a growing interest in whether or not this assumption is correct. In this paper we investigate the interpretability of multi-head attention in abstractive summarization, a sequence-to-sequence task for which attention does not have an intuitive alignment role, such as in machine translation. We first introduce three metrics to gain insight in the focus of attention heads and observe that these heads s…
Instituto de Telecomunicações(电信研究所);Instituto Superior Técnico(高等技术学院);LUMLIS (Lisbon ELLIS Unit)(里斯本ELLIS单位(LUMLIS));Unbabel;Informatics Institute, University of Amsterdam(阿姆斯特丹大学信息学院);Instituto de Sistemas e Robótica(系统与机器人研究所)
Exponential families are widely used in machine learning; they include many distributions in continuous and discrete domains (e.g., Gaussian, Dirichlet, Poisson, and categorical distributions via the softmax transformation). Distributions in each of these families have fixed support. In contrast, for finite domains, there has been recent work on sparse alternatives to softmax (e.g. sparsemax and alpha-entmax), which have varying support, being able to assign zero probability to irrelevant categories. This paper expands that work in two directions: first, we extend alpha-entmax to continuous do…
Instituto de Telecomunicações(电信研究所);Instituto Superior Técnico(高等技术学院);Unbabel;Instituto de Sistemas e Robótica(系统与机器人研究所);Google Research(谷歌研究院);University of Amsterdam(阿姆斯特丹大学)
Exponential families are widely used in machine learning, including many distributions in continuous and discrete domains (e.g., Gaussian, Dirichlet, Poisson, and categorical distributions via the softmax transformation). Distributions in each of these families have fixed support. In contrast, for finite domains, recent work on sparse alternatives to softmax (e.g., sparsemax, $α$-entmax, and fusedmax), has led to distributions with varying support. This paper develops sparse alternatives to continuous distributions, based on several technical contributions: First, we define $Ω$-regularized pre…
School of Informatics, University of Edinburgh(爱丁堡大学信息学院);ILLC, University of Amsterdam(阿姆斯特丹大学语言、逻辑与计算研究所);Department of Computational Linguistics, University of Zurich(苏黎世大学计算语言学系)
Recently, it has been argued that encoder-decoder models can be made more interpretable by replacing the softmax function in the attention with its sparse variants. In this work, we introduce a novel, simple method for achieving sparsity in attention: we replace the softmax activation with a ReLU, and show that sparsity naturally emerges from such a formulation. Training stability is achieved with layer normalization with either a specialized initialization or an additional gating function. Our model, which we call Rectified Linear Attention (ReLA), is easy to implement and more efficient than…
Instituto Superior Técnico & Instituto de Telecomunicações, Universidade de Lisboa, Portugal(里斯本大学理工学院及电信研究所,葡萄牙);Champalimaud Research, Lisbon, Portugal(Champalimaud研究,葡萄牙里斯本);TransPerfect, Lisbon, Portugal(TransPerfect,葡萄牙里斯本);Carnegie Mellon University, Pittsburgh, USA(卡内基梅隆大学,美国匹兹堡)
Google(谷歌);University of Cambridge(剑桥大学);Alan Turing Institute(艾伦·图灵研究所);DeepMind(深度思维)
We introduce Performers, Transformer architectures which can estimate regular (softmax) full-rank-attention Transformers with provable accuracy, but using only linear (as opposed to quadratic) space and time complexity, without relying on any priors such as sparsity or low-rankness. To approximate softmax attention-kernels, Performers use a novel Fast Attention Via positive Orthogonal Random features approach (FAVOR+), which may be of independent interest for scalable kernel methods. FAVOR+ can be also used to efficiently model kernelizable attention mechanisms beyond softmax. This representat…
Middle Tennessee State University(中田纳西州立大学);The University of Hong Kong(香港大学);University of Wisconsin-Madison(威斯康星大学麦迪逊分校);Tsinghua University(清华大学);The Simons Institute for the Theory of Computing at the UC, Berkeley(加州大学伯克利分校西蒙斯理论计算研究所)
Cardiff University(卡迪夫大学);Osaka City University(大阪市立大学);Beijing Jiaotong University(北京交通大学);Shenzhen University(深圳大学);Shenzhen Zhuiyi Technology Co., Ltd.(深圳追一科技有限公司);Chinese Academy of Science(中国科学院)
The softmax function is widely used in artificial neural networks for the multiclass classification problems, where the softmax transformation enforces the output to be positive and sum to one, and the corresponding loss function allows to use maximum likelihood principle to optimize the model. However, softmax leaves a large margin for loss function to conduct optimizing operation when it comes to high-dimensional classification, which results in low-performance to some extent. In this paper, we provide an empirical study on a simple and concise softmax variant, namely sparse-softmax, to alle…
Stanford University(斯坦福大学);Adobe Research(Adobe研究院);University at Buffalo, SUNY(纽约州立大学布法罗分校)
Recent advances in efficient Transformers have exploited either the sparsity or low-rank properties of attention matrices to reduce the computational and memory bottlenecks of modeling long sequences. However, it is still challenging to balance the trade-off between model quality and efficiency to perform a one-size-fits-all approximation for different tasks. To better understand this trade-off, we observe that sparse and low-rank approximations excel in different regimes, determined by the softmax temperature in attention, and sparse + low-rank can outperform each individually. Inspired by th…
Many applications of generative models rely on the marginalization of their high-dimensional output probability distributions. Normalization functions that yield sparse probability distributions can make exact marginalization more computationally tractable. However, sparse normalization functions usually require alternative loss functions for training since the log-likelihood is undefined for sparse probability distributions. Furthermore, many sparse normalization functions often collapse the multimodality of distributions. In this work, we present $\textit{ev-softmax}$, a sparse normalization…
University of Amsterdam(阿姆斯特丹大学);Priberam Labs(Priberam实验室);Institute of Systems and Robotics(系统与机器人研究所);LUMLIS (Lisbon ELLIS Unit)(LUMLIS(里斯本ELLIS单元));Unbabel(Unbabel公司)
Visual attention mechanisms are widely used in multimodal tasks, as visual question answering (VQA). One drawback of softmax-based attention mechanisms is that they assign some probability mass to all image regions, regardless of their adjacency structure and of their relevance to the text. In this paper, to better link the image structure with the text, we replace the traditional softmax attention mechanism with two alternative sparsity-promoting transformations: sparsemax, which is able to select only the relevant regions (assigning zero weight to the rest), and a newly proposed Total-Variat…
Carnegie Mellon University(卡内基梅隆大学);Instituto Superior Técnico(高等理工学院);Universidade de Lisboa(里斯本大学);Unbabel(Unbabel公司);Instituto de Telecomunicações(电信研究所)
In NMT, words are sometimes dropped from the source or generated repeatedly in the translation. We explore novel strategies to address the coverage problem that change only the attention transformation. Our approach allocates fertilities to source words, used to bound the attention each word can receive. We experiment with various sparse and constrained attention transformations and propose a new one, constrained sparsemax, shown to be differentiable and sparse. Empirical evaluation is provided in three languages pairs.
Sliding Window Attention Training for Efficient Large Language Models
City University of Hong Kong(香港城市大学);Xi’an Jiaotong University(西安交通大学);Jarvis Research Center, Tencent YouTu Lab(腾讯优图实验室研究部);Westlake University(西湖大学);University of Science and Technology of China(中国科学技术大学);Southern University of Science and Technology(南方科技大学)
When Does Sparse MoE Help in Vision? The Role of Backbone Compute Leverage in Sparse Routing
Department of Computer Science and Software Engineering(计算机科学与软件工程系);Auburn University(阿伯拉罕大学);Department of Information Management(信息管理系);National Central University(国立中央大学)
Self-attention based Transformer has demonstrated the state-of-the-art performances in a number of natural language processing tasks. Self-attention is able to model long-term dependencies, but it may suffer from the extraction of irrelevant information in the context. To tackle the problem, we propose a novel model called \textbf{Explicit Sparse Transformer}. Explicit Sparse Transformer is able to improve the concentration of attention on the global context through an explicit selection of the most relevant segments. Extensive experimental results on a series of natural language processing an…
Attention mechanisms have become ubiquitous in NLP. Recent architectures, notably the Transformer, learn powerful context-aware word representations through layered, multi-headed attention. The multiple heads learn diverse types of word relationships. However, with standard softmax attention, all attention heads are dense, assigning a non-zero weight to all context words. In this work, we introduce the adaptively sparse Transformer, wherein attention heads have flexible, context-dependent sparsity patterns. This sparsity is accomplished by replacing softmax with $α$-entmax: a differentiable ge…
Rice University(莱斯大学);Georgia Institute of Technology(佐治亚理工学院);Nanjing University(南京大学)
Vision Transformer (ViT) has emerged as a competitive alternative to convolutional neural networks for various computer vision applications. Specifically, ViT multi-head attention layers make it possible to embed information globally across the overall image. Nevertheless, computing and storing such attention matrices incurs a quadratic cost dependency on the number of patches, limiting its achievable efficiency and scalability and prohibiting more extensive real-world ViT applications on resource-constrained devices. Sparse attention has been shown to be a promising direction for improving ha…
STILL: Selecting Tokens for Intra-Layer Hybrid Attention to Linearize LLMs
SMULL Group, Harbin Institute of Technology, Shenzhen(SMULL小组,哈尔滨工业大学,深圳);Pengcheng Laboratory(Pengcheng实验室);UQMM Lab, University of Queensland(UQMM实验室,昆士兰大学);Huawei Technologies Co., Ltd.(华为技术有限公司)
Peking University(北京大学);Peng Cheng Laboratory(鹏城实验室);Sea AI Lab(Sea人工智能实验室);Shenzhen EEGSmart Technology Co., Ltd.(深圳脑陆科技有限公司)
We consider two biologically plausible structures, the Spiking Neural Network (SNN) and the self-attention mechanism. The former offers an energy-efficient and event-driven paradigm for deep learning, while the latter has the ability to capture feature dependencies, enabling Transformer to achieve good performance. It is intuitively promising to explore the marriage between them. In this paper, we consider leveraging both self-attention capability and biological properties of SNNs, and propose a novel Spiking Self Attention (SSA) as well as a powerful framework, named Spiking Transformer (Spik…
University of California, Los Angeles (UCLA)(加州大学洛杉矶分校)
Despite the success of deep learning in domains such as image, voice, and graphs, there has been little progress in deep representation learning for domains without a known structure between features. For instance, a tabular dataset of different demographic and clinical factors where the feature interactions are not given as a prior. In this paper, we propose Group-Connected Multilayer Perceptron (GMLP) networks to enable deep representation learning in these domains. GMLP is based on the idea of learning expressive feature combinations (groups) and exploiting them to reduce the network comple…
Instituto Superior Técnico, Universidade de Lisboa(里斯本大学技术高级学院);Instituto de Telecomunicações(电信研究所);TransPerfect(TransPerfect公司);ELLIS Unit Lisbon(里斯本ELLIS单位)
An important class of problems involves training deep neural networks with sparse prediction targets of very high dimension D. These occur naturally in e.g. neural language models or the learning of word-embeddings, often posed as predicting the probability of next words among a vocabulary of size D (e.g. 200 000). Computing the equally large, but typically non-sparse D-dimensional output vector from a last hidden layer of reasonable dimension d (e.g. 500) incurs a prohibitive O(Dd) computational cost for each example, as does updating the D x d output weight matrix and computing the gradient …
DashAttention: Differentiable and Adaptive Sparse Hierarchical Attention
Tsinghua University(清华大学);Instituto Superior Técnico, Universidade de Lisboa(里斯本大学理工学院);Instituto de Telecomunicações(电信研究院);Carnegie Mellon University(卡内基梅隆大学);Sapienza University of Rome(罗马萨皮恩扎大学);University of Edinburgh(爱丁堡大学);TransPerfect(TransPerfect公司);ELLIS Unit Lisbon(里斯本ELLIS单位)