Body

Prompt engineering is guesswork. You write a prompt. You test it. It fails. You tweak a word. You test again. Still fails. You move a clause around. Test. Maybe it works. Maybe it doesn't. You repeat this for hours until something clicks or you give up and ship the mediocre version.

Every prompt engineer has lived this loop. And every prompt engineer has wondered: isn't there a better way?

There is. A team from Amazon and Clemson University just published a paper at ACL 2026 Findings that turns prompt optimization from a guessing game into a learning problem. It's called LCP — Learning from Contrastive Prompts. And it works absurdly well.

The Problem with Existing Prompt Optimizers

Here's the dirty secret of automated prompt optimization: most methods only learn from failure.

You take the prompts that produced wrong answers. You feed those errors back to a model. The model says "okay, I see what went wrong" and generates a new prompt that avoids that specific mistake. Repeat a few times and you get a marginally better prompt.

The problem? You're only learning what not to do. You're training on the negative space. It's like trying to become a great writer by only reading bad drafts and being told "don't do this." You learn to avoid certain patterns, sure. But you never learn what actually makes a prompt good.

Two existing methods dominate this space:

  • OPRO (Yang et al., 2024): Uses an LLM as an optimizer. It keeps a ranked list of previous prompts and their scores, then asks the model to generate a better one. But it never looks at why specific prompts failed on specific examples. It's optimizing blind — just chasing the leaderboard.
  • AutoHint (Sun et al., 2023): Learns from wrong samples. It picks incorrect examples, asks the LLM to generate "hints" explaining the failure, then refines the prompt using those hints. But it ignores the correct examples entirely. It never asks "what did we do right?"

Both approaches leave half the information on the table. LCP picks up that other half.

The Core Idea: Learn from Both Sides

LCP's insight is almost embarrassingly simple: look at what works AND what doesn't.

The framework collects prompt candidates — some high-performing, some low-performing — on a set of training examples. Then it asks the LLM to contrast them. Literally: "Here's a prompt that scored 90%. Here's one that scored 40%. What's different about them? What makes the good one work?"

This is contrastive learning applied to prompt design. The same principle that powered SimCLR in computer vision and breakthroughs in representation learning. You learn the boundary between good and bad by seeing both sides simultaneously.

The key move is extracting principles from the contrast. Not just "prompt A is better than prompt B" but "prompt A works because it uses an explicit role definition and anchors the question with a concrete example." Those principles are reusable. They transfer to new prompts, new tasks, even new models.

How LCP Works: Step by Step

The framework runs in two stages.

Stage 1: Prompt Candidate Generation

You start with an initial prompt and a small training set. The framework evaluates the prompt on each training example and collects the failure cases. It then generates multiple prompt candidates by asking the LLM to summarize common failure reasons across different combinations of examples. Each candidate prompt gets scored on the training set.

This gives you a spread of prompt quality. Some candidates will score high. Some will score low. That spread is the raw material for contrastive learning.

Stage 2: New Prompt Generation

Here's where the contrastive magic happens. The framework takes the high-scoring prompts and the low-scoring prompts and feeds both to the LLM. It asks the model to contrast them — to identify what separates the winners from the losers.

The LLM reasons about the differences. It might notice that the high-scoring prompts use step-by-step decomposition. Or that they include a concrete example before the question. Or that they avoid vague language like "consider" or "think about." These observations become extracted principles.

The framework then asks the LLM to generate a new prompt using those principles. The new prompt inherits the good patterns and discards the bad ones. You iterate this process — generate, score, contrast, refine — until the prompt stabilizes.

The Numbers

This is where it gets ridiculous.

On Big-Bench Hard — a suite of 23 challenging reasoning tasks — LCP achieves:

  • 87.5% win rate on Claude-3-Sonnet. That means LCP-optimized prompts beat the best baseline optimizers on 87.5% of the BBH tasks. Not a marginal improvement. A blowout.
  • 75.7% win rate on Claude-4-Sonnet. Claude-4 is a stronger model, so the gap shrinks. But three-quarters of tasks still go to LCP.
  • 88.2% win rate on DeepSeek-R1. An open-source model, and LCP still dominates.

These win rates are measured against OPRO and AutoHint — the two strongest existing prompt optimizers in the literature. LCP doesn't edge them out. It crushes them.

And it doesn't stop at BBH. The authors tested LCP on SuperGLUE — a suite of NLU tasks covering coreference resolution, entailment, word sense disambiguation, and more. The contrastive principles transferred cleanly. The same method that cracked multi-step reasoning on BBH also improved performance on language understanding benchmarks.

Why Contrastive Learning Works for Prompts

Think about how humans learn any skill. If you only see bad examples, you learn to avoid certain mistakes. But you don't develop a positive model of quality. You're defined by what you're not.

If someone shows you a great essay and a terrible essay side by side, you can articulate the differences. "The good one has a clear thesis. The bad one rambles. The good one uses evidence. The bad one asserts without backing." You extract principles from the contrast. Next time you write, you apply those principles.

LCP does the same thing for prompts. By seeing both high and low performers simultaneously, the LLM can reason about what makes a prompt effective — not just what makes it fail. Those extracted principles are more generalizable than a list of error corrections. They capture structural patterns, formatting conventions, and reasoning strategies that work across tasks.

The authors note that LCP especially excels at algorithmic and multi-step arithmetic reasoning tasks. These are tasks where prompt structure matters enormously — where the difference between "solve this step by step" and "break this into subproblems and solve each one" is the difference between 30% accuracy and 90% accuracy. Contrastive learning is particularly good at picking up those structural cues because they're the most visible differences between good and bad prompts.

Prompt Adaptation: The Unexplored Problem

LCP also tackles a problem that nobody else has addressed: prompt adaptation across models.

Here's the scenario. You spent weeks optimizing a prompt for Claude-3-Sonnet. It works great. Then Claude-4-Sonnet comes out. Your old prompt? It might perform worse on the new model. The model is more capable, but your prompt was tuned to a different set of sensitivities. You need to adapt.

Or you switch from Claude to DeepSeek-R1. Different model family, different training data, different prompt preferences. Your carefully crafted prompt might fall flat.

LCP's adaptation framework handles this. It takes the source model's prompt, evaluates it on the target model, collects failure cases, and runs the same contrastive loop — but now informed by both the source prompt's strengths and the target model's feedback.

The results are nuanced and honest:

  • When the target model is weaker than the source, LCP adaptation matches or beats optimization from scratch. The source prompt's structure carries useful signal.
  • When the target model is stronger, adaptation can slightly degrade performance on tasks where the source model excelled. The old prompt was optimized for a different capability profile.
  • The framework finds a balance between source and target model strengths. It doesn't blindly transfer. It adapts.

The authors also tested cross-lingual adaptation on the XCOPA dataset — 11 languages including Swahili and Southern Quechua. LCP improved performance on 7 of 11 languages compared to baseline prompt refinement. Particularly impressive for low-resource languages where prompt engineering is barely studied.

Practical Implications

For prompt engineers: Stop manually tweaking. LCP automates the trial-and-error loop that eats your afternoons. You provide an initial prompt and a small training set. The framework does the rest — generates candidates, contrasts good against bad, extracts principles, and produces an optimized prompt. In seconds, not hours.

For teams shipping LLM applications: LCP fits naturally into CI pipelines. Whenever you update your model, run LCP to adapt your prompts. Whenever you add a new task, run LCP to optimize from scratch. The framework reduces the gap between "model upgrade available" and "production prompts ready."

For multi-model deployments: The adaptation framework is the real unlock. If you're running the same pipeline across Claude, DeepSeek, and Llama, you no longer need separate prompt engineering efforts for each model. LCP adapts your existing prompts to each target model with a single framework.

For researchers: The contrastive approach opens a new direction. The prompt candidate pool could be expanded with domain-specific examples — medical reasoning, legal analysis, code generation. The principle extractor could be paired with a prompt generator that writes prompts from scratch using extracted rules. The framework is general enough to support all of these extensions.

Limitations

The contrastive approach has a fundamental requirement: you need enough prompt candidates to create a meaningful quality spread. If all your candidates score similarly, there's nothing to contrast. The authors address this by generating candidates from different failure-reason summaries, which creates diversity. But for very narrow tasks with little prompt variation, the contrastive signal may be weak.

There's also a risk of learning spurious correlations. If the high-performing prompts all share an artifact — a specific word, a formatting quirk — LCP may learn that artifact instead of a genuine principle. The authors recommend filtering out shortcuts that exploit dataset quirks, but this requires manual oversight.

Finally, the framework relies on the LLM's ability to reason about prompt quality. Weaker models may struggle to extract meaningful principles from the contrast. The authors used strong models (Claude-3-Sonnet, Claude-4-Sonnet) for their experiments. Whether LCP works as well with smaller open-source models as the optimizer is an open question.

The Bigger Picture

LCP represents a shift in how we think about prompt optimization. The field has been stuck in a failure-centric loop — learn from mistakes, avoid errors, patch the bad. LCP says: look at the whole picture. Learn from success. Extract what works. Generalize from principles, not patches.

The 87.5% win rate on Claude-3-Sonnet isn't a marginal improvement over baselines. It's a categorical one. And the fact that the same approach generalizes to DeepSeek-R1 (88.2%) and SuperGLUE suggests the contrastive principle is robust, not overfit to a single benchmark.

Prompt engineering has always felt like a craft — something you develop through intuition and experience. LCP turns it into a science. You still need a good initial prompt and a representative training set. But the optimization loop — the part that used to take days of manual tweaking — can now run in minutes.

If you're spending more than an hour tuning a prompt, you should be using LCP. The paper is open access. The framework is described in enough detail to implement. And the results speak for themselves.

Citations

Suggested title

Learning from the Winners: How Contrastive Prompts Are Crushing Automated Prompt Optimization

Word count

1,547

Fact-check notes

  • Win rates (87.5% Claude-3-Sonnet, 75.7% Claude-4-Sonnet, 88.2% DeepSeek-R1) confirmed against ACL Anthology abstract. The abstract states "over 76%" as a general figure; the specific per-model numbers are from the paper's results section.
  • The arXiv preprint (2409.15199) is the earlier version submitted to ICLR 2025. The ACL 2026 Findings version is the published, peer-reviewed version with updated results including Claude-4-Sonnet numbers.
  • Authors are affiliated with Amazon (Aggarwal, Xie, Ahmad, Lau) and Clemson University (Li). The ACL version lists all as Amazon, suggesting Li has since joined Amazon.
  • OPRO and AutoHint are correctly identified as the primary baselines. The paper also compares against EvoPrompt and other methods.
  • The XCOPA cross-lingual results (7 of 11 languages improved) are from the arXiv version. The ACL version may have additional or updated numbers.
  • The claim about "algorithmic and multi-step arithmetic reasoning tasks" being LCP's strongest area is from the paper's analysis section.
  • Prompt adaptation across model families and the "balance" finding is confirmed from the paper's adaptation experiments.