Large language models (large LMs) are susceptible to producing text that contains hallucinated content. An important instance of this problem is self-contradiction, where the LM generates two contradictory sentences within the same context. In this work, we present a comprehensive investigation into self-contradiction for various instruction-tuned LMs, covering evaluation, detection, and mitigation. Our analysis reveals the prevalence of self-contradictions when LMs generate text for open-domain topics, e.g., in 17.7% of all sentences produced by ChatGPT. Self-contradiction also complements retrieval-based methods, as a large portion of them (e.g., 35.8% for ChatGPT) cannot be verified using Wikipedia. We then propose a novel prompting-based framework designed to effectively detect and mitigate self-contradictions. Our detector achieves high accuracy, e.g., around 80% F1 score when prompting ChatGPT. The mitigation algorithm iteratively refines the generated text to remove contradictory information while preserving text fluency and informativeness. Importantly, our entire framework is applicable to black-box LMs and does not require external grounded knowledge. Our approach is practically effective and has been released as a push-button tool to benefit the public, available at https://chatprotect.ai/.
翻译:大型语言模型(大型LMs)易生成包含幻觉内容的文本。该问题的一个重要实例是自我矛盾,即模型在同一语境中生成两个矛盾的句子。本研究对多种指令微调型LMs的自我矛盾性进行了全面探讨,涵盖评估、检测与缓解三方面。分析揭示,在开放领域话题生成中,自我矛盾现象普遍存在——例如ChatGPT产生的所有句子中,17.7%存在该问题。此外,自我矛盾性补充了基于检索的方法的局限性,因其相当比例(如ChatGPT的35.8%)无法通过维基百科验证。我们随后提出一种基于提示的新型框架,可有效检测并缓解自我矛盾。检测器达到高精度,诱导ChatGPT时的F1分数约为80%。缓解算法通过迭代精炼生成文本,在消除矛盾信息的同时保持文本流畅性与信息量。重要的是,本框架适用于黑盒LMs且无需外部实体知识。该方法实践有效,已作为即用型工具发布于https://chatprotect.ai/以惠及公众。