groundlens
12/15/2025
groundlens is a Python library for detecting LLM hallucinations using embedding geometry.
Two methods, zero LLM dependencies:
- SGI (Semantic Grounding Index) — measures whether a response engages its source material. For RAG systems with context.
- DGI (Directional Grounding Index) — measures whether a response’s displacement in embedding space aligns with grounded patterns. Context-free.
pip install groundlensfrom groundlens import compute_sgi
result = compute_sgi( question="What is the capital of France?", context="France is in Western Europe. Its capital is Paris.", response="The capital of France is Paris.",)# result.flagged → FalseDomain-specific calibration achieves AUROC 0.90-0.99. Generic calibration: AUROC ~0.76.
GitHub repository · Documentation · PyPI
← Back to projects