Start natural voice conversations anytime with GPT-LiveTrack the latest safety rules for bigger modelsChatGPT Voice feels more natural in live conversationTranslate naturally during calls, meetings, and travelEasily automate multi-step daily tasks at lower costMake Claude easier to deploy through AWSClaude Fable 5 is usable again after the pauseKeep research tools and analysis in one placeKeep research tools in one place and move fasterDelegate more everyday coding work to ClaudeMeasure how well AI agents handle ambiguous biology research judgmentsClaude Sonnet 5 is built for heavier coding and work tasksHP partnership makes enterprise rollout easierTag Claude in Slack to delegate tasks with your whole teamHand Slack tasks to Claude more easilyConfidential AI gets stronger for sensitive workloadsHelps defenders validate and fix vulnerabilitiesGemini API key management is moving to safer auth keysGoogle Home Speaker makes home control feel naturalClaude expands more easily into Korean businesses and researchStart natural voice conversations anytime with GPT-LiveTrack the latest safety rules for bigger modelsChatGPT Voice feels more natural in live conversationTranslate naturally during calls, meetings, and travelEasily automate multi-step daily tasks at lower costMake Claude easier to deploy through AWSClaude Fable 5 is usable again after the pauseKeep research tools and analysis in one placeKeep research tools in one place and move fasterDelegate more everyday coding work to ClaudeMeasure how well AI agents handle ambiguous biology research judgmentsClaude Sonnet 5 is built for heavier coding and work tasksHP partnership makes enterprise rollout easierTag Claude in Slack to delegate tasks with your whole teamHand Slack tasks to Claude more easilyConfidential AI gets stronger for sensitive workloadsHelps defenders validate and fix vulnerabilitiesGemini API key management is moving to safer auth keysGoogle Home Speaker makes home control feel naturalClaude expands more easily into Korean businesses and research
Official sources only. Rumors, leaks, and get-rich schemes are excluded.
← Back to glossary
GlossaryAI term

Context Compression

コンテキスト圧縮

Definition

Context compression is the practice of shrinking long inputs into key points or necessary information to save tokens while maintaining accuracy. It is important for balancing quality, latency, and cost.

Passing 10 retrieved chunks directly to an LLM from a RAG pipeline consumes thousands of tokens. Moreover, most of that information may not be directly relevant to the user's question. Context compression is a technique that extracts or summarizes only the truly necessary information from lengthy retrieved documents, passing it efficiently to the LLM.

Why Compression Is Necessary

LLM context windows are limited, and input token counts translate directly to cost. Research has also identified the "Lost in the Middle" problem, where information in the middle of long contexts tends to be overlooked. When too much low-relevance information is included, the response can lose focus. Context compression simultaneously reduces token costs and improves response accuracy.

Extractive and Abstractive Approaches

Context compression has two main approaches. The extractive approach pulls out only the sentences or paragraphs relevant to the question from the search results. LangChain's LLMChainExtractor, for example, uses an LLM for each chunk with the instruction "extract only the parts relevant to this question," removing unnecessary portions.

The abstractive approach summarizes the entire search results into a shorter form. It integrates information spanning multiple chunks and generates a concise summary focused on the question. Because integration and compression happen simultaneously, this approach has the advantage of restructuring fragmented search results into coherent context.

Combining with Filtering

As a pre-compression step, filtering out low-relevance documents is also effective. By using a reranking model to exclude chunks scoring below a threshold and then applying compression to the remaining chunks, the number of LLM calls can also be reduced. A pipeline of reranking, filtering, compression, and generation achieves the optimal balance of accuracy and cost.

Risks and Countermeasures

Context compression comes with caveats. There is a risk of losing important details or numerical values during compression. Additionally, using an LLM for the compression itself incurs extra inference costs. It is therefore important to quantitatively measure the effect of compression and compare response quality with and without compression. Adjusting the degree of compression while monitoring the balance between token savings and response accuracy is the practical approach.

h
hayami

Stay on top of OpenAI, Google & Anthropic updates. An AI digest for business professionals.

Source Policy

We use only official sources. Each article links to the original announcement so you can verify it yourself.

© 2026 hayami. All rights reserved.