PH AI Works

Evaluation

Tested on 60 sample questions with known correct answers (a “gold set”). The main figures are for the setup in use, dense retrieval. Hybrid search, which scored lower, is shown beside them for comparison. Out-of-scope questions are scored separately on whether they were refused: a system tuned only to find answers will answer everything, even questions it should decline.

gemini-embedding-001 · top_k=5 · min_score=0.655 · run 2026-08-05T03:08:04Z

top-1 accuracy
96%
hybrid: 90%
recall@5
100%
hybrid: 100%
MRR
0.979
hybrid: 0.938
refusal, retrieval only
75%

End to end, through the agent

The score threshold alone refuses 75% of out-of-scope questions. A higher threshold refuses more of them, but it also starts declining questions it should answer (see the threshold sweep below). The ones that get through are clearly on topic: they ask for a diagnosis, a drug dose or a product recommendation. A similarity score can't tell these apart from a fair question about the same blood marker. The answer-writing step can, and in this test it declined all of them.

out-of-scope refused
100%
in-scope answered
94%
cited the right brief
94%

gemini-2.5-flash · zero hallucinated citations: the harness asserts every cited id was in the retrieval result

The in-scope questions it declined all ask for a personal diagnosis. The search found the right brief (HbA1c is the brief for “am I prediabetic”), and declining to diagnose is also the right call. They count as misses only because the gold set checks retrieval, not answers:

  • lay-02 am I prediabetic — model_declined
  • lay-05 is my thyroid underactive — model_declined
  • lay-16 my periods have stopped and I get hot flushes — model_declined

Why hybrid retrieval was dropped

Hybrid search is the usual recommendation, and this demo was first built with it. But testing different weights for the keyword part (BM25) showed it never helped here: the more weight it got, the worse the results. BM25 locks onto a word that many briefs share, such as “cholesterol”, and pushes all of them above the one that answers the question. The code is still there, but it is off by default.

BM25 weighttop-1MRR
dense-only96%0.979
096%0.979
0.196%0.979
0.294%0.969
0.392%0.958
0.490%0.944
0.590%0.944
0.790%0.939
190%0.938

By case type

Results by question type. Each type is designed to catch a different kind of failure. The exact row settled the hybrid question: keyword search is meant to help with exact names, but dense retrieval already finds every one of them.

case typendense (shipped)hybrid
confusable2090%85%
exact12100%100%
lay16100%88%
oos1275%75%

Threshold sweep

Why min_score is 0.655 and not a rounder number. A higher threshold refuses more out-of-scope questions, but it also starts declining questions it could have answered. The chosen value gives the best combined score.

thresholdanswered correctlycorrectly refusedcombined
0.5196%8%78%
0.5396%17%80%
0.5496%17%80%
0.5696%17%80%
0.5796%25%82%
0.5996%33%83%
0.6096%33%83%
0.6296%42%85%
0.6396%58%88%
0.6594%75%90%
0.6694%75%90%
0.6892%75%88%
0.6983%92%85%
0.7179%100%83%
0.7271%100%77%
0.7467%100%73%
0.7648%100%58%
0.7738%100%50%
0.7921%100%37%
0.808%100%27%
0.820%100%20%

Remaining failures (5)

Shown in full, not hidden. A test set with zero failures has usually been edited to fit the system, not the other way round.

  • conf-05confusablewhich liver enzyme tells me whether a high ALP is bone or liver
    expected GGT · got ALP, GGT, ALT · best cosine 0.816
  • conf-10confusablethe iron test that is not thrown off by inflammation
    expected Transferrin Saturation · got Serum Iron, Transferrin Saturation, Ferritin · best cosine 0.7572
  • oos-06ooswhich brand of vitamin D supplement should I buy
    expected a refusal · got Vitamin D, Calcium, Folate · best cosine 0.6802
  • oos-07ooswhat dose of levothyroxine should I take for my TSH
    expected a refusal · got TSH, Free T4, Free T3 · best cosine 0.6858
  • oos-08oosdo I have diabetes, just tell me yes or no
    expected a refusal · got HbA1c, Fasting Glucose, C-Peptide · best cosine 0.7012

← Back to the demo