Transformer-VQ: Linear-Time Transformers via Vector Quantization
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. 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: https://github.com/transformer-vq/transformer_vq
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
10 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness cites Efficiently Modeling Long Sequences with Structured State Spaces
- FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness cites Reformer: The Efficient Transformer
- Parallelizing Linear Transformers with the Delta Rule over Sequence Length cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
- Parallelizing Linear Transformers with the Delta Rule over Sequence Length cites Efficiently Modeling Long Sequences with Structured State Spaces
- Parallelizing Linear Transformers with the Delta Rule over Sequence Length cites Reformer: The Efficient Transformer
- Parallelizing Linear Transformers with the Delta Rule over Sequence Length cites Gated Linear Attention Transformers with Hardware-Efficient Training
- Gated Linear Attention Transformers with Hardware-Efficient Training cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
- Gated Linear Attention Transformers with Hardware-Efficient Training cites Efficiently Modeling Long Sequences with Structured State Spaces
- Gated Linear Attention Transformers with Hardware-Efficient Training cites Reformer: The Efficient Transformer
- PQCache: Product Quantization-based KVCache for Long Context LLM Inference cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
- Short-Long Convolutions Help Hardware-Efficient Linear Attention to Focus on Long Sequences cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
- Short-Long Convolutions Help Hardware-Efficient Linear Attention to Focus on Long Sequences cites Efficiently Modeling Long Sequences with Structured State Spaces
- Short-Long Convolutions Help Hardware-Efficient Linear Attention to Focus on Long Sequences cites Reformer: The Efficient Transformer
- Short-Long Convolutions Help Hardware-Efficient Linear Attention to Focus on Long Sequences cites Gated Linear Attention Transformers with Hardware-Efficient Training
Cited by top-tier papers10
- Parallelizing Linear Transformers with the Delta Rule over Sequence LengthSonglin Yang, Bailin Wang, Yu Zhang, Yikang Shen et al.NeurIPS 2024 · 412 citations
- Gated Linear Attention Transformers with Hardware-Efficient TrainingSonglin Yang, Bailin Wang, Yikang Shen, Rameswar Panda et al.ICML 2024 · 390 citations
- PQCache: Product Quantization-based KVCache for Long Context LLM InferenceHailin Zhang, Xiaodong Ji, Yilin Chen, Fangcheng Fu et al.SIGMOD 2025 · 13 citations
- Short-Long Convolutions Help Hardware-Efficient Linear Attention to Focus on Long SequencesZicheng Liu, Siyuan Li, Li Wang, Zedong Wang et al.ICML 2024 · 11 citations
- PathVQ: Reforming Computational Pathology Foundation Model for Whole Slide Image Analysis via Vector QuantizationHonglin Li, Zhongyi Shui, Yunlong Zhang, Chenglu Zhu et al.NeurIPS 2025 · 6 citations
Builds on52
- Zero-Shot Text-to-Image GenerationAditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray et al.ICML 2021 · 6,356 citations
- FlashAttention: Fast and Memory-Efficient Exact Attention with IO-AwarenessTri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra et al.NeurIPS 2022 · 5,493 citations
- The Curious Case of Neural Text DegenerationAri Holtzman, Jan Buys, Li Du, Maxwell Forbes et al.ICLR 2020 · 4,112 citations
- Efficiently Modeling Long Sequences with Structured State SpacesAlbert Gu, Karan Goel, Christopher RéICLR 2022 · 3,482 citations
- Reformer: The Efficient TransformerNikita Kitaev, Lukasz Kaiser, Anselm LevskayaICLR 2020 · 2,878 citations
Related papers
- DeFormer: Decomposing Pre-trained Transformers for Faster Question AnsweringQingqing Cao, Harsh Trivedi, Aruna Balasubramanian, Niranjan BalasubramanianACL 2020 · 61 citations
- SageAttention: Accurate 8-Bit Attention for Plug-and-play Inference AccelerationJintao Zhang, Jia Wei, Pengle Zhang, Jun Zhu et al.ICLR 2025
- RocketKV: Accelerating Long-Context LLM Inference via Two-Stage KV Cache CompressionPayman Behnam, Yaosheng Fu, Ritchie Zhao, Po-An Tsai et al.ICML 2025
- Long-Short Transformer: Efficient Transformers for Language and VisionChen Zhu, Wei Ping, Chaowei Xiao, Mohammad Shoeybi et al.NeurIPS 2021 · 180 citations
- SoftVQ-VAE: Efficient 1-Dimensional Continuous TokenizerHao Chen, Ze Wang, Xiang Li, Ximeng Sun et al.CVPR 2025
