通过 Bespoke-Minicheck 减少幻觉
2024 年 9 月 18 日
Bespoke-Minicheck 是由 Bespoke Labs 开发的新的基于事实的真实性检查模型,现已在 Ollama 中提供。它可以对其他模型生成的回应进行事实检查,以检测和减少幻觉。
工作原理
Bespoke-Minicheck 的工作原理是获取事实信息块(即文档)和生成的输出(即声明),并根据文档验证声明。如果文档支持该声明,模型将输出是。否则,它将输出否
RAG 用例
在构建检索增强生成 (RAG) 应用程序时,Bespoke-Minicheck 特别强大,因为它可以用于确保响应基于提供给 LLM 的检索到的上下文。这可以作为后处理步骤来检测幻觉
有关如何在 RAG 应用程序中使用 Ollama 中的 Bespoke-Minicheck 的示例,请参阅 GitHub 上的 RAG 示例。
开始入门
首先下载并运行模型
ollama run bespoke-minicheck
接下来,按如下方式编写提示,同时提供源文档和声明
Document: A group of students gather in the school library to study for their upcoming final exams.
Claim: The students are preparing for an examination.
由于源信息支持该声明,模型将输出是。
Yes
但是,当声明不受文档支持时,模型将响应否
Document: A group of students gather in the school library to study for their upcoming final exams.
Claim: The students are out on vacation
No
有关如何使用 Ollama 中的 Bespoke-Minicheck 对照源信息进行事实检查的示例,请参阅 GitHub 上的事实检查示例。