project-nomad/admin/app/controllers
jakeaturner ae06a295de feat(AI): let retrieval decline instead of making the prompt paper over it
There was one cutoff, Qdrant's score_threshold at 0.3, and nomic scores
unrelated text well above it, so every question retrieved *something*
(nonEmptyRateOnRefusal 1.0) and rag_context wasted four lines asking a 3B
model to "silently judge" relevance. That is a classification a number
should decide, not a micro model.

Adds `RAG_MIN_FINAL_SCORE`, a floor on the post-rerank score, applied before
source diversity. The floor judges relevance, the 0.85^n penalty judges
redundancy. Nothing clears it and nothing is injected. `score_threshold` stays
at 0.3 as the candidate net. Exposed as `rag.minRelevance` with a module-
scoped TTL cache invalidated from `updateSetting`.

The floor is calibrated and the harness was describing the wrong number:
aggregate() bucketed semanticScore, so its percentiles measured raw cosine
while the new knob filters the reranked score. Both axes now, and the gap
matters: recall falls at 0.60 on the semantic axis, 0.66 on the final one.

  floor  recall@5  precision@5  emptyOnAnswerable  nonEmptyOnRefusal
  0.00     0.991      0.221            0%               100%
  0.62     0.991      0.524            0%                60%
  0.66     0.991      0.695            0%                60%
  0.67     0.972      0.704            1%                60%

Default 0.62, not the last-lossless 0.66: the refusal win is complete at
0.62 and 28 documents is a thin basis for spending margin. 0.60 is the
honest floor. Three of five refusal goldens are near-corpus by
construction, where declining is the generation tier's job.

Both eval tiers pin the floor to the constant and ignore the setting, for
the same reason the harness never sets skipRetrieval.

4 metrics improved against baseline, no regressions.
2026-09-29 15:54:41 -07:00
..
benchmark_controller.ts fix(benchmark): surface a clear reason when leaderboard submission fails (#1138) 2026-08-04 03:38:38 +00:00
chats_controller.ts fix(security): SSRF validation for map downloads and error sanitization (CWE-918, CWE-209) (#552) 2026-04-21 14:26:28 -07:00
collection_updates_controller.ts fix(security): path traversal and SSRF protections from pre-launch audit 2026-03-11 14:08:09 -07:00
conditions_controller.ts Add offline FDA drug reference (labels, interaction view, conditions, remedies) (#1040) 2026-08-04 03:38:33 +00:00
creator_packs_controller.ts feat(creator-packs): gated per-creator video packs, offline via Kiwix (#1106) 2026-08-04 03:38:27 +00:00
docs_controller.ts fix(Docs): fix doc rendering 2025-07-11 15:31:07 -07:00
downloads_controller.ts fix(downloads): add retry button and resource download link for failed downloads (#1059) 2026-08-04 03:37:31 +00:00
drug_reference_controller.ts Add offline FDA drug reference (labels, interaction view, conditions, remedies) (#1040) 2026-08-04 03:38:33 +00:00
easy_setup_controller.ts feat(AI): enable remote AI chat host 2026-04-03 14:26:50 -07:00
home_controller.ts Add offline FDA drug reference (labels, interaction view, conditions, remedies) (#1040) 2026-08-04 03:38:33 +00:00
maps_controller.ts fix(maps): warn when world basemap missing instead of silent grey map (#1104) 2026-08-04 03:38:29 +00:00
nomad_md_controller.ts feat(AI): nomad.md for custom instructions (#1127) 2026-08-04 03:38:33 +00:00
ollama_controller.ts feat(AI): budget the prompt and actually set the context window (#1253) 2026-09-29 15:54:41 -07:00
openapi_controller.ts fix(UI): add API reference to Settings sidebar 2026-08-04 03:38:40 +00:00
rag_controller.ts feat(rag): add subject/collection organization to knowledge base (#1063) 2026-08-04 03:37:42 +00:00
settings_controller.ts feat(AI): let retrieval decline instead of making the prompt paper over it 2026-09-29 15:54:41 -07:00
supply_depot_controller.ts feat: supply depot 2026-06-23 04:46:45 +00:00
system_controller.ts feat(supply-depot): add uninstall for curated apps (#1006) 2026-06-23 04:47:05 +00:00
zim_controller.ts feat(zim): add zim uploader in content manager 2026-06-23 04:47:08 +00:00