project-nomad/admin/tests/eval/corpus
jakeaturner a915cdcfc9 feat(AI): add opt-in relevance check for off-topic retrieval
The post-rerank relevance floor rejects noise but passes coherent
off-topic questions, and it gets worse as the library grows. Adding
Gutenberg prose, the Python tutorial and MDN pages to the eval corpus
took the off-topic leak rate from 22% to 67% at the 0.62 floor.

Score cutoff does not fix it. The weakest correct top hit scores 0.666
while "write me a haiku about autumn leaves" pulls Walden at 0.705.
A cosine floor and a top-vs-median contrast test both cost recall
faster than they cut leaks.

- Add rag.relevanceCheck (default off). After the floor, the tasks
  model, or the chat model when none is set, gives one grammar-constrained
  on_topic verdict for the whole retrieved set. Off topic means no
  context and no citations. Any failure keeps the chunks unjudged.
- Add a Settings > Models toggle recommending an 8B+ tasks model.
  On llama3:8b the check cuts off-topic leaks from 67% to 6% for about
  5 points of core recall@5 and ~0.6s per turn. On 3B models it rejects
  most valid questions, which is why it is opt-in.
- Add 6 distractor documents and an off_topic suite (18 unanswerable
  questions, 7 distractor controls) to the eval corpus.
- Report per-tag leak rates and leaked cases with top scores in
  eval:retrieval. Add --judge-model to measure the check and --dump to
  export pre-floor candidate pools for offline gate simulation.
- Pin the check off in eval:generation so a local setting cannot move
  scores.
- Record the distractor sweep on RAG_MIN_FINAL_SCORE. The 0.62 default
  stays: 0.65 halves leaks at no measured recall cost but leaves only
  0.016 of margin.

The corpus fingerprint changes to b4ebe5dce8699f5d. Retrieval reports
from before this commit are not comparable, and a new baseline is
committed.

Refs #1341
2026-09-29 15:54:41 -07:00
..
distractor-gutenberg-pride-and-prejudice.md feat(AI): add opt-in relevance check for off-topic retrieval 2026-09-29 15:54:41 -07:00
distractor-gutenberg-sherlock-holmes.md feat(AI): add opt-in relevance check for off-topic retrieval 2026-09-29 15:54:41 -07:00
distractor-gutenberg-walden.md feat(AI): add opt-in relevance check for off-topic retrieval 2026-09-29 15:54:41 -07:00
distractor-mdn-css-flexbox.md feat(AI): add opt-in relevance check for off-topic retrieval 2026-09-29 15:54:41 -07:00
distractor-mdn-javascript-guide.md feat(AI): add opt-in relevance check for off-topic retrieval 2026-09-29 15:54:41 -07:00
distractor-python-tutorial.md feat(AI): add opt-in relevance check for off-topic retrieval 2026-09-29 15:54:41 -07:00
equipment-tr88-pump.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
firstaid-bleeding-control.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
firstaid-burns.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
firstaid-hypothermia.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
firstaid-ifak-contents.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
food-canning-pressure.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
food-canning-waterbath.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
food-dehydrating.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
food-mylar-oxygen.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
food-storage-rotation.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
gear-bug-out-bag.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
gear-edc.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
navigation-map-compass.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
power-battery-chemistry.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
power-emp-protection.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
power-solar-sizing.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
protocol-thornfield-cache.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
radio-antenna-basics.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
radio-gmrs-frs.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
radio-ham-bands.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
regions-elevation-table.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
sanitation-waste.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
shelter-cold-layering.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
water-boiling.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
water-chemical-treatment.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
water-filtration.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
water-river-song.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00
water-storage.md feat(eval): standardized RAG quality evaluation harness (#1233) 2026-09-29 15:54:41 -07:00