You Only Use Reactive Attention Slice For Long Context Retrieval

Yun Joon Soh, Hanxian Huang, Yuandong Tian, Jishen Zhao
9/3/2024
cs.CLcs.AIcs.IR

No official code found. Best implementation: yjsoh/youra (5 stars, last commit 2024-09-05).

Abstract

Supporting longer context for Large Language Models (LLM) is a promising direction to advance LLMs. As training a model for a longer context window is computationally expensive, many alternative solutions, such as Retrieval Augmented Generation (RAG), have been used. However, most existing RAG methods adopt embedding-based retrieval that falls short on long contexts. To address such challenges, we propose an attention-based retrieval technique, You Only Use Reactive Attention slice (YOURA). YOURA leverages a novel retrieval heuristic called reaction score to rank the relevance of each sentence in the input context with the query sentence. Intuitively, we measure how the per-token attention score "reacts" to the query and greedily retrieves the most reactive sentences. Internally, YOURA generates a token-indexed vector (called reaction vector) for the whole input context. To map each sentence to the token-indexed vector, we propose an Embedding-Agnostic Sentence Yield (EASY), a best-effort token wiggling algorithm. We evaluate our retrieval technique on three open-source pre-trained LLM models across six LongBench QA datasets. Our technique achieves up to 30% vLLM inference throughput improvement for serving long-context queries with a nearly identical quality score to the simple yet effective truncate-middle approach.

View on arXivView PDF

Code Implementations(1)

yjsoh/youraCommunity100%

Repository for You Only Use Reactive Attention slice (YOURA) for long context retrieval

50Shell, PythonSep 3, 20242 years ago

Similar Papers

Cite this paper

@article{soh2024only,
  title  = {You Only Use Reactive Attention Slice For Long Context Retrieval},
  author = {Yun Joon Soh and Hanxian Huang and Yuandong Tian and Jishen Zhao},
  year   = {2024},
  eprint = {2409.13695},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2409.13695v1}
}

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

Discussion