What is Context Compression?
Context Compression is an optimization technique that sits between the retrieval step and the generation step in a RAG pipeline. It reduces the size of retrieved documents before they are fed into the LLM, keeping only the most relevant information while discarding redundant or irrelevant content.
CN: Context Compression(上下文压缩)是RAG流程中位于检索步骤和生成步骤之间的优化技术。它在将检索到的文档送入LLM之前,压缩这些文档的大小,只保留最相关的信息,同时丢弃冗余或不相关的内容。
Imagine you’re a busy executive preparing for a meeting. Your assistant brings you 50 pages of reports (retrieved documents). Instead of reading all 50 pages, your assistant first skims through them, highlights the 5 pages that are actually relevant to today’s agenda, and gives you only those. That’s Context Compression — a “smart assistant” that filters and condenses information before it reaches the LLM.
CN: 想象你是一位忙碌的高管,正在为会议做准备。你的助理拿来50页报告(检索到的文档)。与其让你读完50页,助理先快速浏览一遍,划出与今天议程真正相关的5页,只给你这些。这就是Context Compression——一个在信息到达LLM之前进行过滤和浓缩的“智能助理”。
What are the main contents?
Context Compression techniques can be classified into several categories:
By Compression Approach:
- Extractive Compression(抽取式压缩)
Selects and keeps only the most important parts of the text, discarding the rest. Think of it as “highlighting” key sentences.
选择并只保留文本中最重要的部分,丢弃其余部分。可以理解为“高亮”关键句子。 - Abstractive Compression(抽象式/生成式压缩)
Generates a new, shorter summary that captures the essence of the original text. Think of it as “summarization.
生成一个新的、更短的摘要,捕捉原文的精华。可以理解为“摘要生成 - Soft/Hard Compression(软/硬压缩)

