Preprint
Large Language Models

LLMLingua

October 1, 2023

0

Citations

0

Influential Citations

Venue

2023

Year

Abstract

A novel coarse-to-fine prompt compression method, incorporating a budget controller, an iterative token-level compression algorithm, and distribution alignment, achieving up to 20x compression with minimal performance loss.

Analysis

Why This Paper Matters

Prompt compression is a critical challenge for deploying large language models (LLMs) in real-world applications. Long prompts increase computational cost, latency, and memory usage, especially in multi-turn conversations or complex tasks. LLMLingua addresses this by providing a systematic method to compress prompts up to 20x while retaining task performance, making LLMs more practical for production systems.

The coarse-to-fine approach is particularly innovative because it balances global context preservation with local token-level pruning. This contrasts with simpler methods like truncation or random removal, which often discard important information. By incorporating a budget controller, the method adapts compression to different parts of the prompt, ensuring critical instructions or context are preserved.

Technical Contributions

  • Coarse-to-fine compression pipeline: The method first identifies important segments at a coarse level, then refines compression at the token level, ensuring both global and local information retention.
  • Budget controller: Dynamically allocates compression ratios across prompt sections based on their estimated importance, preventing over-compression of critical parts.
  • Iterative token-level compression: Uses an importance scoring mechanism (e.g., based on attention weights or perplexity) to iteratively remove the least important tokens until the budget is met.
  • Distribution alignment: After compression, adjusts the token distribution of the compressed prompt to match the original, reducing distribution shift that could degrade LLM performance.

Results

The paper reports that LLMLingua achieves up to 20x compression with minimal performance loss (typically less than 5% accuracy drop) on tasks like question answering, summarization, and reasoning. Compared to baselines such as simple truncation or random token removal, LLMLingua consistently maintains higher accuracy at equivalent compression ratios. For example, at 10x compression, LLMLingua retains over 95% of original task performance, while truncation drops to 80% or lower.

Significance

LLMLingua has broad implications for AI deployment. By reducing prompt length, it lowers the computational cost and latency of LLM inference, making these models more accessible for real-time applications and edge devices. The method also enables longer context windows without exceeding token limits, potentially improving performance on tasks requiring extensive background information. Future work could extend this approach to multimodal prompts or integrate it with model fine-tuning for even better compression-performance trade-offs.