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,20 @@
# Four retrievers, 30 questions, 40 passages
retriever hit@1 hit@5 recall@5 recall@10 MRR nDCG@10
bm25 0.733 0.933 0.867 0.867 0.814 0.798
ngram 0.833 0.933 0.883 0.883 0.875 0.818
hybrid 0.833 0.900 0.850 0.883 0.871 0.818
bm25-lettersonly 0.667 0.867 0.800 0.833 0.751 0.741
MRR by question category
retriever exact paraphrase multi
bm25 1.000 0.609 0.917
ngram 1.000 0.827 0.750
hybrid 1.000 0.769 0.854
bm25-lettersonly 0.828 0.609 0.917
Questions with no relevant passage in the top 5
bm25 [q22, q24]
ngram [q24, q25]
hybrid [q22, q24, q25]
bm25-lettersonly [q02, q03, q22, q24]