Transformer-VQ: Linear-Time Transformers via Vector Quantization

Lucas D. Lingle
9/1/2023
39 citations
transformer-attention

No official code found. Best implementation: lucaslingle/transformer_vq (200 stars, Python, last commit 2023-12-04).

Abstract

We introduce Transformer-VQ, a decoder-only transformer computing softmax-based dense self-attention in linear time. Transformer-VQ's efficient attention is enabled by vector-quantized keys and a novel caching mechanism.

Show full abstract

In our large-scale experiments, Transformer-VQ is shown highly competitive in quality, obtaining 0.99 bpb on Enwik8, 26.6 ppl on PG-19, and 3.16 bpb on ImageNet64. In addition, the optimized implementation of Transformer-VQ is over 3x faster than a comparable quadratic-time transformer at sequence length 8k, is over 12x faster at 32k, and can scale to 131k with similar throughput. Code available: \url{https://github.com/transformer-vq/transformer_vq}

View on arXivView PDF

Code Implementations(1)

Official implementation of 'Transformer-VQ: Linear-Time Transformers via Vector Quantization'

20012Python, ShellSep 27, 20232 years ago

Similar Papers

Cite this paper

@article{lingle2023transformervq,
  title  = {Transformer-VQ: Linear-Time Transformers via Vector Quantization},
  author = {Lucas D. Lingle},
  year   = {2023},
  eprint = {2309.16354},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/pdf/2309.16354},
  journal = {ICLR 2023 2023}
}

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/2309.16354.svg)](https://codeofpaper.com/paper/2309.16354)

Discussion