PromptItIn logoPromptItIn
AI glossary · Prompting

Prompt Compression

Reducing prompt length while preserving the information needed for accurate responses.

PromptItIn team

A bookshelf with one card pulled out

What it means

Prompt compression techniques shrink long prompts — particularly retrieved documents or conversation histories — to fit within a model's context window or to reduce token costs.

Methods include extractive compression (removing irrelevant sentences), abstractive compression (summarising), selective retrieval (only including the most relevant chunks), and learned compression (using a smaller model to encode long context into a compact representation).

As context windows grow, compression matters less for fitting text in, but remains critical for cost control and for mitigating the 'lost in the middle' phenomenon where models underweight centrally positioned content.

Examples

  • Using a summarisation model to condense a 50-page PDF to 2,000 tokens before passing it to a question-answering model.
  • Removing boilerplate and repeated content from a conversation history before appending it to a new prompt.

Context Window

The maximum number of tokens a model can process in a single input-output interaction.

RAG (Retrieval-Augmented Generation)

Augmenting model responses by retrieving relevant documents from an external knowledge base at inference time.

Token

The basic unit of text a language model processes, roughly corresponding to a word or word fragment.

Put this into practice

PromptItIn applies techniques like prompt compression for you: describe what you want and it builds the prompt.

Try PromptItIn freeAdd to Chrome, free

You might also like

How to Add Context to AI Prompts →Advanced Role Prompting Techniques →Customer Support Prompts →How to Write Prompts for Claude — The Complete Guide →How to Use Grok Effectively: Tips and Prompts for Grok 3 →AI Video Prompt Builder →
← Browse the AI prompt glossary