Prompt Compression

What is Prompt Compression?

Prompt compression is the practice of reducing the number of tokens in prompts sent to a language model, by removing, shortening or summarizing content, while keeping the information the model needs.

Updated November 2026 · 5 min read


Prompt compression makes the input to a language model smaller. Prompts in production applications often grow long over time: instructions accumulate, examples are added, retrieved documents are included in full and conversation history piles up. Much of this content is redundant or irrelevant to the question at hand, yet every token is billed and processed. Prompt compression removes or condenses that excess, either through manual editing of prompts or through automated methods that shorten text before it reaches the model.

Because input tokens often make up most of what applications pay for, compressing prompts reduces costs directly, and it usually makes responses faster too. It can even improve quality, since models sometimes perform better when they are not distracted by irrelevant material. For IT financial management, prompt compression is a practical, low-risk optimization that complements caching, routing and model selection, and tokens per request is the measure that shows whether it is working.

Definition of Prompt Compression

Prompt compression is any technique that reduces the token count of a model's input while preserving the information needed to produce a good answer. It applies to system instructions, examples, retrieved content, tool results and conversation history. Each source has its own techniques, and most applications benefit from more than one.

It complements prompt caching. Caching makes repeated content cheaper, while compression reduces the amount of content in the first place. Both reduce the input side of input and output tokens.

Manual Compression

The simplest form is editing prompts by hand: removing duplicated instructions, shortening verbose wording, cutting examples that do not improve results and replacing long explanations with concise rules.

Prompts that have been extended by many contributors over months often shrink considerably when reviewed as a whole, with no loss in quality.

Manual compression should be tested against an evaluation set, since removing a seemingly minor instruction can occasionally change behavior. Changes are best made in small steps, with each one checked before the next.

Automated Compression

Automated methods shorten content dynamically. Retrieval systems can send only the most relevant passages instead of whole documents. Conversation history can be summarized, keeping recent turns in full and older ones in brief.

Specialized compression tools use a small model to identify and remove tokens that contribute little meaning, shrinking long contexts by a large factor.

Tool outputs, such as database results or web pages, can be filtered or summarized before being passed to the model, which is especially valuable for agents that call many tools. Raw tool outputs often contain formatting, metadata and repeated fields that the model does not need.

Importance of Prompt Compression in IT Financial Management

Input tokens drive a large share of AI costs, particularly for applications that use long instructions, retrieval or conversation history. Reducing them reduces cost in direct proportion.

Long prompts also slow responses, since the model must process every input token before answering. Compression improves user experience as well as cost.

Prompt length tends to creep upward as applications evolve, so without regular attention, costs rise even when usage does not. Tracking tokens per request makes this creep visible before it becomes expensive.

Compression and Quality

Compression is not only about saving money. Models can lose track of important information in very long prompts, so focused prompts sometimes produce better answers.

However, aggressive automated compression can remove details the model needs. The right level depends on the task and should be found through testing. Tasks that depend on exact wording, figures or legal language usually tolerate less compression than general question answering.

Measuring quality before and after compression, using an AI evaluation set, ensures savings do not come at the expense of results.

Compression for Agents

Agents send their accumulated history and tool results with each step, so their prompts grow quickly. Compression at each step can keep growth in check.

Summarizing completed steps, trimming tool outputs to relevant fields and limiting how much history is retained can reduce the cost of long tasks substantially.

These techniques also help agents stay within the model's context window on long tasks.

How to Apply Prompt Compression

Applying prompt compression involves measuring where input tokens come from, reducing the largest sources and verifying that quality holds.

Most applications have a few dominant sources of input, so targeted changes usually deliver most of the benefit.

Finding the Opportunities

Break down input tokens by source for each application: instructions, examples, retrieved content, history and tool results.

Identify the largest sources and the ones growing fastest, and review them for redundancy and relevance. Content that no one can explain the purpose of is usually a good candidate for removal.

Estimate the savings from reducing each source, using current volumes and prices. Ranking opportunities by savings keeps the effort focused where it matters.

Compressing and Verifying

Edit instructions and examples for brevity, tighten retrieval to send fewer, more relevant passages and add summarization for history and tool outputs.

Consider automated compression tools for very long contexts, testing them carefully on real inputs. Compression adds a small processing step, so its cost and delay should be weighed against the tokens it saves.

Compare quality and cost before and after each change, and track tokens per request over time so that growth is caught early. Include results in AI cost optimization reporting.

Examples of Prompt Compression in IT Financial Management

The examples below show prompt compression reducing costs.

Both use an illustrative input price of $3 per million tokens. The first trims an overgrown system prompt, and the second compresses agent tool outputs.

In each, quality was measured before and after to confirm the change was safe.

Trimming a System Prompt

A company's sales assistant uses a system prompt that has grown to 7,500 tokens over a year of additions. With 400,000 requests a month, the prompt alone costs about $9,000 a month.

A review removes duplicated rules, outdated product details and examples that no longer affect answers, bringing the prompt to 2,800 tokens.

Cost for the system prompt falls to about $3,400 a month. Scores on the team's evaluation set are unchanged, and response times improve slightly. The team adds a review of prompt length to its quarterly release checklist.

Compressing Tool Outputs

Another company's research agent retrieves web pages and passes them to the model in full, averaging 12,000 tokens per page and five pages per task. Each task's tool content costs about $0.18.

The team adds a step that extracts only the relevant sections of each page, averaging 2,000 tokens per page.

Tool content cost falls to about $0.03 per task. Across 150,000 tasks a month, this saves about $22,500, and answer quality improves slightly because the model receives less noise.

Conclusion

Prompt compression reduces the tokens sent to a language model by removing, shortening or summarizing content while keeping what the model needs. It can be done manually, by editing prompts, or automatically, through retrieval, summarization and compression tools.

In IT financial management, prompt compression is a practical, low-risk way to reduce AI costs and response times, and it counters the steady growth of prompts over time. Measuring input by source, trimming the largest sources, compressing agent histories and tool outputs, and verifying quality with evaluations help organizations pay only for the tokens that matter.