paper-with-me

홈 › Papers

Cottention: Linear Transformers With Cosine Attention

2024-09-27 · Gabriel Mongaras, Trevor Dohm, Eric C. Larson

Attention mechanisms, particularly softmax attention, have been instrumental in the success of transformer-based models such as GPT. However, the quadratic memory complexity of softmax attention with respect to sequence length poses significant challenges for processing longer sequences. We introduce Cottention, a novel attention mechanism that replaces the softmax operation with cosine similarity. By leveraging the properties of cosine similarity and rearranging the attention equation, Cottention achieves native linear memory complexity with respect to sequence length, making it inherently more memory-efficient than softmax attention. We demonstrate that Cottention can be reformulated as a recurrent neural network (RNN) with a finite hidden state, allowing for constant memory usage during inference. We evaluate Cottention on both the bidirectional BERT and causal GPT tasks, demonstrating comparable performance to softmax attention while significantly reducing memory requirements. To ensure efficient computation, we develop a custom CUDA kernel for Cottention. Our results show that Cottention is a promising alternative to softmax attention, enabling the processing of longer sequences without sacrificing performance, due to its native linear memory complexity and ability to maintain a constant memory footprint during inference.

📄 PDF Abstract BibTeX arXiv:2409.18747

Code (1)

gmongaras/Cottention_Transformer 공식 구현 pytorch

Methods 이 논문이 사용한 방법론

Refunds@Expedia|||How do I get a full refund from Expedia? “How do I get a full refund from Expedia? How do I get a full refund from Expedia? – Call ☎️ +1-(888) 829 (0881) or +1-805-330-4056 or +1-805-330-4056 for Quick Help &…
Attention 설명 없음
WordPiece 설명 없음
Linear Warmup With Linear Decay Linear Warmup With Linear Decay is a learning rate schedule in which we increase the learning rate linearly for $n$ updates and then linearly decay afterwards.
Linear Layer A Linear Layer is a projection $\mathbf{XW + b}$.
Residual Connection 설명 없음
Cosine Annealing Cosine Annealing is a type of learning rate schedule that has the effect of starting with a large learning rate that is relatively rapidly decreased to a minimum value before…
BPE Byte Pair Encoding, or BPE, is a subword segmentation algorithm that encodes rare and unknown words as sequences of subword units. The intuition is that various word…

Similar Papers 제목 키워드 기반

A Computationally Efficient Multidimensional Vision Transformer

2026-02-23 · Alaa El Ichi, Khalide Jbilou arxiv

Vision Transformers have achieved state-of-the-art performance in a wide range of computer vision tasks, but their practical deployment is limited by high computational and memory costs. In this paper, we introduce a nov…

Self-Attention And Beyond the Infinite: Towards Linear Transformers with Infinite Self-Attention

2026-02-26 · Giorgio Roffo, Hazem Abdelkawy, Nilli Lavie, Luke Palmer arxiv

The quadratic cost of softmax attention limits Transformer scalability in high-resolution vision. We introduce Infinite Self-Attention (InfSA), a spectral reformulation that treats each attention layer as a diffusion ste…

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

Your Attention Matters: to Improve Model Robustness to Noise and Spurious Correlations

2025-07-28 · Camilo Tamayo-Rousseau, Yunjia Zhao, Yiqun Zhang, Randall Balestriero arxiv

Self-attention mechanisms are foundational to Transformer architectures, supporting their impressive success in a wide range of tasks. While there are many self-attention variants, their robustness to noise and spurious …

A Unified Framework for Interpretable Transformers Using PDEs and Information Theory

2024-08-18 · Yukun Zhang

This paper presents a novel unified theoretical framework for understanding Transformer architectures by integrating Partial Differential Equations (PDEs), Neural Information Flow Theory, and Information Bottleneck Theor…