Ollama 跑 Bespoke-Minicheck:给 RAG 回答做事实核查降幻觉

难度:入门 · 来源:Ollama Blog · 采集于:2026-11-05

你将学到什么

  • 在 Ollama 中运行 Bespoke-Minicheck 这个「有据事实核查」模型,判断某条结论能否被给定文档支持。
  • 掌握 Document / Claim 的提示词写法,并读懂 Yes / No 输出。
  • 了解如何把它放进 RAG 流程,作为后处理环节检测并减少幻觉。

前置条件

  • 已安装 Ollama:模型通过 ollama run 直接下载并运行。
  • 准备两样东西:一段作为依据的原文(Document),一条待核查的结论(Claim)。

步骤

  1. 下载并运行模型:
ollama run bespoke-minicheck
  1. 在提示词里同时给出原文与待核查结论,先用 Document: 写依据,再用 Claim: 写结论。例如:
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.
  1. 读取判定结果。上面的结论能被文档支持,模型输出:
Yes

把 Claim 换成文档里没有依据的说法,例如:

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
  1. 在 RAG 应用中作为后处理使用:让模型基于检索到的上下文生成回答后,再用 Bespoke-Minicheck 核对回答是否真正落在检索内容上,从而把不被上下文支持的输出识别为幻觉。原文给出两个可参考的 Python 示例:Fact Checking(https://github.com/ollama/ollama/tree/main/examples/python-grounded-factuality-simple-check)与 RAG(https://github.com/ollama/ollama/tree/main/examples/python-grounded-factuality-rag-check)。

常见坑/注意事项

  • 判断完全依赖你提供的 Document:文档支持 Claim 才输出 Yes,否则输出 No,模型不会给出解释性长文。
  • 提示词必须同时包含 Document 与 Claim 两部分,缺一不可。
  • 它的定位是核查「结论 vs 给定文档」的事实性,因此在 RAG 中适合放在生成之后做后处理,而不是替代检索或生成本身。

原文链接:https://ollama.com/blog/reduce-hallucinations-with-bespoke-minicheck


原文:Reduce hallucinations with Bespoke-Minicheck September 18, 2024 Bespoke-Minicheck is a new grounded factuality checking(本文为采集智能体整理的导读,版权归原作者,请阅读原文获取完整内容)

← 用 Ollama 给 Llama 3.1 接入工具调用用 Ollama 嵌入模型构建 RAG 检索示例 →
AI技术网博主

独立开发者,记录 AI、开发与效率工具。

查看主页

评论(2)

aijishu554432026-11-05 13:26
事实核查这一步单独做比塞进主流程好。分开之后出错能定位到具体环节,也方便单独换模型。另外核查模型不需要太大,7B 量级在「判断陈述与来源是否一致」这类任务上已经够用,速度快很多。
aijishu554432026-11-05 14:00
补充一个排查顺序:先看 https://ai.jishu5.com/nav/devtools 里的工具分类,按用途定位后再试配置,比盲试快。
登录后即可参与回复。立即登录 或 注册账号