Writing in the Margins: Better Inference Pattern for Long Context Retrieval

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Russak, Melisa, Jamil, Umar, Bryant, Christopher, Kamble, Kiran, Magnuson, Axel, Russak, Mateusz, AlShikh, Waseem
Format: Preprint
Veröffentlicht: 2024
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866916371119472640
author Russak, Melisa
Jamil, Umar
Bryant, Christopher
Kamble, Kiran
Magnuson, Axel
Russak, Mateusz
AlShikh, Waseem
author_facet Russak, Melisa
Jamil, Umar
Bryant, Christopher
Kamble, Kiran
Magnuson, Axel
Russak, Mateusz
AlShikh, Waseem
contents In this paper, we introduce Writing in the Margins (WiM), a new inference pattern for Large Language Models designed to optimize the handling of long input sequences in retrieval-oriented tasks. This approach leverages the chunked prefill of the key-value cache to perform segment-wise inference, which enables efficient processing of extensive contexts along with the generation and classification of intermediate information ("margins") that guide the model towards specific tasks. This method increases computational overhead marginally while significantly enhancing the performance of off-the-shelf models without the need for fine-tuning. Specifically, we observe that WiM provides an average enhancement of 7.5% in accuracy for reasoning skills (HotpotQA, MultiHop-RAG) and more than a 30.0% increase in the F1-score for aggregation tasks (CWE). Additionally, we show how the proposed pattern fits into an interactive retrieval design that provides end-users with ongoing updates about the progress of context processing, and pinpoints the integration of relevant information into the final response. We release our implementation of WiM using Hugging Face Transformers library at https://github.com/writer/writing-in-the-margins.
format Preprint
id arxiv_https___arxiv_org_abs_2408_14906
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Writing in the Margins: Better Inference Pattern for Long Context Retrieval
Russak, Melisa
Jamil, Umar
Bryant, Christopher
Kamble, Kiran
Magnuson, Axel
Russak, Mateusz
AlShikh, Waseem
Computation and Language
Information Retrieval
In this paper, we introduce Writing in the Margins (WiM), a new inference pattern for Large Language Models designed to optimize the handling of long input sequences in retrieval-oriented tasks. This approach leverages the chunked prefill of the key-value cache to perform segment-wise inference, which enables efficient processing of extensive contexts along with the generation and classification of intermediate information ("margins") that guide the model towards specific tasks. This method increases computational overhead marginally while significantly enhancing the performance of off-the-shelf models without the need for fine-tuning. Specifically, we observe that WiM provides an average enhancement of 7.5% in accuracy for reasoning skills (HotpotQA, MultiHop-RAG) and more than a 30.0% increase in the F1-score for aggregation tasks (CWE). Additionally, we show how the proposed pattern fits into an interactive retrieval design that provides end-users with ongoing updates about the progress of context processing, and pinpoints the integration of relevant information into the final response. We release our implementation of WiM using Hugging Face Transformers library at https://github.com/writer/writing-in-the-margins.
title Writing in the Margins: Better Inference Pattern for Long Context Retrieval
topic Computation and Language
Information Retrieval
url https://arxiv.org/abs/2408.14906