Customizing Language Model Responses with Contrastive In-Context Learning
摘要
Large language models (LLMs) are becoming increasingly important for machine learning applications. However, it can be challenging to align LLMs with our intent, particularly when we want to generate content that is preferable over others or when we want the LLM to respond in a certain style or tone that is hard to describe. To address this challenge, we propose an approach that uses contrastive examples to better describe our intent. This involves providing positive examples that illustrate the true intent, along with negative examples that show what characteristics we want LLMs to avoid. The negative examples can be retrieved from labeled data, written by a human, or generated by the LLM itself. Before generating an answer, we ask the model to analyze the examples to teach itself what to avoid. This reasoning step provides the model with the appropriate articulation of the user's need and guides it towards generting a better answer. We tested our approach on both synthesized and real-world datasets, including StackExchange and Reddit, and found that it significantly improves performance compared to standard few-shot prompting.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 9 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
引用它的顶会 Paper9
- Learning from Mistakes: Negative Reasoning Samples Enhance Out-of-Domain GeneralizationTian Xueyun, Minghua Ma, Bingbing Xu, Nuoyan Lyu 等ACL 2026 · 3 次引用
- RIMRULE: Improving Tool-Using Language Agents via MDL-Guided Rule LearningXiang Gao, Yuguang Yao, Qi Zhang, Kaiwen Dong 等ACL 2026 · 2 次引用
- Q-Adapter: Customizing Pre-trained LLMs to New Preferences with Forgetting MitigationYi-Chen Li, Fuxiang Zhang, Wenjie Qiu, Lei Yuan 等ICLR 2025 · 1 次引用
- Network-Level Prompt and Trait Leakage in Local Research AgentsHyejun Jeong, Mohammadreza Teymoorianfard, Abhinav Kumar, Amir Houmansadr 等USENIX Security 2026 · 1 次引用
- PANDAS: Improving Many-shot Jailbreaking via Positive Affirmation, Negative Demonstration, and Adaptive SamplingAvery Ma, Yangchen Pan, Amir-massoud FarahmandICML 2025
它引用的 Paper9
- Learning Transferable Visual Models From Natural Language SupervisionAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh 等ICML 2021 · 47,906 次引用
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma 等NeurIPS 2022 · 22,562 次引用
- BERTScore: Evaluating Text Generation with BERTTianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q. Weinberger 等ICLR 2020 · 8,443 次引用
- Flamingo: a Visual Language Model for Few-Shot LearningJean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech 等NeurIPS 2022 · 6,707 次引用
- Large Language Models are Human-Level Prompt EngineersYongchao Zhou, Andrei Ioan Muresanu, Ziwen Han, Keiran Paster 等ICLR 2023 · 297 次引用
相关 Paper
- Co-Evolving LLMs and Embedding Models via Density-Guided Preference Optimization for Text ClusteringZetong Li, Qinliang Su, Minhua Huang, Yin YangEMNLP 2025
- Generating Diverse Training Samples for Relation Extraction with Large Language ModelsZexuan Li, Hongliang Dai, Piji LiACL 2025
- Prompting Contrastive Explanations for Commonsense Reasoning TasksBhargavi Paranjape, Julian Michael, Marjan Ghazvininejad, Hannaneh Hajishirzi 等ACL Findings 2021 · 53 次引用
- AvaTaR: Optimizing LLM Agents for Tool Usage via Contrastive ReasoningShirley Wu, Shiyu Zhao, Qian Huang, Kexin Huang 等NeurIPS 2024 · 95 次引用
- Mitigating Contradictions in Dialogue Based on Contrastive LearningWeizhao Li, Junsheng Kong, Ben Liao, Yi CaiACL Findings 2022 · 5 次引用
