使用 Bespoke-Minicheck 減少幻覺

2024 年 9 月 18 日

Bespoke-Minicheck 是由 Bespoke Labs 開發的新型基於事實的查核模型,現已在 Ollama 中提供。它可以事實查核其他模型生成的回應,以偵測並減少幻覺。

運作方式

Bespoke-Minicheck 的運作方式是接收事實資訊塊(即文件)和生成的輸出(即聲明),並根據文件驗證聲明。如果文件支持該聲明,模型將輸出。否則,它將輸出

illustration of how Bespoke-Minicheck works

RAG 使用案例

Bespoke-Minicheck 在建構檢索增強生成 (RAG) 應用程式時尤其強大,因為它可用於確保回應基於提供給 LLM 的檢索上下文。這可以作為後處理步驟來完成,以偵測幻覺

illustration of Bespoke-Minicheck used for Retrieval Augmented Generation (RAG) applications

如需了解如何在搭配 Ollama 的 RAG 應用程式中使用 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

如需了解如何使用 Bespoke-Minicheck 根據來源資訊事實查核聲明的範例,請參閱 GitHub 上的事實查核範例

範例

閱讀更多