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
翻译:大型语言模型(LLMs)在机器学习应用中日益重要。然而,使LLMs符合我们的意图颇具挑战性,尤其是当我们希望生成优于其他选项的内容,或要求LLM以难以描述的风格或语气进行响应时。为解决这一难题,我们提出一种利用对比示例更精准描述意图的方法。具体而言,该方法通过提供正面示例以阐明真实意图,同时辅以负面示例指明需规避的特征。负面示例可从标注数据中检索、由人工编写或由LLM自身生成。在生成回答前,我们要求模型分析示例以自主识别需规避的内容。这一推理步骤使模型能够精准把握用户需求,并引导其生成更优回答。我们在合成数据集及StackExchange、Reddit等真实场景数据集上验证了该方法,结果表明其相较于标准少样本提示方法性能显著提升。