Skip to content

About

Your LLM already says which words it guessed. Highlights them from token logprobs, no second model call. Rust CLI, HTML report, CI gate.

Topics

Resources

Contributing

Stars

19 stars

Watchers

2 watching

Forks

Repository files navigation

LLM Hallucination Detector: the model already told you which words it guessed

English | 简体中文 | 日本語 | 한국어

crates.io

The usual way to catch a hallucination is to pay for more model calls: RAGAS faithfulness asks an LLM to check each claim (docs), and SelfCheckGPT samples the answer again and compares (paper). The model already reported how sure it was about every token, and most apps never ask: in OpenAI's Chat Completions API, logprobs is off unless you turn it on (API reference). This tool reads those logprobs and shows which words of an AI answer to double-check, with no second LLM call: 9.0 ms for a 4,000-token answer.

A real Llama 3.1 answer as a confidence heatmap, with Aelbert and Dordrecht flagged.
  • Reads the model's own token logprobs.
  • Highlights the words it was unsure about.
  • Shows what it almost said instead.
  • Outputs terminal, HTML, Markdown or JSON.
  • Fails CI with --fail-on-flag.

Install

cargo install --locked llm-token-visualizer

No Rust? Download for Windows (.exe).

Use

llm-token-visualizer --logprobs-file answer.json --threshold 0.6

Reference · docs.rs · Site · Releases

License: MIT, see LICENSE.

More: docs/DETAILS.md

About

Your LLM already says which words it guessed. Highlights them from token logprobs, no second model call. Rust CLI, HTML report, CI gate.

Topics

Resources

Contributing

Stars

19 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages