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:
co-authored by
Claude Sonnet 5.5
parent
0bb301d361
commit
98ed878675
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Runs the gate against the broken tokenizer and records what a failing CI job prints.
|
||||
set -uo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
{
|
||||
echo "# mvn test -Dtest=GoldenSetGateTest -Drageval.retriever=bm25-lettersonly"
|
||||
echo
|
||||
mvn -B test -Dtest=GoldenSetGateTest -Drageval.retriever=bm25-lettersonly 2>&1 \
|
||||
| grep -v -E "Picked up|^WARNING|^\[INFO\] (Download|Copying|Using|---|Nothing|Changes|Compiling)|Progress|^$" \
|
||||
| sed -n '/Gate run/,/BUILD FAILURE/p' | grep -v -E "^\s+at |Time elapsed|^\[ERROR\] *$|Help 1|re-run Maven|full stack|For more information|-e switch|-X switch|^\[ERROR\] *\[Help"
|
||||
echo
|
||||
echo "exit status of mvn: non-zero (see BUILD FAILURE above)"
|
||||
} > output/08-ci-failure.txt
|
||||
cat output/08-ci-failure.txt
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Regenerates every file under output/. 00-07 are written by the test suite itself through the Transcript
|
||||
# helper; 08 is the recorded output of a deliberately failing gate. No Docker, database, model or API key.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
rm -rf target
|
||||
mvn -q -B test 2>&1 | grep -E "Tests run:|BUILD|FAIL" || true
|
||||
scripts/ci-fail-demo.sh > /dev/null
|
||||
ls output
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# Rewrites src/test/resources/baseline.properties from the current retriever. Run it on purpose, after an
|
||||
# improvement you want to lock in, and review the diff like code. Tolerance 0.04 is a little more than one
|
||||
# question moving one rank on 30 questions.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
mvn -q -B compile 2>&1 | grep -E "ERROR" || true
|
||||
java -cp target/classes com.ankurm.rageval.WriteBaseline "${1:-bm25}" src/test/resources/baseline.properties "${2:-0.04}" 2>&1 | grep -v Picked
|
||||
Reference in New Issue
Block a user