Using In-Context Learning to Improve Dialogue Safety
Nicholas Meade, Spandana Gella, Devamanyu Hazarika, Prakhar Gupta, Di Jin, Siva Reddy, Yang Liu, Dilek Hakkani-Tür
TL;DR
The paper tackles the problem of safety in open-domain dialogue by proposing a retrieval-based in-context learning approach that uses safety demonstrations retrieved from a relevant pool to condition model generation. It evaluates this method across OPT, LLaMA, and Vicuna using ProsocialDialog, DiaSafety, and Commonsense-Dialogues, with automatic and human assessments showing safety improvements scale with demonstration similarity and count, while preserving response quality. The approach is shown to be competitive with strong training-based baselines (Safe Response Fine-Tuning, DIRECTOR, Self-Debias) and can complement RLHF, offering a practical post-deployment option for reducing toxicity without additional training. Overall, the findings suggest that retrieval-enabled in-context conditioning provides a flexible, scalable means to enhance dialogue safety in real-world settings, with potential for integration alongside existing safety pipelines.
Abstract
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, which often perpetuates social biases or stereotypes. We investigate a retrieval-based method 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 strong baselines without requiring training. For instance, using automatic evaluation, we find our best fine-tuned baseline only generates safe responses to unsafe dialogue contexts from DiaSafety 4.04% more than our approach. Finally, we also propose a re-ranking procedure which can further improve response safeness.
