🛡️ RAGGround
Sub-15ms Deterministic & ONNX-Powered Hallucination Guardrail & Citation Verifier for RAG
Stop wasting 4 seconds and thousands of dollars on LLM-as-a-judge evaluators. Verify groundedness, highlight hallucinations at sentence-level granularity, and inject verified citations in sub-15 milliseconds.
⚡ Why RAGGround?
Most RAG teams evaluate hallucinations using Ragas or LLM-as-a-judge. In production, this causes 3 critical problems:
- Unusable Latency: Calling GPT-4 to judge an answer adds 3,000–8,000 ms to every response.
- Double API Bills: Every token generated requires an extra LLM call to evaluate.
- No Span Citations: LLM judges give vague scores (
0.75) without pinpointing the exact hallucinated sentence or linking claims to documents.
RAGGround solves this with a 2-Tiered Local Engine:
- ⚡ Tier 1 (Sub-1ms): Deterministic token-alignment, sequence matching (LCS), and entity consistency verification.
- 🧠 Tier 2 (~10ms CPU): Quantized INT8 Natural Language Inference (NLI) model executed locally with ONNX Runtime. Zero PyTorch installation required (< 45MB RAM).
🚀 Quickstart
1. Installation
pip install ragground
2. Verify RAG Outputs (Python API)
from ragground import RAGGround
guard = RAGGround()
context = """
Tesla reported Q3 revenue of $25.18 billion, an 8% increase year-over-year.
Operating margin came in at 10.8% with free cash flow of $2.74 billion.
"""
answer = """
Tesla's Q3 revenue rose 8% to $25.18 billion.
Free cash flow reached $2.74 billion.
The company also announced plans to launch humanoid robots by Christmas.
"""
report = guard.verify(context=context, answer=answer)
print(f"Grounded: {report.is_grounded}") # False
print(f"Score: {report.grounding_score:.2f}") # 0.67 (2 of 3 verified)
print(f"Latency: {report.latency_ms} ms") # 11.2 ms
# Inspect flagged hallucinations
for h in report.hallucinations:
print(f"⚠️ Hallucination: {h.text}")
print(f" Status: {h.status.value} (Confidence: {h.confidence:.2f})")
# View augmented answer with exact citations injected
print("\n--- Cited Output ---")
print(report.cited_answer)
📊 Benchmark: RAGGround vs. LLM-as-a-Judge
| Metric | RAGGround (Tier 1 + ONNX) | Ragas (GPT-4o-mini / 3.5) | Regex / Exact Match |
|---|---|---|---|
| P50 Latency (per query) | ~8.2 ms ⚡ (300x faster) | ~3,400 ms 🐢 | < 1 ms |
| P99 Latency (per query) | ~14.5 ms | ~6,800 ms | < 2 ms |
| Cloud API Cost | $0.00 (Runs locally) | $150–$400 / 100k calls | $0.00 |
| Paraphrase Understanding | ✅ High (Neural NLI) | ✅ High | ❌ None (Breaks on synonyms) |
| Number & Entity Checking | ✅ Strict Entity Matching | ⚠️ LLM Drift | ⚠️ High False Positives |
| Deterministic Output | ✅ 100% Reproducible | ❌ Nondeterministic | ✅ 100% Reproducible |
| Citations Generated | ✅ Exact Sentence-to-Source | ⚠️ Vague Overall Score | ❌ None |
💻 Command Line Interface (CLI)
Audit any context and answer directly in your terminal:
ragground verify \
-c "Python 3.12 introduced improved error messages and isolated subinterpreters." \
-a "Python 3.12 added isolated subinterpreters. It also removed the GIL completely."
Benchmark your local CPU:
ragground benchmark
🏗️ Architecture
[ User Context & Answer ] ──► [ Claim Decomposition ] ──► [ Tier 1: Token & LCS Shortcut (< 1ms) ]
│
┌──────────────────────────────────┴─────────────────────────────────┐
▼ (High Overlap) ▼ (Paraphrased / Fuzzy)
[ Mark Verified ] [ Tier 2: ONNX NLI Transformer (~10ms) ]
│ │
└───────────────────────────────┬────────────────────────────────────┘
▼
[ Citation & GuardReport ]
📚 Documentation
For in-depth guides and references, check the docs/ directory:
- Getting Started
- System Architecture
- API Reference
- Benchmarks
- FastAPI & LangChain Integration Guide
- Custom ONNX Models
📄 License
Apache 2.0 License. See LICENSE for details.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ragground-0.1.1.tar.gz.
File metadata
- Download URL: ragground-0.1.1.tar.gz
- Upload date:
- Size: 33.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d14a7711f4a3253a3f3ac2be4fc1c9422ddd662fa822c850320413dd52f114b9
|
|
| MD5 |
081eb5158b3c1bf62f6e44d54966a295
|
|
| BLAKE2b-256 |
f90163c4e53327f5a1aa12dca6c53b1ad41fd8c10a8374ee2ba11f48880c3872
|
File details
Details for the file ragground-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ragground-0.1.1-py3-none-any.whl
- Upload date:
- Size: 24.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8898c3c615bb719bf3d375d858cfa934d03bb0e49fd8041e100f9057f09e1c4
|
|
| MD5 |
b1fa8e451485198d38753b1cc441e70d
|
|
| BLAKE2b-256 |
9b810f69f765a81eab8817dfa327dc7a1ef46ce471db3a619a99d592678476ad
|