Superposition Prompting: Improving and Accelerating Retrieval-Augmented Generation

Thomas Merth, Qichen Fu, Mohammad Rastegari, Mahyar Najibi
4/10/2024
cs.CLcs.AIcs.LG

No official code found. Best implementation: apple/ml-superposition-prompting (147 stars, last commit 2024-07-19).

Abstract

Despite the successes of large language models (LLMs), they exhibit significant drawbacks, particularly when processing long contexts. Their inference cost scales quadratically with respect to sequence length, making it expensive for deployment in some real-world text processing applications, such as retrieval-augmented generation (RAG). Additionally, LLMs also exhibit the "distraction phenomenon", where irrelevant context in the prompt degrades output quality. To address these drawbacks, we propose a novel RAG prompting methodology, *superposition prompting*, which can be directly applied to pre-trained transformer-based LLMs *without the need for fine-tuning*. At a high level, superposition prompting allows the LLM to process input documents in parallel *prompt paths*, discarding paths once they are deemed irrelevant. We demonstrate the capability of our method to simultaneously enhance time efficiency across a variety of question-answering benchmarks using multiple pre-trained LLMs. Furthermore, our technique significantly improves accuracy when the retrieved context is large relative the context the model was trained on. For example, our approach facilitates a 93x reduction in compute time while *improving* accuracy by 43% on the NaturalQuestions-Open dataset with the MPT-7B instruction-tuned model over naive RAG.

View on arXivView PDF

Code Implementations(1)

14719Shell, PythonJul 19, 20242 years agoNOASSERTION

Similar Papers

Cite this paper

@article{merth2024superposition,
  title  = {Superposition Prompting: Improving and Accelerating Retrieval-Augmented Generation},
  author = {Thomas Merth and Qichen Fu and Mohammad Rastegari and Mahyar Najibi},
  year   = {2024},
  eprint = {2404.06910},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2404.06910v2},
  journal = {ICML 2024 2024}
}

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

Discussion