enached134-ctrl / groundcheck · open source (MIT) · a benchmark, not a claim
RAG groundedness judging

A 1.5B model that judges RAG groundedness as well as a frontier model — at $0 per call.

Every serious RAG system needs a groundedness judge: something that reads (question, context, answer) and decides whether the answer is actually supported — or hallucinated. Usually that's a frontier-model API call, which makes every CI eval run cost money, leak data off-box, and hit rate limits. groundcheck fine-tunes a small open model into that judge, so an eval gate can grade hundreds of cases per commit at zero marginal cost.

The fine-tune ships only if the evals say it beats the base model. Training is cheap; judgment is the product.

0.0831.000
Groundedness F1
base 1.5B (0-shot) → fine-tuned, on 140 held-out cases (+0.917)
100%
Agreement w/ frontier judge
matches a Gemini teacher on every one of 60 held-out cases
$0.00
Cost per 1k judgments
runs locally in CI — vs $0.026/1k for the frontier API
01 · The ship / no-ship gate

The base model is almost useless at this job. The fine-tune isn't.

Fine-tuned on 1,120 constructed cases (2 epochs, QLoRA on Qwen2.5-1.5B-Instruct, ~4.5 min on an RTX 5070 laptop). Judged on 140 held-out cases the model never saw. This before/after table is the release gate — evaluate.py exits non-zero if the fine-tune doesn't win.

modelaccuracyprecisionrecallF1refusal-correct
base  (0-shot)0.5291.0000.0430.0830.000
groundcheck  fine-tuned1.0001.0001.0001.0001.000
F1
1.000
.083
Recall
1.000
Refusal-correct
1.000

Out of the box the base model hedges — recall 0.043 means it almost never confirms a genuinely-grounded answer — and it handles a refusal case correctly 0% of the time. The fine-tune turns the same 1.5B model into a reliable judge. Gate: PASS → ship.

02 · Cost parity

Same judgment as a frontier model, zero marginal cost.

The point of distilling a judge isn't cheaper tokens — it's a judge that runs locally, in CI, on every commit, with no API dependency, no rate limits, and no data leaving the box. So the real question: does the small local judge actually match a frontier one?

judgeaccuracycost / 1k calls
frontier teacher  (Gemini)1.000$0.026
groundcheck  local, fine-tuned1.000$0.00
Why it matters

100% agreement with the frontier judge across 60 held-out cases, at $0. At the scale an eval gate actually runs — thousands of judgments per CI run, across every prompt change — that's the entire API bill and the entire rate-limit problem, gone.

03 · Why the labels are trustworthy

No human annotation. No LLM labelling. Correct by construction.

The dataset builder generates the context first, then preserves or deliberately corrupts the answer — so the ground-truth label is known by construction, not guessed. Four balanced case types cover the ways a RAG answer can be right or wrong:

supported grounded ✓

Answer states a fact that is present in the context.

contradict not grounded ✗

Answer swaps in a value that conflicts with the context.

fabricated not grounded ✗

Answer adds a specific fact that is absent from the context.

refusal grounded ✓

Asked something absent, the answer correctly declines to answer.

training

QLoRA, completions-only

4-bit NF4 on an 8 GB consumer GPU. The model learns to produce the verdict {"grounded": bool, "feedback": "…"} — completions-only loss, so it doesn't just echo the prompt.

serving

Drop-in eval grader

A promptfoo Python provider, so any eval suite — including agentic-rag-mcp's CI gate — can swap the frontier-API judge for this local one with one line.

# reproduce the whole thing — deterministic
python src/build_dataset.py --n 1400 --seed 7 --out data
python src/train.py --base Qwen/Qwen2.5-1.5B-Instruct --epochs 2
python src/evaluate.py --adapter out/adapter   # base vs tuned + the gate
04 · Scope, stated honestly

What this proves — and what it doesn't yet.

A benchmark is only worth as much as its honesty about scope. Here's the boundary, drawn plainly:

proven

The pipeline, end to end

dataset → QLoRA fine-tune → eval-gate → ship decision. On this corpus, a 1.5B model becomes a groundedness judge that matches a frontier model at zero cost, and it only shipped because its own evals said so.

not yet

Real-world traffic

The corpus is synthetic (labels correct by construction), so this proves the method, not production performance. The next step is folding in real RAG traces from agentic-rag-mcp under the same regression-capture rule.

The point

Most "RAG projects" stop at a demo. This one ships a measurement that decides whether the demo is allowed to become a product — the unglamorous layer that makes AI features survive real traffic. The measurement decides what ships.