paper-with-me

홈 › Papers

Improving Transformers with Probabilistic Attention Keys

2021-10-16 · Tam Nguyen, Tan M. Nguyen, Dung D. Le, Duy Khuong Nguyen, Viet-Anh Tran, Richard G. Baraniuk, Nhat Ho, Stanley J. Osher

Multi-head attention is a driving force behind state-of-the-art transformers, which achieve remarkable performance across a variety of natural language processing (NLP) and computer vision tasks. It has been observed that for many applications, those attention heads learn redundant embedding, and most of them can be removed without degrading the performance of the model. Inspired by this observation, we propose Transformer with a Mixture of Gaussian Keys (Transformer-MGK), a novel transformer architecture that replaces redundant heads in transformers with a mixture of keys at each head. These mixtures of keys follow a Gaussian mixture model and allow each attention head to focus on different parts of the input sequence efficiently. Compared to its conventional transformer counterpart, Transformer-MGK accelerates training and inference, has fewer parameters, and requires fewer FLOPs to compute while achieving comparable or better accuracy across tasks. Transformer-MGK can also be easily extended to use with linear attention. We empirically demonstrate the advantage of Transformer-MGK in a range of practical applications, including language modeling and tasks that involve very long sequences. On the Wikitext-103 and Long Range Arena benchmark, Transformer-MGKs with 4 heads attain comparable or better performance to the baseline transformers with 8 heads.

📄 PDF Abstract BibTeX arXiv:2110.08678

Code (1)

minhtannguyen/transformer-mgk 공식 구현 pytorch

Tasks

Language ModelingLanguage Modelling

Methods 이 논문이 사용한 방법론

Multi-Head Attention 설명 없음
Attention 설명 없음
Linear Layer A Linear Layer is a projection $\mathbf{XW + b}$.
Absolute Position Encodings Absolute Position Encodings are a type of position embeddings for [Transformer-based models] where positional encodings are…
Position-Wise Feed-Forward Layer 설명 없음
Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…
Residual Connection 설명 없음
Adam 설명 없음

Similar Papers 제목 키워드 기반

Discrete Cosine Transform Based Decorrelated Attention for Vision Transformers

2024-05-22 · Hongyi Pan, Emadeldeen Hamdan, Xin Zhu, Ahmet Enis Cetin 외

Central to the Transformer architectures' effectiveness is the self-attention mechanism, a function that maps queries, keys, and values into a high-dimensional vector space. However, training the attention weights of que…

Quantization

Are queries and keys always relevant? A case study on Transformer wave functions

2024-05-29 · Riccardo Rende, Luciano Loris Viteritti

The dot product attention mechanism, originally designed for natural language processing tasks, is a cornerstone of modern Transformers. It adeptly captures semantic relationships between word pairs in sentences by compu…

Dynamic Group Transformer: A General Vision Transformer Backbone with Dynamic Group Attention

2022-03-08 · Kai Liu, Tianyi Wu, Cong Liu, Guodong Guo

Recently, Transformers have shown promising performance in various vision tasks. To reduce the quadratic computation complexity caused by each query attending to all keys/values, various methods have constrained the rang…

image-classificationImage ClassificationInstance Segmentationobject-detection+2

On the Expressivity Role of LayerNorm in Transformers' Attention

2023-05-04 · Shaked Brody, Uri Alon, Eran Yahav

Layer Normalization (LayerNorm) is an inherent component in all Transformer-based models. In this paper, we show that LayerNorm is crucial to the expressivity of the multi-head attention layer that follows it. This is in…

Language ModelingLanguage Modelling

TRA: Better Length Generalisation with Threshold Relative Attention

2025-03-29 · Mattia Opper, Roland Fernandez, Paul Smolensky, Jianfeng Gao

Transformers struggle with length generalisation, displaying poor performance even on basic tasks. We test whether these limitations can be explained through two key failures of the self-attention mechanism. The first is…

Decoder