AI Dictionary › Prompting
Prompt Contrastivo
Contrastive prompting is a technique in which the model is shown, within the same prompt, both a correct and an incorrect example (or a good and a mediocre one) of the same type of task, so that the direct comparison between the two clarifies to the model which characteristics distinguish a valid response from one to avoid.
Unlike simple few-shot, where only positive examples to imitate are shown, here the prompt also makes explicit what is wrong with a negative example, often accompanied by a short explanation of why that example is inadequate. The model can thus learn not only the pattern to follow but also the boundary separating an acceptable output from one to discard.
This technique is useful when there are typical, recurring errors one wants to explicitly prevent: showing an example of an overly verbose response next to a concise, well-calibrated one for a customer service context, or comparing a correct technical explanation with one containing a common conceptual error, explaining the difference.
The term echoes the concept of contrastive learning, already known in machine learning as a technique that teaches a model to distinguish similar examples belonging to different classes, here adapted to prompting as a way to sharpen the boundaries of a correct response through direct comparison.
Grace often uses comparisons between a valid answer and one to avoid, so you can see precisely where the line sits in a scenario.
From our network
AGORÀ Intelligence: Enterprise AI Governance Platform
Govern AI at scale: policies, adoption and measurable results on your data. Built for boards and C-suite.
Visit agora-intelligence.com →From the Agora Intelligence blog
📱 Download the Android app (beta) iOS coming soon
Say what you mean. Get what you need.
Grace Certified, the AI coach that trains and certifies your prompt engineering, by Agora Intelligence.