Skip to content

ch11: hard evaluation set (240 questions) for the four retrieval strategies - #3

Merged
codelformat merged 18 commits into
mainfrom
ch11
Oct 12, 2026
Merged

codelformat merged 18 commits into
mainfrom
ch11

Conversation

@codelformat

Copy link
Copy Markdown
Owner

Summary

  • Adds evals/hard_set/ and scripts/synth_hard_set.py: a 240-question hard retrieval set (4 buckets × 60: sibling models, colloquial with no shared words, buried key term, model-specific rules). Code picks targets from the knowledge-base structure; DeepSeek writes questions; mechanical filters; labeling = full-list pass → general-chunk recall → two consecutive pair confirmations.
  • Integrity: synthesis never imports retrieval/milvus/rerank/embeddings (subprocess test); the set was frozen at 19e983d before any retrieval ran; 6 expectations were written down before the run and are checked automatically in the report.
  • evals/run_rag_eval.py: --set hard, --gen-repeat N (faithfulness averaged per run; faith_cases from run 1 only). Base set behavior and report format unchanged.

Results (retrieval, 240 hard questions)

Strategy R@1 R@5 MRR Misses at rank 1
Dense 0.975 1.000 0.987 6
BM25 0.904 0.988 0.940 23
Hybrid (RRF) 0.975 0.996 0.983 6
Hybrid + rerank 0.992 1.000 0.996 2

4 of 6 expectations held. Two did not (buried-term: dense not below BM25; model-specific: RRF tied rerank). The gap to dense stays small (1.7 pts R@1).

Known limitations (also in README and dev-notes)

  • Hard-set faithfulness is not reported: generation hit DeepSeek 402 Insufficient Balance midway (1023/1920 failed). Retrieval is unaffected (all query rewrites finished before the balance ran out).
  • Spot-check was done by Claude, not a person (user delegated): 19/20 clean, H1_35 over-labeled. Deviation from spec §8 is recorded.
  • In this report the 未检索/裁判失败 columns are 2-run totals (fixed in code afterwards).

Test plan

  • uv run pytest -q → 1201 passed
  • uv run python scripts/synth_hard_set.py --check → passed
  • Independent whole-branch review (With fixes; Important items addressed, minors recorded in dev-notes)

🤖 Generated with Claude Code

sheng guan and others added 18 commits October 10, 2026 22:53
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oup cap

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in RAG eval

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
First real synthesis under-labeled general chunks (category table, 7-day
policy). Add per-chunk pair checks over structural same-topic keys and give
both labeling prompts the model's category and the FAQ default-model rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Strict labeling left H4 at 56/60 after 128 seeds. Add a third H4 slot at the
end of the pool and raise attempts per seed from 3 to 5. Labeling and filter
rules are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v3 spot-check: labeler still missed general chunks when a question drifted
off the target aspect (e.g. K2 same-style exchange vs 售后手册 申请换货).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h rule

v4 spot-check: pair checks accepted off-topic general chunks (warranty
questions labeled with the return-period table or the 'see product page'
warranty note).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fifth synthesis run. Spot-check by Claude (user delegated): 19/20 clean,
one over-labeled key noted. No retrieval has been run on this set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ot-check note

Review: with --gen-repeat N the 未检索/裁判失败 columns summed N runs and case
lines repeated without a run marker. The spot-check note wrongly claimed an
over-labeled key cannot favor any strategy; it can, and the note now records
the deviation from spec §8 (Claude, not the user, did the spot-check).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Retrieval on the frozen 240-question hard set: hybrid+rerank R@1 0.992,
MRR 0.996 (dense 0.975 / 0.987, BM25 0.904 / 0.940). 4 of 6 pre-registered
expectations held. Generation failed midway (upstream 402 Insufficient
Balance), so hard-set faithfulness is not reported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codelformat
codelformat merged commit ca5ffa6 into main Oct 12, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant