Context and knowledge

Prompt compression

stable definition
Machine-readable Download Markdown

Definition

Prompt compression reduces the tokens sent to a model while trying to preserve the information needed for the next action. The compressor may select passages, summarize history, remove tokens estimated to be low value, shorten tool output, or replace a sequence of attempts with the current artifact and unresolved failures.

The preservation target must be explicit. Task goals, standing constraints, source provenance, exceptions, current state, and known failures do not have equal redundancy. A summary that keeps the topic while dropping one negation or approval boundary can remain fluent and still be operationally wrong.

Huiqiang Jiang and colleagues' 2023 LLMLingua paper treated prompt compression as an optimization problem and used a smaller language model for token-level compression. It is one learned method, not the origin of shortening prompts.

Compaction introduces a state transition. The original context is replaced or bypassed, so the system needs tests for what survives. Zhiqi Wang and colleagues' 2026 COMPINT study found that several compactors frequently lost standing session constraints across long-context chat, agent, and research settings. Its models and compactors are perishable, but the evaluation method exposes a durable requirement: test retained behavior, not summary fluency alone.

For high-consequence constraints, deterministic storage and reinjection can be safer than asking a summary to remember everything. Compression can point to a durable artifact instead of paraphrasing it, provided the next context retrieves the artifact when needed.

Distinguish it from nearby terms

Truncation drops content at a boundary. Summarization rewrites it. Selection keeps chosen passages unchanged. Prompt compression is the broader objective and may use any of these mechanisms. Prompt caching avoids recomputing a repeated prefix but does not shorten it.

Check your understanding

A compacted session remembers the goal and recent files but loses a standing rule requiring approval before deployment. Which retention probe should have failed before the compacted state was accepted?