All guides

Optimize prompts

Tune prompt structure, few-shot examples, and token budgets for consistency.

Intermediate14 min readJul 14, 2025
OptimizationPromptingResponses
Key takeaways
  • Start with a minimal contract and expand only as needed.
  • Use few-shot examples to lock format and tone.
  • Budget tokens by section and enforce caps.

Establish a signal hierarchy

Put the most important instruction first and avoid competing goals.

Use short, declarative statements instead of long narrative prompts.

Use few-shot anchors

Add a single high quality example that mirrors the target output. Keep it short and consistent with your schema.

Enforce token budgets

Measure your average token usage and cap responses to protect latency and cost.

  • Set max tokens per section.
  • Summarize long inputs before passing them forward.
  • Prefer short summaries for high volume workflows.