LongLLMLingua: Accelerating and Enhancing LLMs in Long Context Scenarios via Prompt Compression

Huiqiang Jiang, Qianhui Wu, Xufang Luo, Dongsheng Li, Chin-Yew Lin +2 more
10/10/2023
cs.CLcs.LG

Official code: microsoft/LLMLingua (6,463 stars, MIT, last commit 2026-04-08). 1 more implementation below.

Abstract

In long context scenarios, large language models (LLMs) face three main challenges: higher computational cost, performance reduction, and position bias. Research indicates that LLM performance hinges on the density and position of key information in the input prompt. Inspired by these findings, we propose LongLLMLingua for prompt compression towards improving LLMs' perception of the key information to simultaneously address the three challenges. Our extensive evaluation across various long context scenarios demonstrates that LongLLMLingua not only enhances performance but also significantly reduces costs and latency. For instance, in the NaturalQuestions benchmark, LongLLMLingua boosts performance by up to 21.4% with around 4x fewer tokens in GPT-3.5-Turbo, leading to substantial cost savings. It achieves a 94.0% cost reduction in the LooGLE benchmark. Moreover, when compressing prompts of about 10k tokens at ratios of 2x-6x, LongLLMLingua can accelerate end-to-end latency by 1.4x-2.6x. Our code is available at https://aka.ms/LongLLMLingua.

View on arXivView PDF

Code Implementations(2)

MIT

[EMNLP'23, ACL'24] To speed up LLMs' inference and enhance LLM's perceive of key information, compress the prompt and KV-Cache, which achieves up to 20x compression with minimal performance loss.

6,463403Shell, PythonJul 7, 20236 months agoMIT
CC-BY-4.0

[EMNLP 2024] Refiner: Restructure Retrieval Content Efficiently to Advance Question-Answering Capabilities

50Shell, PythonJun 13, 20241 years agoCC-BY-4.0
compressormulti-turn-dialoguequestion-answeringretrieval-augmented-generationsummarizer

Similar Papers

Cite this paper

@article{jiang2023longllmlingua,
  title  = {LongLLMLingua: Accelerating and Enhancing LLMs in Long Context Scenarios via Prompt Compression},
  author = {Huiqiang Jiang and Qianhui Wu and Xufang Luo and Dongsheng Li and Chin-Yew Lin and Yuqing Yang and Lili Qiu},
  year   = {2023},
  eprint = {2310.06839},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2310.06839v2}
}

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

Discussion