Submit a Story

Glossary term

Context Compression

Updated Oct 17, 2026

In short

Techniques for reducing the size of information sent to a model while preserving the details needed for the current task.

Context compression reduces prompt length by removing repetition, summarizing history, selecting relevant passages or converting verbose records into compact structured facts. It can lower token cost and help a system stay within a model’s context window.

Methods include dropping duplicate text, keeping only the most relevant retrieved passages, summarizing older turns and replacing a long tool output with the few fields the agent needs. Pick the approach based on what the task requires: a coding agent may need exact error text kept, while a chat assistant may only need the gist of earlier turns. It pairs naturally with retrieval-augmented generation and document chunking.

Compression can discard details that later turn out to matter. Preserve source references for important facts, distinguish confirmed information from inference and test summaries against tasks that require precise recall. Related: Context Window, Conversation Summarization.