arXivDaily arXiv每日学术速递 周一至周五更新
今晚才能更新了~~大家休息下再来吧
arXiv 2007.04825cs.LGstat.ML
收藏

Fast Transformers with Clustered Attention

Idiap Research Institute(IDIAP研究所);Ecole Polytechnique Fédérale de Lausanne(洛桑联邦理工学院);University of Geneva(日内瓦大学)

Apoorv Vyas, Angelos Katharopoulos, François Fleuret

英文摘要:

Transformers have been proven a successful model for a variety of tasks in sequence modeling. However, computing the attention matrix, which is their key component, has quadratic complexity with respect to the sequence length, thus making them prohibitively expensive for large sequences. To address this, we propose clustered attention, which instead of computing the attention for every query, groups queries into clusters and computes attention just for the centroids. To further improve this approximation, we use the computed clusters to identify the keys with the highest attention per query and compute the exact key/query dot products. This results in a model with linear complexity with respect to the sequence length for a fixed number of clusters. We evaluate our approach on two automatic speech recognition datasets and show that our model consistently outperforms vanilla transformers for a given computational budget. Finally, we demonstrate that our model can approximate arbitrarily complex attention distributions with a minimal number of clusters by approximating a pretrained BERT model on GLUE and SQuAD benchmarks with only 25 clusters and no loss in performance.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑