# Context Compression

- **Canonical URL:** https://getaimath.com/dictionary/context-compression/
- **Topics:** [Context, Memory & Retrieval](https://getaimath.com/dictionary/category/context-memory-and-retrieval/)
- **Last updated:** 2026-11-25

## What is Context Compression?

**In one sentence:** Context compression shrinks the information in a model's context so more fits or it costs less.

This can mean summarizing old messages, removing repeated text, or keeping only the most relevant sentences. The goal is to keep the meaning while using fewer tokens.

![Context Window vs. Memory: Your Desk vs. The Filing Cabinet — Simple cartoon comparing the AI Context Window (a small desk that can only fit a few pages right now) with External Memory & Search (a big filing cabinet where a librarian grabs just the 3 pages you need).](https://getaimath.com/diagrams/context-memory-and-retrieval.png)
*Napkin Diagram (Context, Memory & Retrieval): The context window is the small desk the AI can see right now; search grabs the right pages from the filing cabinet.*

## What is an example of Context Compression?

Replacing 50 old chat messages with a 5-sentence summary is context compression.

## Why does Context Compression matter?

It lets long conversations and tasks continue without hitting limits.

## Related Concepts

- [Context Engineering](https://getaimath.com/dictionary/context-engineering/): Context engineering is the practice of carefully designing everything a model sees, like instructions, examples, retrieved documents, tools and memory, to get the best results.
- [Context Rot](https://getaimath.com/dictionary/context-rot/): Context rot is when a model gets worse at using information as its context gets longer and more cluttered.
- [Context Management](https://getaimath.com/dictionary/context-management/): Context management is deciding what information goes into a model's limited context window, and what stays out.
- [Long Context](https://getaimath.com/dictionary/long-context/): Long context means a model can handle very large inputs, often hundreds of thousands or millions of tokens.
- [Context Overflow](https://getaimath.com/dictionary/context-overflow/): Context overflow is what happens when there is more text than fits in a model's context window.
- [Short-Term Memory](https://getaimath.com/dictionary/short-term-memory/): In AI, short-term memory is the information a model can use right now, which is basically what is in its current context.

---
Source: The AI Math Dictionary (https://getaimath.com/dictionary/context-compression/)
