Research map / Large language models / Language, safety and interpretability
Customizing Language Model Responses with Contrastive In-Context Learning
Read the paperCheck your idea against 108,967 papers
AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
Proposes contrastive in-context learning, pairing positive and negative demonstrations and prompting the LLM to analyze their differences before answering, to better align LLM outputs with user preferences.
Problem
Aligning LLM outputs with user intent when desired style, tone, or preference is hard to describe in instructions or measure with automatic metrics.
Approach
Use contrastive few-shot examples (a positive and a negative response per demonstration), with negatives taken from low-rated human answers, from zero-shot LLM outputs, or from an automated evaluator, and add a reasoning step where the model analyzes the contrast before generating its answer.
Key results
- Contrastive combined prompting with ChatGPT on Reddit improved GPT Score to 0.690-0.701 vs 0.578-0.583 for few-shot (k=1,2), and won 76% of test cases vs 64% for two-shot against zero-shot.
- On constrained generation with GPT-4, contrastive combined reached 0.943 success rate vs 0.900 for two-shot and 0.850 for zero-shot.
- Negatives generated by the LLM itself performed on par with or better than human-written low-rated negatives in many settings.
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| Use combined contrastive examples and an analysis instruction instead of standard few-shot examples | GPT-4 · StackExchange | GPT Score: 0.582 -> 0.607 | Helped |
| Use combined contrastive examples and an analysis instruction instead of standard few-shot examples | GPT-4 · Reddit | GPT Score: 0.590 -> 0.670 | Helped |
| Use combined contrastive examples and an analysis instruction instead of standard few-shot examples | GPT-4 · Constrained Gen. | Success rate: 0.900 -> 0.943 | Helped |
| Use combined contrastive examples and an analysis instruction instead of standard few-shot examples | GPT-4 · Concise vs. Detailed | BERT Score: 0.880 -> 0.917 | Helped |
| Add an analysis instruction to contrastive examples (ablation) | GPT-4 contrastive prompting · StackExchange | GPT Score: 0.590 -> 0.607 | Helped |
| Add contrastive examples to the analysis instruction (ablation) | GPT-4 contrastive prompting · StackExchange | GPT Score: 0.591 -> 0.607 | Helped |
| Add an analysis instruction to contrastive examples (ablation) | GPT-4 contrastive prompting · Reddit | GPT Score: 0.671 -> 0.670 | No clear effect |
| Add contrastive examples to the analysis instruction (ablation) | GPT-4 contrastive prompting · Reddit | GPT Score: 0.672 -> 0.670 | Hurt |
| Replace human-written negative examples with generated negative examples (ablation) | GPT-4 combined contrastive prompting · Reddit | GPT Score: 0.665 -> 0.670 | Helped |
| Replace human-written negative examples with generated negative examples (ablation) | GPT-4 combined contrastive prompting · StackExchange | BERT Score: 0.847 -> 0.845 | Hurt |
| Use contrastive examples and an analysis instruction instead of standard few-shot examples | GPT-4 · Funny vs. Serious | Emb. Similarity: 0.624 -> 0.616 (human); 0.624 -> 0.630 (generated) | Mixed |
| Use contrastive examples and an analysis instruction instead of standard few-shot examples | GPT-4 · British vs. American | BERT Score: 0.868 -> 0.886 (human); 0.868 -> 0.884 (generated) | Helped |
Surprising findings
- LLM-generated zero-shot responses used as negative examples performed on par with or better than low-rated human answers.
- Generated analysis alone (instruction only) gave only modest gains, not significantly better than standard few-shot on real-world data.
Limitations
- Negative examples from upvote/downvote signals are a noisy proxy for preference, and preferences across examples may be inconsistent.
- Improvements over standard few-shot are modest on StackExchange and not significantly better for instruction-only variants.
- Evaluation relies on reference similarity metrics and GPT-4 scoring, with only moderate correlation to human labels (0.65 and 0.58).
Experimental setup
Datasets: StackExchange (cooking.stackexchange.com) Reddit NoStupidQuestions StackExchange questions for constrained generation
Benchmarks: StackExchange cooking preference dataset Reddit NoStupidQuestions Synthetic stylistic datasets (funny vs. serious, concise vs. detailed, British vs. American) Constrained generation (seed words)
Metrics: BERT Score Emb. Similarity DialogRPT score GPT Score Success rate
Baselines: zero-shot prompting standard few-shot prompting
Builds on: chain-of-thought prompting few-shot prompting Sentence-BERT DialogRPT
Closest papers by meaning
- Supervised Knowledge Makes Large Language Models Better In-context Learners (ICLR 2024 · similarity 0.89)
- DistiLLM-2: A Contrastive Approach Boosts the Distillation of LLMs (ICML 2025 · similarity 0.87)
- HonestLLM: Toward an Honest and Helpful Large Language Model (NeurIPS 2024 · similarity 0.87)
- Teaching Large Language Models to Translate with Comparison (AAAI 2024 · similarity 0.87)
- Large Language Models are Demonstration Pre-Selectors for Themselves (ICML 2025 · similarity 0.87)
- Improving Factuality and Reasoning in Language Models through Multiagent Debate (ICML 2024 · similarity 0.86)
Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.
