paper-with-me

Papers

RetrievalAttention: Accelerating Long-Context LLM Inference via Vector Retrieval

2024-09-16 · Di Liu, Meng Chen, Baotong Lu, Huiqiang Jiang, Zhenhua Han, Qianxi Zhang, Qi Chen, Chengruidong Zhang, Bailu Ding, Kai Zhang, Chen Chen, Fan Yang, Yuqing Yang, Lili Qiu

Transformer-based Large Language Models (LLMs) have become increasingly important. However, due to the quadratic time complexity of attention computation, scaling LLMs to longer contexts incurs extremely slow inference speed and high GPU memory consumption for caching key-value (KV) vectors. This paper proposes RetrievalAttention, a training-free approach to both accelerate attention computation and reduce GPU memory consumption. By leveraging the dynamic sparsity of attention mechanism, RetrievalAttention proposes to build approximate nearest neighbor search (ANNS) indexes for KV vectors in CPU memory and retrieve the most relevant ones through vector search during generation. Unfortunately, we observe that the off-the-shelf ANNS indexes are often ineffective for such retrieval tasks due to the out-of-distribution (OOD) between query vectors and key vectors in the attention mechanism. RetrievalAttention addresses the OOD challenge by designing an attention-aware vector search algorithm that can adapt to the distribution of query vectors. Our evaluation demonstrates that RetrievalAttention achieves near full attention accuracy while only requiring access to 1--3% of the data. This leads to a significant reduction in the inference cost of long-context LLMs, with a much lower GPU memory footprint. In particular, RetrievalAttention only needs a single NVIDIA RTX4090 (24GB) to serve 128K tokens for LLMs with 8B parameters, which is capable of generating one token in 0.188 seconds.

📄 PDF Abstract BibTeX arXiv:2409.10516

Code (1)

jzbjyb/reatt 공식 구현 pytorch

Tasks

CPUGPURetrieval

Methods 이 논문이 사용한 방법론

Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…
Attention 설명 없음
SPEED The monocular depth estimation (MDE) is the task of estimating depth from a single frame. This information is an essential knowledge in many computer vision tasks such as scene…

Similar Papers 제목 키워드 기반

Accelerating Production LLMs with Combined Token/Embedding Speculators

2024-04-29 · Davis Wertheimer, Joshua Rosenkranz, Thomas Parnell, Sahil Suneja 외

This technical report describes the design and training of novel speculative decoding draft models, for accelerating the inference speeds of large language models in a production environment. By conditioning draft predic…

VecAttention: Vector-wise Sparse Attention for Accelerating Long Context Inference

2026-03-31 · Anmin Liu, Ruixuan Yang, Huiqiang Jiang, Bin Lin 외 arxiv

Long-context video understanding and generation pose a significant computational challenge for Transformer-based video models due to the quadratic complexity of self-attention. While existing sparse attention methods emp…

AdaSkip: Adaptive Sublayer Skipping for Accelerating Long-Context LLM Inference

2025-01-04 · Zhuomin He, Yizhen Yao, Pengfei Zuo, Bin Gao 외

Long-context large language models (LLMs) inference is increasingly critical, motivating a number of studies devoted to alleviating the substantial storage and computational costs in such scenarios. Layer-wise skipping m…

Understanding Task Vectors in In-Context Learning: Emergence, Functionality, and Limitations

2025-06-10 · Yuxin Dong, Jiachen Jiang, Zhihui Zhu, Xia Ning

Task vectors offer a compelling mechanism for accelerating inference in in-context learning (ICL) by distilling task-specific information into a single, reusable representation. Despite their empirical success, the under…

In-Context LearningTriplet

PackKV: Reducing KV Cache Memory Footprint through LLM-Aware Lossy Compression

2025-12-30 · Bo Jiang, Taolue Yang, Youyuan Liu, Xubin He 외 arxiv

Transformer-based large language models (LLMs) have demonstrated remarkable potential across a wide range of practical applications. However, long-context inference remains a significant challenge due to the substantial …

Computational Efficiency