Add rag-eval module: retrieval metrics, golden dataset and a JUnit regression gate

hit@k, recall@k, precision@k, MRR and nDCG@k in plain Java with their edge
cases pinned by tests, a 30-question graded golden dataset over a 40-passage
runbook, a paired bootstrap, and a gate (baseline + tolerance + no new misses)
shown failing on a tokenizer that drops digits. BM25, a hashed-trigram vector
(not a neural embedding) and RRF; no model, no network. Java 25, JUnit 6.1.3.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b7F47n8shUHpexxavn
This commit is contained in:
Ankur
2026-11-25 13:20:18 +05:30
co-authored by Claude Sonnet 5.5
parent 0bb301d361
commit 98ed878675
43 changed files with 1385 additions and 0 deletions
@@ -0,0 +1,16 @@
# The gate against bm25-lettersonly (a tokenizer that drops digits)
FAIL overall hit@1 = 0.667, below baseline 0.733 - 0.04 = 0.693
FAIL exact hit@1 = 0.818, below baseline 1.000 - 0.04 = 0.960
FAIL overall hit@5 = 0.867, below baseline 0.933 - 0.04 = 0.893
FAIL exact hit@5 = 0.818, below baseline 1.000 - 0.04 = 0.960
FAIL overall recall@5 = 0.800, below baseline 0.867 - 0.04 = 0.827
FAIL exact recall@5 = 0.818, below baseline 1.000 - 0.04 = 0.960
FAIL exact recall@10 = 0.909, below baseline 1.000 - 0.04 = 0.960
FAIL overall mrr = 0.751, below baseline 0.814 - 0.04 = 0.774
FAIL exact mrr = 0.828, below baseline 1.000 - 0.04 = 0.960
FAIL overall ndcg@10 = 0.741, below baseline 0.798 - 0.04 = 0.758
FAIL exact ndcg@10 = 0.846, below baseline 1.000 - 0.04 = 0.960
FAIL new miss@5: q02 "E-4012" (relevant not in top 5, got [p01, p02, p03, p04, p05])
FAIL new miss@5: q03 "E-5003" (relevant not in top 5, got [p01, p02, p03, p04, p05])
13 violations