Skip to content

ch12: expanded knowledge base and frozen v2 evaluation set - #4

Merged
codelformat merged 35 commits into
mainfrom
ch12
Oct 12, 2026
Merged

codelformat merged 35 commits into
mainfrom
ch12

Conversation

@codelformat

Copy link
Copy Markdown
Owner

Summary

  • Knowledge base: 16 look-alike models (40 in total). New 《配送与签收政策》 and 《预售与缺货政策》. 12 new FAQ entries. 5 new lexicon synonyms. scripts/check_kb_v2.py checks the additions against the spec appendices, and checks that no existing line changed.
  • v2 evaluation set (evals/rag_eval_v2.jsonl, A 40 / B 50 / C 50 / E 100 / D 60):
    • Written from a seeded target list. Reviewed in 2 rounds.
    • Frozen in da67f2b before any v2 retrieval run. run_rag_eval.py --set v2 checks the SHA-256 and compares the result with 6 expectations written before the freeze.
  • Evaluation: v2, the old 300-question set and the ch11 hard set, run on the old and the new knowledge base (retrieval only). The ch11 hard set ran from a ch11 worktree. ch11 is not merged.
  • Runner fix: the report header now shows Query-rewrite fallbacks, and a run with more than 3 fallbacks exits 1. Before this fix, a DeepSeek balance outage made all 540 rewrites fall back, and the run still exited 0.

Results (evals/reports/ch12_comparison.md)

  • v2: hybrid_rerank R@5 0.933, against bm25 0.917, hybrid 0.915 and dense 0.882. 3 of 6 pre-registered expectations met. The target band 0.88–0.92 and "others < 0.90" were not met. The set was not changed after the run.
  • On v2, A, B and C have R@5 1.000 for every strategy. All of the difficulty comes from the 100 multi-fact E questions.
  • hybrid_rerank leads the runner-up by about 0.02 R@1 on all 3 sets.
  • Erratum: E080, E086 and E093 miss one equivalent key. Corrected, the v2 R@5 gap is about +0.010.
  • On the old sets, hybrid_rerank stays almost the same on the new knowledge base (base R@5 0.992 → 0.988; hard R@5 1.000).

Open decisions (not done in this PR)

  • The new lexicon aliases rewrite unrelated production queries. For example, the rerank query turns 退回快递点 into 拒收点. See docs/backlog/2026-10-11-lexicon-alias-side-effects.md.
  • GATE_* were calibrated on the old knowledge base. README and facts.ts numbers were not updated. Faithfulness was not evaluated.

Test plan

  • uv run pytest -q: 1347 passed
  • uv run python scripts/check_kb_v2.py, evals/v2/check_d_evidence.py, run_rag_eval.py --check, run_rag_eval.py --set v2 --check
  • build_kb.py --rebuild and --check: 302 = 302
  • Whole-branch code review (Opus): "With fixes". Important findings addressed; the details are in dev-notes/ch12.md.

🤖 Generated with Claude Code

sheng guan and others added 30 commits October 11, 2026 11:17
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>
…istered expectations

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>
…AQ entries

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>
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>
…cts; backlog entry

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>
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>
Judge validation: 78/78 groups (100%).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…xpectations 7-9

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Faithfulness 0.893, false refusal 0.134, E_multi group coverage 0.664
(0.947 answered-only). Run 1 voided (4 rewrite fallbacks); run 2 used.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Group-level split of E uncovered groups (59 self-check / 22 retrieval / 1 omission),
judge-validation scope note, E075 failure description, pre-threshold Top-5 caveat;
commit void-run report and judge-eval log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sheng guan and others added 5 commits October 11, 2026 21:46
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…up notes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts: both chapters added --set to run_rag_eval.py. --set now accepts
base, hard and v2. The two expectation modules are imported under aliases.
--coverage is rejected with --gen-repeat > 1 (coverage is summarized per
question). Full suite: 1478 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop old knowledge-base and old 300-question numbers. Show the v2 set
(retrieval, faithfulness, fact coverage, wrong answers on unanswerable)
and the hard set on the new knowledge base. Welcome page shows 1,478 tests,
Recall@5 0.933 and faithfulness 0.893.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codelformat
codelformat merged commit 5cc3c3a into main Oct 12, 2026
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