You Only Use Reactive Attention Slice For Long Context Retrieval

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Soh, Yun Joon, Huang, Hanxian, Tian, Yuandong, Zhao, Jishen
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866914955114053632
author Soh, Yun Joon
Huang, Hanxian
Tian, Yuandong
Zhao, Jishen
author_facet Soh, Yun Joon
Huang, Hanxian
Tian, Yuandong
Zhao, Jishen
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2409_13695
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle You Only Use Reactive Attention Slice For Long Context Retrieval
Soh, Yun Joon
Huang, Hanxian
Tian, Yuandong
Zhao, Jishen
Computation and Language
Artificial Intelligence
Information Retrieval
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.
title You Only Use Reactive Attention Slice For Long Context Retrieval
topic Computation and Language
Artificial Intelligence
Information Retrieval
url https://arxiv.org/abs/2409.13695