Meta-Prompting & Compression

Use meta-prompts to generate task-specific prompts and compress prompts without losing quality.

7 min read
2 quiz questions

A meta-prompt is a prompt designed to generate other prompts. Instead of writing a prompt for each new task, you write one meta-prompt that takes a task description and produces an optimized prompt. This is the ultimate leverage — one well-designed meta-prompt can replace hours of manual prompt engineering.

Meta-prompt: "You are an expert prompt engineer. Given a task description, generate an optimized prompt that: 1. Starts with a clear role definition 2. Specifies the exact output format 3. Includes 2 examples of expected behavior 4. Adds constraints to prevent common failure modes 5. Ends with the specific task Task description: [USER'S TASK] Generate the optimized prompt:" Input: "I need emails classified as spam or not spam" Output: A fully structured classification prompt with role, format, examples, and constraints.

Long prompts cost more, run slower, and can actually perform worse (the model gets lost in verbosity). Prompt compression techniques reduce token count while maintaining performance. Studies show 40-70% compression is often possible with minimal quality loss.

  • Remove redundancy: Eliminate repeated instructions, merge overlapping rules
  • Use shorthand: Replace verbose phrases with concise equivalents ("Do not" → "Never")
  • Structured formats: Tables and lists are more token-efficient than paragraphs
  • LLM-based compression: Ask a model to compress the prompt while preserving meaning
  • Selective few-shot: Use 1-2 highly representative examples instead of 5+ mediocre ones

Never compress without measuring. Run your eval suite on both the original and compressed prompt. Accept the compression only if performance stays within an acceptable threshold (e.g., less than 2% accuracy drop). Sometimes compression actually improves performance by reducing noise.

A common compression win: replace lengthy "do not" lists with a single positive instruction. "Do not use jargon, do not use long sentences, do not use passive voice" becomes "Use simple, short, active sentences."

Prompt Templates

Universal Meta-Prompt

Generates optimized prompts for any task by describing what you need.

You are an expert prompt engineer. I'll describe a task, and you'll generate an optimized prompt.

Task: [DESCRIBE WHAT YOU NEED THE AI TO DO]
Target model: [MODEL NAME, e.g., "GPT-4o" or "Claude"]
Output format: [DESIRED FORMAT]

Generate a production-ready prompt that includes: role definition, clear instructions, output format specification, 1-2 examples, key constraints, and the task placeholder. Optimize for accuracy and conciseness.

Prompt Compressor

Compresses prompts while preserving their core instructions and effectiveness.

Compress this prompt to use fewer tokens while maintaining its effectiveness. Target: 50% reduction.

Original prompt:
[LONG PROMPT]

Compression rules:
- Merge redundant instructions
- Replace verbose phrases with concise equivalents
- Convert paragraphs to bullet points where appropriate
- Remove filler words
- Keep all essential instructions and constraints

Output the compressed prompt and note what was removed/changed.

Test Your Knowledge

Knowledge Check

1 / 2

What is a meta-prompt?

Key Takeaways

  • Meta-prompts generate task-specific prompts from descriptions — one meta-prompt replaces hours of manual work
  • Prompt compression can reduce tokens by 40-70% with minimal quality loss by removing redundancy and using concise structures
  • Always validate compression with your eval suite — sometimes shorter prompts actually perform better