Lune

EMNLP Findings2023

Using In-Context Learning to Improve Dialogue Safety

Nicholas Meade, Spandana Gella, Devamanyu Hazarika, Prakhar Gupta, Di Jin, Siva Reddy, Yang Liu, Dilek Hakkani-Tur

Abstract

Warning: This paper contains examples that may be offensive or upsetting.

While large neural-based conversational models have become increasingly proficient dialogue agents, recent work has highlighted safety issues with these systems. For example, these systems can be goaded into generating toxic content, often perpetuating social biases or stereotypes. We investigate a retrieval-based approach for reducing bias and toxicity in responses from chatbots. It uses in-context learning to steer a model towards safer generations. Concretely, to generate a response to an unsafe dialogue context, we retrieve demonstrations of safe responses to similar dialogue contexts. We find our method performs competitively with existing approaches to dialogue safety without requiring training. We also show, using automatic and human evaluation, that reductions in toxicity obtained using our approach are not at the cost engagingness or coherency. Finally, we note our method can be used in compliment to existing dialogue safety approaches, such as RLHF.

Ask Lune

Ask anything. The answer quotes the paper.

Lune reads all of it and the papers around it, then shows you the passages behind every answer.

Questions to start from

Lune answers from

the full paper · 10 top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Cited by top-tier papers10

  1. A Survey on In-context LearningQingxiu Dong, Lei Li, Damai Dai, Ce Zheng et al.EMNLP 2024 · 479 citations
  2. In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space SteeringSheng Liu, Haotian Ye, Lei Xing, James Y. ZouICML 2024 · 244 citations
  3. Beyond task performance: evaluating and reducing the flaws of large multimodal models with in-context-learningMustafa Shukor, Alexandre Ramé, Corentin Dancette, Matthieu CordICLR 2024 · 31 citations
  4. Beyond Output Matching: Bidirectional Alignment for Enhanced In-Context LearningChengwei Qin, Wenhan Xia, Fangkai Jiao, Chen Chen et al.ACL 2025 · 7 citations
  5. SAIL: Sample-Centric In-Context Learning for Document Information ExtractionJinyu Zhang, Zhiyuan You, Jize Wang, Xinyi LeAAAI 2025 · 7 citations

Builds on30

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida et al.NeurIPS 2022 · 24,707 citations
  3. The Curious Case of Neural Text DegenerationAri Holtzman, Jan Buys, Li Du, Maxwell Forbes et al.ICLR 2020 · 4,112 citations
  4. MPNet: Masked and Permuted Pre-training for Language UnderstandingKaitao Song, Xu Tan, Tao Qin, Jianfeng Lu et al.NeurIPS 2020 · 1,957 citations
  5. Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order SensitivityYao Lu, Max Bartolo, Alastair Moore, Sebastian Riedel et al.ACL 2022 · 1,494 citations

Related papers

  1. Constructing Highly Inductive Contexts for Dialogue Safety through Controllable Reverse GenerationZhexin Zhang, Jiale Cheng, Hao Sun, Jiawen Deng et al.EMNLP Findings 2022 · 3 citations
  2. Cognitive Analysis Graph-Guided Multi-Turn Safety Enhancement for Large Language ModelsLanxue Zhang, Yuqiang Xie, Fang Fang, Yubing Ren et al.ACL Findings 2026
  3. Safety Pretraining: Toward the Next Generation of Safe AIPratyush Maini, Sachin Goyal, Dylan Sam, Alexander Robey et al.NeurIPS 2025 · 50 citations
  4. Demonstrations Are All You Need: Advancing Offensive Content Paraphrasing using In-Context LearningAnirudh Som, Karan Sikka, Helen Gent, Ajay Divakaran et al.ACL Findings 2024 · 4 citations
  5. Just Say No: Analyzing the Stance of Neural Dialogue Generation in Offensive ContextsAshutosh Baheti, Maarten Sap, Alan Ritter, Mark O. RiedlEMNLP 2021 · 50 citations
Dusk over the sea between two cliffs drawn in fine vertical lines