Skip to main content
← Back to techniques

Contrastive / Negative prompting

Fundamentals

Level 1 · Foundations

Show a good example and a bad example side by side, so the model learns the boundary between them.

Contrastive prompting shows the model both a correct example and an incorrect one, explaining briefly why the bad example is wrong — instead of only showing what's right. Seeing the boundary between acceptable and unacceptable often teaches the pattern more precisely than a single good example alone, especially for tasks like classification, content moderation, or matching a specific writing style.

When to use it

Use it for tasks with a real risk of a plausible-but-wrong answer — classification, extraction, tone/style matching, moderation — where showing what to avoid is as informative as showing what to aim for.

When to avoid it

Avoid it for simple tasks where a single good example is already unambiguous — adding a bad example adds length without adding clarity.

Advantages

  • Teaches the boundary of the task, not just one point inside it
  • Particularly effective for classification, extraction, and style-matching tasks
  • Reduces the model repeating a specific known failure mode

Disadvantages

  • Requires a genuinely informative bad example, not an exaggerated strawman
  • Adds more tokens than a single-example technique

Examples

Task: classify customer messages as "urgent" or "not urgent".

Good example: Input: "My payment failed and I'm locked out of my account right now." → Output: urgent
Bad example: Input: "Just wanted to say I love the new update!" → Output: urgent (wrong — this is positive feedback, not a problem needing attention)

Apply the same standard to: "The app has been running slowly since yesterday."

Try it

Fill in the placeholders below and see the compiled prompt update live.

What you want to achieve.

Input → Output that represents the desired result.

Input → Output that represents what to avoid, and briefly why it's wrong.

Who or what this is written for or about.

13
Words
114
Characters
0/4
Placeholders filled
1 min
Reading time
Quality score11
  • Completeness0
  • Clarity0
  • Context0
  • Specificity0
  • Constraints0
  • Format0
  • Output0
  • Constraints note0
  • Success criteria0
  • Scope focus100
  • Verification step0
  • Negative example100
  • Confidence0
  • Placeholder syntax100
  • Markdown structure0
Suggestions
  • Fill in the remaining placeholders.
  • Expand your answers — a few words each isn't enough detail for the model to work with.
  • Add background context so the model understands the situation.
{{OBJECTIVE}} Good example: {{GOOD_EXAMPLE}} Bad example: {{BAD_EXAMPLE}} Apply the same standard to: {{TARGET}}
AI Assistant

Jump to a page…

Navigation