CAST: Clustering Self-Attention using Surrogate Tokens for Efficient Transformers

Adjorn van Engelenhoven, Nicola Strisciuglio, Estefanía Talavera
2/6/2024
cs.LG

No confident code implementation found for this paper. 4 possible matches can be shown below.

Abstract

The Transformer architecture has shown to be a powerful tool for a wide range of tasks. It is based on the self-attention mechanism, which is an inherently computationally expensive operation with quadratic computational complexity: memory usage and compute time increase quadratically with the length of the input sequences, thus limiting the application of Transformers. In this work, we propose a novel Clustering self-Attention mechanism using Surrogate Tokens (CAST), to optimize the attention computation and achieve efficient transformers. CAST utilizes learnable surrogate tokens to construct a cluster affinity matrix, used to cluster the input sequence and generate novel cluster summaries. The self-attention from within each cluster is then combined with the cluster summaries of other clusters, enabling information flow across the entire input sequence. CAST improves efficiency by reducing the complexity from $O(N^2)$ to $O(αN)$ where N is the sequence length, and α is constant according to the number of clusters and samples per cluster. We show that CAST performs better than or comparable to the baseline Transformers on long-range sequence modeling tasks, while also achieving higher results on time and memory efficiency than other efficient transformers.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 4 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{engelenhoven2024cast,
  title  = {CAST: Clustering Self-Attention using Surrogate Tokens for Efficient Transformers},
  author = {Adjorn van Engelenhoven and Nicola Strisciuglio and Estefanía Talavera},
  year   = {2024},
  eprint = {2402.04239},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2402.04239v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2402.04239.svg)](https://codeofpaper.com/paper/2402.04239)

Discussion